Update auto-generated bindings for LDK 0.0.115
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 #[derive(Clone)]
12 /// An enum which can either contain a u64 or not
13 pub enum COption_DurationZ {
14         /// When we're in this state, this COption_DurationZ contains a u64
15         Some(u64),
16         /// When we're in this state, this COption_DurationZ contains nothing
17         None
18 }
19 impl COption_DurationZ {
20         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21                 if let Self::None = self { false } else { true }
22         }
23         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
24                 !self.is_some()
25         }
26         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
27                 if let Self::Some(v) = self { v } else { unreachable!() }
28         }
29 }
30 #[no_mangle]
31 /// Constructs a new COption_DurationZ containing a u64
32 pub extern "C" fn COption_DurationZ_some(o: u64) -> COption_DurationZ {
33         COption_DurationZ::Some(o)
34 }
35 #[no_mangle]
36 /// Constructs a new COption_DurationZ containing nothing
37 pub extern "C" fn COption_DurationZ_none() -> COption_DurationZ {
38         COption_DurationZ::None
39 }
40 #[no_mangle]
41 /// Frees any resources associated with the u64, if we are in the Some state
42 pub extern "C" fn COption_DurationZ_free(_res: COption_DurationZ) { }
43 #[no_mangle]
44 /// Creates a new COption_DurationZ which has the same data as `orig`
45 /// but with all dynamically-allocated buffers duplicated in new buffers.
46 pub extern "C" fn COption_DurationZ_clone(orig: &COption_DurationZ) -> COption_DurationZ { Clone::clone(&orig) }
47 #[repr(C)]
48 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
49 /// This corresponds to std::vector in C++
50 pub struct CVec_BlindedPathZ {
51         /// The elements in the array.
52         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
53         pub data: *mut crate::lightning::blinded_path::BlindedPath,
54         /// The number of elements pointed to by `data`.
55         pub datalen: usize
56 }
57 impl CVec_BlindedPathZ {
58         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
59                 if self.datalen == 0 { return Vec::new(); }
60                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
61                 self.data = core::ptr::null_mut();
62                 self.datalen = 0;
63                 ret
64         }
65         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
66                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
67         }
68 }
69 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
70         fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
71                 let datalen = v.len();
72                 let data = Box::into_raw(v.into_boxed_slice());
73                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
74         }
75 }
76 #[no_mangle]
77 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
78 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
79 impl Drop for CVec_BlindedPathZ {
80         fn drop(&mut self) {
81                 if self.datalen == 0 { return; }
82                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
83         }
84 }
85 impl Clone for CVec_BlindedPathZ {
86         fn clone(&self) -> Self {
87                 let mut res = Vec::new();
88                 if self.datalen == 0 { return Self::from(res); }
89                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
90                 Self::from(res)
91         }
92 }
93 #[repr(C)]
94 #[derive(Clone)]
95 /// An enum which can either contain a u64 or not
96 pub enum COption_u64Z {
97         /// When we're in this state, this COption_u64Z contains a u64
98         Some(u64),
99         /// When we're in this state, this COption_u64Z contains nothing
100         None
101 }
102 impl COption_u64Z {
103         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
104                 if let Self::None = self { false } else { true }
105         }
106         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
107                 !self.is_some()
108         }
109         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
110                 if let Self::Some(v) = self { v } else { unreachable!() }
111         }
112 }
113 #[no_mangle]
114 /// Constructs a new COption_u64Z containing a u64
115 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
116         COption_u64Z::Some(o)
117 }
118 #[no_mangle]
119 /// Constructs a new COption_u64Z containing nothing
120 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
121         COption_u64Z::None
122 }
123 #[no_mangle]
124 /// Frees any resources associated with the u64, if we are in the Some state
125 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
126 #[no_mangle]
127 /// Creates a new COption_u64Z which has the same data as `orig`
128 /// but with all dynamically-allocated buffers duplicated in new buffers.
129 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
130 #[repr(C)]
131 /// The contents of CResult_NoneAPIErrorZ
132 pub union CResult_NoneAPIErrorZPtr {
133         /// Note that this value is always NULL, as there are no contents in the OK variant
134         pub result: *mut core::ffi::c_void,
135         /// A pointer to the contents in the error state.
136         /// Reading from this pointer when `result_ok` is set is undefined.
137         pub err: *mut crate::lightning::util::errors::APIError,
138 }
139 #[repr(C)]
140 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
141 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
143 pub struct CResult_NoneAPIErrorZ {
144         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
145         /// `err` or `result` depending on the state of `result_ok`.
146         pub contents: CResult_NoneAPIErrorZPtr,
147         /// Whether this CResult_NoneAPIErrorZ represents a success state.
148         pub result_ok: bool,
149 }
150 #[no_mangle]
151 /// Creates a new CResult_NoneAPIErrorZ in the success state.
152 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
153         CResult_NoneAPIErrorZ {
154                 contents: CResult_NoneAPIErrorZPtr {
155                         result: core::ptr::null_mut(),
156                 },
157                 result_ok: true,
158         }
159 }
160 #[no_mangle]
161 /// Creates a new CResult_NoneAPIErrorZ in the error state.
162 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
163         CResult_NoneAPIErrorZ {
164                 contents: CResult_NoneAPIErrorZPtr {
165                         err: Box::into_raw(Box::new(e)),
166                 },
167                 result_ok: false,
168         }
169 }
170 /// Checks if the given object is currently in the success state
171 #[no_mangle]
172 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
173         o.result_ok
174 }
175 #[no_mangle]
176 /// Frees any resources used by the CResult_NoneAPIErrorZ.
177 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
178 impl Drop for CResult_NoneAPIErrorZ {
179         fn drop(&mut self) {
180                 if self.result_ok {
181                 } else {
182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
184                         }
185                 }
186         }
187 }
188 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
189         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
190                 let contents = if o.result_ok {
191                         let _ = unsafe { Box::from_raw(o.contents.result) };
192                         o.contents.result = core::ptr::null_mut();
193                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
194                 } else {
195                         let err = unsafe { o.contents.err };
196                         unsafe { o.contents.err = core::ptr::null_mut(); }
197                         CResult_NoneAPIErrorZPtr { err }
198                 };
199                 Self {
200                         contents,
201                         result_ok: o.result_ok,
202                 }
203         }
204 }
205 impl Clone for CResult_NoneAPIErrorZ {
206         fn clone(&self) -> Self {
207                 if self.result_ok {
208                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
209                                 result: core::ptr::null_mut()
210                         } }
211                 } else {
212                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
213                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
214                         } }
215                 }
216         }
217 }
218 #[no_mangle]
219 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
220 /// but with all dynamically-allocated buffers duplicated in new buffers.
221 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
222 #[repr(C)]
223 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
224 /// This corresponds to std::vector in C++
225 pub struct CVec_CResult_NoneAPIErrorZZ {
226         /// The elements in the array.
227         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
228         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
229         /// The number of elements pointed to by `data`.
230         pub datalen: usize
231 }
232 impl CVec_CResult_NoneAPIErrorZZ {
233         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
234                 if self.datalen == 0 { return Vec::new(); }
235                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
236                 self.data = core::ptr::null_mut();
237                 self.datalen = 0;
238                 ret
239         }
240         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
241                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
242         }
243 }
244 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
245         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
246                 let datalen = v.len();
247                 let data = Box::into_raw(v.into_boxed_slice());
248                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
249         }
250 }
251 #[no_mangle]
252 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
253 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
254 impl Drop for CVec_CResult_NoneAPIErrorZZ {
255         fn drop(&mut self) {
256                 if self.datalen == 0 { return; }
257                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
258         }
259 }
260 impl Clone for CVec_CResult_NoneAPIErrorZZ {
261         fn clone(&self) -> Self {
262                 let mut res = Vec::new();
263                 if self.datalen == 0 { return Self::from(res); }
264                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
265                 Self::from(res)
266         }
267 }
268 #[repr(C)]
269 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
270 /// This corresponds to std::vector in C++
271 pub struct CVec_APIErrorZ {
272         /// The elements in the array.
273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
274         pub data: *mut crate::lightning::util::errors::APIError,
275         /// The number of elements pointed to by `data`.
276         pub datalen: usize
277 }
278 impl CVec_APIErrorZ {
279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
280                 if self.datalen == 0 { return Vec::new(); }
281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
282                 self.data = core::ptr::null_mut();
283                 self.datalen = 0;
284                 ret
285         }
286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
288         }
289 }
290 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
291         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
292                 let datalen = v.len();
293                 let data = Box::into_raw(v.into_boxed_slice());
294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
295         }
296 }
297 #[no_mangle]
298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
299 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
300 impl Drop for CVec_APIErrorZ {
301         fn drop(&mut self) {
302                 if self.datalen == 0 { return; }
303                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
304         }
305 }
306 impl Clone for CVec_APIErrorZ {
307         fn clone(&self) -> Self {
308                 let mut res = Vec::new();
309                 if self.datalen == 0 { return Self::from(res); }
310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
311                 Self::from(res)
312         }
313 }
314 #[repr(C)]
315 /// A dynamically-allocated array of u8s of arbitrary size.
316 /// This corresponds to std::vector in C++
317 pub struct CVec_u8Z {
318         /// The elements in the array.
319         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
320         pub data: *mut u8,
321         /// The number of elements pointed to by `data`.
322         pub datalen: usize
323 }
324 impl CVec_u8Z {
325         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
326                 if self.datalen == 0 { return Vec::new(); }
327                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
328                 self.data = core::ptr::null_mut();
329                 self.datalen = 0;
330                 ret
331         }
332         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
333                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
334         }
335 }
336 impl From<Vec<u8>> for CVec_u8Z {
337         fn from(v: Vec<u8>) -> Self {
338                 let datalen = v.len();
339                 let data = Box::into_raw(v.into_boxed_slice());
340                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
341         }
342 }
343 #[no_mangle]
344 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
345 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
346 impl Drop for CVec_u8Z {
347         fn drop(&mut self) {
348                 if self.datalen == 0 { return; }
349                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
350         }
351 }
352 impl Clone for CVec_u8Z {
353         fn clone(&self) -> Self {
354                 let mut res = Vec::new();
355                 if self.datalen == 0 { return Self::from(res); }
356                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
357                 Self::from(res)
358         }
359 }
360 #[repr(C)]
361 #[derive(Clone)]
362 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
363 pub enum COption_CVec_u8ZZ {
364         /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
365         Some(crate::c_types::derived::CVec_u8Z),
366         /// When we're in this state, this COption_CVec_u8ZZ contains nothing
367         None
368 }
369 impl COption_CVec_u8ZZ {
370         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
371                 if let Self::None = self { false } else { true }
372         }
373         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
374                 !self.is_some()
375         }
376         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
377                 if let Self::Some(v) = self { v } else { unreachable!() }
378         }
379 }
380 #[no_mangle]
381 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
382 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
383         COption_CVec_u8ZZ::Some(o)
384 }
385 #[no_mangle]
386 /// Constructs a new COption_CVec_u8ZZ containing nothing
387 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
388         COption_CVec_u8ZZ::None
389 }
390 #[no_mangle]
391 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
392 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
393 #[no_mangle]
394 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
395 /// but with all dynamically-allocated buffers duplicated in new buffers.
396 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
397 #[repr(C)]
398 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
399 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
400         /// A pointer to the contents in the success state.
401         /// Reading from this pointer when `result_ok` is not set is undefined.
402         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
403         /// A pointer to the contents in the error state.
404         /// Reading from this pointer when `result_ok` is set is undefined.
405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
406 }
407 #[repr(C)]
408 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
409 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
411 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
412         /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
413         /// `err` or `result` depending on the state of `result_ok`.
414         pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
415         /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
416         pub result_ok: bool,
417 }
418 #[no_mangle]
419 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
420 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
421         CResult_RecipientOnionFieldsDecodeErrorZ {
422                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
423                         result: Box::into_raw(Box::new(o)),
424                 },
425                 result_ok: true,
426         }
427 }
428 #[no_mangle]
429 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
430 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
431         CResult_RecipientOnionFieldsDecodeErrorZ {
432                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
433                         err: Box::into_raw(Box::new(e)),
434                 },
435                 result_ok: false,
436         }
437 }
438 /// Checks if the given object is currently in the success state
439 #[no_mangle]
440 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
441         o.result_ok
442 }
443 #[no_mangle]
444 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
445 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
446 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
447         fn drop(&mut self) {
448                 if self.result_ok {
449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
451                         }
452                 } else {
453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
455                         }
456                 }
457         }
458 }
459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
461                 let contents = if o.result_ok {
462                         let result = unsafe { o.contents.result };
463                         unsafe { o.contents.result = core::ptr::null_mut() };
464                         CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
465                 } else {
466                         let err = unsafe { o.contents.err };
467                         unsafe { o.contents.err = core::ptr::null_mut(); }
468                         CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
469                 };
470                 Self {
471                         contents,
472                         result_ok: o.result_ok,
473                 }
474         }
475 }
476 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
477         fn clone(&self) -> Self {
478                 if self.result_ok {
479                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
480                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
481                         } }
482                 } else {
483                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
485                         } }
486                 }
487         }
488 }
489 #[no_mangle]
490 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
491 /// but with all dynamically-allocated buffers duplicated in new buffers.
492 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
493 #[repr(C)]
494 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
495 pub enum COption_HTLCClaimZ {
496         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
497         Some(crate::lightning::ln::chan_utils::HTLCClaim),
498         /// When we're in this state, this COption_HTLCClaimZ contains nothing
499         None
500 }
501 impl COption_HTLCClaimZ {
502         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
503                 if let Self::None = self { false } else { true }
504         }
505         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
506                 !self.is_some()
507         }
508         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
509                 if let Self::Some(v) = self { v } else { unreachable!() }
510         }
511 }
512 #[no_mangle]
513 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
514 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
515         COption_HTLCClaimZ::Some(o)
516 }
517 #[no_mangle]
518 /// Constructs a new COption_HTLCClaimZ containing nothing
519 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
520         COption_HTLCClaimZ::None
521 }
522 #[no_mangle]
523 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
524 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
525 #[repr(C)]
526 /// The contents of CResult_NoneNoneZ
527 pub union CResult_NoneNoneZPtr {
528         /// Note that this value is always NULL, as there are no contents in the OK variant
529         pub result: *mut core::ffi::c_void,
530         /// Note that this value is always NULL, as there are no contents in the Err variant
531         pub err: *mut core::ffi::c_void,
532 }
533 #[repr(C)]
534 /// A CResult_NoneNoneZ represents the result of a fallible operation,
535 /// containing a () on success and a () on failure.
536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
537 pub struct CResult_NoneNoneZ {
538         /// The contents of this CResult_NoneNoneZ, accessible via either
539         /// `err` or `result` depending on the state of `result_ok`.
540         pub contents: CResult_NoneNoneZPtr,
541         /// Whether this CResult_NoneNoneZ represents a success state.
542         pub result_ok: bool,
543 }
544 #[no_mangle]
545 /// Creates a new CResult_NoneNoneZ in the success state.
546 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
547         CResult_NoneNoneZ {
548                 contents: CResult_NoneNoneZPtr {
549                         result: core::ptr::null_mut(),
550                 },
551                 result_ok: true,
552         }
553 }
554 #[no_mangle]
555 /// Creates a new CResult_NoneNoneZ in the error state.
556 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
557         CResult_NoneNoneZ {
558                 contents: CResult_NoneNoneZPtr {
559                         err: core::ptr::null_mut(),
560                 },
561                 result_ok: false,
562         }
563 }
564 /// Checks if the given object is currently in the success state
565 #[no_mangle]
566 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
567         o.result_ok
568 }
569 #[no_mangle]
570 /// Frees any resources used by the CResult_NoneNoneZ.
571 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
572 impl Drop for CResult_NoneNoneZ {
573         fn drop(&mut self) {
574                 if self.result_ok {
575                 } else {
576                 }
577         }
578 }
579 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
580         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
581                 let contents = if o.result_ok {
582                         let _ = unsafe { Box::from_raw(o.contents.result) };
583                         o.contents.result = core::ptr::null_mut();
584                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
585                 } else {
586                         let _ = unsafe { Box::from_raw(o.contents.err) };
587                         o.contents.err = core::ptr::null_mut();
588                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
589                 };
590                 Self {
591                         contents,
592                         result_ok: o.result_ok,
593                 }
594         }
595 }
596 impl Clone for CResult_NoneNoneZ {
597         fn clone(&self) -> Self {
598                 if self.result_ok {
599                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
600                                 result: core::ptr::null_mut()
601                         } }
602                 } else {
603                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
604                                 err: core::ptr::null_mut()
605                         } }
606                 }
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
611 /// but with all dynamically-allocated buffers duplicated in new buffers.
612 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
613 #[repr(C)]
614 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
615 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
616         /// A pointer to the contents in the success state.
617         /// Reading from this pointer when `result_ok` is not set is undefined.
618         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
619         /// A pointer to the contents in the error state.
620         /// Reading from this pointer when `result_ok` is set is undefined.
621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
622 }
623 #[repr(C)]
624 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
625 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
627 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
628         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
629         /// `err` or `result` depending on the state of `result_ok`.
630         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
631         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
632         pub result_ok: bool,
633 }
634 #[no_mangle]
635 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
636 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
637         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
638                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
639                         result: Box::into_raw(Box::new(o)),
640                 },
641                 result_ok: true,
642         }
643 }
644 #[no_mangle]
645 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
646 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
647         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
648                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
649                         err: Box::into_raw(Box::new(e)),
650                 },
651                 result_ok: false,
652         }
653 }
654 /// Checks if the given object is currently in the success state
655 #[no_mangle]
656 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
657         o.result_ok
658 }
659 #[no_mangle]
660 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
661 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
662 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
663         fn drop(&mut self) {
664                 if self.result_ok {
665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
667                         }
668                 } else {
669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
671                         }
672                 }
673         }
674 }
675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
677                 let contents = if o.result_ok {
678                         let result = unsafe { o.contents.result };
679                         unsafe { o.contents.result = core::ptr::null_mut() };
680                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
681                 } else {
682                         let err = unsafe { o.contents.err };
683                         unsafe { o.contents.err = core::ptr::null_mut(); }
684                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
685                 };
686                 Self {
687                         contents,
688                         result_ok: o.result_ok,
689                 }
690         }
691 }
692 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
693         fn clone(&self) -> Self {
694                 if self.result_ok {
695                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
696                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
697                         } }
698                 } else {
699                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
701                         } }
702                 }
703         }
704 }
705 #[no_mangle]
706 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
707 /// but with all dynamically-allocated buffers duplicated in new buffers.
708 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
709 #[repr(C)]
710 /// The contents of CResult_TxCreationKeysDecodeErrorZ
711 pub union CResult_TxCreationKeysDecodeErrorZPtr {
712         /// A pointer to the contents in the success state.
713         /// Reading from this pointer when `result_ok` is not set is undefined.
714         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
715         /// A pointer to the contents in the error state.
716         /// Reading from this pointer when `result_ok` is set is undefined.
717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
718 }
719 #[repr(C)]
720 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
721 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
723 pub struct CResult_TxCreationKeysDecodeErrorZ {
724         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
725         /// `err` or `result` depending on the state of `result_ok`.
726         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
727         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
728         pub result_ok: bool,
729 }
730 #[no_mangle]
731 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
732 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
733         CResult_TxCreationKeysDecodeErrorZ {
734                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
735                         result: Box::into_raw(Box::new(o)),
736                 },
737                 result_ok: true,
738         }
739 }
740 #[no_mangle]
741 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
742 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
743         CResult_TxCreationKeysDecodeErrorZ {
744                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
745                         err: Box::into_raw(Box::new(e)),
746                 },
747                 result_ok: false,
748         }
749 }
750 /// Checks if the given object is currently in the success state
751 #[no_mangle]
752 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
753         o.result_ok
754 }
755 #[no_mangle]
756 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
757 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
758 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
759         fn drop(&mut self) {
760                 if self.result_ok {
761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
763                         }
764                 } else {
765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
767                         }
768                 }
769         }
770 }
771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
773                 let contents = if o.result_ok {
774                         let result = unsafe { o.contents.result };
775                         unsafe { o.contents.result = core::ptr::null_mut() };
776                         CResult_TxCreationKeysDecodeErrorZPtr { result }
777                 } else {
778                         let err = unsafe { o.contents.err };
779                         unsafe { o.contents.err = core::ptr::null_mut(); }
780                         CResult_TxCreationKeysDecodeErrorZPtr { err }
781                 };
782                 Self {
783                         contents,
784                         result_ok: o.result_ok,
785                 }
786         }
787 }
788 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
789         fn clone(&self) -> Self {
790                 if self.result_ok {
791                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
792                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
793                         } }
794                 } else {
795                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
796                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
797                         } }
798                 }
799         }
800 }
801 #[no_mangle]
802 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
803 /// but with all dynamically-allocated buffers duplicated in new buffers.
804 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
805 #[repr(C)]
806 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
807 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
808         /// A pointer to the contents in the success state.
809         /// Reading from this pointer when `result_ok` is not set is undefined.
810         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
811         /// A pointer to the contents in the error state.
812         /// Reading from this pointer when `result_ok` is set is undefined.
813         pub err: *mut crate::lightning::ln::msgs::DecodeError,
814 }
815 #[repr(C)]
816 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
817 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
819 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
820         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
821         /// `err` or `result` depending on the state of `result_ok`.
822         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
823         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
824         pub result_ok: bool,
825 }
826 #[no_mangle]
827 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
828 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
829         CResult_ChannelPublicKeysDecodeErrorZ {
830                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
831                         result: Box::into_raw(Box::new(o)),
832                 },
833                 result_ok: true,
834         }
835 }
836 #[no_mangle]
837 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
838 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
839         CResult_ChannelPublicKeysDecodeErrorZ {
840                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
841                         err: Box::into_raw(Box::new(e)),
842                 },
843                 result_ok: false,
844         }
845 }
846 /// Checks if the given object is currently in the success state
847 #[no_mangle]
848 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
849         o.result_ok
850 }
851 #[no_mangle]
852 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
853 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
854 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
855         fn drop(&mut self) {
856                 if self.result_ok {
857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
859                         }
860                 } else {
861                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
862                                 let _ = unsafe { Box::from_raw(self.contents.err) };
863                         }
864                 }
865         }
866 }
867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
868         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
869                 let contents = if o.result_ok {
870                         let result = unsafe { o.contents.result };
871                         unsafe { o.contents.result = core::ptr::null_mut() };
872                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
873                 } else {
874                         let err = unsafe { o.contents.err };
875                         unsafe { o.contents.err = core::ptr::null_mut(); }
876                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
877                 };
878                 Self {
879                         contents,
880                         result_ok: o.result_ok,
881                 }
882         }
883 }
884 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
885         fn clone(&self) -> Self {
886                 if self.result_ok {
887                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
888                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
889                         } }
890                 } else {
891                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
892                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
893                         } }
894                 }
895         }
896 }
897 #[no_mangle]
898 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
899 /// but with all dynamically-allocated buffers duplicated in new buffers.
900 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
901 #[repr(C)]
902 #[derive(Clone)]
903 /// An enum which can either contain a u32 or not
904 pub enum COption_u32Z {
905         /// When we're in this state, this COption_u32Z contains a u32
906         Some(u32),
907         /// When we're in this state, this COption_u32Z contains nothing
908         None
909 }
910 impl COption_u32Z {
911         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
912                 if let Self::None = self { false } else { true }
913         }
914         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
915                 !self.is_some()
916         }
917         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
918                 if let Self::Some(v) = self { v } else { unreachable!() }
919         }
920 }
921 #[no_mangle]
922 /// Constructs a new COption_u32Z containing a u32
923 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
924         COption_u32Z::Some(o)
925 }
926 #[no_mangle]
927 /// Constructs a new COption_u32Z containing nothing
928 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
929         COption_u32Z::None
930 }
931 #[no_mangle]
932 /// Frees any resources associated with the u32, if we are in the Some state
933 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
934 #[no_mangle]
935 /// Creates a new COption_u32Z which has the same data as `orig`
936 /// but with all dynamically-allocated buffers duplicated in new buffers.
937 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
938 #[repr(C)]
939 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
940 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
941         /// A pointer to the contents in the success state.
942         /// Reading from this pointer when `result_ok` is not set is undefined.
943         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
944         /// A pointer to the contents in the error state.
945         /// Reading from this pointer when `result_ok` is set is undefined.
946         pub err: *mut crate::lightning::ln::msgs::DecodeError,
947 }
948 #[repr(C)]
949 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
950 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
952 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
953         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
954         /// `err` or `result` depending on the state of `result_ok`.
955         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
956         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
957         pub result_ok: bool,
958 }
959 #[no_mangle]
960 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
961 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
962         CResult_HTLCOutputInCommitmentDecodeErrorZ {
963                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
964                         result: Box::into_raw(Box::new(o)),
965                 },
966                 result_ok: true,
967         }
968 }
969 #[no_mangle]
970 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
971 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
972         CResult_HTLCOutputInCommitmentDecodeErrorZ {
973                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
974                         err: Box::into_raw(Box::new(e)),
975                 },
976                 result_ok: false,
977         }
978 }
979 /// Checks if the given object is currently in the success state
980 #[no_mangle]
981 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
982         o.result_ok
983 }
984 #[no_mangle]
985 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
986 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
987 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
988         fn drop(&mut self) {
989                 if self.result_ok {
990                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
991                                 let _ = unsafe { Box::from_raw(self.contents.result) };
992                         }
993                 } else {
994                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
995                                 let _ = unsafe { Box::from_raw(self.contents.err) };
996                         }
997                 }
998         }
999 }
1000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
1002                 let contents = if o.result_ok {
1003                         let result = unsafe { o.contents.result };
1004                         unsafe { o.contents.result = core::ptr::null_mut() };
1005                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
1006                 } else {
1007                         let err = unsafe { o.contents.err };
1008                         unsafe { o.contents.err = core::ptr::null_mut(); }
1009                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
1010                 };
1011                 Self {
1012                         contents,
1013                         result_ok: o.result_ok,
1014                 }
1015         }
1016 }
1017 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
1018         fn clone(&self) -> Self {
1019                 if self.result_ok {
1020                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1021                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
1022                         } }
1023                 } else {
1024                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
1025                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1026                         } }
1027                 }
1028         }
1029 }
1030 #[no_mangle]
1031 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
1032 /// but with all dynamically-allocated buffers duplicated in new buffers.
1033 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
1034 #[repr(C)]
1035 /// An enum which can either contain a  or not
1036 pub enum COption_NoneZ {
1037         /// When we're in this state, this COption_NoneZ contains a 
1038         Some,
1039         /// When we're in this state, this COption_NoneZ contains nothing
1040         None
1041 }
1042 impl COption_NoneZ {
1043         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1044                 if let Self::None = self { false } else { true }
1045         }
1046         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1047                 !self.is_some()
1048         }
1049 }
1050 #[no_mangle]
1051 /// Constructs a new COption_NoneZ containing a 
1052 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
1053         COption_NoneZ::Some
1054 }
1055 #[no_mangle]
1056 /// Constructs a new COption_NoneZ containing nothing
1057 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
1058         COption_NoneZ::None
1059 }
1060 #[no_mangle]
1061 /// Frees any resources associated with the , if we are in the Some state
1062 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
1063 #[repr(C)]
1064 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1065 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1066         /// A pointer to the contents in the success state.
1067         /// Reading from this pointer when `result_ok` is not set is undefined.
1068         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
1069         /// A pointer to the contents in the error state.
1070         /// Reading from this pointer when `result_ok` is set is undefined.
1071         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1072 }
1073 #[repr(C)]
1074 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1075 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1077 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1078         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1079         /// `err` or `result` depending on the state of `result_ok`.
1080         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
1081         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1082         pub result_ok: bool,
1083 }
1084 #[no_mangle]
1085 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
1086 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1087         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1088                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1089                         result: Box::into_raw(Box::new(o)),
1090                 },
1091                 result_ok: true,
1092         }
1093 }
1094 #[no_mangle]
1095 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
1096 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1097         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1098                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1099                         err: Box::into_raw(Box::new(e)),
1100                 },
1101                 result_ok: false,
1102         }
1103 }
1104 /// Checks if the given object is currently in the success state
1105 #[no_mangle]
1106 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
1107         o.result_ok
1108 }
1109 #[no_mangle]
1110 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
1111 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
1112 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1113         fn drop(&mut self) {
1114                 if self.result_ok {
1115                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1116                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1117                         }
1118                 } else {
1119                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1120                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1121                         }
1122                 }
1123         }
1124 }
1125 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1126         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1127                 let contents = if o.result_ok {
1128                         let result = unsafe { o.contents.result };
1129                         unsafe { o.contents.result = core::ptr::null_mut() };
1130                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
1131                 } else {
1132                         let err = unsafe { o.contents.err };
1133                         unsafe { o.contents.err = core::ptr::null_mut(); }
1134                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
1135                 };
1136                 Self {
1137                         contents,
1138                         result_ok: o.result_ok,
1139                 }
1140         }
1141 }
1142 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1143         fn clone(&self) -> Self {
1144                 if self.result_ok {
1145                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1146                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1147                         } }
1148                 } else {
1149                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1150                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1151                         } }
1152                 }
1153         }
1154 }
1155 #[no_mangle]
1156 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1157 /// but with all dynamically-allocated buffers duplicated in new buffers.
1158 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1159 #[repr(C)]
1160 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1161 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
1162         /// A pointer to the contents in the success state.
1163         /// Reading from this pointer when `result_ok` is not set is undefined.
1164         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
1165         /// A pointer to the contents in the error state.
1166         /// Reading from this pointer when `result_ok` is set is undefined.
1167         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1168 }
1169 #[repr(C)]
1170 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1171 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1173 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
1174         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1175         /// `err` or `result` depending on the state of `result_ok`.
1176         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
1177         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1178         pub result_ok: bool,
1179 }
1180 #[no_mangle]
1181 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
1182 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1183         CResult_ChannelTransactionParametersDecodeErrorZ {
1184                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1185                         result: Box::into_raw(Box::new(o)),
1186                 },
1187                 result_ok: true,
1188         }
1189 }
1190 #[no_mangle]
1191 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
1192 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
1193         CResult_ChannelTransactionParametersDecodeErrorZ {
1194                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1195                         err: Box::into_raw(Box::new(e)),
1196                 },
1197                 result_ok: false,
1198         }
1199 }
1200 /// Checks if the given object is currently in the success state
1201 #[no_mangle]
1202 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
1203         o.result_ok
1204 }
1205 #[no_mangle]
1206 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
1207 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
1208 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
1209         fn drop(&mut self) {
1210                 if self.result_ok {
1211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1213                         }
1214                 } else {
1215                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1216                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1217                         }
1218                 }
1219         }
1220 }
1221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
1222         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
1223                 let contents = if o.result_ok {
1224                         let result = unsafe { o.contents.result };
1225                         unsafe { o.contents.result = core::ptr::null_mut() };
1226                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1227                 } else {
1228                         let err = unsafe { o.contents.err };
1229                         unsafe { o.contents.err = core::ptr::null_mut(); }
1230                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1231                 };
1232                 Self {
1233                         contents,
1234                         result_ok: o.result_ok,
1235                 }
1236         }
1237 }
1238 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1239         fn clone(&self) -> Self {
1240                 if self.result_ok {
1241                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1242                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1243                         } }
1244                 } else {
1245                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1246                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1247                         } }
1248                 }
1249         }
1250 }
1251 #[no_mangle]
1252 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1253 /// but with all dynamically-allocated buffers duplicated in new buffers.
1254 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1255 #[repr(C)]
1256 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1257 /// This corresponds to std::vector in C++
1258 pub struct CVec_SignatureZ {
1259         /// The elements in the array.
1260         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1261         pub data: *mut crate::c_types::Signature,
1262         /// The number of elements pointed to by `data`.
1263         pub datalen: usize
1264 }
1265 impl CVec_SignatureZ {
1266         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1267                 if self.datalen == 0 { return Vec::new(); }
1268                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1269                 self.data = core::ptr::null_mut();
1270                 self.datalen = 0;
1271                 ret
1272         }
1273         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1274                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1275         }
1276 }
1277 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1278         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1279                 let datalen = v.len();
1280                 let data = Box::into_raw(v.into_boxed_slice());
1281                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1282         }
1283 }
1284 #[no_mangle]
1285 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1286 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1287 impl Drop for CVec_SignatureZ {
1288         fn drop(&mut self) {
1289                 if self.datalen == 0 { return; }
1290                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1291         }
1292 }
1293 impl Clone for CVec_SignatureZ {
1294         fn clone(&self) -> Self {
1295                 let mut res = Vec::new();
1296                 if self.datalen == 0 { return Self::from(res); }
1297                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1298                 Self::from(res)
1299         }
1300 }
1301 #[repr(C)]
1302 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1303 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1304         /// A pointer to the contents in the success state.
1305         /// Reading from this pointer when `result_ok` is not set is undefined.
1306         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1307         /// A pointer to the contents in the error state.
1308         /// Reading from this pointer when `result_ok` is set is undefined.
1309         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1310 }
1311 #[repr(C)]
1312 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1313 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1315 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1316         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1317         /// `err` or `result` depending on the state of `result_ok`.
1318         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1319         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1320         pub result_ok: bool,
1321 }
1322 #[no_mangle]
1323 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1324 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1325         CResult_HolderCommitmentTransactionDecodeErrorZ {
1326                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1327                         result: Box::into_raw(Box::new(o)),
1328                 },
1329                 result_ok: true,
1330         }
1331 }
1332 #[no_mangle]
1333 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1334 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1335         CResult_HolderCommitmentTransactionDecodeErrorZ {
1336                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1337                         err: Box::into_raw(Box::new(e)),
1338                 },
1339                 result_ok: false,
1340         }
1341 }
1342 /// Checks if the given object is currently in the success state
1343 #[no_mangle]
1344 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1345         o.result_ok
1346 }
1347 #[no_mangle]
1348 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1349 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1350 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1351         fn drop(&mut self) {
1352                 if self.result_ok {
1353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1355                         }
1356                 } else {
1357                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1358                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1359                         }
1360                 }
1361         }
1362 }
1363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1365                 let contents = if o.result_ok {
1366                         let result = unsafe { o.contents.result };
1367                         unsafe { o.contents.result = core::ptr::null_mut() };
1368                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1369                 } else {
1370                         let err = unsafe { o.contents.err };
1371                         unsafe { o.contents.err = core::ptr::null_mut(); }
1372                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1373                 };
1374                 Self {
1375                         contents,
1376                         result_ok: o.result_ok,
1377                 }
1378         }
1379 }
1380 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1381         fn clone(&self) -> Self {
1382                 if self.result_ok {
1383                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1385                         } }
1386                 } else {
1387                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1388                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1389                         } }
1390                 }
1391         }
1392 }
1393 #[no_mangle]
1394 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1395 /// but with all dynamically-allocated buffers duplicated in new buffers.
1396 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1397 #[repr(C)]
1398 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1399 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1400         /// A pointer to the contents in the success state.
1401         /// Reading from this pointer when `result_ok` is not set is undefined.
1402         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1403         /// A pointer to the contents in the error state.
1404         /// Reading from this pointer when `result_ok` is set is undefined.
1405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1406 }
1407 #[repr(C)]
1408 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1409 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1411 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1412         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1413         /// `err` or `result` depending on the state of `result_ok`.
1414         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1415         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1416         pub result_ok: bool,
1417 }
1418 #[no_mangle]
1419 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1420 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1421         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1422                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1423                         result: Box::into_raw(Box::new(o)),
1424                 },
1425                 result_ok: true,
1426         }
1427 }
1428 #[no_mangle]
1429 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1430 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1431         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1432                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1433                         err: Box::into_raw(Box::new(e)),
1434                 },
1435                 result_ok: false,
1436         }
1437 }
1438 /// Checks if the given object is currently in the success state
1439 #[no_mangle]
1440 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1441         o.result_ok
1442 }
1443 #[no_mangle]
1444 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1445 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1446 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1447         fn drop(&mut self) {
1448                 if self.result_ok {
1449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1451                         }
1452                 } else {
1453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1455                         }
1456                 }
1457         }
1458 }
1459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1461                 let contents = if o.result_ok {
1462                         let result = unsafe { o.contents.result };
1463                         unsafe { o.contents.result = core::ptr::null_mut() };
1464                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1465                 } else {
1466                         let err = unsafe { o.contents.err };
1467                         unsafe { o.contents.err = core::ptr::null_mut(); }
1468                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1469                 };
1470                 Self {
1471                         contents,
1472                         result_ok: o.result_ok,
1473                 }
1474         }
1475 }
1476 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1477         fn clone(&self) -> Self {
1478                 if self.result_ok {
1479                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1480                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1481                         } }
1482                 } else {
1483                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1485                         } }
1486                 }
1487         }
1488 }
1489 #[no_mangle]
1490 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1491 /// but with all dynamically-allocated buffers duplicated in new buffers.
1492 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1493 #[repr(C)]
1494 /// The contents of CResult_TrustedClosingTransactionNoneZ
1495 pub union CResult_TrustedClosingTransactionNoneZPtr {
1496         /// A pointer to the contents in the success state.
1497         /// Reading from this pointer when `result_ok` is not set is undefined.
1498         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1499         /// Note that this value is always NULL, as there are no contents in the Err variant
1500         pub err: *mut core::ffi::c_void,
1501 }
1502 #[repr(C)]
1503 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1504 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1506 pub struct CResult_TrustedClosingTransactionNoneZ {
1507         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1508         /// `err` or `result` depending on the state of `result_ok`.
1509         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1510         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1511         pub result_ok: bool,
1512 }
1513 #[no_mangle]
1514 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1515 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1516         CResult_TrustedClosingTransactionNoneZ {
1517                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1518                         result: Box::into_raw(Box::new(o)),
1519                 },
1520                 result_ok: true,
1521         }
1522 }
1523 #[no_mangle]
1524 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1525 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1526         CResult_TrustedClosingTransactionNoneZ {
1527                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1528                         err: core::ptr::null_mut(),
1529                 },
1530                 result_ok: false,
1531         }
1532 }
1533 /// Checks if the given object is currently in the success state
1534 #[no_mangle]
1535 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1536         o.result_ok
1537 }
1538 #[no_mangle]
1539 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1540 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1541 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1542         fn drop(&mut self) {
1543                 if self.result_ok {
1544                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1545                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1546                         }
1547                 } else {
1548                 }
1549         }
1550 }
1551 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1552         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1553                 let contents = if o.result_ok {
1554                         let result = unsafe { o.contents.result };
1555                         unsafe { o.contents.result = core::ptr::null_mut() };
1556                         CResult_TrustedClosingTransactionNoneZPtr { result }
1557                 } else {
1558                         let _ = unsafe { Box::from_raw(o.contents.err) };
1559                         o.contents.err = core::ptr::null_mut();
1560                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1561                 };
1562                 Self {
1563                         contents,
1564                         result_ok: o.result_ok,
1565                 }
1566         }
1567 }
1568 #[repr(C)]
1569 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1570 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1571         /// A pointer to the contents in the success state.
1572         /// Reading from this pointer when `result_ok` is not set is undefined.
1573         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1574         /// A pointer to the contents in the error state.
1575         /// Reading from this pointer when `result_ok` is set is undefined.
1576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1577 }
1578 #[repr(C)]
1579 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1580 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1582 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1583         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1584         /// `err` or `result` depending on the state of `result_ok`.
1585         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1586         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1587         pub result_ok: bool,
1588 }
1589 #[no_mangle]
1590 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1591 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1592         CResult_CommitmentTransactionDecodeErrorZ {
1593                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1594                         result: Box::into_raw(Box::new(o)),
1595                 },
1596                 result_ok: true,
1597         }
1598 }
1599 #[no_mangle]
1600 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1601 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1602         CResult_CommitmentTransactionDecodeErrorZ {
1603                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1604                         err: Box::into_raw(Box::new(e)),
1605                 },
1606                 result_ok: false,
1607         }
1608 }
1609 /// Checks if the given object is currently in the success state
1610 #[no_mangle]
1611 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1612         o.result_ok
1613 }
1614 #[no_mangle]
1615 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1616 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1617 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1618         fn drop(&mut self) {
1619                 if self.result_ok {
1620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1622                         }
1623                 } else {
1624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1626                         }
1627                 }
1628         }
1629 }
1630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1632                 let contents = if o.result_ok {
1633                         let result = unsafe { o.contents.result };
1634                         unsafe { o.contents.result = core::ptr::null_mut() };
1635                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1636                 } else {
1637                         let err = unsafe { o.contents.err };
1638                         unsafe { o.contents.err = core::ptr::null_mut(); }
1639                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1640                 };
1641                 Self {
1642                         contents,
1643                         result_ok: o.result_ok,
1644                 }
1645         }
1646 }
1647 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1648         fn clone(&self) -> Self {
1649                 if self.result_ok {
1650                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1651                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1652                         } }
1653                 } else {
1654                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1656                         } }
1657                 }
1658         }
1659 }
1660 #[no_mangle]
1661 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1662 /// but with all dynamically-allocated buffers duplicated in new buffers.
1663 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1664 #[repr(C)]
1665 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1666 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1667         /// A pointer to the contents in the success state.
1668         /// Reading from this pointer when `result_ok` is not set is undefined.
1669         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1670         /// Note that this value is always NULL, as there are no contents in the Err variant
1671         pub err: *mut core::ffi::c_void,
1672 }
1673 #[repr(C)]
1674 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1675 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1677 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1678         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1679         /// `err` or `result` depending on the state of `result_ok`.
1680         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1681         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1682         pub result_ok: bool,
1683 }
1684 #[no_mangle]
1685 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1686 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1687         CResult_TrustedCommitmentTransactionNoneZ {
1688                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1689                         result: Box::into_raw(Box::new(o)),
1690                 },
1691                 result_ok: true,
1692         }
1693 }
1694 #[no_mangle]
1695 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1696 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1697         CResult_TrustedCommitmentTransactionNoneZ {
1698                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1699                         err: core::ptr::null_mut(),
1700                 },
1701                 result_ok: false,
1702         }
1703 }
1704 /// Checks if the given object is currently in the success state
1705 #[no_mangle]
1706 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1707         o.result_ok
1708 }
1709 #[no_mangle]
1710 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1711 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1712 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1713         fn drop(&mut self) {
1714                 if self.result_ok {
1715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1717                         }
1718                 } else {
1719                 }
1720         }
1721 }
1722 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1723         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1724                 let contents = if o.result_ok {
1725                         let result = unsafe { o.contents.result };
1726                         unsafe { o.contents.result = core::ptr::null_mut() };
1727                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1728                 } else {
1729                         let _ = unsafe { Box::from_raw(o.contents.err) };
1730                         o.contents.err = core::ptr::null_mut();
1731                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1732                 };
1733                 Self {
1734                         contents,
1735                         result_ok: o.result_ok,
1736                 }
1737         }
1738 }
1739 #[repr(C)]
1740 /// The contents of CResult_CVec_SignatureZNoneZ
1741 pub union CResult_CVec_SignatureZNoneZPtr {
1742         /// A pointer to the contents in the success state.
1743         /// Reading from this pointer when `result_ok` is not set is undefined.
1744         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1745         /// Note that this value is always NULL, as there are no contents in the Err variant
1746         pub err: *mut core::ffi::c_void,
1747 }
1748 #[repr(C)]
1749 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1750 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1751 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1752 pub struct CResult_CVec_SignatureZNoneZ {
1753         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1754         /// `err` or `result` depending on the state of `result_ok`.
1755         pub contents: CResult_CVec_SignatureZNoneZPtr,
1756         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1757         pub result_ok: bool,
1758 }
1759 #[no_mangle]
1760 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1761 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1762         CResult_CVec_SignatureZNoneZ {
1763                 contents: CResult_CVec_SignatureZNoneZPtr {
1764                         result: Box::into_raw(Box::new(o)),
1765                 },
1766                 result_ok: true,
1767         }
1768 }
1769 #[no_mangle]
1770 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1771 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1772         CResult_CVec_SignatureZNoneZ {
1773                 contents: CResult_CVec_SignatureZNoneZPtr {
1774                         err: core::ptr::null_mut(),
1775                 },
1776                 result_ok: false,
1777         }
1778 }
1779 /// Checks if the given object is currently in the success state
1780 #[no_mangle]
1781 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1782         o.result_ok
1783 }
1784 #[no_mangle]
1785 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1786 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1787 impl Drop for CResult_CVec_SignatureZNoneZ {
1788         fn drop(&mut self) {
1789                 if self.result_ok {
1790                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1791                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1792                         }
1793                 } else {
1794                 }
1795         }
1796 }
1797 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1798         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1799                 let contents = if o.result_ok {
1800                         let result = unsafe { o.contents.result };
1801                         unsafe { o.contents.result = core::ptr::null_mut() };
1802                         CResult_CVec_SignatureZNoneZPtr { result }
1803                 } else {
1804                         let _ = unsafe { Box::from_raw(o.contents.err) };
1805                         o.contents.err = core::ptr::null_mut();
1806                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1807                 };
1808                 Self {
1809                         contents,
1810                         result_ok: o.result_ok,
1811                 }
1812         }
1813 }
1814 impl Clone for CResult_CVec_SignatureZNoneZ {
1815         fn clone(&self) -> Self {
1816                 if self.result_ok {
1817                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1818                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1819                         } }
1820                 } else {
1821                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1822                                 err: core::ptr::null_mut()
1823                         } }
1824                 }
1825         }
1826 }
1827 #[no_mangle]
1828 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1829 /// but with all dynamically-allocated buffers duplicated in new buffers.
1830 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1831 #[repr(C)]
1832 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1833 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1834         /// A pointer to the contents in the success state.
1835         /// Reading from this pointer when `result_ok` is not set is undefined.
1836         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1837         /// A pointer to the contents in the error state.
1838         /// Reading from this pointer when `result_ok` is set is undefined.
1839         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1840 }
1841 #[repr(C)]
1842 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1843 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1845 pub struct CResult_ShutdownScriptDecodeErrorZ {
1846         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1847         /// `err` or `result` depending on the state of `result_ok`.
1848         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1849         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1850         pub result_ok: bool,
1851 }
1852 #[no_mangle]
1853 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1854 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1855         CResult_ShutdownScriptDecodeErrorZ {
1856                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1857                         result: Box::into_raw(Box::new(o)),
1858                 },
1859                 result_ok: true,
1860         }
1861 }
1862 #[no_mangle]
1863 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1864 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1865         CResult_ShutdownScriptDecodeErrorZ {
1866                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1867                         err: Box::into_raw(Box::new(e)),
1868                 },
1869                 result_ok: false,
1870         }
1871 }
1872 /// Checks if the given object is currently in the success state
1873 #[no_mangle]
1874 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1875         o.result_ok
1876 }
1877 #[no_mangle]
1878 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1879 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1880 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1881         fn drop(&mut self) {
1882                 if self.result_ok {
1883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1885                         }
1886                 } else {
1887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1889                         }
1890                 }
1891         }
1892 }
1893 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1894         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1895                 let contents = if o.result_ok {
1896                         let result = unsafe { o.contents.result };
1897                         unsafe { o.contents.result = core::ptr::null_mut() };
1898                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1899                 } else {
1900                         let err = unsafe { o.contents.err };
1901                         unsafe { o.contents.err = core::ptr::null_mut(); }
1902                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1903                 };
1904                 Self {
1905                         contents,
1906                         result_ok: o.result_ok,
1907                 }
1908         }
1909 }
1910 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1911         fn clone(&self) -> Self {
1912                 if self.result_ok {
1913                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1914                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1915                         } }
1916                 } else {
1917                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1918                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1919                         } }
1920                 }
1921         }
1922 }
1923 #[no_mangle]
1924 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1925 /// but with all dynamically-allocated buffers duplicated in new buffers.
1926 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1927 #[repr(C)]
1928 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1929 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1930         /// A pointer to the contents in the success state.
1931         /// Reading from this pointer when `result_ok` is not set is undefined.
1932         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1933         /// A pointer to the contents in the error state.
1934         /// Reading from this pointer when `result_ok` is set is undefined.
1935         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1936 }
1937 #[repr(C)]
1938 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1939 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1941 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1942         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1943         /// `err` or `result` depending on the state of `result_ok`.
1944         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1945         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1946         pub result_ok: bool,
1947 }
1948 #[no_mangle]
1949 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1950 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1951         CResult_ShutdownScriptInvalidShutdownScriptZ {
1952                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1953                         result: Box::into_raw(Box::new(o)),
1954                 },
1955                 result_ok: true,
1956         }
1957 }
1958 #[no_mangle]
1959 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1960 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1961         CResult_ShutdownScriptInvalidShutdownScriptZ {
1962                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1963                         err: Box::into_raw(Box::new(e)),
1964                 },
1965                 result_ok: false,
1966         }
1967 }
1968 /// Checks if the given object is currently in the success state
1969 #[no_mangle]
1970 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1971         o.result_ok
1972 }
1973 #[no_mangle]
1974 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1975 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1976 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1977         fn drop(&mut self) {
1978                 if self.result_ok {
1979                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1980                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1981                         }
1982                 } else {
1983                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1984                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1985                         }
1986                 }
1987         }
1988 }
1989 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1990         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1991                 let contents = if o.result_ok {
1992                         let result = unsafe { o.contents.result };
1993                         unsafe { o.contents.result = core::ptr::null_mut() };
1994                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1995                 } else {
1996                         let err = unsafe { o.contents.err };
1997                         unsafe { o.contents.err = core::ptr::null_mut(); }
1998                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1999                 };
2000                 Self {
2001                         contents,
2002                         result_ok: o.result_ok,
2003                 }
2004         }
2005 }
2006 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
2007         fn clone(&self) -> Self {
2008                 if self.result_ok {
2009                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2010                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
2011                         } }
2012                 } else {
2013                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
2014                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
2015                         } }
2016                 }
2017         }
2018 }
2019 #[no_mangle]
2020 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
2021 /// but with all dynamically-allocated buffers duplicated in new buffers.
2022 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
2023 #[repr(C)]
2024 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
2025 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
2026         /// A pointer to the contents in the success state.
2027         /// Reading from this pointer when `result_ok` is not set is undefined.
2028         pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
2029         /// A pointer to the contents in the error state.
2030         /// Reading from this pointer when `result_ok` is set is undefined.
2031         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2032 }
2033 #[repr(C)]
2034 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
2035 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
2036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2037 pub struct CResult_BlindedPayInfoDecodeErrorZ {
2038         /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
2039         /// `err` or `result` depending on the state of `result_ok`.
2040         pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
2041         /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
2042         pub result_ok: bool,
2043 }
2044 #[no_mangle]
2045 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
2046 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
2047         CResult_BlindedPayInfoDecodeErrorZ {
2048                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2049                         result: Box::into_raw(Box::new(o)),
2050                 },
2051                 result_ok: true,
2052         }
2053 }
2054 #[no_mangle]
2055 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
2056 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
2057         CResult_BlindedPayInfoDecodeErrorZ {
2058                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2059                         err: Box::into_raw(Box::new(e)),
2060                 },
2061                 result_ok: false,
2062         }
2063 }
2064 /// Checks if the given object is currently in the success state
2065 #[no_mangle]
2066 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
2067         o.result_ok
2068 }
2069 #[no_mangle]
2070 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
2071 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
2072 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
2073         fn drop(&mut self) {
2074                 if self.result_ok {
2075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2077                         }
2078                 } else {
2079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2081                         }
2082                 }
2083         }
2084 }
2085 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
2086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
2087                 let contents = if o.result_ok {
2088                         let result = unsafe { o.contents.result };
2089                         unsafe { o.contents.result = core::ptr::null_mut() };
2090                         CResult_BlindedPayInfoDecodeErrorZPtr { result }
2091                 } else {
2092                         let err = unsafe { o.contents.err };
2093                         unsafe { o.contents.err = core::ptr::null_mut(); }
2094                         CResult_BlindedPayInfoDecodeErrorZPtr { err }
2095                 };
2096                 Self {
2097                         contents,
2098                         result_ok: o.result_ok,
2099                 }
2100         }
2101 }
2102 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
2103         fn clone(&self) -> Self {
2104                 if self.result_ok {
2105                         Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2106                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
2107                         } }
2108                 } else {
2109                         Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
2110                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2111                         } }
2112                 }
2113         }
2114 }
2115 #[no_mangle]
2116 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
2117 /// but with all dynamically-allocated buffers duplicated in new buffers.
2118 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
2119 #[repr(C)]
2120 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2121 pub enum COption_WriteableScoreZ {
2122         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2123         Some(crate::lightning::routing::scoring::WriteableScore),
2124         /// When we're in this state, this COption_WriteableScoreZ contains nothing
2125         None
2126 }
2127 impl COption_WriteableScoreZ {
2128         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2129                 if let Self::None = self { false } else { true }
2130         }
2131         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2132                 !self.is_some()
2133         }
2134         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2135                 if let Self::Some(v) = self { v } else { unreachable!() }
2136         }
2137 }
2138 #[no_mangle]
2139 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2140 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2141         COption_WriteableScoreZ::Some(o)
2142 }
2143 #[no_mangle]
2144 /// Constructs a new COption_WriteableScoreZ containing nothing
2145 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2146         COption_WriteableScoreZ::None
2147 }
2148 #[no_mangle]
2149 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2150 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2151 #[repr(C)]
2152 /// The contents of CResult_NoneErrorZ
2153 pub union CResult_NoneErrorZPtr {
2154         /// Note that this value is always NULL, as there are no contents in the OK variant
2155         pub result: *mut core::ffi::c_void,
2156         /// A pointer to the contents in the error state.
2157         /// Reading from this pointer when `result_ok` is set is undefined.
2158         pub err: *mut crate::c_types::IOError,
2159 }
2160 #[repr(C)]
2161 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2162 /// containing a () on success and a crate::c_types::IOError on failure.
2163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2164 pub struct CResult_NoneErrorZ {
2165         /// The contents of this CResult_NoneErrorZ, accessible via either
2166         /// `err` or `result` depending on the state of `result_ok`.
2167         pub contents: CResult_NoneErrorZPtr,
2168         /// Whether this CResult_NoneErrorZ represents a success state.
2169         pub result_ok: bool,
2170 }
2171 #[no_mangle]
2172 /// Creates a new CResult_NoneErrorZ in the success state.
2173 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2174         CResult_NoneErrorZ {
2175                 contents: CResult_NoneErrorZPtr {
2176                         result: core::ptr::null_mut(),
2177                 },
2178                 result_ok: true,
2179         }
2180 }
2181 #[no_mangle]
2182 /// Creates a new CResult_NoneErrorZ in the error state.
2183 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2184         CResult_NoneErrorZ {
2185                 contents: CResult_NoneErrorZPtr {
2186                         err: Box::into_raw(Box::new(e)),
2187                 },
2188                 result_ok: false,
2189         }
2190 }
2191 /// Checks if the given object is currently in the success state
2192 #[no_mangle]
2193 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2194         o.result_ok
2195 }
2196 #[no_mangle]
2197 /// Frees any resources used by the CResult_NoneErrorZ.
2198 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2199 impl Drop for CResult_NoneErrorZ {
2200         fn drop(&mut self) {
2201                 if self.result_ok {
2202                 } else {
2203                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2204                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2205                         }
2206                 }
2207         }
2208 }
2209 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2210         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2211                 let contents = if o.result_ok {
2212                         let _ = unsafe { Box::from_raw(o.contents.result) };
2213                         o.contents.result = core::ptr::null_mut();
2214                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2215                 } else {
2216                         let err = unsafe { o.contents.err };
2217                         unsafe { o.contents.err = core::ptr::null_mut(); }
2218                         CResult_NoneErrorZPtr { err }
2219                 };
2220                 Self {
2221                         contents,
2222                         result_ok: o.result_ok,
2223                 }
2224         }
2225 }
2226 impl Clone for CResult_NoneErrorZ {
2227         fn clone(&self) -> Self {
2228                 if self.result_ok {
2229                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2230                                 result: core::ptr::null_mut()
2231                         } }
2232                 } else {
2233                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2234                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2235                         } }
2236                 }
2237         }
2238 }
2239 #[no_mangle]
2240 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2241 /// but with all dynamically-allocated buffers duplicated in new buffers.
2242 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2243 #[repr(C)]
2244 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2245 /// This corresponds to std::vector in C++
2246 pub struct CVec_ChannelDetailsZ {
2247         /// The elements in the array.
2248         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2249         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2250         /// The number of elements pointed to by `data`.
2251         pub datalen: usize
2252 }
2253 impl CVec_ChannelDetailsZ {
2254         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2255                 if self.datalen == 0 { return Vec::new(); }
2256                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2257                 self.data = core::ptr::null_mut();
2258                 self.datalen = 0;
2259                 ret
2260         }
2261         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2262                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2263         }
2264 }
2265 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2266         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2267                 let datalen = v.len();
2268                 let data = Box::into_raw(v.into_boxed_slice());
2269                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2270         }
2271 }
2272 #[no_mangle]
2273 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2274 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2275 impl Drop for CVec_ChannelDetailsZ {
2276         fn drop(&mut self) {
2277                 if self.datalen == 0 { return; }
2278                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2279         }
2280 }
2281 impl Clone for CVec_ChannelDetailsZ {
2282         fn clone(&self) -> Self {
2283                 let mut res = Vec::new();
2284                 if self.datalen == 0 { return Self::from(res); }
2285                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2286                 Self::from(res)
2287         }
2288 }
2289 #[repr(C)]
2290 /// The contents of CResult_RouteLightningErrorZ
2291 pub union CResult_RouteLightningErrorZPtr {
2292         /// A pointer to the contents in the success state.
2293         /// Reading from this pointer when `result_ok` is not set is undefined.
2294         pub result: *mut crate::lightning::routing::router::Route,
2295         /// A pointer to the contents in the error state.
2296         /// Reading from this pointer when `result_ok` is set is undefined.
2297         pub err: *mut crate::lightning::ln::msgs::LightningError,
2298 }
2299 #[repr(C)]
2300 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2301 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2303 pub struct CResult_RouteLightningErrorZ {
2304         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2305         /// `err` or `result` depending on the state of `result_ok`.
2306         pub contents: CResult_RouteLightningErrorZPtr,
2307         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2308         pub result_ok: bool,
2309 }
2310 #[no_mangle]
2311 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2312 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2313         CResult_RouteLightningErrorZ {
2314                 contents: CResult_RouteLightningErrorZPtr {
2315                         result: Box::into_raw(Box::new(o)),
2316                 },
2317                 result_ok: true,
2318         }
2319 }
2320 #[no_mangle]
2321 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2322 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2323         CResult_RouteLightningErrorZ {
2324                 contents: CResult_RouteLightningErrorZPtr {
2325                         err: Box::into_raw(Box::new(e)),
2326                 },
2327                 result_ok: false,
2328         }
2329 }
2330 /// Checks if the given object is currently in the success state
2331 #[no_mangle]
2332 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2333         o.result_ok
2334 }
2335 #[no_mangle]
2336 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2337 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2338 impl Drop for CResult_RouteLightningErrorZ {
2339         fn drop(&mut self) {
2340                 if self.result_ok {
2341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2343                         }
2344                 } else {
2345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2347                         }
2348                 }
2349         }
2350 }
2351 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2353                 let contents = if o.result_ok {
2354                         let result = unsafe { o.contents.result };
2355                         unsafe { o.contents.result = core::ptr::null_mut() };
2356                         CResult_RouteLightningErrorZPtr { result }
2357                 } else {
2358                         let err = unsafe { o.contents.err };
2359                         unsafe { o.contents.err = core::ptr::null_mut(); }
2360                         CResult_RouteLightningErrorZPtr { err }
2361                 };
2362                 Self {
2363                         contents,
2364                         result_ok: o.result_ok,
2365                 }
2366         }
2367 }
2368 impl Clone for CResult_RouteLightningErrorZ {
2369         fn clone(&self) -> Self {
2370                 if self.result_ok {
2371                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2372                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2373                         } }
2374                 } else {
2375                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2377                         } }
2378                 }
2379         }
2380 }
2381 #[no_mangle]
2382 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2383 /// but with all dynamically-allocated buffers duplicated in new buffers.
2384 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2385 #[repr(C)]
2386 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2387 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2388         /// A pointer to the contents in the success state.
2389         /// Reading from this pointer when `result_ok` is not set is undefined.
2390         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2391         /// A pointer to the contents in the error state.
2392         /// Reading from this pointer when `result_ok` is set is undefined.
2393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2394 }
2395 #[repr(C)]
2396 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2397 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2399 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2400         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2401         /// `err` or `result` depending on the state of `result_ok`.
2402         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2403         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2404         pub result_ok: bool,
2405 }
2406 #[no_mangle]
2407 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2408 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2409         CResult_InFlightHtlcsDecodeErrorZ {
2410                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2411                         result: Box::into_raw(Box::new(o)),
2412                 },
2413                 result_ok: true,
2414         }
2415 }
2416 #[no_mangle]
2417 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2418 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2419         CResult_InFlightHtlcsDecodeErrorZ {
2420                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2421                         err: Box::into_raw(Box::new(e)),
2422                 },
2423                 result_ok: false,
2424         }
2425 }
2426 /// Checks if the given object is currently in the success state
2427 #[no_mangle]
2428 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2429         o.result_ok
2430 }
2431 #[no_mangle]
2432 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2433 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2434 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2435         fn drop(&mut self) {
2436                 if self.result_ok {
2437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2439                         }
2440                 } else {
2441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2443                         }
2444                 }
2445         }
2446 }
2447 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2449                 let contents = if o.result_ok {
2450                         let result = unsafe { o.contents.result };
2451                         unsafe { o.contents.result = core::ptr::null_mut() };
2452                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
2453                 } else {
2454                         let err = unsafe { o.contents.err };
2455                         unsafe { o.contents.err = core::ptr::null_mut(); }
2456                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
2457                 };
2458                 Self {
2459                         contents,
2460                         result_ok: o.result_ok,
2461                 }
2462         }
2463 }
2464 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2465         fn clone(&self) -> Self {
2466                 if self.result_ok {
2467                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2468                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2469                         } }
2470                 } else {
2471                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2473                         } }
2474                 }
2475         }
2476 }
2477 #[no_mangle]
2478 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2479 /// but with all dynamically-allocated buffers duplicated in new buffers.
2480 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2481 #[repr(C)]
2482 /// The contents of CResult_RouteHopDecodeErrorZ
2483 pub union CResult_RouteHopDecodeErrorZPtr {
2484         /// A pointer to the contents in the success state.
2485         /// Reading from this pointer when `result_ok` is not set is undefined.
2486         pub result: *mut crate::lightning::routing::router::RouteHop,
2487         /// A pointer to the contents in the error state.
2488         /// Reading from this pointer when `result_ok` is set is undefined.
2489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2490 }
2491 #[repr(C)]
2492 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2493 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2495 pub struct CResult_RouteHopDecodeErrorZ {
2496         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2497         /// `err` or `result` depending on the state of `result_ok`.
2498         pub contents: CResult_RouteHopDecodeErrorZPtr,
2499         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2500         pub result_ok: bool,
2501 }
2502 #[no_mangle]
2503 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2504 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2505         CResult_RouteHopDecodeErrorZ {
2506                 contents: CResult_RouteHopDecodeErrorZPtr {
2507                         result: Box::into_raw(Box::new(o)),
2508                 },
2509                 result_ok: true,
2510         }
2511 }
2512 #[no_mangle]
2513 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2514 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2515         CResult_RouteHopDecodeErrorZ {
2516                 contents: CResult_RouteHopDecodeErrorZPtr {
2517                         err: Box::into_raw(Box::new(e)),
2518                 },
2519                 result_ok: false,
2520         }
2521 }
2522 /// Checks if the given object is currently in the success state
2523 #[no_mangle]
2524 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2525         o.result_ok
2526 }
2527 #[no_mangle]
2528 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2529 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2530 impl Drop for CResult_RouteHopDecodeErrorZ {
2531         fn drop(&mut self) {
2532                 if self.result_ok {
2533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2535                         }
2536                 } else {
2537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2539                         }
2540                 }
2541         }
2542 }
2543 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2545                 let contents = if o.result_ok {
2546                         let result = unsafe { o.contents.result };
2547                         unsafe { o.contents.result = core::ptr::null_mut() };
2548                         CResult_RouteHopDecodeErrorZPtr { result }
2549                 } else {
2550                         let err = unsafe { o.contents.err };
2551                         unsafe { o.contents.err = core::ptr::null_mut(); }
2552                         CResult_RouteHopDecodeErrorZPtr { err }
2553                 };
2554                 Self {
2555                         contents,
2556                         result_ok: o.result_ok,
2557                 }
2558         }
2559 }
2560 impl Clone for CResult_RouteHopDecodeErrorZ {
2561         fn clone(&self) -> Self {
2562                 if self.result_ok {
2563                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2564                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2565                         } }
2566                 } else {
2567                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2569                         } }
2570                 }
2571         }
2572 }
2573 #[no_mangle]
2574 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2575 /// but with all dynamically-allocated buffers duplicated in new buffers.
2576 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2577 #[repr(C)]
2578 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
2579 /// This corresponds to std::vector in C++
2580 pub struct CVec_BlindedHopZ {
2581         /// The elements in the array.
2582         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2583         pub data: *mut crate::lightning::blinded_path::BlindedHop,
2584         /// The number of elements pointed to by `data`.
2585         pub datalen: usize
2586 }
2587 impl CVec_BlindedHopZ {
2588         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
2589                 if self.datalen == 0 { return Vec::new(); }
2590                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2591                 self.data = core::ptr::null_mut();
2592                 self.datalen = 0;
2593                 ret
2594         }
2595         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
2596                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2597         }
2598 }
2599 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
2600         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
2601                 let datalen = v.len();
2602                 let data = Box::into_raw(v.into_boxed_slice());
2603                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2604         }
2605 }
2606 #[no_mangle]
2607 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2608 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
2609 impl Drop for CVec_BlindedHopZ {
2610         fn drop(&mut self) {
2611                 if self.datalen == 0 { return; }
2612                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2613         }
2614 }
2615 impl Clone for CVec_BlindedHopZ {
2616         fn clone(&self) -> Self {
2617                 let mut res = Vec::new();
2618                 if self.datalen == 0 { return Self::from(res); }
2619                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2620                 Self::from(res)
2621         }
2622 }
2623 #[repr(C)]
2624 /// The contents of CResult_BlindedTailDecodeErrorZ
2625 pub union CResult_BlindedTailDecodeErrorZPtr {
2626         /// A pointer to the contents in the success state.
2627         /// Reading from this pointer when `result_ok` is not set is undefined.
2628         pub result: *mut crate::lightning::routing::router::BlindedTail,
2629         /// A pointer to the contents in the error state.
2630         /// Reading from this pointer when `result_ok` is set is undefined.
2631         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2632 }
2633 #[repr(C)]
2634 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
2635 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
2636 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2637 pub struct CResult_BlindedTailDecodeErrorZ {
2638         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
2639         /// `err` or `result` depending on the state of `result_ok`.
2640         pub contents: CResult_BlindedTailDecodeErrorZPtr,
2641         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
2642         pub result_ok: bool,
2643 }
2644 #[no_mangle]
2645 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
2646 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
2647         CResult_BlindedTailDecodeErrorZ {
2648                 contents: CResult_BlindedTailDecodeErrorZPtr {
2649                         result: Box::into_raw(Box::new(o)),
2650                 },
2651                 result_ok: true,
2652         }
2653 }
2654 #[no_mangle]
2655 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
2656 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
2657         CResult_BlindedTailDecodeErrorZ {
2658                 contents: CResult_BlindedTailDecodeErrorZPtr {
2659                         err: Box::into_raw(Box::new(e)),
2660                 },
2661                 result_ok: false,
2662         }
2663 }
2664 /// Checks if the given object is currently in the success state
2665 #[no_mangle]
2666 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
2667         o.result_ok
2668 }
2669 #[no_mangle]
2670 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
2671 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
2672 impl Drop for CResult_BlindedTailDecodeErrorZ {
2673         fn drop(&mut self) {
2674                 if self.result_ok {
2675                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2676                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2677                         }
2678                 } else {
2679                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2680                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2681                         }
2682                 }
2683         }
2684 }
2685 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
2686         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
2687                 let contents = if o.result_ok {
2688                         let result = unsafe { o.contents.result };
2689                         unsafe { o.contents.result = core::ptr::null_mut() };
2690                         CResult_BlindedTailDecodeErrorZPtr { result }
2691                 } else {
2692                         let err = unsafe { o.contents.err };
2693                         unsafe { o.contents.err = core::ptr::null_mut(); }
2694                         CResult_BlindedTailDecodeErrorZPtr { err }
2695                 };
2696                 Self {
2697                         contents,
2698                         result_ok: o.result_ok,
2699                 }
2700         }
2701 }
2702 impl Clone for CResult_BlindedTailDecodeErrorZ {
2703         fn clone(&self) -> Self {
2704                 if self.result_ok {
2705                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
2706                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
2707                         } }
2708                 } else {
2709                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
2710                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2711                         } }
2712                 }
2713         }
2714 }
2715 #[no_mangle]
2716 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
2717 /// but with all dynamically-allocated buffers duplicated in new buffers.
2718 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
2719 #[repr(C)]
2720 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2721 /// This corresponds to std::vector in C++
2722 pub struct CVec_RouteHopZ {
2723         /// The elements in the array.
2724         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2725         pub data: *mut crate::lightning::routing::router::RouteHop,
2726         /// The number of elements pointed to by `data`.
2727         pub datalen: usize
2728 }
2729 impl CVec_RouteHopZ {
2730         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2731                 if self.datalen == 0 { return Vec::new(); }
2732                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2733                 self.data = core::ptr::null_mut();
2734                 self.datalen = 0;
2735                 ret
2736         }
2737         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2738                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2739         }
2740 }
2741 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2742         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2743                 let datalen = v.len();
2744                 let data = Box::into_raw(v.into_boxed_slice());
2745                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2746         }
2747 }
2748 #[no_mangle]
2749 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2750 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2751 impl Drop for CVec_RouteHopZ {
2752         fn drop(&mut self) {
2753                 if self.datalen == 0 { return; }
2754                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2755         }
2756 }
2757 impl Clone for CVec_RouteHopZ {
2758         fn clone(&self) -> Self {
2759                 let mut res = Vec::new();
2760                 if self.datalen == 0 { return Self::from(res); }
2761                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2762                 Self::from(res)
2763         }
2764 }
2765 #[repr(C)]
2766 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
2767 /// This corresponds to std::vector in C++
2768 pub struct CVec_PathZ {
2769         /// The elements in the array.
2770         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2771         pub data: *mut crate::lightning::routing::router::Path,
2772         /// The number of elements pointed to by `data`.
2773         pub datalen: usize
2774 }
2775 impl CVec_PathZ {
2776         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
2777                 if self.datalen == 0 { return Vec::new(); }
2778                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2779                 self.data = core::ptr::null_mut();
2780                 self.datalen = 0;
2781                 ret
2782         }
2783         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
2784                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2785         }
2786 }
2787 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
2788         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
2789                 let datalen = v.len();
2790                 let data = Box::into_raw(v.into_boxed_slice());
2791                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2792         }
2793 }
2794 #[no_mangle]
2795 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2796 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
2797 impl Drop for CVec_PathZ {
2798         fn drop(&mut self) {
2799                 if self.datalen == 0 { return; }
2800                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2801         }
2802 }
2803 impl Clone for CVec_PathZ {
2804         fn clone(&self) -> Self {
2805                 let mut res = Vec::new();
2806                 if self.datalen == 0 { return Self::from(res); }
2807                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2808                 Self::from(res)
2809         }
2810 }
2811 #[repr(C)]
2812 /// The contents of CResult_RouteDecodeErrorZ
2813 pub union CResult_RouteDecodeErrorZPtr {
2814         /// A pointer to the contents in the success state.
2815         /// Reading from this pointer when `result_ok` is not set is undefined.
2816         pub result: *mut crate::lightning::routing::router::Route,
2817         /// A pointer to the contents in the error state.
2818         /// Reading from this pointer when `result_ok` is set is undefined.
2819         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2820 }
2821 #[repr(C)]
2822 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2823 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2825 pub struct CResult_RouteDecodeErrorZ {
2826         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2827         /// `err` or `result` depending on the state of `result_ok`.
2828         pub contents: CResult_RouteDecodeErrorZPtr,
2829         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2830         pub result_ok: bool,
2831 }
2832 #[no_mangle]
2833 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2834 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2835         CResult_RouteDecodeErrorZ {
2836                 contents: CResult_RouteDecodeErrorZPtr {
2837                         result: Box::into_raw(Box::new(o)),
2838                 },
2839                 result_ok: true,
2840         }
2841 }
2842 #[no_mangle]
2843 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2844 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2845         CResult_RouteDecodeErrorZ {
2846                 contents: CResult_RouteDecodeErrorZPtr {
2847                         err: Box::into_raw(Box::new(e)),
2848                 },
2849                 result_ok: false,
2850         }
2851 }
2852 /// Checks if the given object is currently in the success state
2853 #[no_mangle]
2854 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2855         o.result_ok
2856 }
2857 #[no_mangle]
2858 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2859 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2860 impl Drop for CResult_RouteDecodeErrorZ {
2861         fn drop(&mut self) {
2862                 if self.result_ok {
2863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2865                         }
2866                 } else {
2867                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2868                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2869                         }
2870                 }
2871         }
2872 }
2873 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2874         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2875                 let contents = if o.result_ok {
2876                         let result = unsafe { o.contents.result };
2877                         unsafe { o.contents.result = core::ptr::null_mut() };
2878                         CResult_RouteDecodeErrorZPtr { result }
2879                 } else {
2880                         let err = unsafe { o.contents.err };
2881                         unsafe { o.contents.err = core::ptr::null_mut(); }
2882                         CResult_RouteDecodeErrorZPtr { err }
2883                 };
2884                 Self {
2885                         contents,
2886                         result_ok: o.result_ok,
2887                 }
2888         }
2889 }
2890 impl Clone for CResult_RouteDecodeErrorZ {
2891         fn clone(&self) -> Self {
2892                 if self.result_ok {
2893                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2894                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2895                         } }
2896                 } else {
2897                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2898                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2899                         } }
2900                 }
2901         }
2902 }
2903 #[no_mangle]
2904 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2905 /// but with all dynamically-allocated buffers duplicated in new buffers.
2906 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2907 #[repr(C)]
2908 /// The contents of CResult_RouteParametersDecodeErrorZ
2909 pub union CResult_RouteParametersDecodeErrorZPtr {
2910         /// A pointer to the contents in the success state.
2911         /// Reading from this pointer when `result_ok` is not set is undefined.
2912         pub result: *mut crate::lightning::routing::router::RouteParameters,
2913         /// A pointer to the contents in the error state.
2914         /// Reading from this pointer when `result_ok` is set is undefined.
2915         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2916 }
2917 #[repr(C)]
2918 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2919 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2920 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2921 pub struct CResult_RouteParametersDecodeErrorZ {
2922         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2923         /// `err` or `result` depending on the state of `result_ok`.
2924         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2925         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2926         pub result_ok: bool,
2927 }
2928 #[no_mangle]
2929 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2930 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2931         CResult_RouteParametersDecodeErrorZ {
2932                 contents: CResult_RouteParametersDecodeErrorZPtr {
2933                         result: Box::into_raw(Box::new(o)),
2934                 },
2935                 result_ok: true,
2936         }
2937 }
2938 #[no_mangle]
2939 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2940 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2941         CResult_RouteParametersDecodeErrorZ {
2942                 contents: CResult_RouteParametersDecodeErrorZPtr {
2943                         err: Box::into_raw(Box::new(e)),
2944                 },
2945                 result_ok: false,
2946         }
2947 }
2948 /// Checks if the given object is currently in the success state
2949 #[no_mangle]
2950 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2951         o.result_ok
2952 }
2953 #[no_mangle]
2954 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2955 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2956 impl Drop for CResult_RouteParametersDecodeErrorZ {
2957         fn drop(&mut self) {
2958                 if self.result_ok {
2959                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2960                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2961                         }
2962                 } else {
2963                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2964                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2965                         }
2966                 }
2967         }
2968 }
2969 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2970         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2971                 let contents = if o.result_ok {
2972                         let result = unsafe { o.contents.result };
2973                         unsafe { o.contents.result = core::ptr::null_mut() };
2974                         CResult_RouteParametersDecodeErrorZPtr { result }
2975                 } else {
2976                         let err = unsafe { o.contents.err };
2977                         unsafe { o.contents.err = core::ptr::null_mut(); }
2978                         CResult_RouteParametersDecodeErrorZPtr { err }
2979                 };
2980                 Self {
2981                         contents,
2982                         result_ok: o.result_ok,
2983                 }
2984         }
2985 }
2986 impl Clone for CResult_RouteParametersDecodeErrorZ {
2987         fn clone(&self) -> Self {
2988                 if self.result_ok {
2989                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2990                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2991                         } }
2992                 } else {
2993                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2994                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2995                         } }
2996                 }
2997         }
2998 }
2999 #[no_mangle]
3000 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
3001 /// but with all dynamically-allocated buffers duplicated in new buffers.
3002 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
3003 #[repr(C)]
3004 /// A dynamically-allocated array of u64s of arbitrary size.
3005 /// This corresponds to std::vector in C++
3006 pub struct CVec_u64Z {
3007         /// The elements in the array.
3008         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3009         pub data: *mut u64,
3010         /// The number of elements pointed to by `data`.
3011         pub datalen: usize
3012 }
3013 impl CVec_u64Z {
3014         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
3015                 if self.datalen == 0 { return Vec::new(); }
3016                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3017                 self.data = core::ptr::null_mut();
3018                 self.datalen = 0;
3019                 ret
3020         }
3021         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
3022                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3023         }
3024 }
3025 impl From<Vec<u64>> for CVec_u64Z {
3026         fn from(v: Vec<u64>) -> Self {
3027                 let datalen = v.len();
3028                 let data = Box::into_raw(v.into_boxed_slice());
3029                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3030         }
3031 }
3032 #[no_mangle]
3033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3034 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
3035 impl Drop for CVec_u64Z {
3036         fn drop(&mut self) {
3037                 if self.datalen == 0 { return; }
3038                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3039         }
3040 }
3041 impl Clone for CVec_u64Z {
3042         fn clone(&self) -> Self {
3043                 let mut res = Vec::new();
3044                 if self.datalen == 0 { return Self::from(res); }
3045                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3046                 Self::from(res)
3047         }
3048 }
3049 #[repr(C)]
3050 /// The contents of CResult_PaymentParametersDecodeErrorZ
3051 pub union CResult_PaymentParametersDecodeErrorZPtr {
3052         /// A pointer to the contents in the success state.
3053         /// Reading from this pointer when `result_ok` is not set is undefined.
3054         pub result: *mut crate::lightning::routing::router::PaymentParameters,
3055         /// A pointer to the contents in the error state.
3056         /// Reading from this pointer when `result_ok` is set is undefined.
3057         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3058 }
3059 #[repr(C)]
3060 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
3061 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3063 pub struct CResult_PaymentParametersDecodeErrorZ {
3064         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
3065         /// `err` or `result` depending on the state of `result_ok`.
3066         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
3067         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
3068         pub result_ok: bool,
3069 }
3070 #[no_mangle]
3071 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
3072 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
3073         CResult_PaymentParametersDecodeErrorZ {
3074                 contents: CResult_PaymentParametersDecodeErrorZPtr {
3075                         result: Box::into_raw(Box::new(o)),
3076                 },
3077                 result_ok: true,
3078         }
3079 }
3080 #[no_mangle]
3081 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
3082 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
3083         CResult_PaymentParametersDecodeErrorZ {
3084                 contents: CResult_PaymentParametersDecodeErrorZPtr {
3085                         err: Box::into_raw(Box::new(e)),
3086                 },
3087                 result_ok: false,
3088         }
3089 }
3090 /// Checks if the given object is currently in the success state
3091 #[no_mangle]
3092 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
3093         o.result_ok
3094 }
3095 #[no_mangle]
3096 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
3097 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
3098 impl Drop for CResult_PaymentParametersDecodeErrorZ {
3099         fn drop(&mut self) {
3100                 if self.result_ok {
3101                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3102                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3103                         }
3104                 } else {
3105                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3106                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3107                         }
3108                 }
3109         }
3110 }
3111 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
3112         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3113                 let contents = if o.result_ok {
3114                         let result = unsafe { o.contents.result };
3115                         unsafe { o.contents.result = core::ptr::null_mut() };
3116                         CResult_PaymentParametersDecodeErrorZPtr { result }
3117                 } else {
3118                         let err = unsafe { o.contents.err };
3119                         unsafe { o.contents.err = core::ptr::null_mut(); }
3120                         CResult_PaymentParametersDecodeErrorZPtr { err }
3121                 };
3122                 Self {
3123                         contents,
3124                         result_ok: o.result_ok,
3125                 }
3126         }
3127 }
3128 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3129         fn clone(&self) -> Self {
3130                 if self.result_ok {
3131                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3132                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3133                         } }
3134                 } else {
3135                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3136                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3137                         } }
3138                 }
3139         }
3140 }
3141 #[no_mangle]
3142 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3143 /// but with all dynamically-allocated buffers duplicated in new buffers.
3144 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3145 #[repr(C)]
3146 /// A tuple of 2 elements. See the individual fields for the types contained.
3147 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3148         /// The element at position 0
3149         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3150         /// The element at position 1
3151         pub b: crate::lightning::blinded_path::BlindedPath,
3152 }
3153 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3154         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3155                 Self {
3156                         a: tup.0,
3157                         b: tup.1,
3158                 }
3159         }
3160 }
3161 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3162         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3163                 (self.a, self.b)
3164         }
3165 }
3166 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3167         fn clone(&self) -> Self {
3168                 Self {
3169                         a: Clone::clone(&self.a),
3170                         b: Clone::clone(&self.b),
3171                 }
3172         }
3173 }
3174 #[no_mangle]
3175 /// Creates a new tuple which has the same data as `orig`
3176 /// but with all dynamically-allocated buffers duplicated in new buffers.
3177 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3178 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3179 #[no_mangle]
3180 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3181         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3182 }
3183
3184 #[no_mangle]
3185 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3186 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3187 #[repr(C)]
3188 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
3189 /// This corresponds to std::vector in C++
3190 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3191         /// The elements in the array.
3192         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3193         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
3194         /// The number of elements pointed to by `data`.
3195         pub datalen: usize
3196 }
3197 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3198         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
3199                 if self.datalen == 0 { return Vec::new(); }
3200                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3201                 self.data = core::ptr::null_mut();
3202                 self.datalen = 0;
3203                 ret
3204         }
3205         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
3206                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3207         }
3208 }
3209 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3210         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
3211                 let datalen = v.len();
3212                 let data = Box::into_raw(v.into_boxed_slice());
3213                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3214         }
3215 }
3216 #[no_mangle]
3217 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3218 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
3219 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3220         fn drop(&mut self) {
3221                 if self.datalen == 0 { return; }
3222                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3223         }
3224 }
3225 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
3226         fn clone(&self) -> Self {
3227                 let mut res = Vec::new();
3228                 if self.datalen == 0 { return Self::from(res); }
3229                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3230                 Self::from(res)
3231         }
3232 }
3233 #[repr(C)]
3234 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
3235 /// This corresponds to std::vector in C++
3236 pub struct CVec_RouteHintZ {
3237         /// The elements in the array.
3238         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3239         pub data: *mut crate::lightning::routing::router::RouteHint,
3240         /// The number of elements pointed to by `data`.
3241         pub datalen: usize
3242 }
3243 impl CVec_RouteHintZ {
3244         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
3245                 if self.datalen == 0 { return Vec::new(); }
3246                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3247                 self.data = core::ptr::null_mut();
3248                 self.datalen = 0;
3249                 ret
3250         }
3251         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
3252                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3253         }
3254 }
3255 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
3256         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
3257                 let datalen = v.len();
3258                 let data = Box::into_raw(v.into_boxed_slice());
3259                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3260         }
3261 }
3262 #[no_mangle]
3263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3264 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3265 impl Drop for CVec_RouteHintZ {
3266         fn drop(&mut self) {
3267                 if self.datalen == 0 { return; }
3268                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3269         }
3270 }
3271 impl Clone for CVec_RouteHintZ {
3272         fn clone(&self) -> Self {
3273                 let mut res = Vec::new();
3274                 if self.datalen == 0 { return Self::from(res); }
3275                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3276                 Self::from(res)
3277         }
3278 }
3279 #[repr(C)]
3280 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3281 /// This corresponds to std::vector in C++
3282 pub struct CVec_RouteHintHopZ {
3283         /// The elements in the array.
3284         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3285         pub data: *mut crate::lightning::routing::router::RouteHintHop,
3286         /// The number of elements pointed to by `data`.
3287         pub datalen: usize
3288 }
3289 impl CVec_RouteHintHopZ {
3290         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3291                 if self.datalen == 0 { return Vec::new(); }
3292                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3293                 self.data = core::ptr::null_mut();
3294                 self.datalen = 0;
3295                 ret
3296         }
3297         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3298                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3299         }
3300 }
3301 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3302         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3303                 let datalen = v.len();
3304                 let data = Box::into_raw(v.into_boxed_slice());
3305                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3306         }
3307 }
3308 #[no_mangle]
3309 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3310 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3311 impl Drop for CVec_RouteHintHopZ {
3312         fn drop(&mut self) {
3313                 if self.datalen == 0 { return; }
3314                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3315         }
3316 }
3317 impl Clone for CVec_RouteHintHopZ {
3318         fn clone(&self) -> Self {
3319                 let mut res = Vec::new();
3320                 if self.datalen == 0 { return Self::from(res); }
3321                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3322                 Self::from(res)
3323         }
3324 }
3325 #[repr(C)]
3326 /// The contents of CResult_RouteHintDecodeErrorZ
3327 pub union CResult_RouteHintDecodeErrorZPtr {
3328         /// A pointer to the contents in the success state.
3329         /// Reading from this pointer when `result_ok` is not set is undefined.
3330         pub result: *mut crate::lightning::routing::router::RouteHint,
3331         /// A pointer to the contents in the error state.
3332         /// Reading from this pointer when `result_ok` is set is undefined.
3333         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3334 }
3335 #[repr(C)]
3336 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3337 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3339 pub struct CResult_RouteHintDecodeErrorZ {
3340         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3341         /// `err` or `result` depending on the state of `result_ok`.
3342         pub contents: CResult_RouteHintDecodeErrorZPtr,
3343         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3344         pub result_ok: bool,
3345 }
3346 #[no_mangle]
3347 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3348 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3349         CResult_RouteHintDecodeErrorZ {
3350                 contents: CResult_RouteHintDecodeErrorZPtr {
3351                         result: Box::into_raw(Box::new(o)),
3352                 },
3353                 result_ok: true,
3354         }
3355 }
3356 #[no_mangle]
3357 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3358 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3359         CResult_RouteHintDecodeErrorZ {
3360                 contents: CResult_RouteHintDecodeErrorZPtr {
3361                         err: Box::into_raw(Box::new(e)),
3362                 },
3363                 result_ok: false,
3364         }
3365 }
3366 /// Checks if the given object is currently in the success state
3367 #[no_mangle]
3368 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
3369         o.result_ok
3370 }
3371 #[no_mangle]
3372 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
3373 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
3374 impl Drop for CResult_RouteHintDecodeErrorZ {
3375         fn drop(&mut self) {
3376                 if self.result_ok {
3377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3379                         }
3380                 } else {
3381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3383                         }
3384                 }
3385         }
3386 }
3387 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
3388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
3389                 let contents = if o.result_ok {
3390                         let result = unsafe { o.contents.result };
3391                         unsafe { o.contents.result = core::ptr::null_mut() };
3392                         CResult_RouteHintDecodeErrorZPtr { result }
3393                 } else {
3394                         let err = unsafe { o.contents.err };
3395                         unsafe { o.contents.err = core::ptr::null_mut(); }
3396                         CResult_RouteHintDecodeErrorZPtr { err }
3397                 };
3398                 Self {
3399                         contents,
3400                         result_ok: o.result_ok,
3401                 }
3402         }
3403 }
3404 impl Clone for CResult_RouteHintDecodeErrorZ {
3405         fn clone(&self) -> Self {
3406                 if self.result_ok {
3407                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
3408                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
3409                         } }
3410                 } else {
3411                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
3412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3413                         } }
3414                 }
3415         }
3416 }
3417 #[no_mangle]
3418 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
3419 /// but with all dynamically-allocated buffers duplicated in new buffers.
3420 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
3421 #[repr(C)]
3422 /// The contents of CResult_RouteHintHopDecodeErrorZ
3423 pub union CResult_RouteHintHopDecodeErrorZPtr {
3424         /// A pointer to the contents in the success state.
3425         /// Reading from this pointer when `result_ok` is not set is undefined.
3426         pub result: *mut crate::lightning::routing::router::RouteHintHop,
3427         /// A pointer to the contents in the error state.
3428         /// Reading from this pointer when `result_ok` is set is undefined.
3429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3430 }
3431 #[repr(C)]
3432 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3433 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3435 pub struct CResult_RouteHintHopDecodeErrorZ {
3436         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3437         /// `err` or `result` depending on the state of `result_ok`.
3438         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
3439         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3440         pub result_ok: bool,
3441 }
3442 #[no_mangle]
3443 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3444 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3445         CResult_RouteHintHopDecodeErrorZ {
3446                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3447                         result: Box::into_raw(Box::new(o)),
3448                 },
3449                 result_ok: true,
3450         }
3451 }
3452 #[no_mangle]
3453 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3454 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3455         CResult_RouteHintHopDecodeErrorZ {
3456                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3457                         err: Box::into_raw(Box::new(e)),
3458                 },
3459                 result_ok: false,
3460         }
3461 }
3462 /// Checks if the given object is currently in the success state
3463 #[no_mangle]
3464 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3465         o.result_ok
3466 }
3467 #[no_mangle]
3468 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3469 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3470 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3471         fn drop(&mut self) {
3472                 if self.result_ok {
3473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3475                         }
3476                 } else {
3477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3479                         }
3480                 }
3481         }
3482 }
3483 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3485                 let contents = if o.result_ok {
3486                         let result = unsafe { o.contents.result };
3487                         unsafe { o.contents.result = core::ptr::null_mut() };
3488                         CResult_RouteHintHopDecodeErrorZPtr { result }
3489                 } else {
3490                         let err = unsafe { o.contents.err };
3491                         unsafe { o.contents.err = core::ptr::null_mut(); }
3492                         CResult_RouteHintHopDecodeErrorZPtr { err }
3493                 };
3494                 Self {
3495                         contents,
3496                         result_ok: o.result_ok,
3497                 }
3498         }
3499 }
3500 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3501         fn clone(&self) -> Self {
3502                 if self.result_ok {
3503                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3504                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3505                         } }
3506                 } else {
3507                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3509                         } }
3510                 }
3511         }
3512 }
3513 #[no_mangle]
3514 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3515 /// but with all dynamically-allocated buffers duplicated in new buffers.
3516 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3517 #[repr(C)]
3518 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3519 /// This corresponds to std::vector in C++
3520 pub struct CVec_PublicKeyZ {
3521         /// The elements in the array.
3522         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3523         pub data: *mut crate::c_types::PublicKey,
3524         /// The number of elements pointed to by `data`.
3525         pub datalen: usize
3526 }
3527 impl CVec_PublicKeyZ {
3528         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3529                 if self.datalen == 0 { return Vec::new(); }
3530                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3531                 self.data = core::ptr::null_mut();
3532                 self.datalen = 0;
3533                 ret
3534         }
3535         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3536                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3537         }
3538 }
3539 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3540         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3541                 let datalen = v.len();
3542                 let data = Box::into_raw(v.into_boxed_slice());
3543                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3544         }
3545 }
3546 #[no_mangle]
3547 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3548 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3549 impl Drop for CVec_PublicKeyZ {
3550         fn drop(&mut self) {
3551                 if self.datalen == 0 { return; }
3552                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3553         }
3554 }
3555 impl Clone for CVec_PublicKeyZ {
3556         fn clone(&self) -> Self {
3557                 let mut res = Vec::new();
3558                 if self.datalen == 0 { return Self::from(res); }
3559                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3560                 Self::from(res)
3561         }
3562 }
3563 #[repr(C)]
3564 /// A tuple of 2 elements. See the individual fields for the types contained.
3565 pub struct C2Tuple_usizeTransactionZ {
3566         /// The element at position 0
3567         pub a: usize,
3568         /// The element at position 1
3569         pub b: crate::c_types::Transaction,
3570 }
3571 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3572         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3573                 Self {
3574                         a: tup.0,
3575                         b: tup.1,
3576                 }
3577         }
3578 }
3579 impl C2Tuple_usizeTransactionZ {
3580         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3581                 (self.a, self.b)
3582         }
3583 }
3584 impl Clone for C2Tuple_usizeTransactionZ {
3585         fn clone(&self) -> Self {
3586                 Self {
3587                         a: Clone::clone(&self.a),
3588                         b: Clone::clone(&self.b),
3589                 }
3590         }
3591 }
3592 #[no_mangle]
3593 /// Creates a new tuple which has the same data as `orig`
3594 /// but with all dynamically-allocated buffers duplicated in new buffers.
3595 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3596 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3597 #[no_mangle]
3598 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3599         C2Tuple_usizeTransactionZ { a, b, }
3600 }
3601
3602 #[no_mangle]
3603 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3604 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3605 #[repr(C)]
3606 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3607 /// This corresponds to std::vector in C++
3608 pub struct CVec_C2Tuple_usizeTransactionZZ {
3609         /// The elements in the array.
3610         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3611         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3612         /// The number of elements pointed to by `data`.
3613         pub datalen: usize
3614 }
3615 impl CVec_C2Tuple_usizeTransactionZZ {
3616         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3617                 if self.datalen == 0 { return Vec::new(); }
3618                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3619                 self.data = core::ptr::null_mut();
3620                 self.datalen = 0;
3621                 ret
3622         }
3623         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3624                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3625         }
3626 }
3627 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3628         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3629                 let datalen = v.len();
3630                 let data = Box::into_raw(v.into_boxed_slice());
3631                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3632         }
3633 }
3634 #[no_mangle]
3635 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3636 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3637 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3638         fn drop(&mut self) {
3639                 if self.datalen == 0 { return; }
3640                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3641         }
3642 }
3643 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3644         fn clone(&self) -> Self {
3645                 let mut res = Vec::new();
3646                 if self.datalen == 0 { return Self::from(res); }
3647                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3648                 Self::from(res)
3649         }
3650 }
3651 #[repr(C)]
3652 /// A tuple of 2 elements. See the individual fields for the types contained.
3653 pub struct C2Tuple_TxidBlockHashZ {
3654         /// The element at position 0
3655         pub a: crate::c_types::ThirtyTwoBytes,
3656         /// The element at position 1
3657         pub b: crate::c_types::ThirtyTwoBytes,
3658 }
3659 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
3660         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
3661                 Self {
3662                         a: tup.0,
3663                         b: tup.1,
3664                 }
3665         }
3666 }
3667 impl C2Tuple_TxidBlockHashZ {
3668         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
3669                 (self.a, self.b)
3670         }
3671 }
3672 impl Clone for C2Tuple_TxidBlockHashZ {
3673         fn clone(&self) -> Self {
3674                 Self {
3675                         a: Clone::clone(&self.a),
3676                         b: Clone::clone(&self.b),
3677                 }
3678         }
3679 }
3680 #[no_mangle]
3681 /// Creates a new tuple which has the same data as `orig`
3682 /// but with all dynamically-allocated buffers duplicated in new buffers.
3683 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
3684 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
3685 #[no_mangle]
3686 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
3687         C2Tuple_TxidBlockHashZ { a, b, }
3688 }
3689
3690 #[no_mangle]
3691 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
3692 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
3693 #[repr(C)]
3694 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
3695 /// This corresponds to std::vector in C++
3696 pub struct CVec_C2Tuple_TxidBlockHashZZ {
3697         /// The elements in the array.
3698         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3699         pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
3700         /// The number of elements pointed to by `data`.
3701         pub datalen: usize
3702 }
3703 impl CVec_C2Tuple_TxidBlockHashZZ {
3704         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
3705                 if self.datalen == 0 { return Vec::new(); }
3706                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3707                 self.data = core::ptr::null_mut();
3708                 self.datalen = 0;
3709                 ret
3710         }
3711         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
3712                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3713         }
3714 }
3715 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
3716         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
3717                 let datalen = v.len();
3718                 let data = Box::into_raw(v.into_boxed_slice());
3719                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3720         }
3721 }
3722 #[no_mangle]
3723 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3724 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
3725 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
3726         fn drop(&mut self) {
3727                 if self.datalen == 0 { return; }
3728                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3729         }
3730 }
3731 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
3732         fn clone(&self) -> Self {
3733                 let mut res = Vec::new();
3734                 if self.datalen == 0 { return Self::from(res); }
3735                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3736                 Self::from(res)
3737         }
3738 }
3739 #[repr(C)]
3740 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3741 /// This corresponds to std::vector in C++
3742 pub struct CVec_MonitorEventZ {
3743         /// The elements in the array.
3744         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3745         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3746         /// The number of elements pointed to by `data`.
3747         pub datalen: usize
3748 }
3749 impl CVec_MonitorEventZ {
3750         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3751                 if self.datalen == 0 { return Vec::new(); }
3752                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3753                 self.data = core::ptr::null_mut();
3754                 self.datalen = 0;
3755                 ret
3756         }
3757         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3758                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3759         }
3760 }
3761 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3762         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3763                 let datalen = v.len();
3764                 let data = Box::into_raw(v.into_boxed_slice());
3765                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3766         }
3767 }
3768 #[no_mangle]
3769 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3770 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3771 impl Drop for CVec_MonitorEventZ {
3772         fn drop(&mut self) {
3773                 if self.datalen == 0 { return; }
3774                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3775         }
3776 }
3777 impl Clone for CVec_MonitorEventZ {
3778         fn clone(&self) -> Self {
3779                 let mut res = Vec::new();
3780                 if self.datalen == 0 { return Self::from(res); }
3781                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3782                 Self::from(res)
3783         }
3784 }
3785 #[repr(C)]
3786 /// A tuple of 3 elements. See the individual fields for the types contained.
3787 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3788         /// The element at position 0
3789         pub a: crate::lightning::chain::transaction::OutPoint,
3790         /// The element at position 1
3791         pub b: crate::c_types::derived::CVec_MonitorEventZ,
3792         /// The element at position 2
3793         pub c: crate::c_types::PublicKey,
3794 }
3795 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3796         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
3797                 Self {
3798                         a: tup.0,
3799                         b: tup.1,
3800                         c: tup.2,
3801                 }
3802         }
3803 }
3804 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3805         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
3806                 (self.a, self.b, self.c)
3807         }
3808 }
3809 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3810         fn clone(&self) -> Self {
3811                 Self {
3812                         a: Clone::clone(&self.a),
3813                         b: Clone::clone(&self.b),
3814                         c: Clone::clone(&self.c),
3815                 }
3816         }
3817 }
3818 #[no_mangle]
3819 /// Creates a new tuple which has the same data as `orig`
3820 /// but with all dynamically-allocated buffers duplicated in new buffers.
3821 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
3822 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
3823 #[no_mangle]
3824 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3825         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
3826 }
3827
3828 #[no_mangle]
3829 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
3830 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
3831 #[repr(C)]
3832 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
3833 /// This corresponds to std::vector in C++
3834 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3835         /// The elements in the array.
3836         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3837         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
3838         /// The number of elements pointed to by `data`.
3839         pub datalen: usize
3840 }
3841 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3842         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
3843                 if self.datalen == 0 { return Vec::new(); }
3844                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3845                 self.data = core::ptr::null_mut();
3846                 self.datalen = 0;
3847                 ret
3848         }
3849         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
3850                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3851         }
3852 }
3853 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3854         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
3855                 let datalen = v.len();
3856                 let data = Box::into_raw(v.into_boxed_slice());
3857                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3858         }
3859 }
3860 #[no_mangle]
3861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3862 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
3863 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3864         fn drop(&mut self) {
3865                 if self.datalen == 0 { return; }
3866                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3867         }
3868 }
3869 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3870         fn clone(&self) -> Self {
3871                 let mut res = Vec::new();
3872                 if self.datalen == 0 { return Self::from(res); }
3873                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3874                 Self::from(res)
3875         }
3876 }
3877 #[repr(C)]
3878 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3879 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3880         /// A pointer to the contents in the success state.
3881         /// Reading from this pointer when `result_ok` is not set is undefined.
3882         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3883         /// A pointer to the contents in the error state.
3884         /// Reading from this pointer when `result_ok` is set is undefined.
3885         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3886 }
3887 #[repr(C)]
3888 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3889 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3891 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3892         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3893         /// `err` or `result` depending on the state of `result_ok`.
3894         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3895         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3896         pub result_ok: bool,
3897 }
3898 #[no_mangle]
3899 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3901         CResult_FixedPenaltyScorerDecodeErrorZ {
3902                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3903                         result: Box::into_raw(Box::new(o)),
3904                 },
3905                 result_ok: true,
3906         }
3907 }
3908 #[no_mangle]
3909 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3910 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3911         CResult_FixedPenaltyScorerDecodeErrorZ {
3912                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3913                         err: Box::into_raw(Box::new(e)),
3914                 },
3915                 result_ok: false,
3916         }
3917 }
3918 /// Checks if the given object is currently in the success state
3919 #[no_mangle]
3920 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3921         o.result_ok
3922 }
3923 #[no_mangle]
3924 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3925 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3926 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3927         fn drop(&mut self) {
3928                 if self.result_ok {
3929                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3930                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3931                         }
3932                 } else {
3933                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3934                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3935                         }
3936                 }
3937         }
3938 }
3939 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3940         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3941                 let contents = if o.result_ok {
3942                         let result = unsafe { o.contents.result };
3943                         unsafe { o.contents.result = core::ptr::null_mut() };
3944                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3945                 } else {
3946                         let err = unsafe { o.contents.err };
3947                         unsafe { o.contents.err = core::ptr::null_mut(); }
3948                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3949                 };
3950                 Self {
3951                         contents,
3952                         result_ok: o.result_ok,
3953                 }
3954         }
3955 }
3956 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3957         fn clone(&self) -> Self {
3958                 if self.result_ok {
3959                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3960                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3961                         } }
3962                 } else {
3963                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3964                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3965                         } }
3966                 }
3967         }
3968 }
3969 #[no_mangle]
3970 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3971 /// but with all dynamically-allocated buffers duplicated in new buffers.
3972 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3973 #[repr(C)]
3974 /// A tuple of 2 elements. See the individual fields for the types contained.
3975 pub struct C2Tuple_u64u64Z {
3976         /// The element at position 0
3977         pub a: u64,
3978         /// The element at position 1
3979         pub b: u64,
3980 }
3981 impl From<(u64, u64)> for C2Tuple_u64u64Z {
3982         fn from (tup: (u64, u64)) -> Self {
3983                 Self {
3984                         a: tup.0,
3985                         b: tup.1,
3986                 }
3987         }
3988 }
3989 impl C2Tuple_u64u64Z {
3990         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
3991                 (self.a, self.b)
3992         }
3993 }
3994 impl Clone for C2Tuple_u64u64Z {
3995         fn clone(&self) -> Self {
3996                 Self {
3997                         a: Clone::clone(&self.a),
3998                         b: Clone::clone(&self.b),
3999                 }
4000         }
4001 }
4002 #[no_mangle]
4003 /// Creates a new tuple which has the same data as `orig`
4004 /// but with all dynamically-allocated buffers duplicated in new buffers.
4005 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4006 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4007 #[no_mangle]
4008 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4009         C2Tuple_u64u64Z { a, b, }
4010 }
4011
4012 #[no_mangle]
4013 /// Frees any resources used by the C2Tuple_u64u64Z.
4014 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4015 #[repr(C)]
4016 #[derive(Clone)]
4017 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4018 pub enum COption_C2Tuple_u64u64ZZ {
4019         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4020         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4021         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4022         None
4023 }
4024 impl COption_C2Tuple_u64u64ZZ {
4025         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4026                 if let Self::None = self { false } else { true }
4027         }
4028         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4029                 !self.is_some()
4030         }
4031         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4032                 if let Self::Some(v) = self { v } else { unreachable!() }
4033         }
4034 }
4035 #[no_mangle]
4036 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4037 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4038         COption_C2Tuple_u64u64ZZ::Some(o)
4039 }
4040 #[no_mangle]
4041 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4042 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4043         COption_C2Tuple_u64u64ZZ::None
4044 }
4045 #[no_mangle]
4046 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4047 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4048 #[no_mangle]
4049 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4050 /// but with all dynamically-allocated buffers duplicated in new buffers.
4051 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4052 #[repr(C)]
4053 /// A tuple of 2 elements. See the individual fields for the types contained.
4054 pub struct C2Tuple_Z {
4055         /// The element at position 0
4056         pub a: crate::c_types::EightU16s,
4057         /// The element at position 1
4058         pub b: crate::c_types::EightU16s,
4059 }
4060 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4061         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4062                 Self {
4063                         a: tup.0,
4064                         b: tup.1,
4065                 }
4066         }
4067 }
4068 impl C2Tuple_Z {
4069         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4070                 (self.a, self.b)
4071         }
4072 }
4073 impl Clone for C2Tuple_Z {
4074         fn clone(&self) -> Self {
4075                 Self {
4076                         a: Clone::clone(&self.a),
4077                         b: Clone::clone(&self.b),
4078                 }
4079         }
4080 }
4081 #[no_mangle]
4082 /// Creates a new tuple which has the same data as `orig`
4083 /// but with all dynamically-allocated buffers duplicated in new buffers.
4084 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4085 /// Creates a new C2Tuple_Z from the contained elements.
4086 #[no_mangle]
4087 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4088         C2Tuple_Z { a, b, }
4089 }
4090
4091 #[no_mangle]
4092 /// Frees any resources used by the C2Tuple_Z.
4093 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4094 #[repr(C)]
4095 /// A tuple of 2 elements. See the individual fields for the types contained.
4096 pub struct C2Tuple__u168_u168Z {
4097         /// The element at position 0
4098         pub a: crate::c_types::EightU16s,
4099         /// The element at position 1
4100         pub b: crate::c_types::EightU16s,
4101 }
4102 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4103         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4104                 Self {
4105                         a: tup.0,
4106                         b: tup.1,
4107                 }
4108         }
4109 }
4110 impl C2Tuple__u168_u168Z {
4111         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4112                 (self.a, self.b)
4113         }
4114 }
4115 impl Clone for C2Tuple__u168_u168Z {
4116         fn clone(&self) -> Self {
4117                 Self {
4118                         a: Clone::clone(&self.a),
4119                         b: Clone::clone(&self.b),
4120                 }
4121         }
4122 }
4123 #[no_mangle]
4124 /// Creates a new tuple which has the same data as `orig`
4125 /// but with all dynamically-allocated buffers duplicated in new buffers.
4126 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4127 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4128 #[no_mangle]
4129 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4130         C2Tuple__u168_u168Z { a, b, }
4131 }
4132
4133 #[no_mangle]
4134 /// Frees any resources used by the C2Tuple__u168_u168Z.
4135 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4136 #[repr(C)]
4137 #[derive(Clone)]
4138 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4139 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4140         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4141         Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4142         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4143         None
4144 }
4145 impl COption_C2Tuple_EightU16sEightU16sZZ {
4146         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4147                 if let Self::None = self { false } else { true }
4148         }
4149         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4150                 !self.is_some()
4151         }
4152         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4153                 if let Self::Some(v) = self { v } else { unreachable!() }
4154         }
4155 }
4156 #[no_mangle]
4157 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4158 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4159         COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4160 }
4161 #[no_mangle]
4162 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4163 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4164         COption_C2Tuple_EightU16sEightU16sZZ::None
4165 }
4166 #[no_mangle]
4167 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4168 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4169 #[no_mangle]
4170 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4171 /// but with all dynamically-allocated buffers duplicated in new buffers.
4172 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4173 #[repr(C)]
4174 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4175 /// This corresponds to std::vector in C++
4176 pub struct CVec_NodeIdZ {
4177         /// The elements in the array.
4178         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4179         pub data: *mut crate::lightning::routing::gossip::NodeId,
4180         /// The number of elements pointed to by `data`.
4181         pub datalen: usize
4182 }
4183 impl CVec_NodeIdZ {
4184         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4185                 if self.datalen == 0 { return Vec::new(); }
4186                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4187                 self.data = core::ptr::null_mut();
4188                 self.datalen = 0;
4189                 ret
4190         }
4191         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4192                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4193         }
4194 }
4195 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4196         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4197                 let datalen = v.len();
4198                 let data = Box::into_raw(v.into_boxed_slice());
4199                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4200         }
4201 }
4202 #[no_mangle]
4203 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4204 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4205 impl Drop for CVec_NodeIdZ {
4206         fn drop(&mut self) {
4207                 if self.datalen == 0 { return; }
4208                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4209         }
4210 }
4211 impl Clone for CVec_NodeIdZ {
4212         fn clone(&self) -> Self {
4213                 let mut res = Vec::new();
4214                 if self.datalen == 0 { return Self::from(res); }
4215                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4216                 Self::from(res)
4217         }
4218 }
4219 #[repr(C)]
4220 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4221 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4222         /// A pointer to the contents in the success state.
4223         /// Reading from this pointer when `result_ok` is not set is undefined.
4224         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4225         /// A pointer to the contents in the error state.
4226         /// Reading from this pointer when `result_ok` is set is undefined.
4227         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4228 }
4229 #[repr(C)]
4230 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4231 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4233 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4234         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4235         /// `err` or `result` depending on the state of `result_ok`.
4236         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4237         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4238         pub result_ok: bool,
4239 }
4240 #[no_mangle]
4241 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4242 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4243         CResult_ProbabilisticScorerDecodeErrorZ {
4244                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4245                         result: Box::into_raw(Box::new(o)),
4246                 },
4247                 result_ok: true,
4248         }
4249 }
4250 #[no_mangle]
4251 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4252 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4253         CResult_ProbabilisticScorerDecodeErrorZ {
4254                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4255                         err: Box::into_raw(Box::new(e)),
4256                 },
4257                 result_ok: false,
4258         }
4259 }
4260 /// Checks if the given object is currently in the success state
4261 #[no_mangle]
4262 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4263         o.result_ok
4264 }
4265 #[no_mangle]
4266 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4267 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4268 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4269         fn drop(&mut self) {
4270                 if self.result_ok {
4271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4273                         }
4274                 } else {
4275                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4276                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4277                         }
4278                 }
4279         }
4280 }
4281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4282         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4283                 let contents = if o.result_ok {
4284                         let result = unsafe { o.contents.result };
4285                         unsafe { o.contents.result = core::ptr::null_mut() };
4286                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4287                 } else {
4288                         let err = unsafe { o.contents.err };
4289                         unsafe { o.contents.err = core::ptr::null_mut(); }
4290                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4291                 };
4292                 Self {
4293                         contents,
4294                         result_ok: o.result_ok,
4295                 }
4296         }
4297 }
4298 #[repr(C)]
4299 /// The contents of CResult_InitFeaturesDecodeErrorZ
4300 pub union CResult_InitFeaturesDecodeErrorZPtr {
4301         /// A pointer to the contents in the success state.
4302         /// Reading from this pointer when `result_ok` is not set is undefined.
4303         pub result: *mut crate::lightning::ln::features::InitFeatures,
4304         /// A pointer to the contents in the error state.
4305         /// Reading from this pointer when `result_ok` is set is undefined.
4306         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4307 }
4308 #[repr(C)]
4309 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4310 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4312 pub struct CResult_InitFeaturesDecodeErrorZ {
4313         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4314         /// `err` or `result` depending on the state of `result_ok`.
4315         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4316         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4317         pub result_ok: bool,
4318 }
4319 #[no_mangle]
4320 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4321 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4322         CResult_InitFeaturesDecodeErrorZ {
4323                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4324                         result: Box::into_raw(Box::new(o)),
4325                 },
4326                 result_ok: true,
4327         }
4328 }
4329 #[no_mangle]
4330 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4331 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4332         CResult_InitFeaturesDecodeErrorZ {
4333                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4334                         err: Box::into_raw(Box::new(e)),
4335                 },
4336                 result_ok: false,
4337         }
4338 }
4339 /// Checks if the given object is currently in the success state
4340 #[no_mangle]
4341 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4342         o.result_ok
4343 }
4344 #[no_mangle]
4345 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4346 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4347 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4348         fn drop(&mut self) {
4349                 if self.result_ok {
4350                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4351                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4352                         }
4353                 } else {
4354                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4355                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4356                         }
4357                 }
4358         }
4359 }
4360 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4361         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4362                 let contents = if o.result_ok {
4363                         let result = unsafe { o.contents.result };
4364                         unsafe { o.contents.result = core::ptr::null_mut() };
4365                         CResult_InitFeaturesDecodeErrorZPtr { result }
4366                 } else {
4367                         let err = unsafe { o.contents.err };
4368                         unsafe { o.contents.err = core::ptr::null_mut(); }
4369                         CResult_InitFeaturesDecodeErrorZPtr { err }
4370                 };
4371                 Self {
4372                         contents,
4373                         result_ok: o.result_ok,
4374                 }
4375         }
4376 }
4377 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4378         fn clone(&self) -> Self {
4379                 if self.result_ok {
4380                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4381                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4382                         } }
4383                 } else {
4384                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4385                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4386                         } }
4387                 }
4388         }
4389 }
4390 #[no_mangle]
4391 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4392 /// but with all dynamically-allocated buffers duplicated in new buffers.
4393 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4394 #[repr(C)]
4395 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4396 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4397         /// A pointer to the contents in the success state.
4398         /// Reading from this pointer when `result_ok` is not set is undefined.
4399         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4400         /// A pointer to the contents in the error state.
4401         /// Reading from this pointer when `result_ok` is set is undefined.
4402         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4403 }
4404 #[repr(C)]
4405 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4406 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4408 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4409         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4410         /// `err` or `result` depending on the state of `result_ok`.
4411         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4412         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4413         pub result_ok: bool,
4414 }
4415 #[no_mangle]
4416 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4417 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4418         CResult_ChannelFeaturesDecodeErrorZ {
4419                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4420                         result: Box::into_raw(Box::new(o)),
4421                 },
4422                 result_ok: true,
4423         }
4424 }
4425 #[no_mangle]
4426 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4427 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4428         CResult_ChannelFeaturesDecodeErrorZ {
4429                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4430                         err: Box::into_raw(Box::new(e)),
4431                 },
4432                 result_ok: false,
4433         }
4434 }
4435 /// Checks if the given object is currently in the success state
4436 #[no_mangle]
4437 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4438         o.result_ok
4439 }
4440 #[no_mangle]
4441 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4442 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4443 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4444         fn drop(&mut self) {
4445                 if self.result_ok {
4446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4448                         }
4449                 } else {
4450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4452                         }
4453                 }
4454         }
4455 }
4456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4457         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4458                 let contents = if o.result_ok {
4459                         let result = unsafe { o.contents.result };
4460                         unsafe { o.contents.result = core::ptr::null_mut() };
4461                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4462                 } else {
4463                         let err = unsafe { o.contents.err };
4464                         unsafe { o.contents.err = core::ptr::null_mut(); }
4465                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4466                 };
4467                 Self {
4468                         contents,
4469                         result_ok: o.result_ok,
4470                 }
4471         }
4472 }
4473 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4474         fn clone(&self) -> Self {
4475                 if self.result_ok {
4476                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4477                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4478                         } }
4479                 } else {
4480                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4481                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4482                         } }
4483                 }
4484         }
4485 }
4486 #[no_mangle]
4487 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4488 /// but with all dynamically-allocated buffers duplicated in new buffers.
4489 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4490 #[repr(C)]
4491 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4492 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4493         /// A pointer to the contents in the success state.
4494         /// Reading from this pointer when `result_ok` is not set is undefined.
4495         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4496         /// A pointer to the contents in the error state.
4497         /// Reading from this pointer when `result_ok` is set is undefined.
4498         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4499 }
4500 #[repr(C)]
4501 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4502 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4504 pub struct CResult_NodeFeaturesDecodeErrorZ {
4505         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4506         /// `err` or `result` depending on the state of `result_ok`.
4507         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4508         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4509         pub result_ok: bool,
4510 }
4511 #[no_mangle]
4512 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4513 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4514         CResult_NodeFeaturesDecodeErrorZ {
4515                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4516                         result: Box::into_raw(Box::new(o)),
4517                 },
4518                 result_ok: true,
4519         }
4520 }
4521 #[no_mangle]
4522 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4523 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4524         CResult_NodeFeaturesDecodeErrorZ {
4525                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4526                         err: Box::into_raw(Box::new(e)),
4527                 },
4528                 result_ok: false,
4529         }
4530 }
4531 /// Checks if the given object is currently in the success state
4532 #[no_mangle]
4533 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4534         o.result_ok
4535 }
4536 #[no_mangle]
4537 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4538 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4539 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4540         fn drop(&mut self) {
4541                 if self.result_ok {
4542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4544                         }
4545                 } else {
4546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4548                         }
4549                 }
4550         }
4551 }
4552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4553         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4554                 let contents = if o.result_ok {
4555                         let result = unsafe { o.contents.result };
4556                         unsafe { o.contents.result = core::ptr::null_mut() };
4557                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4558                 } else {
4559                         let err = unsafe { o.contents.err };
4560                         unsafe { o.contents.err = core::ptr::null_mut(); }
4561                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4562                 };
4563                 Self {
4564                         contents,
4565                         result_ok: o.result_ok,
4566                 }
4567         }
4568 }
4569 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4570         fn clone(&self) -> Self {
4571                 if self.result_ok {
4572                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4573                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4574                         } }
4575                 } else {
4576                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4577                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4578                         } }
4579                 }
4580         }
4581 }
4582 #[no_mangle]
4583 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4584 /// but with all dynamically-allocated buffers duplicated in new buffers.
4585 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4586 #[repr(C)]
4587 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4588 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4589         /// A pointer to the contents in the success state.
4590         /// Reading from this pointer when `result_ok` is not set is undefined.
4591         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4592         /// A pointer to the contents in the error state.
4593         /// Reading from this pointer when `result_ok` is set is undefined.
4594         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4595 }
4596 #[repr(C)]
4597 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4598 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4600 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4601         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4602         /// `err` or `result` depending on the state of `result_ok`.
4603         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4604         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4605         pub result_ok: bool,
4606 }
4607 #[no_mangle]
4608 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4609 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4610         CResult_InvoiceFeaturesDecodeErrorZ {
4611                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4612                         result: Box::into_raw(Box::new(o)),
4613                 },
4614                 result_ok: true,
4615         }
4616 }
4617 #[no_mangle]
4618 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4619 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4620         CResult_InvoiceFeaturesDecodeErrorZ {
4621                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4622                         err: Box::into_raw(Box::new(e)),
4623                 },
4624                 result_ok: false,
4625         }
4626 }
4627 /// Checks if the given object is currently in the success state
4628 #[no_mangle]
4629 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4630         o.result_ok
4631 }
4632 #[no_mangle]
4633 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4634 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4635 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4636         fn drop(&mut self) {
4637                 if self.result_ok {
4638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4640                         }
4641                 } else {
4642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4644                         }
4645                 }
4646         }
4647 }
4648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4650                 let contents = if o.result_ok {
4651                         let result = unsafe { o.contents.result };
4652                         unsafe { o.contents.result = core::ptr::null_mut() };
4653                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4654                 } else {
4655                         let err = unsafe { o.contents.err };
4656                         unsafe { o.contents.err = core::ptr::null_mut(); }
4657                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4658                 };
4659                 Self {
4660                         contents,
4661                         result_ok: o.result_ok,
4662                 }
4663         }
4664 }
4665 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4666         fn clone(&self) -> Self {
4667                 if self.result_ok {
4668                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4669                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4670                         } }
4671                 } else {
4672                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4673                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4674                         } }
4675                 }
4676         }
4677 }
4678 #[no_mangle]
4679 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4680 /// but with all dynamically-allocated buffers duplicated in new buffers.
4681 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4682 #[repr(C)]
4683 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
4684 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
4685         /// A pointer to the contents in the success state.
4686         /// Reading from this pointer when `result_ok` is not set is undefined.
4687         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
4688         /// A pointer to the contents in the error state.
4689         /// Reading from this pointer when `result_ok` is set is undefined.
4690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4691 }
4692 #[repr(C)]
4693 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
4694 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4696 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
4697         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
4698         /// `err` or `result` depending on the state of `result_ok`.
4699         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
4700         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
4701         pub result_ok: bool,
4702 }
4703 #[no_mangle]
4704 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
4705 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
4706         CResult_BlindedHopFeaturesDecodeErrorZ {
4707                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4708                         result: Box::into_raw(Box::new(o)),
4709                 },
4710                 result_ok: true,
4711         }
4712 }
4713 #[no_mangle]
4714 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
4715 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
4716         CResult_BlindedHopFeaturesDecodeErrorZ {
4717                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4718                         err: Box::into_raw(Box::new(e)),
4719                 },
4720                 result_ok: false,
4721         }
4722 }
4723 /// Checks if the given object is currently in the success state
4724 #[no_mangle]
4725 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
4726         o.result_ok
4727 }
4728 #[no_mangle]
4729 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
4730 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
4731 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
4732         fn drop(&mut self) {
4733                 if self.result_ok {
4734                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4735                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4736                         }
4737                 } else {
4738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4740                         }
4741                 }
4742         }
4743 }
4744 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
4745         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4746                 let contents = if o.result_ok {
4747                         let result = unsafe { o.contents.result };
4748                         unsafe { o.contents.result = core::ptr::null_mut() };
4749                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
4750                 } else {
4751                         let err = unsafe { o.contents.err };
4752                         unsafe { o.contents.err = core::ptr::null_mut(); }
4753                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
4754                 };
4755                 Self {
4756                         contents,
4757                         result_ok: o.result_ok,
4758                 }
4759         }
4760 }
4761 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
4762         fn clone(&self) -> Self {
4763                 if self.result_ok {
4764                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4765                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
4766                         } }
4767                 } else {
4768                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
4769                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4770                         } }
4771                 }
4772         }
4773 }
4774 #[no_mangle]
4775 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
4776 /// but with all dynamically-allocated buffers duplicated in new buffers.
4777 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
4778 #[repr(C)]
4779 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4780 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4781         /// A pointer to the contents in the success state.
4782         /// Reading from this pointer when `result_ok` is not set is undefined.
4783         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4784         /// A pointer to the contents in the error state.
4785         /// Reading from this pointer when `result_ok` is set is undefined.
4786         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4787 }
4788 #[repr(C)]
4789 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4790 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4792 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4793         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4794         /// `err` or `result` depending on the state of `result_ok`.
4795         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4796         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4797         pub result_ok: bool,
4798 }
4799 #[no_mangle]
4800 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4801 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4802         CResult_ChannelTypeFeaturesDecodeErrorZ {
4803                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4804                         result: Box::into_raw(Box::new(o)),
4805                 },
4806                 result_ok: true,
4807         }
4808 }
4809 #[no_mangle]
4810 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4811 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4812         CResult_ChannelTypeFeaturesDecodeErrorZ {
4813                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4814                         err: Box::into_raw(Box::new(e)),
4815                 },
4816                 result_ok: false,
4817         }
4818 }
4819 /// Checks if the given object is currently in the success state
4820 #[no_mangle]
4821 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4822         o.result_ok
4823 }
4824 #[no_mangle]
4825 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4826 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4827 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4828         fn drop(&mut self) {
4829                 if self.result_ok {
4830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4832                         }
4833                 } else {
4834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4836                         }
4837                 }
4838         }
4839 }
4840 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4841         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4842                 let contents = if o.result_ok {
4843                         let result = unsafe { o.contents.result };
4844                         unsafe { o.contents.result = core::ptr::null_mut() };
4845                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4846                 } else {
4847                         let err = unsafe { o.contents.err };
4848                         unsafe { o.contents.err = core::ptr::null_mut(); }
4849                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4850                 };
4851                 Self {
4852                         contents,
4853                         result_ok: o.result_ok,
4854                 }
4855         }
4856 }
4857 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4858         fn clone(&self) -> Self {
4859                 if self.result_ok {
4860                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4861                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4862                         } }
4863                 } else {
4864                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4865                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4866                         } }
4867                 }
4868         }
4869 }
4870 #[no_mangle]
4871 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4872 /// but with all dynamically-allocated buffers duplicated in new buffers.
4873 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4874 #[repr(C)]
4875 /// The contents of CResult_PaymentPurposeDecodeErrorZ
4876 pub union CResult_PaymentPurposeDecodeErrorZPtr {
4877         /// A pointer to the contents in the success state.
4878         /// Reading from this pointer when `result_ok` is not set is undefined.
4879         pub result: *mut crate::lightning::events::PaymentPurpose,
4880         /// A pointer to the contents in the error state.
4881         /// Reading from this pointer when `result_ok` is set is undefined.
4882         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4883 }
4884 #[repr(C)]
4885 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
4886 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
4887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4888 pub struct CResult_PaymentPurposeDecodeErrorZ {
4889         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
4890         /// `err` or `result` depending on the state of `result_ok`.
4891         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
4892         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
4893         pub result_ok: bool,
4894 }
4895 #[no_mangle]
4896 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
4897 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
4898         CResult_PaymentPurposeDecodeErrorZ {
4899                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
4900                         result: Box::into_raw(Box::new(o)),
4901                 },
4902                 result_ok: true,
4903         }
4904 }
4905 #[no_mangle]
4906 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
4907 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
4908         CResult_PaymentPurposeDecodeErrorZ {
4909                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
4910                         err: Box::into_raw(Box::new(e)),
4911                 },
4912                 result_ok: false,
4913         }
4914 }
4915 /// Checks if the given object is currently in the success state
4916 #[no_mangle]
4917 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
4918         o.result_ok
4919 }
4920 #[no_mangle]
4921 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
4922 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
4923 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
4924         fn drop(&mut self) {
4925                 if self.result_ok {
4926                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4927                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4928                         }
4929                 } else {
4930                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4931                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4932                         }
4933                 }
4934         }
4935 }
4936 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
4937         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
4938                 let contents = if o.result_ok {
4939                         let result = unsafe { o.contents.result };
4940                         unsafe { o.contents.result = core::ptr::null_mut() };
4941                         CResult_PaymentPurposeDecodeErrorZPtr { result }
4942                 } else {
4943                         let err = unsafe { o.contents.err };
4944                         unsafe { o.contents.err = core::ptr::null_mut(); }
4945                         CResult_PaymentPurposeDecodeErrorZPtr { err }
4946                 };
4947                 Self {
4948                         contents,
4949                         result_ok: o.result_ok,
4950                 }
4951         }
4952 }
4953 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
4954         fn clone(&self) -> Self {
4955                 if self.result_ok {
4956                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
4957                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
4958                         } }
4959                 } else {
4960                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
4961                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4962                         } }
4963                 }
4964         }
4965 }
4966 #[no_mangle]
4967 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
4968 /// but with all dynamically-allocated buffers duplicated in new buffers.
4969 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
4970 #[repr(C)]
4971 #[derive(Clone)]
4972 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
4973 pub enum COption_NetworkUpdateZ {
4974         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
4975         Some(crate::lightning::routing::gossip::NetworkUpdate),
4976         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
4977         None
4978 }
4979 impl COption_NetworkUpdateZ {
4980         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4981                 if let Self::None = self { false } else { true }
4982         }
4983         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4984                 !self.is_some()
4985         }
4986         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
4987                 if let Self::Some(v) = self { v } else { unreachable!() }
4988         }
4989 }
4990 #[no_mangle]
4991 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
4992 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
4993         COption_NetworkUpdateZ::Some(o)
4994 }
4995 #[no_mangle]
4996 /// Constructs a new COption_NetworkUpdateZ containing nothing
4997 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
4998         COption_NetworkUpdateZ::None
4999 }
5000 #[no_mangle]
5001 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
5002 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
5003 #[no_mangle]
5004 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
5005 /// but with all dynamically-allocated buffers duplicated in new buffers.
5006 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
5007 #[repr(C)]
5008 #[derive(Clone)]
5009 /// An enum which can either contain a crate::lightning::events::PathFailure or not
5010 pub enum COption_PathFailureZ {
5011         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
5012         Some(crate::lightning::events::PathFailure),
5013         /// When we're in this state, this COption_PathFailureZ contains nothing
5014         None
5015 }
5016 impl COption_PathFailureZ {
5017         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5018                 if let Self::None = self { false } else { true }
5019         }
5020         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5021                 !self.is_some()
5022         }
5023         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
5024                 if let Self::Some(v) = self { v } else { unreachable!() }
5025         }
5026 }
5027 #[no_mangle]
5028 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
5029 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
5030         COption_PathFailureZ::Some(o)
5031 }
5032 #[no_mangle]
5033 /// Constructs a new COption_PathFailureZ containing nothing
5034 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
5035         COption_PathFailureZ::None
5036 }
5037 #[no_mangle]
5038 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
5039 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
5040 #[no_mangle]
5041 /// Creates a new COption_PathFailureZ which has the same data as `orig`
5042 /// but with all dynamically-allocated buffers duplicated in new buffers.
5043 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
5044 #[repr(C)]
5045 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
5046 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
5047         /// A pointer to the contents in the success state.
5048         /// Reading from this pointer when `result_ok` is not set is undefined.
5049         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
5050         /// A pointer to the contents in the error state.
5051         /// Reading from this pointer when `result_ok` is set is undefined.
5052         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5053 }
5054 #[repr(C)]
5055 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
5056 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5058 pub struct CResult_COption_PathFailureZDecodeErrorZ {
5059         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
5060         /// `err` or `result` depending on the state of `result_ok`.
5061         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
5062         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
5063         pub result_ok: bool,
5064 }
5065 #[no_mangle]
5066 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
5067 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
5068         CResult_COption_PathFailureZDecodeErrorZ {
5069                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5070                         result: Box::into_raw(Box::new(o)),
5071                 },
5072                 result_ok: true,
5073         }
5074 }
5075 #[no_mangle]
5076 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
5077 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
5078         CResult_COption_PathFailureZDecodeErrorZ {
5079                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5080                         err: Box::into_raw(Box::new(e)),
5081                 },
5082                 result_ok: false,
5083         }
5084 }
5085 /// Checks if the given object is currently in the success state
5086 #[no_mangle]
5087 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
5088         o.result_ok
5089 }
5090 #[no_mangle]
5091 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
5092 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
5093 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
5094         fn drop(&mut self) {
5095                 if self.result_ok {
5096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5098                         }
5099                 } else {
5100                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5101                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5102                         }
5103                 }
5104         }
5105 }
5106 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
5107         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5108                 let contents = if o.result_ok {
5109                         let result = unsafe { o.contents.result };
5110                         unsafe { o.contents.result = core::ptr::null_mut() };
5111                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
5112                 } else {
5113                         let err = unsafe { o.contents.err };
5114                         unsafe { o.contents.err = core::ptr::null_mut(); }
5115                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
5116                 };
5117                 Self {
5118                         contents,
5119                         result_ok: o.result_ok,
5120                 }
5121         }
5122 }
5123 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
5124         fn clone(&self) -> Self {
5125                 if self.result_ok {
5126                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5127                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
5128                         } }
5129                 } else {
5130                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
5131                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5132                         } }
5133                 }
5134         }
5135 }
5136 #[no_mangle]
5137 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
5138 /// but with all dynamically-allocated buffers duplicated in new buffers.
5139 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
5140 #[repr(C)]
5141 #[derive(Clone)]
5142 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
5143 pub enum COption_ClosureReasonZ {
5144         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
5145         Some(crate::lightning::events::ClosureReason),
5146         /// When we're in this state, this COption_ClosureReasonZ contains nothing
5147         None
5148 }
5149 impl COption_ClosureReasonZ {
5150         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5151                 if let Self::None = self { false } else { true }
5152         }
5153         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5154                 !self.is_some()
5155         }
5156         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
5157                 if let Self::Some(v) = self { v } else { unreachable!() }
5158         }
5159 }
5160 #[no_mangle]
5161 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
5162 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
5163         COption_ClosureReasonZ::Some(o)
5164 }
5165 #[no_mangle]
5166 /// Constructs a new COption_ClosureReasonZ containing nothing
5167 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
5168         COption_ClosureReasonZ::None
5169 }
5170 #[no_mangle]
5171 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
5172 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
5173 #[no_mangle]
5174 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
5175 /// but with all dynamically-allocated buffers duplicated in new buffers.
5176 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
5177 #[repr(C)]
5178 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
5179 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
5180         /// A pointer to the contents in the success state.
5181         /// Reading from this pointer when `result_ok` is not set is undefined.
5182         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
5183         /// A pointer to the contents in the error state.
5184         /// Reading from this pointer when `result_ok` is set is undefined.
5185         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5186 }
5187 #[repr(C)]
5188 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
5189 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5191 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
5192         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
5193         /// `err` or `result` depending on the state of `result_ok`.
5194         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
5195         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
5196         pub result_ok: bool,
5197 }
5198 #[no_mangle]
5199 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
5200 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
5201         CResult_COption_ClosureReasonZDecodeErrorZ {
5202                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5203                         result: Box::into_raw(Box::new(o)),
5204                 },
5205                 result_ok: true,
5206         }
5207 }
5208 #[no_mangle]
5209 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
5210 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
5211         CResult_COption_ClosureReasonZDecodeErrorZ {
5212                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5213                         err: Box::into_raw(Box::new(e)),
5214                 },
5215                 result_ok: false,
5216         }
5217 }
5218 /// Checks if the given object is currently in the success state
5219 #[no_mangle]
5220 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
5221         o.result_ok
5222 }
5223 #[no_mangle]
5224 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
5225 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
5226 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
5227         fn drop(&mut self) {
5228                 if self.result_ok {
5229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5231                         }
5232                 } else {
5233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5235                         }
5236                 }
5237         }
5238 }
5239 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
5240         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5241                 let contents = if o.result_ok {
5242                         let result = unsafe { o.contents.result };
5243                         unsafe { o.contents.result = core::ptr::null_mut() };
5244                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
5245                 } else {
5246                         let err = unsafe { o.contents.err };
5247                         unsafe { o.contents.err = core::ptr::null_mut(); }
5248                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
5249                 };
5250                 Self {
5251                         contents,
5252                         result_ok: o.result_ok,
5253                 }
5254         }
5255 }
5256 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
5257         fn clone(&self) -> Self {
5258                 if self.result_ok {
5259                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5260                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
5261                         } }
5262                 } else {
5263                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
5264                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5265                         } }
5266                 }
5267         }
5268 }
5269 #[no_mangle]
5270 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
5271 /// but with all dynamically-allocated buffers duplicated in new buffers.
5272 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
5273 #[repr(C)]
5274 #[derive(Clone)]
5275 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
5276 pub enum COption_HTLCDestinationZ {
5277         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
5278         Some(crate::lightning::events::HTLCDestination),
5279         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
5280         None
5281 }
5282 impl COption_HTLCDestinationZ {
5283         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5284                 if let Self::None = self { false } else { true }
5285         }
5286         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5287                 !self.is_some()
5288         }
5289         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
5290                 if let Self::Some(v) = self { v } else { unreachable!() }
5291         }
5292 }
5293 #[no_mangle]
5294 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
5295 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
5296         COption_HTLCDestinationZ::Some(o)
5297 }
5298 #[no_mangle]
5299 /// Constructs a new COption_HTLCDestinationZ containing nothing
5300 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
5301         COption_HTLCDestinationZ::None
5302 }
5303 #[no_mangle]
5304 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
5305 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
5306 #[no_mangle]
5307 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
5308 /// but with all dynamically-allocated buffers duplicated in new buffers.
5309 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
5310 #[repr(C)]
5311 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
5312 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5313         /// A pointer to the contents in the success state.
5314         /// Reading from this pointer when `result_ok` is not set is undefined.
5315         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
5316         /// A pointer to the contents in the error state.
5317         /// Reading from this pointer when `result_ok` is set is undefined.
5318         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5319 }
5320 #[repr(C)]
5321 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
5322 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5324 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
5325         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
5326         /// `err` or `result` depending on the state of `result_ok`.
5327         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
5328         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
5329         pub result_ok: bool,
5330 }
5331 #[no_mangle]
5332 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
5333 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
5334         CResult_COption_HTLCDestinationZDecodeErrorZ {
5335                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5336                         result: Box::into_raw(Box::new(o)),
5337                 },
5338                 result_ok: true,
5339         }
5340 }
5341 #[no_mangle]
5342 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
5343 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
5344         CResult_COption_HTLCDestinationZDecodeErrorZ {
5345                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5346                         err: Box::into_raw(Box::new(e)),
5347                 },
5348                 result_ok: false,
5349         }
5350 }
5351 /// Checks if the given object is currently in the success state
5352 #[no_mangle]
5353 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
5354         o.result_ok
5355 }
5356 #[no_mangle]
5357 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
5358 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
5359 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
5360         fn drop(&mut self) {
5361                 if self.result_ok {
5362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5364                         }
5365                 } else {
5366                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5367                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5368                         }
5369                 }
5370         }
5371 }
5372 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
5373         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5374                 let contents = if o.result_ok {
5375                         let result = unsafe { o.contents.result };
5376                         unsafe { o.contents.result = core::ptr::null_mut() };
5377                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
5378                 } else {
5379                         let err = unsafe { o.contents.err };
5380                         unsafe { o.contents.err = core::ptr::null_mut(); }
5381                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
5382                 };
5383                 Self {
5384                         contents,
5385                         result_ok: o.result_ok,
5386                 }
5387         }
5388 }
5389 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
5390         fn clone(&self) -> Self {
5391                 if self.result_ok {
5392                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5393                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
5394                         } }
5395                 } else {
5396                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
5397                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5398                         } }
5399                 }
5400         }
5401 }
5402 #[no_mangle]
5403 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
5404 /// but with all dynamically-allocated buffers duplicated in new buffers.
5405 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
5406 #[repr(C)]
5407 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
5408 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
5409         /// A pointer to the contents in the success state.
5410         /// Reading from this pointer when `result_ok` is not set is undefined.
5411         pub result: *mut crate::lightning::events::PaymentFailureReason,
5412         /// A pointer to the contents in the error state.
5413         /// Reading from this pointer when `result_ok` is set is undefined.
5414         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5415 }
5416 #[repr(C)]
5417 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
5418 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
5419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5420 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
5421         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
5422         /// `err` or `result` depending on the state of `result_ok`.
5423         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
5424         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
5425         pub result_ok: bool,
5426 }
5427 #[no_mangle]
5428 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
5429 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
5430         CResult_PaymentFailureReasonDecodeErrorZ {
5431                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5432                         result: Box::into_raw(Box::new(o)),
5433                 },
5434                 result_ok: true,
5435         }
5436 }
5437 #[no_mangle]
5438 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
5439 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
5440         CResult_PaymentFailureReasonDecodeErrorZ {
5441                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5442                         err: Box::into_raw(Box::new(e)),
5443                 },
5444                 result_ok: false,
5445         }
5446 }
5447 /// Checks if the given object is currently in the success state
5448 #[no_mangle]
5449 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
5450         o.result_ok
5451 }
5452 #[no_mangle]
5453 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
5454 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
5455 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
5456         fn drop(&mut self) {
5457                 if self.result_ok {
5458                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5459                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5460                         }
5461                 } else {
5462                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5463                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5464                         }
5465                 }
5466         }
5467 }
5468 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
5469         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
5470                 let contents = if o.result_ok {
5471                         let result = unsafe { o.contents.result };
5472                         unsafe { o.contents.result = core::ptr::null_mut() };
5473                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
5474                 } else {
5475                         let err = unsafe { o.contents.err };
5476                         unsafe { o.contents.err = core::ptr::null_mut(); }
5477                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
5478                 };
5479                 Self {
5480                         contents,
5481                         result_ok: o.result_ok,
5482                 }
5483         }
5484 }
5485 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
5486         fn clone(&self) -> Self {
5487                 if self.result_ok {
5488                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5489                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
5490                         } }
5491                 } else {
5492                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
5493                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5494                         } }
5495                 }
5496         }
5497 }
5498 #[no_mangle]
5499 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
5500 /// but with all dynamically-allocated buffers duplicated in new buffers.
5501 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
5502 #[repr(C)]
5503 #[derive(Clone)]
5504 /// An enum which can either contain a crate::c_types::U128 or not
5505 pub enum COption_u128Z {
5506         /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
5507         Some(crate::c_types::U128),
5508         /// When we're in this state, this COption_u128Z contains nothing
5509         None
5510 }
5511 impl COption_u128Z {
5512         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5513                 if let Self::None = self { false } else { true }
5514         }
5515         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5516                 !self.is_some()
5517         }
5518         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
5519                 if let Self::Some(v) = self { v } else { unreachable!() }
5520         }
5521 }
5522 #[no_mangle]
5523 /// Constructs a new COption_u128Z containing a crate::c_types::U128
5524 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
5525         COption_u128Z::Some(o)
5526 }
5527 #[no_mangle]
5528 /// Constructs a new COption_u128Z containing nothing
5529 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
5530         COption_u128Z::None
5531 }
5532 #[no_mangle]
5533 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
5534 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
5535 #[no_mangle]
5536 /// Creates a new COption_u128Z which has the same data as `orig`
5537 /// but with all dynamically-allocated buffers duplicated in new buffers.
5538 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
5539 #[repr(C)]
5540 #[derive(Clone)]
5541 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
5542 pub enum COption_PaymentFailureReasonZ {
5543         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
5544         Some(crate::lightning::events::PaymentFailureReason),
5545         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
5546         None
5547 }
5548 impl COption_PaymentFailureReasonZ {
5549         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5550                 if let Self::None = self { false } else { true }
5551         }
5552         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5553                 !self.is_some()
5554         }
5555         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
5556                 if let Self::Some(v) = self { v } else { unreachable!() }
5557         }
5558 }
5559 #[no_mangle]
5560 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
5561 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
5562         COption_PaymentFailureReasonZ::Some(o)
5563 }
5564 #[no_mangle]
5565 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
5566 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
5567         COption_PaymentFailureReasonZ::None
5568 }
5569 #[no_mangle]
5570 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
5571 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
5572 #[no_mangle]
5573 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
5576 #[repr(C)]
5577 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
5578 /// This corresponds to std::vector in C++
5579 pub struct CVec_SpendableOutputDescriptorZ {
5580         /// The elements in the array.
5581         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5582         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5583         /// The number of elements pointed to by `data`.
5584         pub datalen: usize
5585 }
5586 impl CVec_SpendableOutputDescriptorZ {
5587         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
5588                 if self.datalen == 0 { return Vec::new(); }
5589                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5590                 self.data = core::ptr::null_mut();
5591                 self.datalen = 0;
5592                 ret
5593         }
5594         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
5595                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5596         }
5597 }
5598 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
5599         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
5600                 let datalen = v.len();
5601                 let data = Box::into_raw(v.into_boxed_slice());
5602                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5603         }
5604 }
5605 #[no_mangle]
5606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5607 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
5608 impl Drop for CVec_SpendableOutputDescriptorZ {
5609         fn drop(&mut self) {
5610                 if self.datalen == 0 { return; }
5611                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5612         }
5613 }
5614 impl Clone for CVec_SpendableOutputDescriptorZ {
5615         fn clone(&self) -> Self {
5616                 let mut res = Vec::new();
5617                 if self.datalen == 0 { return Self::from(res); }
5618                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5619                 Self::from(res)
5620         }
5621 }
5622 #[repr(C)]
5623 #[derive(Clone)]
5624 /// An enum which can either contain a crate::lightning::events::Event or not
5625 pub enum COption_EventZ {
5626         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
5627         Some(crate::lightning::events::Event),
5628         /// When we're in this state, this COption_EventZ contains nothing
5629         None
5630 }
5631 impl COption_EventZ {
5632         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5633                 if let Self::None = self { false } else { true }
5634         }
5635         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5636                 !self.is_some()
5637         }
5638         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
5639                 if let Self::Some(v) = self { v } else { unreachable!() }
5640         }
5641 }
5642 #[no_mangle]
5643 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
5644 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
5645         COption_EventZ::Some(o)
5646 }
5647 #[no_mangle]
5648 /// Constructs a new COption_EventZ containing nothing
5649 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
5650         COption_EventZ::None
5651 }
5652 #[no_mangle]
5653 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
5654 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
5655 #[no_mangle]
5656 /// Creates a new COption_EventZ which has the same data as `orig`
5657 /// but with all dynamically-allocated buffers duplicated in new buffers.
5658 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
5659 #[repr(C)]
5660 /// The contents of CResult_COption_EventZDecodeErrorZ
5661 pub union CResult_COption_EventZDecodeErrorZPtr {
5662         /// A pointer to the contents in the success state.
5663         /// Reading from this pointer when `result_ok` is not set is undefined.
5664         pub result: *mut crate::c_types::derived::COption_EventZ,
5665         /// A pointer to the contents in the error state.
5666         /// Reading from this pointer when `result_ok` is set is undefined.
5667         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5668 }
5669 #[repr(C)]
5670 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
5671 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5672 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5673 pub struct CResult_COption_EventZDecodeErrorZ {
5674         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
5675         /// `err` or `result` depending on the state of `result_ok`.
5676         pub contents: CResult_COption_EventZDecodeErrorZPtr,
5677         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
5678         pub result_ok: bool,
5679 }
5680 #[no_mangle]
5681 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
5682 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
5683         CResult_COption_EventZDecodeErrorZ {
5684                 contents: CResult_COption_EventZDecodeErrorZPtr {
5685                         result: Box::into_raw(Box::new(o)),
5686                 },
5687                 result_ok: true,
5688         }
5689 }
5690 #[no_mangle]
5691 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
5692 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
5693         CResult_COption_EventZDecodeErrorZ {
5694                 contents: CResult_COption_EventZDecodeErrorZPtr {
5695                         err: Box::into_raw(Box::new(e)),
5696                 },
5697                 result_ok: false,
5698         }
5699 }
5700 /// Checks if the given object is currently in the success state
5701 #[no_mangle]
5702 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
5703         o.result_ok
5704 }
5705 #[no_mangle]
5706 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
5707 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
5708 impl Drop for CResult_COption_EventZDecodeErrorZ {
5709         fn drop(&mut self) {
5710                 if self.result_ok {
5711                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5712                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5713                         }
5714                 } else {
5715                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5716                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5717                         }
5718                 }
5719         }
5720 }
5721 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
5722         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5723                 let contents = if o.result_ok {
5724                         let result = unsafe { o.contents.result };
5725                         unsafe { o.contents.result = core::ptr::null_mut() };
5726                         CResult_COption_EventZDecodeErrorZPtr { result }
5727                 } else {
5728                         let err = unsafe { o.contents.err };
5729                         unsafe { o.contents.err = core::ptr::null_mut(); }
5730                         CResult_COption_EventZDecodeErrorZPtr { err }
5731                 };
5732                 Self {
5733                         contents,
5734                         result_ok: o.result_ok,
5735                 }
5736         }
5737 }
5738 impl Clone for CResult_COption_EventZDecodeErrorZ {
5739         fn clone(&self) -> Self {
5740                 if self.result_ok {
5741                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
5742                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
5743                         } }
5744                 } else {
5745                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
5746                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5747                         } }
5748                 }
5749         }
5750 }
5751 #[no_mangle]
5752 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
5753 /// but with all dynamically-allocated buffers duplicated in new buffers.
5754 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
5755 #[repr(C)]
5756 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
5757 /// This corresponds to std::vector in C++
5758 pub struct CVec_MessageSendEventZ {
5759         /// The elements in the array.
5760         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5761         pub data: *mut crate::lightning::events::MessageSendEvent,
5762         /// The number of elements pointed to by `data`.
5763         pub datalen: usize
5764 }
5765 impl CVec_MessageSendEventZ {
5766         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
5767                 if self.datalen == 0 { return Vec::new(); }
5768                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5769                 self.data = core::ptr::null_mut();
5770                 self.datalen = 0;
5771                 ret
5772         }
5773         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
5774                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5775         }
5776 }
5777 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
5778         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
5779                 let datalen = v.len();
5780                 let data = Box::into_raw(v.into_boxed_slice());
5781                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5782         }
5783 }
5784 #[no_mangle]
5785 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5786 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
5787 impl Drop for CVec_MessageSendEventZ {
5788         fn drop(&mut self) {
5789                 if self.datalen == 0 { return; }
5790                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5791         }
5792 }
5793 impl Clone for CVec_MessageSendEventZ {
5794         fn clone(&self) -> Self {
5795                 let mut res = Vec::new();
5796                 if self.datalen == 0 { return Self::from(res); }
5797                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5798                 Self::from(res)
5799         }
5800 }
5801 #[repr(C)]
5802 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5803 /// This corresponds to std::vector in C++
5804 pub struct CVec_ChainHashZ {
5805         /// The elements in the array.
5806         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5807         pub data: *mut crate::c_types::ThirtyTwoBytes,
5808         /// The number of elements pointed to by `data`.
5809         pub datalen: usize
5810 }
5811 impl CVec_ChainHashZ {
5812         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
5813                 if self.datalen == 0 { return Vec::new(); }
5814                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5815                 self.data = core::ptr::null_mut();
5816                 self.datalen = 0;
5817                 ret
5818         }
5819         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
5820                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5821         }
5822 }
5823 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ChainHashZ {
5824         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
5825                 let datalen = v.len();
5826                 let data = Box::into_raw(v.into_boxed_slice());
5827                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5828         }
5829 }
5830 #[no_mangle]
5831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5832 pub extern "C" fn CVec_ChainHashZ_free(_res: CVec_ChainHashZ) { }
5833 impl Drop for CVec_ChainHashZ {
5834         fn drop(&mut self) {
5835                 if self.datalen == 0 { return; }
5836                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5837         }
5838 }
5839 impl Clone for CVec_ChainHashZ {
5840         fn clone(&self) -> Self {
5841                 let mut res = Vec::new();
5842                 if self.datalen == 0 { return Self::from(res); }
5843                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5844                 Self::from(res)
5845         }
5846 }
5847 #[repr(C)]
5848 /// The contents of CResult_PublicKeyErrorZ
5849 pub union CResult_PublicKeyErrorZPtr {
5850         /// A pointer to the contents in the success state.
5851         /// Reading from this pointer when `result_ok` is not set is undefined.
5852         pub result: *mut crate::c_types::PublicKey,
5853         /// A pointer to the contents in the error state.
5854         /// Reading from this pointer when `result_ok` is set is undefined.
5855         pub err: *mut crate::c_types::Secp256k1Error,
5856 }
5857 #[repr(C)]
5858 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
5859 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
5860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5861 pub struct CResult_PublicKeyErrorZ {
5862         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
5863         /// `err` or `result` depending on the state of `result_ok`.
5864         pub contents: CResult_PublicKeyErrorZPtr,
5865         /// Whether this CResult_PublicKeyErrorZ represents a success state.
5866         pub result_ok: bool,
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_PublicKeyErrorZ in the success state.
5870 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
5871         CResult_PublicKeyErrorZ {
5872                 contents: CResult_PublicKeyErrorZPtr {
5873                         result: Box::into_raw(Box::new(o)),
5874                 },
5875                 result_ok: true,
5876         }
5877 }
5878 #[no_mangle]
5879 /// Creates a new CResult_PublicKeyErrorZ in the error state.
5880 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
5881         CResult_PublicKeyErrorZ {
5882                 contents: CResult_PublicKeyErrorZPtr {
5883                         err: Box::into_raw(Box::new(e)),
5884                 },
5885                 result_ok: false,
5886         }
5887 }
5888 /// Checks if the given object is currently in the success state
5889 #[no_mangle]
5890 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
5891         o.result_ok
5892 }
5893 #[no_mangle]
5894 /// Frees any resources used by the CResult_PublicKeyErrorZ.
5895 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
5896 impl Drop for CResult_PublicKeyErrorZ {
5897         fn drop(&mut self) {
5898                 if self.result_ok {
5899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5901                         }
5902                 } else {
5903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5905                         }
5906                 }
5907         }
5908 }
5909 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
5910         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
5911                 let contents = if o.result_ok {
5912                         let result = unsafe { o.contents.result };
5913                         unsafe { o.contents.result = core::ptr::null_mut() };
5914                         CResult_PublicKeyErrorZPtr { result }
5915                 } else {
5916                         let err = unsafe { o.contents.err };
5917                         unsafe { o.contents.err = core::ptr::null_mut(); }
5918                         CResult_PublicKeyErrorZPtr { err }
5919                 };
5920                 Self {
5921                         contents,
5922                         result_ok: o.result_ok,
5923                 }
5924         }
5925 }
5926 impl Clone for CResult_PublicKeyErrorZ {
5927         fn clone(&self) -> Self {
5928                 if self.result_ok {
5929                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
5930                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
5931                         } }
5932                 } else {
5933                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
5934                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
5935                         } }
5936                 }
5937         }
5938 }
5939 #[no_mangle]
5940 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
5941 /// but with all dynamically-allocated buffers duplicated in new buffers.
5942 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
5943 #[repr(C)]
5944 /// The contents of CResult_NodeIdDecodeErrorZ
5945 pub union CResult_NodeIdDecodeErrorZPtr {
5946         /// A pointer to the contents in the success state.
5947         /// Reading from this pointer when `result_ok` is not set is undefined.
5948         pub result: *mut crate::lightning::routing::gossip::NodeId,
5949         /// A pointer to the contents in the error state.
5950         /// Reading from this pointer when `result_ok` is set is undefined.
5951         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5952 }
5953 #[repr(C)]
5954 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5955 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5957 pub struct CResult_NodeIdDecodeErrorZ {
5958         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5959         /// `err` or `result` depending on the state of `result_ok`.
5960         pub contents: CResult_NodeIdDecodeErrorZPtr,
5961         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5962         pub result_ok: bool,
5963 }
5964 #[no_mangle]
5965 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5966 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5967         CResult_NodeIdDecodeErrorZ {
5968                 contents: CResult_NodeIdDecodeErrorZPtr {
5969                         result: Box::into_raw(Box::new(o)),
5970                 },
5971                 result_ok: true,
5972         }
5973 }
5974 #[no_mangle]
5975 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5976 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5977         CResult_NodeIdDecodeErrorZ {
5978                 contents: CResult_NodeIdDecodeErrorZPtr {
5979                         err: Box::into_raw(Box::new(e)),
5980                 },
5981                 result_ok: false,
5982         }
5983 }
5984 /// Checks if the given object is currently in the success state
5985 #[no_mangle]
5986 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5987         o.result_ok
5988 }
5989 #[no_mangle]
5990 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5991 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5992 impl Drop for CResult_NodeIdDecodeErrorZ {
5993         fn drop(&mut self) {
5994                 if self.result_ok {
5995                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5996                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5997                         }
5998                 } else {
5999                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6000                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6001                         }
6002                 }
6003         }
6004 }
6005 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
6006         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
6007                 let contents = if o.result_ok {
6008                         let result = unsafe { o.contents.result };
6009                         unsafe { o.contents.result = core::ptr::null_mut() };
6010                         CResult_NodeIdDecodeErrorZPtr { result }
6011                 } else {
6012                         let err = unsafe { o.contents.err };
6013                         unsafe { o.contents.err = core::ptr::null_mut(); }
6014                         CResult_NodeIdDecodeErrorZPtr { err }
6015                 };
6016                 Self {
6017                         contents,
6018                         result_ok: o.result_ok,
6019                 }
6020         }
6021 }
6022 impl Clone for CResult_NodeIdDecodeErrorZ {
6023         fn clone(&self) -> Self {
6024                 if self.result_ok {
6025                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
6026                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
6027                         } }
6028                 } else {
6029                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
6030                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6031                         } }
6032                 }
6033         }
6034 }
6035 #[no_mangle]
6036 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
6037 /// but with all dynamically-allocated buffers duplicated in new buffers.
6038 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
6039 #[repr(C)]
6040 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
6041 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6042         /// A pointer to the contents in the success state.
6043         /// Reading from this pointer when `result_ok` is not set is undefined.
6044         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
6045         /// A pointer to the contents in the error state.
6046         /// Reading from this pointer when `result_ok` is set is undefined.
6047         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6048 }
6049 #[repr(C)]
6050 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
6051 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6053 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
6054         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
6055         /// `err` or `result` depending on the state of `result_ok`.
6056         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
6057         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
6058         pub result_ok: bool,
6059 }
6060 #[no_mangle]
6061 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
6062 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6063         CResult_COption_NetworkUpdateZDecodeErrorZ {
6064                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6065                         result: Box::into_raw(Box::new(o)),
6066                 },
6067                 result_ok: true,
6068         }
6069 }
6070 #[no_mangle]
6071 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
6072 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
6073         CResult_COption_NetworkUpdateZDecodeErrorZ {
6074                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6075                         err: Box::into_raw(Box::new(e)),
6076                 },
6077                 result_ok: false,
6078         }
6079 }
6080 /// Checks if the given object is currently in the success state
6081 #[no_mangle]
6082 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
6083         o.result_ok
6084 }
6085 #[no_mangle]
6086 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
6087 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
6088 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
6089         fn drop(&mut self) {
6090                 if self.result_ok {
6091                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6092                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6093                         }
6094                 } else {
6095                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6096                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6097                         }
6098                 }
6099         }
6100 }
6101 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
6102         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6103                 let contents = if o.result_ok {
6104                         let result = unsafe { o.contents.result };
6105                         unsafe { o.contents.result = core::ptr::null_mut() };
6106                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
6107                 } else {
6108                         let err = unsafe { o.contents.err };
6109                         unsafe { o.contents.err = core::ptr::null_mut(); }
6110                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
6111                 };
6112                 Self {
6113                         contents,
6114                         result_ok: o.result_ok,
6115                 }
6116         }
6117 }
6118 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
6119         fn clone(&self) -> Self {
6120                 if self.result_ok {
6121                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6122                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
6123                         } }
6124                 } else {
6125                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
6126                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6127                         } }
6128                 }
6129         }
6130 }
6131 #[no_mangle]
6132 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
6135 #[repr(C)]
6136 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
6137 pub enum COption_UtxoLookupZ {
6138         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
6139         Some(crate::lightning::routing::utxo::UtxoLookup),
6140         /// When we're in this state, this COption_UtxoLookupZ contains nothing
6141         None
6142 }
6143 impl COption_UtxoLookupZ {
6144         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6145                 if let Self::None = self { false } else { true }
6146         }
6147         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6148                 !self.is_some()
6149         }
6150         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
6151                 if let Self::Some(v) = self { v } else { unreachable!() }
6152         }
6153 }
6154 #[no_mangle]
6155 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
6156 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
6157         COption_UtxoLookupZ::Some(o)
6158 }
6159 #[no_mangle]
6160 /// Constructs a new COption_UtxoLookupZ containing nothing
6161 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
6162         COption_UtxoLookupZ::None
6163 }
6164 #[no_mangle]
6165 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
6166 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
6167 #[repr(C)]
6168 /// The contents of CResult_boolLightningErrorZ
6169 pub union CResult_boolLightningErrorZPtr {
6170         /// A pointer to the contents in the success state.
6171         /// Reading from this pointer when `result_ok` is not set is undefined.
6172         pub result: *mut bool,
6173         /// A pointer to the contents in the error state.
6174         /// Reading from this pointer when `result_ok` is set is undefined.
6175         pub err: *mut crate::lightning::ln::msgs::LightningError,
6176 }
6177 #[repr(C)]
6178 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
6179 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
6180 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6181 pub struct CResult_boolLightningErrorZ {
6182         /// The contents of this CResult_boolLightningErrorZ, accessible via either
6183         /// `err` or `result` depending on the state of `result_ok`.
6184         pub contents: CResult_boolLightningErrorZPtr,
6185         /// Whether this CResult_boolLightningErrorZ represents a success state.
6186         pub result_ok: bool,
6187 }
6188 #[no_mangle]
6189 /// Creates a new CResult_boolLightningErrorZ in the success state.
6190 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
6191         CResult_boolLightningErrorZ {
6192                 contents: CResult_boolLightningErrorZPtr {
6193                         result: Box::into_raw(Box::new(o)),
6194                 },
6195                 result_ok: true,
6196         }
6197 }
6198 #[no_mangle]
6199 /// Creates a new CResult_boolLightningErrorZ in the error state.
6200 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
6201         CResult_boolLightningErrorZ {
6202                 contents: CResult_boolLightningErrorZPtr {
6203                         err: Box::into_raw(Box::new(e)),
6204                 },
6205                 result_ok: false,
6206         }
6207 }
6208 /// Checks if the given object is currently in the success state
6209 #[no_mangle]
6210 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
6211         o.result_ok
6212 }
6213 #[no_mangle]
6214 /// Frees any resources used by the CResult_boolLightningErrorZ.
6215 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
6216 impl Drop for CResult_boolLightningErrorZ {
6217         fn drop(&mut self) {
6218                 if self.result_ok {
6219                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6220                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6221                         }
6222                 } else {
6223                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6224                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6225                         }
6226                 }
6227         }
6228 }
6229 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
6230         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
6231                 let contents = if o.result_ok {
6232                         let result = unsafe { o.contents.result };
6233                         unsafe { o.contents.result = core::ptr::null_mut() };
6234                         CResult_boolLightningErrorZPtr { result }
6235                 } else {
6236                         let err = unsafe { o.contents.err };
6237                         unsafe { o.contents.err = core::ptr::null_mut(); }
6238                         CResult_boolLightningErrorZPtr { err }
6239                 };
6240                 Self {
6241                         contents,
6242                         result_ok: o.result_ok,
6243                 }
6244         }
6245 }
6246 impl Clone for CResult_boolLightningErrorZ {
6247         fn clone(&self) -> Self {
6248                 if self.result_ok {
6249                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
6250                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
6251                         } }
6252                 } else {
6253                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
6254                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6255                         } }
6256                 }
6257         }
6258 }
6259 #[no_mangle]
6260 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
6261 /// but with all dynamically-allocated buffers duplicated in new buffers.
6262 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
6263 #[repr(C)]
6264 /// A tuple of 3 elements. See the individual fields for the types contained.
6265 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6266         /// The element at position 0
6267         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
6268         /// The element at position 1
6269         pub b: crate::lightning::ln::msgs::ChannelUpdate,
6270         /// The element at position 2
6271         pub c: crate::lightning::ln::msgs::ChannelUpdate,
6272 }
6273 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6274         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
6275                 Self {
6276                         a: tup.0,
6277                         b: tup.1,
6278                         c: tup.2,
6279                 }
6280         }
6281 }
6282 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6283         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
6284                 (self.a, self.b, self.c)
6285         }
6286 }
6287 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6288         fn clone(&self) -> Self {
6289                 Self {
6290                         a: Clone::clone(&self.a),
6291                         b: Clone::clone(&self.b),
6292                         c: Clone::clone(&self.c),
6293                 }
6294         }
6295 }
6296 #[no_mangle]
6297 /// Creates a new tuple which has the same data as `orig`
6298 /// but with all dynamically-allocated buffers duplicated in new buffers.
6299 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
6300 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
6301 #[no_mangle]
6302 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 {
6303         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
6304 }
6305
6306 #[no_mangle]
6307 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
6308 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
6309 #[repr(C)]
6310 #[derive(Clone)]
6311 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
6312 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6313         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6314         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
6315         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
6316         None
6317 }
6318 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6319         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6320                 if let Self::None = self { false } else { true }
6321         }
6322         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6323                 !self.is_some()
6324         }
6325         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
6326                 if let Self::Some(v) = self { v } else { unreachable!() }
6327         }
6328 }
6329 #[no_mangle]
6330 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
6331 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6332         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
6333 }
6334 #[no_mangle]
6335 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
6336 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
6337         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
6338 }
6339 #[no_mangle]
6340 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
6341 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
6342 #[no_mangle]
6343 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
6344 /// but with all dynamically-allocated buffers duplicated in new buffers.
6345 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
6346 #[repr(C)]
6347 /// The contents of CResult_NoneLightningErrorZ
6348 pub union CResult_NoneLightningErrorZPtr {
6349         /// Note that this value is always NULL, as there are no contents in the OK variant
6350         pub result: *mut core::ffi::c_void,
6351         /// A pointer to the contents in the error state.
6352         /// Reading from this pointer when `result_ok` is set is undefined.
6353         pub err: *mut crate::lightning::ln::msgs::LightningError,
6354 }
6355 #[repr(C)]
6356 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6357 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6359 pub struct CResult_NoneLightningErrorZ {
6360         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
6361         /// `err` or `result` depending on the state of `result_ok`.
6362         pub contents: CResult_NoneLightningErrorZPtr,
6363         /// Whether this CResult_NoneLightningErrorZ represents a success state.
6364         pub result_ok: bool,
6365 }
6366 #[no_mangle]
6367 /// Creates a new CResult_NoneLightningErrorZ in the success state.
6368 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
6369         CResult_NoneLightningErrorZ {
6370                 contents: CResult_NoneLightningErrorZPtr {
6371                         result: core::ptr::null_mut(),
6372                 },
6373                 result_ok: true,
6374         }
6375 }
6376 #[no_mangle]
6377 /// Creates a new CResult_NoneLightningErrorZ in the error state.
6378 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
6379         CResult_NoneLightningErrorZ {
6380                 contents: CResult_NoneLightningErrorZPtr {
6381                         err: Box::into_raw(Box::new(e)),
6382                 },
6383                 result_ok: false,
6384         }
6385 }
6386 /// Checks if the given object is currently in the success state
6387 #[no_mangle]
6388 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
6389         o.result_ok
6390 }
6391 #[no_mangle]
6392 /// Frees any resources used by the CResult_NoneLightningErrorZ.
6393 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
6394 impl Drop for CResult_NoneLightningErrorZ {
6395         fn drop(&mut self) {
6396                 if self.result_ok {
6397                 } else {
6398                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6399                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6400                         }
6401                 }
6402         }
6403 }
6404 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
6405         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
6406                 let contents = if o.result_ok {
6407                         let _ = unsafe { Box::from_raw(o.contents.result) };
6408                         o.contents.result = core::ptr::null_mut();
6409                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
6410                 } else {
6411                         let err = unsafe { o.contents.err };
6412                         unsafe { o.contents.err = core::ptr::null_mut(); }
6413                         CResult_NoneLightningErrorZPtr { err }
6414                 };
6415                 Self {
6416                         contents,
6417                         result_ok: o.result_ok,
6418                 }
6419         }
6420 }
6421 impl Clone for CResult_NoneLightningErrorZ {
6422         fn clone(&self) -> Self {
6423                 if self.result_ok {
6424                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
6425                                 result: core::ptr::null_mut()
6426                         } }
6427                 } else {
6428                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
6429                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
6430                         } }
6431                 }
6432         }
6433 }
6434 #[no_mangle]
6435 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
6436 /// but with all dynamically-allocated buffers duplicated in new buffers.
6437 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
6438 #[repr(C)]
6439 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
6440 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
6441         /// A pointer to the contents in the success state.
6442         /// Reading from this pointer when `result_ok` is not set is undefined.
6443         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
6444         /// A pointer to the contents in the error state.
6445         /// Reading from this pointer when `result_ok` is set is undefined.
6446         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6447 }
6448 #[repr(C)]
6449 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
6450 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6452 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
6453         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
6454         /// `err` or `result` depending on the state of `result_ok`.
6455         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
6456         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
6457         pub result_ok: bool,
6458 }
6459 #[no_mangle]
6460 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
6461 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6462         CResult_ChannelUpdateInfoDecodeErrorZ {
6463                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6464                         result: Box::into_raw(Box::new(o)),
6465                 },
6466                 result_ok: true,
6467         }
6468 }
6469 #[no_mangle]
6470 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
6471 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
6472         CResult_ChannelUpdateInfoDecodeErrorZ {
6473                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6474                         err: Box::into_raw(Box::new(e)),
6475                 },
6476                 result_ok: false,
6477         }
6478 }
6479 /// Checks if the given object is currently in the success state
6480 #[no_mangle]
6481 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
6482         o.result_ok
6483 }
6484 #[no_mangle]
6485 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
6486 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
6487 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
6488         fn drop(&mut self) {
6489                 if self.result_ok {
6490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6492                         }
6493                 } else {
6494                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6495                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6496                         }
6497                 }
6498         }
6499 }
6500 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
6501         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6502                 let contents = if o.result_ok {
6503                         let result = unsafe { o.contents.result };
6504                         unsafe { o.contents.result = core::ptr::null_mut() };
6505                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
6506                 } else {
6507                         let err = unsafe { o.contents.err };
6508                         unsafe { o.contents.err = core::ptr::null_mut(); }
6509                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
6510                 };
6511                 Self {
6512                         contents,
6513                         result_ok: o.result_ok,
6514                 }
6515         }
6516 }
6517 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
6518         fn clone(&self) -> Self {
6519                 if self.result_ok {
6520                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6521                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
6522                         } }
6523                 } else {
6524                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
6525                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6526                         } }
6527                 }
6528         }
6529 }
6530 #[no_mangle]
6531 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
6532 /// but with all dynamically-allocated buffers duplicated in new buffers.
6533 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
6534 #[repr(C)]
6535 /// The contents of CResult_ChannelInfoDecodeErrorZ
6536 pub union CResult_ChannelInfoDecodeErrorZPtr {
6537         /// A pointer to the contents in the success state.
6538         /// Reading from this pointer when `result_ok` is not set is undefined.
6539         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
6540         /// A pointer to the contents in the error state.
6541         /// Reading from this pointer when `result_ok` is set is undefined.
6542         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6543 }
6544 #[repr(C)]
6545 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6546 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6548 pub struct CResult_ChannelInfoDecodeErrorZ {
6549         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6550         /// `err` or `result` depending on the state of `result_ok`.
6551         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
6552         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6553         pub result_ok: bool,
6554 }
6555 #[no_mangle]
6556 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
6557 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
6558         CResult_ChannelInfoDecodeErrorZ {
6559                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6560                         result: Box::into_raw(Box::new(o)),
6561                 },
6562                 result_ok: true,
6563         }
6564 }
6565 #[no_mangle]
6566 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
6567 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
6568         CResult_ChannelInfoDecodeErrorZ {
6569                 contents: CResult_ChannelInfoDecodeErrorZPtr {
6570                         err: Box::into_raw(Box::new(e)),
6571                 },
6572                 result_ok: false,
6573         }
6574 }
6575 /// Checks if the given object is currently in the success state
6576 #[no_mangle]
6577 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
6578         o.result_ok
6579 }
6580 #[no_mangle]
6581 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6582 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6583 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6584         fn drop(&mut self) {
6585                 if self.result_ok {
6586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6588                         }
6589                 } else {
6590                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6591                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6592                         }
6593                 }
6594         }
6595 }
6596 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6597         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6598                 let contents = if o.result_ok {
6599                         let result = unsafe { o.contents.result };
6600                         unsafe { o.contents.result = core::ptr::null_mut() };
6601                         CResult_ChannelInfoDecodeErrorZPtr { result }
6602                 } else {
6603                         let err = unsafe { o.contents.err };
6604                         unsafe { o.contents.err = core::ptr::null_mut(); }
6605                         CResult_ChannelInfoDecodeErrorZPtr { err }
6606                 };
6607                 Self {
6608                         contents,
6609                         result_ok: o.result_ok,
6610                 }
6611         }
6612 }
6613 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6614         fn clone(&self) -> Self {
6615                 if self.result_ok {
6616                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6617                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6618                         } }
6619                 } else {
6620                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6621                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6622                         } }
6623                 }
6624         }
6625 }
6626 #[no_mangle]
6627 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6628 /// but with all dynamically-allocated buffers duplicated in new buffers.
6629 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6630 #[repr(C)]
6631 /// The contents of CResult_RoutingFeesDecodeErrorZ
6632 pub union CResult_RoutingFeesDecodeErrorZPtr {
6633         /// A pointer to the contents in the success state.
6634         /// Reading from this pointer when `result_ok` is not set is undefined.
6635         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6636         /// A pointer to the contents in the error state.
6637         /// Reading from this pointer when `result_ok` is set is undefined.
6638         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6639 }
6640 #[repr(C)]
6641 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6642 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6643 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6644 pub struct CResult_RoutingFeesDecodeErrorZ {
6645         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6646         /// `err` or `result` depending on the state of `result_ok`.
6647         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6648         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6649         pub result_ok: bool,
6650 }
6651 #[no_mangle]
6652 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6653 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6654         CResult_RoutingFeesDecodeErrorZ {
6655                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6656                         result: Box::into_raw(Box::new(o)),
6657                 },
6658                 result_ok: true,
6659         }
6660 }
6661 #[no_mangle]
6662 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6663 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6664         CResult_RoutingFeesDecodeErrorZ {
6665                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6666                         err: Box::into_raw(Box::new(e)),
6667                 },
6668                 result_ok: false,
6669         }
6670 }
6671 /// Checks if the given object is currently in the success state
6672 #[no_mangle]
6673 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6674         o.result_ok
6675 }
6676 #[no_mangle]
6677 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6678 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6679 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6680         fn drop(&mut self) {
6681                 if self.result_ok {
6682                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6683                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6684                         }
6685                 } else {
6686                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6687                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6688                         }
6689                 }
6690         }
6691 }
6692 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6693         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6694                 let contents = if o.result_ok {
6695                         let result = unsafe { o.contents.result };
6696                         unsafe { o.contents.result = core::ptr::null_mut() };
6697                         CResult_RoutingFeesDecodeErrorZPtr { result }
6698                 } else {
6699                         let err = unsafe { o.contents.err };
6700                         unsafe { o.contents.err = core::ptr::null_mut(); }
6701                         CResult_RoutingFeesDecodeErrorZPtr { err }
6702                 };
6703                 Self {
6704                         contents,
6705                         result_ok: o.result_ok,
6706                 }
6707         }
6708 }
6709 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6710         fn clone(&self) -> Self {
6711                 if self.result_ok {
6712                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6713                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6714                         } }
6715                 } else {
6716                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6717                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6718                         } }
6719                 }
6720         }
6721 }
6722 #[no_mangle]
6723 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6724 /// but with all dynamically-allocated buffers duplicated in new buffers.
6725 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6726 #[repr(C)]
6727 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6728 /// This corresponds to std::vector in C++
6729 pub struct CVec_NetAddressZ {
6730         /// The elements in the array.
6731         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6732         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6733         /// The number of elements pointed to by `data`.
6734         pub datalen: usize
6735 }
6736 impl CVec_NetAddressZ {
6737         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6738                 if self.datalen == 0 { return Vec::new(); }
6739                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6740                 self.data = core::ptr::null_mut();
6741                 self.datalen = 0;
6742                 ret
6743         }
6744         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6745                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6746         }
6747 }
6748 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6749         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6750                 let datalen = v.len();
6751                 let data = Box::into_raw(v.into_boxed_slice());
6752                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6753         }
6754 }
6755 #[no_mangle]
6756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6757 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6758 impl Drop for CVec_NetAddressZ {
6759         fn drop(&mut self) {
6760                 if self.datalen == 0 { return; }
6761                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6762         }
6763 }
6764 impl Clone for CVec_NetAddressZ {
6765         fn clone(&self) -> Self {
6766                 let mut res = Vec::new();
6767                 if self.datalen == 0 { return Self::from(res); }
6768                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6769                 Self::from(res)
6770         }
6771 }
6772 #[repr(C)]
6773 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6774 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6775         /// A pointer to the contents in the success state.
6776         /// Reading from this pointer when `result_ok` is not set is undefined.
6777         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6778         /// A pointer to the contents in the error state.
6779         /// Reading from this pointer when `result_ok` is set is undefined.
6780         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6781 }
6782 #[repr(C)]
6783 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6786 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6787         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6788         /// `err` or `result` depending on the state of `result_ok`.
6789         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6790         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6791         pub result_ok: bool,
6792 }
6793 #[no_mangle]
6794 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6796         CResult_NodeAnnouncementInfoDecodeErrorZ {
6797                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6798                         result: Box::into_raw(Box::new(o)),
6799                 },
6800                 result_ok: true,
6801         }
6802 }
6803 #[no_mangle]
6804 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6806         CResult_NodeAnnouncementInfoDecodeErrorZ {
6807                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6808                         err: Box::into_raw(Box::new(e)),
6809                 },
6810                 result_ok: false,
6811         }
6812 }
6813 /// Checks if the given object is currently in the success state
6814 #[no_mangle]
6815 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6816         o.result_ok
6817 }
6818 #[no_mangle]
6819 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6820 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6821 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6822         fn drop(&mut self) {
6823                 if self.result_ok {
6824                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6825                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6826                         }
6827                 } else {
6828                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6829                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6830                         }
6831                 }
6832         }
6833 }
6834 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6835         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6836                 let contents = if o.result_ok {
6837                         let result = unsafe { o.contents.result };
6838                         unsafe { o.contents.result = core::ptr::null_mut() };
6839                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6840                 } else {
6841                         let err = unsafe { o.contents.err };
6842                         unsafe { o.contents.err = core::ptr::null_mut(); }
6843                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6844                 };
6845                 Self {
6846                         contents,
6847                         result_ok: o.result_ok,
6848                 }
6849         }
6850 }
6851 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6852         fn clone(&self) -> Self {
6853                 if self.result_ok {
6854                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6855                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6856                         } }
6857                 } else {
6858                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6859                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6860                         } }
6861                 }
6862         }
6863 }
6864 #[no_mangle]
6865 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6866 /// but with all dynamically-allocated buffers duplicated in new buffers.
6867 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6868 #[repr(C)]
6869 /// The contents of CResult_NodeAliasDecodeErrorZ
6870 pub union CResult_NodeAliasDecodeErrorZPtr {
6871         /// A pointer to the contents in the success state.
6872         /// Reading from this pointer when `result_ok` is not set is undefined.
6873         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6874         /// A pointer to the contents in the error state.
6875         /// Reading from this pointer when `result_ok` is set is undefined.
6876         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6877 }
6878 #[repr(C)]
6879 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6880 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6881 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6882 pub struct CResult_NodeAliasDecodeErrorZ {
6883         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6884         /// `err` or `result` depending on the state of `result_ok`.
6885         pub contents: CResult_NodeAliasDecodeErrorZPtr,
6886         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6887         pub result_ok: bool,
6888 }
6889 #[no_mangle]
6890 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6891 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6892         CResult_NodeAliasDecodeErrorZ {
6893                 contents: CResult_NodeAliasDecodeErrorZPtr {
6894                         result: Box::into_raw(Box::new(o)),
6895                 },
6896                 result_ok: true,
6897         }
6898 }
6899 #[no_mangle]
6900 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6901 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6902         CResult_NodeAliasDecodeErrorZ {
6903                 contents: CResult_NodeAliasDecodeErrorZPtr {
6904                         err: Box::into_raw(Box::new(e)),
6905                 },
6906                 result_ok: false,
6907         }
6908 }
6909 /// Checks if the given object is currently in the success state
6910 #[no_mangle]
6911 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6912         o.result_ok
6913 }
6914 #[no_mangle]
6915 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6916 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6917 impl Drop for CResult_NodeAliasDecodeErrorZ {
6918         fn drop(&mut self) {
6919                 if self.result_ok {
6920                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6921                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6922                         }
6923                 } else {
6924                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6925                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6926                         }
6927                 }
6928         }
6929 }
6930 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6931         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6932                 let contents = if o.result_ok {
6933                         let result = unsafe { o.contents.result };
6934                         unsafe { o.contents.result = core::ptr::null_mut() };
6935                         CResult_NodeAliasDecodeErrorZPtr { result }
6936                 } else {
6937                         let err = unsafe { o.contents.err };
6938                         unsafe { o.contents.err = core::ptr::null_mut(); }
6939                         CResult_NodeAliasDecodeErrorZPtr { err }
6940                 };
6941                 Self {
6942                         contents,
6943                         result_ok: o.result_ok,
6944                 }
6945         }
6946 }
6947 impl Clone for CResult_NodeAliasDecodeErrorZ {
6948         fn clone(&self) -> Self {
6949                 if self.result_ok {
6950                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6951                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6952                         } }
6953                 } else {
6954                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6955                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6956                         } }
6957                 }
6958         }
6959 }
6960 #[no_mangle]
6961 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6962 /// but with all dynamically-allocated buffers duplicated in new buffers.
6963 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6964 #[repr(C)]
6965 /// The contents of CResult_NodeInfoDecodeErrorZ
6966 pub union CResult_NodeInfoDecodeErrorZPtr {
6967         /// A pointer to the contents in the success state.
6968         /// Reading from this pointer when `result_ok` is not set is undefined.
6969         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6970         /// A pointer to the contents in the error state.
6971         /// Reading from this pointer when `result_ok` is set is undefined.
6972         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6973 }
6974 #[repr(C)]
6975 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6976 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6977 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6978 pub struct CResult_NodeInfoDecodeErrorZ {
6979         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6980         /// `err` or `result` depending on the state of `result_ok`.
6981         pub contents: CResult_NodeInfoDecodeErrorZPtr,
6982         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6983         pub result_ok: bool,
6984 }
6985 #[no_mangle]
6986 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6987 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6988         CResult_NodeInfoDecodeErrorZ {
6989                 contents: CResult_NodeInfoDecodeErrorZPtr {
6990                         result: Box::into_raw(Box::new(o)),
6991                 },
6992                 result_ok: true,
6993         }
6994 }
6995 #[no_mangle]
6996 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6997 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6998         CResult_NodeInfoDecodeErrorZ {
6999                 contents: CResult_NodeInfoDecodeErrorZPtr {
7000                         err: Box::into_raw(Box::new(e)),
7001                 },
7002                 result_ok: false,
7003         }
7004 }
7005 /// Checks if the given object is currently in the success state
7006 #[no_mangle]
7007 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
7008         o.result_ok
7009 }
7010 #[no_mangle]
7011 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
7012 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
7013 impl Drop for CResult_NodeInfoDecodeErrorZ {
7014         fn drop(&mut self) {
7015                 if self.result_ok {
7016                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7017                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7018                         }
7019                 } else {
7020                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7021                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7022                         }
7023                 }
7024         }
7025 }
7026 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
7027         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7028                 let contents = if o.result_ok {
7029                         let result = unsafe { o.contents.result };
7030                         unsafe { o.contents.result = core::ptr::null_mut() };
7031                         CResult_NodeInfoDecodeErrorZPtr { result }
7032                 } else {
7033                         let err = unsafe { o.contents.err };
7034                         unsafe { o.contents.err = core::ptr::null_mut(); }
7035                         CResult_NodeInfoDecodeErrorZPtr { err }
7036                 };
7037                 Self {
7038                         contents,
7039                         result_ok: o.result_ok,
7040                 }
7041         }
7042 }
7043 impl Clone for CResult_NodeInfoDecodeErrorZ {
7044         fn clone(&self) -> Self {
7045                 if self.result_ok {
7046                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
7047                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
7048                         } }
7049                 } else {
7050                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
7051                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7052                         } }
7053                 }
7054         }
7055 }
7056 #[no_mangle]
7057 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
7058 /// but with all dynamically-allocated buffers duplicated in new buffers.
7059 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
7060 #[repr(C)]
7061 /// The contents of CResult_NetworkGraphDecodeErrorZ
7062 pub union CResult_NetworkGraphDecodeErrorZPtr {
7063         /// A pointer to the contents in the success state.
7064         /// Reading from this pointer when `result_ok` is not set is undefined.
7065         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
7066         /// A pointer to the contents in the error state.
7067         /// Reading from this pointer when `result_ok` is set is undefined.
7068         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7069 }
7070 #[repr(C)]
7071 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
7072 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
7073 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7074 pub struct CResult_NetworkGraphDecodeErrorZ {
7075         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
7076         /// `err` or `result` depending on the state of `result_ok`.
7077         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
7078         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
7079         pub result_ok: bool,
7080 }
7081 #[no_mangle]
7082 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
7083 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
7084         CResult_NetworkGraphDecodeErrorZ {
7085                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7086                         result: Box::into_raw(Box::new(o)),
7087                 },
7088                 result_ok: true,
7089         }
7090 }
7091 #[no_mangle]
7092 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
7093 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
7094         CResult_NetworkGraphDecodeErrorZ {
7095                 contents: CResult_NetworkGraphDecodeErrorZPtr {
7096                         err: Box::into_raw(Box::new(e)),
7097                 },
7098                 result_ok: false,
7099         }
7100 }
7101 /// Checks if the given object is currently in the success state
7102 #[no_mangle]
7103 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
7104         o.result_ok
7105 }
7106 #[no_mangle]
7107 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
7108 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
7109 impl Drop for CResult_NetworkGraphDecodeErrorZ {
7110         fn drop(&mut self) {
7111                 if self.result_ok {
7112                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7113                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7114                         }
7115                 } else {
7116                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7117                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7118                         }
7119                 }
7120         }
7121 }
7122 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
7123         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
7124                 let contents = if o.result_ok {
7125                         let result = unsafe { o.contents.result };
7126                         unsafe { o.contents.result = core::ptr::null_mut() };
7127                         CResult_NetworkGraphDecodeErrorZPtr { result }
7128                 } else {
7129                         let err = unsafe { o.contents.err };
7130                         unsafe { o.contents.err = core::ptr::null_mut(); }
7131                         CResult_NetworkGraphDecodeErrorZPtr { err }
7132                 };
7133                 Self {
7134                         contents,
7135                         result_ok: o.result_ok,
7136                 }
7137         }
7138 }
7139 #[repr(C)]
7140 #[derive(Clone)]
7141 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
7142 pub enum COption_CVec_NetAddressZZ {
7143         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
7144         Some(crate::c_types::derived::CVec_NetAddressZ),
7145         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
7146         None
7147 }
7148 impl COption_CVec_NetAddressZZ {
7149         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7150                 if let Self::None = self { false } else { true }
7151         }
7152         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7153                 !self.is_some()
7154         }
7155         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
7156                 if let Self::Some(v) = self { v } else { unreachable!() }
7157         }
7158 }
7159 #[no_mangle]
7160 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
7161 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
7162         COption_CVec_NetAddressZZ::Some(o)
7163 }
7164 #[no_mangle]
7165 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
7166 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
7167         COption_CVec_NetAddressZZ::None
7168 }
7169 #[no_mangle]
7170 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
7171 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
7172 #[no_mangle]
7173 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
7174 /// but with all dynamically-allocated buffers duplicated in new buffers.
7175 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
7176 #[repr(C)]
7177 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
7178 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7179         /// A pointer to the contents in the success state.
7180         /// Reading from this pointer when `result_ok` is not set is undefined.
7181         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
7182         /// A pointer to the contents in the error state.
7183         /// Reading from this pointer when `result_ok` is set is undefined.
7184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7185 }
7186 #[repr(C)]
7187 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7188 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7190 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7191         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
7192         /// `err` or `result` depending on the state of `result_ok`.
7193         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
7194         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
7195         pub result_ok: bool,
7196 }
7197 #[no_mangle]
7198 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
7199 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7200         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7201                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7202                         result: Box::into_raw(Box::new(o)),
7203                 },
7204                 result_ok: true,
7205         }
7206 }
7207 #[no_mangle]
7208 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
7209 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7210         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7211                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7212                         err: Box::into_raw(Box::new(e)),
7213                 },
7214                 result_ok: false,
7215         }
7216 }
7217 /// Checks if the given object is currently in the success state
7218 #[no_mangle]
7219 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
7220         o.result_ok
7221 }
7222 #[no_mangle]
7223 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
7224 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
7225 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7226         fn drop(&mut self) {
7227                 if self.result_ok {
7228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7230                         }
7231                 } else {
7232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7234                         }
7235                 }
7236         }
7237 }
7238 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7240                 let contents = if o.result_ok {
7241                         let result = unsafe { o.contents.result };
7242                         unsafe { o.contents.result = core::ptr::null_mut() };
7243                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
7244                 } else {
7245                         let err = unsafe { o.contents.err };
7246                         unsafe { o.contents.err = core::ptr::null_mut(); }
7247                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
7248                 };
7249                 Self {
7250                         contents,
7251                         result_ok: o.result_ok,
7252                 }
7253         }
7254 }
7255 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
7256         fn clone(&self) -> Self {
7257                 if self.result_ok {
7258                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7259                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7260                         } }
7261                 } else {
7262                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
7263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7264                         } }
7265                 }
7266         }
7267 }
7268 #[no_mangle]
7269 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
7270 /// but with all dynamically-allocated buffers duplicated in new buffers.
7271 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7272 #[repr(C)]
7273 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
7274 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7275         /// A pointer to the contents in the success state.
7276         /// Reading from this pointer when `result_ok` is not set is undefined.
7277         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
7278         /// A pointer to the contents in the error state.
7279         /// Reading from this pointer when `result_ok` is set is undefined.
7280         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7281 }
7282 #[repr(C)]
7283 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7284 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7286 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7287         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
7288         /// `err` or `result` depending on the state of `result_ok`.
7289         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
7290         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
7291         pub result_ok: bool,
7292 }
7293 #[no_mangle]
7294 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
7295 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7296         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7297                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7298                         result: Box::into_raw(Box::new(o)),
7299                 },
7300                 result_ok: true,
7301         }
7302 }
7303 #[no_mangle]
7304 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
7305 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7306         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7307                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7308                         err: Box::into_raw(Box::new(e)),
7309                 },
7310                 result_ok: false,
7311         }
7312 }
7313 /// Checks if the given object is currently in the success state
7314 #[no_mangle]
7315 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
7316         o.result_ok
7317 }
7318 #[no_mangle]
7319 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
7320 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
7321 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7322         fn drop(&mut self) {
7323                 if self.result_ok {
7324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7326                         }
7327                 } else {
7328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7330                         }
7331                 }
7332         }
7333 }
7334 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7336                 let contents = if o.result_ok {
7337                         let result = unsafe { o.contents.result };
7338                         unsafe { o.contents.result = core::ptr::null_mut() };
7339                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
7340                 } else {
7341                         let err = unsafe { o.contents.err };
7342                         unsafe { o.contents.err = core::ptr::null_mut(); }
7343                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
7344                 };
7345                 Self {
7346                         contents,
7347                         result_ok: o.result_ok,
7348                 }
7349         }
7350 }
7351 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
7352         fn clone(&self) -> Self {
7353                 if self.result_ok {
7354                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7355                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7356                         } }
7357                 } else {
7358                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
7359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7360                         } }
7361                 }
7362         }
7363 }
7364 #[no_mangle]
7365 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
7366 /// but with all dynamically-allocated buffers duplicated in new buffers.
7367 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7368 #[repr(C)]
7369 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7370 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7371         /// A pointer to the contents in the success state.
7372         /// Reading from this pointer when `result_ok` is not set is undefined.
7373         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
7374         /// A pointer to the contents in the error state.
7375         /// Reading from this pointer when `result_ok` is set is undefined.
7376         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7377 }
7378 #[repr(C)]
7379 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7380 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7382 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
7383         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7384         /// `err` or `result` depending on the state of `result_ok`.
7385         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
7386         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7387         pub result_ok: bool,
7388 }
7389 #[no_mangle]
7390 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
7391 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7392         CResult_SpendableOutputDescriptorDecodeErrorZ {
7393                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7394                         result: Box::into_raw(Box::new(o)),
7395                 },
7396                 result_ok: true,
7397         }
7398 }
7399 #[no_mangle]
7400 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
7401 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7402         CResult_SpendableOutputDescriptorDecodeErrorZ {
7403                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7404                         err: Box::into_raw(Box::new(e)),
7405                 },
7406                 result_ok: false,
7407         }
7408 }
7409 /// Checks if the given object is currently in the success state
7410 #[no_mangle]
7411 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
7412         o.result_ok
7413 }
7414 #[no_mangle]
7415 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
7416 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
7417 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
7418         fn drop(&mut self) {
7419                 if self.result_ok {
7420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7422                         }
7423                 } else {
7424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7426                         }
7427                 }
7428         }
7429 }
7430 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
7431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7432                 let contents = if o.result_ok {
7433                         let result = unsafe { o.contents.result };
7434                         unsafe { o.contents.result = core::ptr::null_mut() };
7435                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
7436                 } else {
7437                         let err = unsafe { o.contents.err };
7438                         unsafe { o.contents.err = core::ptr::null_mut(); }
7439                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
7440                 };
7441                 Self {
7442                         contents,
7443                         result_ok: o.result_ok,
7444                 }
7445         }
7446 }
7447 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
7448         fn clone(&self) -> Self {
7449                 if self.result_ok {
7450                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7451                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7452                         } }
7453                 } else {
7454                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7455                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7456                         } }
7457                 }
7458         }
7459 }
7460 #[no_mangle]
7461 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
7462 /// but with all dynamically-allocated buffers duplicated in new buffers.
7463 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
7464 #[repr(C)]
7465 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7466 /// This corresponds to std::vector in C++
7467 pub struct CVec_PaymentPreimageZ {
7468         /// The elements in the array.
7469         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7470         pub data: *mut crate::c_types::ThirtyTwoBytes,
7471         /// The number of elements pointed to by `data`.
7472         pub datalen: usize
7473 }
7474 impl CVec_PaymentPreimageZ {
7475         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
7476                 if self.datalen == 0 { return Vec::new(); }
7477                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7478                 self.data = core::ptr::null_mut();
7479                 self.datalen = 0;
7480                 ret
7481         }
7482         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
7483                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7484         }
7485 }
7486 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
7487         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
7488                 let datalen = v.len();
7489                 let data = Box::into_raw(v.into_boxed_slice());
7490                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7491         }
7492 }
7493 #[no_mangle]
7494 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7495 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
7496 impl Drop for CVec_PaymentPreimageZ {
7497         fn drop(&mut self) {
7498                 if self.datalen == 0 { return; }
7499                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7500         }
7501 }
7502 impl Clone for CVec_PaymentPreimageZ {
7503         fn clone(&self) -> Self {
7504                 let mut res = Vec::new();
7505                 if self.datalen == 0 { return Self::from(res); }
7506                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7507                 Self::from(res)
7508         }
7509 }
7510 #[repr(C)]
7511 /// A tuple of 2 elements. See the individual fields for the types contained.
7512 pub struct C2Tuple_SignatureCVec_SignatureZZ {
7513         /// The element at position 0
7514         pub a: crate::c_types::Signature,
7515         /// The element at position 1
7516         pub b: crate::c_types::derived::CVec_SignatureZ,
7517 }
7518 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
7519         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
7520                 Self {
7521                         a: tup.0,
7522                         b: tup.1,
7523                 }
7524         }
7525 }
7526 impl C2Tuple_SignatureCVec_SignatureZZ {
7527         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
7528                 (self.a, self.b)
7529         }
7530 }
7531 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
7532         fn clone(&self) -> Self {
7533                 Self {
7534                         a: Clone::clone(&self.a),
7535                         b: Clone::clone(&self.b),
7536                 }
7537         }
7538 }
7539 #[no_mangle]
7540 /// Creates a new tuple which has the same data as `orig`
7541 /// but with all dynamically-allocated buffers duplicated in new buffers.
7542 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
7543 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
7544 #[no_mangle]
7545 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
7546         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
7547 }
7548
7549 #[no_mangle]
7550 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
7551 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
7552 #[repr(C)]
7553 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7554 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7555         /// A pointer to the contents in the success state.
7556         /// Reading from this pointer when `result_ok` is not set is undefined.
7557         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
7558         /// Note that this value is always NULL, as there are no contents in the Err variant
7559         pub err: *mut core::ffi::c_void,
7560 }
7561 #[repr(C)]
7562 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
7563 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
7564 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7565 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7566         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
7567         /// `err` or `result` depending on the state of `result_ok`.
7568         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
7569         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
7570         pub result_ok: bool,
7571 }
7572 #[no_mangle]
7573 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
7574 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7575         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7576                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7577                         result: Box::into_raw(Box::new(o)),
7578                 },
7579                 result_ok: true,
7580         }
7581 }
7582 #[no_mangle]
7583 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
7584 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7585         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7586                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7587                         err: core::ptr::null_mut(),
7588                 },
7589                 result_ok: false,
7590         }
7591 }
7592 /// Checks if the given object is currently in the success state
7593 #[no_mangle]
7594 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
7595         o.result_ok
7596 }
7597 #[no_mangle]
7598 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
7599 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
7600 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7601         fn drop(&mut self) {
7602                 if self.result_ok {
7603                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7604                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7605                         }
7606                 } else {
7607                 }
7608         }
7609 }
7610 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7611         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
7612                 let contents = if o.result_ok {
7613                         let result = unsafe { o.contents.result };
7614                         unsafe { o.contents.result = core::ptr::null_mut() };
7615                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
7616                 } else {
7617                         let _ = unsafe { Box::from_raw(o.contents.err) };
7618                         o.contents.err = core::ptr::null_mut();
7619                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
7620                 };
7621                 Self {
7622                         contents,
7623                         result_ok: o.result_ok,
7624                 }
7625         }
7626 }
7627 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7628         fn clone(&self) -> Self {
7629                 if self.result_ok {
7630                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7631                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
7632                         } }
7633                 } else {
7634                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7635                                 err: core::ptr::null_mut()
7636                         } }
7637                 }
7638         }
7639 }
7640 #[no_mangle]
7641 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
7642 /// but with all dynamically-allocated buffers duplicated in new buffers.
7643 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
7644 #[repr(C)]
7645 /// The contents of CResult_SignatureNoneZ
7646 pub union CResult_SignatureNoneZPtr {
7647         /// A pointer to the contents in the success state.
7648         /// Reading from this pointer when `result_ok` is not set is undefined.
7649         pub result: *mut crate::c_types::Signature,
7650         /// Note that this value is always NULL, as there are no contents in the Err variant
7651         pub err: *mut core::ffi::c_void,
7652 }
7653 #[repr(C)]
7654 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
7655 /// containing a crate::c_types::Signature on success and a () on failure.
7656 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7657 pub struct CResult_SignatureNoneZ {
7658         /// The contents of this CResult_SignatureNoneZ, accessible via either
7659         /// `err` or `result` depending on the state of `result_ok`.
7660         pub contents: CResult_SignatureNoneZPtr,
7661         /// Whether this CResult_SignatureNoneZ represents a success state.
7662         pub result_ok: bool,
7663 }
7664 #[no_mangle]
7665 /// Creates a new CResult_SignatureNoneZ in the success state.
7666 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
7667         CResult_SignatureNoneZ {
7668                 contents: CResult_SignatureNoneZPtr {
7669                         result: Box::into_raw(Box::new(o)),
7670                 },
7671                 result_ok: true,
7672         }
7673 }
7674 #[no_mangle]
7675 /// Creates a new CResult_SignatureNoneZ in the error state.
7676 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
7677         CResult_SignatureNoneZ {
7678                 contents: CResult_SignatureNoneZPtr {
7679                         err: core::ptr::null_mut(),
7680                 },
7681                 result_ok: false,
7682         }
7683 }
7684 /// Checks if the given object is currently in the success state
7685 #[no_mangle]
7686 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
7687         o.result_ok
7688 }
7689 #[no_mangle]
7690 /// Frees any resources used by the CResult_SignatureNoneZ.
7691 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
7692 impl Drop for CResult_SignatureNoneZ {
7693         fn drop(&mut self) {
7694                 if self.result_ok {
7695                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7696                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7697                         }
7698                 } else {
7699                 }
7700         }
7701 }
7702 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
7703         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
7704                 let contents = if o.result_ok {
7705                         let result = unsafe { o.contents.result };
7706                         unsafe { o.contents.result = core::ptr::null_mut() };
7707                         CResult_SignatureNoneZPtr { result }
7708                 } else {
7709                         let _ = unsafe { Box::from_raw(o.contents.err) };
7710                         o.contents.err = core::ptr::null_mut();
7711                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
7712                 };
7713                 Self {
7714                         contents,
7715                         result_ok: o.result_ok,
7716                 }
7717         }
7718 }
7719 impl Clone for CResult_SignatureNoneZ {
7720         fn clone(&self) -> Self {
7721                 if self.result_ok {
7722                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
7723                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
7724                         } }
7725                 } else {
7726                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
7727                                 err: core::ptr::null_mut()
7728                         } }
7729                 }
7730         }
7731 }
7732 #[no_mangle]
7733 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
7734 /// but with all dynamically-allocated buffers duplicated in new buffers.
7735 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
7736 #[repr(C)]
7737 /// The contents of CResult_PublicKeyNoneZ
7738 pub union CResult_PublicKeyNoneZPtr {
7739         /// A pointer to the contents in the success state.
7740         /// Reading from this pointer when `result_ok` is not set is undefined.
7741         pub result: *mut crate::c_types::PublicKey,
7742         /// Note that this value is always NULL, as there are no contents in the Err variant
7743         pub err: *mut core::ffi::c_void,
7744 }
7745 #[repr(C)]
7746 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7747 /// containing a crate::c_types::PublicKey on success and a () on failure.
7748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749 pub struct CResult_PublicKeyNoneZ {
7750         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7751         /// `err` or `result` depending on the state of `result_ok`.
7752         pub contents: CResult_PublicKeyNoneZPtr,
7753         /// Whether this CResult_PublicKeyNoneZ represents a success state.
7754         pub result_ok: bool,
7755 }
7756 #[no_mangle]
7757 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7758 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7759         CResult_PublicKeyNoneZ {
7760                 contents: CResult_PublicKeyNoneZPtr {
7761                         result: Box::into_raw(Box::new(o)),
7762                 },
7763                 result_ok: true,
7764         }
7765 }
7766 #[no_mangle]
7767 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7768 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7769         CResult_PublicKeyNoneZ {
7770                 contents: CResult_PublicKeyNoneZPtr {
7771                         err: core::ptr::null_mut(),
7772                 },
7773                 result_ok: false,
7774         }
7775 }
7776 /// Checks if the given object is currently in the success state
7777 #[no_mangle]
7778 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7779         o.result_ok
7780 }
7781 #[no_mangle]
7782 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7783 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7784 impl Drop for CResult_PublicKeyNoneZ {
7785         fn drop(&mut self) {
7786                 if self.result_ok {
7787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7789                         }
7790                 } else {
7791                 }
7792         }
7793 }
7794 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7795         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7796                 let contents = if o.result_ok {
7797                         let result = unsafe { o.contents.result };
7798                         unsafe { o.contents.result = core::ptr::null_mut() };
7799                         CResult_PublicKeyNoneZPtr { result }
7800                 } else {
7801                         let _ = unsafe { Box::from_raw(o.contents.err) };
7802                         o.contents.err = core::ptr::null_mut();
7803                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7804                 };
7805                 Self {
7806                         contents,
7807                         result_ok: o.result_ok,
7808                 }
7809         }
7810 }
7811 impl Clone for CResult_PublicKeyNoneZ {
7812         fn clone(&self) -> Self {
7813                 if self.result_ok {
7814                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7815                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7816                         } }
7817                 } else {
7818                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7819                                 err: core::ptr::null_mut()
7820                         } }
7821                 }
7822         }
7823 }
7824 #[no_mangle]
7825 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7826 /// but with all dynamically-allocated buffers duplicated in new buffers.
7827 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7828 #[repr(C)]
7829 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7830 pub enum COption_ScalarZ {
7831         /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7832         Some(crate::c_types::BigEndianScalar),
7833         /// When we're in this state, this COption_ScalarZ contains nothing
7834         None
7835 }
7836 impl COption_ScalarZ {
7837         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7838                 if let Self::None = self { false } else { true }
7839         }
7840         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7841                 !self.is_some()
7842         }
7843         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7844                 if let Self::Some(v) = self { v } else { unreachable!() }
7845         }
7846 }
7847 #[no_mangle]
7848 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7849 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7850         COption_ScalarZ::Some(o)
7851 }
7852 #[no_mangle]
7853 /// Constructs a new COption_ScalarZ containing nothing
7854 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7855         COption_ScalarZ::None
7856 }
7857 #[no_mangle]
7858 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7859 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7860 #[repr(C)]
7861 /// The contents of CResult_SharedSecretNoneZ
7862 pub union CResult_SharedSecretNoneZPtr {
7863         /// A pointer to the contents in the success state.
7864         /// Reading from this pointer when `result_ok` is not set is undefined.
7865         pub result: *mut crate::c_types::ThirtyTwoBytes,
7866         /// Note that this value is always NULL, as there are no contents in the Err variant
7867         pub err: *mut core::ffi::c_void,
7868 }
7869 #[repr(C)]
7870 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7871 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7873 pub struct CResult_SharedSecretNoneZ {
7874         /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7875         /// `err` or `result` depending on the state of `result_ok`.
7876         pub contents: CResult_SharedSecretNoneZPtr,
7877         /// Whether this CResult_SharedSecretNoneZ represents a success state.
7878         pub result_ok: bool,
7879 }
7880 #[no_mangle]
7881 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7882 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7883         CResult_SharedSecretNoneZ {
7884                 contents: CResult_SharedSecretNoneZPtr {
7885                         result: Box::into_raw(Box::new(o)),
7886                 },
7887                 result_ok: true,
7888         }
7889 }
7890 #[no_mangle]
7891 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7892 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7893         CResult_SharedSecretNoneZ {
7894                 contents: CResult_SharedSecretNoneZPtr {
7895                         err: core::ptr::null_mut(),
7896                 },
7897                 result_ok: false,
7898         }
7899 }
7900 /// Checks if the given object is currently in the success state
7901 #[no_mangle]
7902 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7903         o.result_ok
7904 }
7905 #[no_mangle]
7906 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7907 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7908 impl Drop for CResult_SharedSecretNoneZ {
7909         fn drop(&mut self) {
7910                 if self.result_ok {
7911                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7912                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7913                         }
7914                 } else {
7915                 }
7916         }
7917 }
7918 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7919         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7920                 let contents = if o.result_ok {
7921                         let result = unsafe { o.contents.result };
7922                         unsafe { o.contents.result = core::ptr::null_mut() };
7923                         CResult_SharedSecretNoneZPtr { result }
7924                 } else {
7925                         let _ = unsafe { Box::from_raw(o.contents.err) };
7926                         o.contents.err = core::ptr::null_mut();
7927                         CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7928                 };
7929                 Self {
7930                         contents,
7931                         result_ok: o.result_ok,
7932                 }
7933         }
7934 }
7935 impl Clone for CResult_SharedSecretNoneZ {
7936         fn clone(&self) -> Self {
7937                 if self.result_ok {
7938                         Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7939                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7940                         } }
7941                 } else {
7942                         Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7943                                 err: core::ptr::null_mut()
7944                         } }
7945                 }
7946         }
7947 }
7948 #[no_mangle]
7949 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7950 /// but with all dynamically-allocated buffers duplicated in new buffers.
7951 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7952 #[repr(C)]
7953 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7954 /// This corresponds to std::vector in C++
7955 pub struct CVec_U5Z {
7956         /// The elements in the array.
7957         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7958         pub data: *mut crate::c_types::U5,
7959         /// The number of elements pointed to by `data`.
7960         pub datalen: usize
7961 }
7962 impl CVec_U5Z {
7963         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7964                 if self.datalen == 0 { return Vec::new(); }
7965                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7966                 self.data = core::ptr::null_mut();
7967                 self.datalen = 0;
7968                 ret
7969         }
7970         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7971                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7972         }
7973 }
7974 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7975         fn from(v: Vec<crate::c_types::U5>) -> Self {
7976                 let datalen = v.len();
7977                 let data = Box::into_raw(v.into_boxed_slice());
7978                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7979         }
7980 }
7981 #[no_mangle]
7982 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7983 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7984 impl Drop for CVec_U5Z {
7985         fn drop(&mut self) {
7986                 if self.datalen == 0 { return; }
7987                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7988         }
7989 }
7990 impl Clone for CVec_U5Z {
7991         fn clone(&self) -> Self {
7992                 let mut res = Vec::new();
7993                 if self.datalen == 0 { return Self::from(res); }
7994                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7995                 Self::from(res)
7996         }
7997 }
7998 #[repr(C)]
7999 /// The contents of CResult_RecoverableSignatureNoneZ
8000 pub union CResult_RecoverableSignatureNoneZPtr {
8001         /// A pointer to the contents in the success state.
8002         /// Reading from this pointer when `result_ok` is not set is undefined.
8003         pub result: *mut crate::c_types::RecoverableSignature,
8004         /// Note that this value is always NULL, as there are no contents in the Err variant
8005         pub err: *mut core::ffi::c_void,
8006 }
8007 #[repr(C)]
8008 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
8009 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
8010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8011 pub struct CResult_RecoverableSignatureNoneZ {
8012         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
8013         /// `err` or `result` depending on the state of `result_ok`.
8014         pub contents: CResult_RecoverableSignatureNoneZPtr,
8015         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
8016         pub result_ok: bool,
8017 }
8018 #[no_mangle]
8019 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
8020 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
8021         CResult_RecoverableSignatureNoneZ {
8022                 contents: CResult_RecoverableSignatureNoneZPtr {
8023                         result: Box::into_raw(Box::new(o)),
8024                 },
8025                 result_ok: true,
8026         }
8027 }
8028 #[no_mangle]
8029 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
8030 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
8031         CResult_RecoverableSignatureNoneZ {
8032                 contents: CResult_RecoverableSignatureNoneZPtr {
8033                         err: core::ptr::null_mut(),
8034                 },
8035                 result_ok: false,
8036         }
8037 }
8038 /// Checks if the given object is currently in the success state
8039 #[no_mangle]
8040 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
8041         o.result_ok
8042 }
8043 #[no_mangle]
8044 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
8045 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
8046 impl Drop for CResult_RecoverableSignatureNoneZ {
8047         fn drop(&mut self) {
8048                 if self.result_ok {
8049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8051                         }
8052                 } else {
8053                 }
8054         }
8055 }
8056 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
8057         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
8058                 let contents = if o.result_ok {
8059                         let result = unsafe { o.contents.result };
8060                         unsafe { o.contents.result = core::ptr::null_mut() };
8061                         CResult_RecoverableSignatureNoneZPtr { result }
8062                 } else {
8063                         let _ = unsafe { Box::from_raw(o.contents.err) };
8064                         o.contents.err = core::ptr::null_mut();
8065                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
8066                 };
8067                 Self {
8068                         contents,
8069                         result_ok: o.result_ok,
8070                 }
8071         }
8072 }
8073 impl Clone for CResult_RecoverableSignatureNoneZ {
8074         fn clone(&self) -> Self {
8075                 if self.result_ok {
8076                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
8077                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
8078                         } }
8079                 } else {
8080                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
8081                                 err: core::ptr::null_mut()
8082                         } }
8083                 }
8084         }
8085 }
8086 #[no_mangle]
8087 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
8088 /// but with all dynamically-allocated buffers duplicated in new buffers.
8089 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
8090 #[repr(C)]
8091 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
8092 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8093         /// A pointer to the contents in the success state.
8094         /// Reading from this pointer when `result_ok` is not set is undefined.
8095         pub result: *mut crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner,
8096         /// A pointer to the contents in the error state.
8097         /// Reading from this pointer when `result_ok` is set is undefined.
8098         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8099 }
8100 #[repr(C)]
8101 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
8102 /// containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8103 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8104 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8105         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
8106         /// `err` or `result` depending on the state of `result_ok`.
8107         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
8108         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
8109         pub result_ok: bool,
8110 }
8111 #[no_mangle]
8112 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
8113 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8114         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8115                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8116                         result: Box::into_raw(Box::new(o)),
8117                 },
8118                 result_ok: true,
8119         }
8120 }
8121 #[no_mangle]
8122 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
8123 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8124         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8125                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
8126                         err: Box::into_raw(Box::new(e)),
8127                 },
8128                 result_ok: false,
8129         }
8130 }
8131 /// Checks if the given object is currently in the success state
8132 #[no_mangle]
8133 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
8134         o.result_ok
8135 }
8136 #[no_mangle]
8137 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
8138 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
8139 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8140         fn drop(&mut self) {
8141                 if self.result_ok {
8142                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8143                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8144                         }
8145                 } else {
8146                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8147                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8148                         }
8149                 }
8150         }
8151 }
8152 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
8153         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8154                 let contents = if o.result_ok {
8155                         let result = unsafe { o.contents.result };
8156                         unsafe { o.contents.result = core::ptr::null_mut() };
8157                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
8158                 } else {
8159                         let err = unsafe { o.contents.err };
8160                         unsafe { o.contents.err = core::ptr::null_mut(); }
8161                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
8162                 };
8163                 Self {
8164                         contents,
8165                         result_ok: o.result_ok,
8166                 }
8167         }
8168 }
8169 #[repr(C)]
8170 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8171 /// This corresponds to std::vector in C++
8172 pub struct CVec_CVec_u8ZZ {
8173         /// The elements in the array.
8174         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8175         pub data: *mut crate::c_types::derived::CVec_u8Z,
8176         /// The number of elements pointed to by `data`.
8177         pub datalen: usize
8178 }
8179 impl CVec_CVec_u8ZZ {
8180         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8181                 if self.datalen == 0 { return Vec::new(); }
8182                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8183                 self.data = core::ptr::null_mut();
8184                 self.datalen = 0;
8185                 ret
8186         }
8187         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8188                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8189         }
8190 }
8191 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8192         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8193                 let datalen = v.len();
8194                 let data = Box::into_raw(v.into_boxed_slice());
8195                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8196         }
8197 }
8198 #[no_mangle]
8199 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8200 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8201 impl Drop for CVec_CVec_u8ZZ {
8202         fn drop(&mut self) {
8203                 if self.datalen == 0 { return; }
8204                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8205         }
8206 }
8207 impl Clone for CVec_CVec_u8ZZ {
8208         fn clone(&self) -> Self {
8209                 let mut res = Vec::new();
8210                 if self.datalen == 0 { return Self::from(res); }
8211                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8212                 Self::from(res)
8213         }
8214 }
8215 #[repr(C)]
8216 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8217 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8218         /// A pointer to the contents in the success state.
8219         /// Reading from this pointer when `result_ok` is not set is undefined.
8220         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8221         /// Note that this value is always NULL, as there are no contents in the Err variant
8222         pub err: *mut core::ffi::c_void,
8223 }
8224 #[repr(C)]
8225 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8226 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8228 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8229         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8230         /// `err` or `result` depending on the state of `result_ok`.
8231         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8232         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8233         pub result_ok: bool,
8234 }
8235 #[no_mangle]
8236 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8237 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8238         CResult_CVec_CVec_u8ZZNoneZ {
8239                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8240                         result: Box::into_raw(Box::new(o)),
8241                 },
8242                 result_ok: true,
8243         }
8244 }
8245 #[no_mangle]
8246 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8247 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8248         CResult_CVec_CVec_u8ZZNoneZ {
8249                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8250                         err: core::ptr::null_mut(),
8251                 },
8252                 result_ok: false,
8253         }
8254 }
8255 /// Checks if the given object is currently in the success state
8256 #[no_mangle]
8257 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
8258         o.result_ok
8259 }
8260 #[no_mangle]
8261 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8262 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8263 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8264         fn drop(&mut self) {
8265                 if self.result_ok {
8266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8268                         }
8269                 } else {
8270                 }
8271         }
8272 }
8273 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
8274         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
8275                 let contents = if o.result_ok {
8276                         let result = unsafe { o.contents.result };
8277                         unsafe { o.contents.result = core::ptr::null_mut() };
8278                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
8279                 } else {
8280                         let _ = unsafe { Box::from_raw(o.contents.err) };
8281                         o.contents.err = core::ptr::null_mut();
8282                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
8283                 };
8284                 Self {
8285                         contents,
8286                         result_ok: o.result_ok,
8287                 }
8288         }
8289 }
8290 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8291         fn clone(&self) -> Self {
8292                 if self.result_ok {
8293                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8294                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8295                         } }
8296                 } else {
8297                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8298                                 err: core::ptr::null_mut()
8299                         } }
8300                 }
8301         }
8302 }
8303 #[no_mangle]
8304 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8305 /// but with all dynamically-allocated buffers duplicated in new buffers.
8306 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
8307 #[repr(C)]
8308 /// The contents of CResult_InMemorySignerDecodeErrorZ
8309 pub union CResult_InMemorySignerDecodeErrorZPtr {
8310         /// A pointer to the contents in the success state.
8311         /// Reading from this pointer when `result_ok` is not set is undefined.
8312         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8313         /// A pointer to the contents in the error state.
8314         /// Reading from this pointer when `result_ok` is set is undefined.
8315         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8316 }
8317 #[repr(C)]
8318 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8319 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8321 pub struct CResult_InMemorySignerDecodeErrorZ {
8322         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8323         /// `err` or `result` depending on the state of `result_ok`.
8324         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8325         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8326         pub result_ok: bool,
8327 }
8328 #[no_mangle]
8329 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8330 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8331         CResult_InMemorySignerDecodeErrorZ {
8332                 contents: CResult_InMemorySignerDecodeErrorZPtr {
8333                         result: Box::into_raw(Box::new(o)),
8334                 },
8335                 result_ok: true,
8336         }
8337 }
8338 #[no_mangle]
8339 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8340 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8341         CResult_InMemorySignerDecodeErrorZ {
8342                 contents: CResult_InMemorySignerDecodeErrorZPtr {
8343                         err: Box::into_raw(Box::new(e)),
8344                 },
8345                 result_ok: false,
8346         }
8347 }
8348 /// Checks if the given object is currently in the success state
8349 #[no_mangle]
8350 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
8351         o.result_ok
8352 }
8353 #[no_mangle]
8354 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8355 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8356 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8357         fn drop(&mut self) {
8358                 if self.result_ok {
8359                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8360                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8361                         }
8362                 } else {
8363                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8364                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8365                         }
8366                 }
8367         }
8368 }
8369 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8370         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8371                 let contents = if o.result_ok {
8372                         let result = unsafe { o.contents.result };
8373                         unsafe { o.contents.result = core::ptr::null_mut() };
8374                         CResult_InMemorySignerDecodeErrorZPtr { result }
8375                 } else {
8376                         let err = unsafe { o.contents.err };
8377                         unsafe { o.contents.err = core::ptr::null_mut(); }
8378                         CResult_InMemorySignerDecodeErrorZPtr { err }
8379                 };
8380                 Self {
8381                         contents,
8382                         result_ok: o.result_ok,
8383                 }
8384         }
8385 }
8386 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8387         fn clone(&self) -> Self {
8388                 if self.result_ok {
8389                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8390                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8391                         } }
8392                 } else {
8393                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8394                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8395                         } }
8396                 }
8397         }
8398 }
8399 #[no_mangle]
8400 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
8403 #[repr(C)]
8404 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8405 /// This corresponds to std::vector in C++
8406 pub struct CVec_TxOutZ {
8407         /// The elements in the array.
8408         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8409         pub data: *mut crate::c_types::TxOut,
8410         /// The number of elements pointed to by `data`.
8411         pub datalen: usize
8412 }
8413 impl CVec_TxOutZ {
8414         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8415                 if self.datalen == 0 { return Vec::new(); }
8416                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8417                 self.data = core::ptr::null_mut();
8418                 self.datalen = 0;
8419                 ret
8420         }
8421         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8422                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8423         }
8424 }
8425 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8426         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8427                 let datalen = v.len();
8428                 let data = Box::into_raw(v.into_boxed_slice());
8429                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8430         }
8431 }
8432 #[no_mangle]
8433 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8434 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8435 impl Drop for CVec_TxOutZ {
8436         fn drop(&mut self) {
8437                 if self.datalen == 0 { return; }
8438                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8439         }
8440 }
8441 impl Clone for CVec_TxOutZ {
8442         fn clone(&self) -> Self {
8443                 let mut res = Vec::new();
8444                 if self.datalen == 0 { return Self::from(res); }
8445                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8446                 Self::from(res)
8447         }
8448 }
8449 #[repr(C)]
8450 /// The contents of CResult_TransactionNoneZ
8451 pub union CResult_TransactionNoneZPtr {
8452         /// A pointer to the contents in the success state.
8453         /// Reading from this pointer when `result_ok` is not set is undefined.
8454         pub result: *mut crate::c_types::Transaction,
8455         /// Note that this value is always NULL, as there are no contents in the Err variant
8456         pub err: *mut core::ffi::c_void,
8457 }
8458 #[repr(C)]
8459 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8460 /// containing a crate::c_types::Transaction on success and a () on failure.
8461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8462 pub struct CResult_TransactionNoneZ {
8463         /// The contents of this CResult_TransactionNoneZ, accessible via either
8464         /// `err` or `result` depending on the state of `result_ok`.
8465         pub contents: CResult_TransactionNoneZPtr,
8466         /// Whether this CResult_TransactionNoneZ represents a success state.
8467         pub result_ok: bool,
8468 }
8469 #[no_mangle]
8470 /// Creates a new CResult_TransactionNoneZ in the success state.
8471 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8472         CResult_TransactionNoneZ {
8473                 contents: CResult_TransactionNoneZPtr {
8474                         result: Box::into_raw(Box::new(o)),
8475                 },
8476                 result_ok: true,
8477         }
8478 }
8479 #[no_mangle]
8480 /// Creates a new CResult_TransactionNoneZ in the error state.
8481 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8482         CResult_TransactionNoneZ {
8483                 contents: CResult_TransactionNoneZPtr {
8484                         err: core::ptr::null_mut(),
8485                 },
8486                 result_ok: false,
8487         }
8488 }
8489 /// Checks if the given object is currently in the success state
8490 #[no_mangle]
8491 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
8492         o.result_ok
8493 }
8494 #[no_mangle]
8495 /// Frees any resources used by the CResult_TransactionNoneZ.
8496 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8497 impl Drop for CResult_TransactionNoneZ {
8498         fn drop(&mut self) {
8499                 if self.result_ok {
8500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8502                         }
8503                 } else {
8504                 }
8505         }
8506 }
8507 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
8508         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
8509                 let contents = if o.result_ok {
8510                         let result = unsafe { o.contents.result };
8511                         unsafe { o.contents.result = core::ptr::null_mut() };
8512                         CResult_TransactionNoneZPtr { result }
8513                 } else {
8514                         let _ = unsafe { Box::from_raw(o.contents.err) };
8515                         o.contents.err = core::ptr::null_mut();
8516                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
8517                 };
8518                 Self {
8519                         contents,
8520                         result_ok: o.result_ok,
8521                 }
8522         }
8523 }
8524 impl Clone for CResult_TransactionNoneZ {
8525         fn clone(&self) -> Self {
8526                 if self.result_ok {
8527                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
8528                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
8529                         } }
8530                 } else {
8531                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
8532                                 err: core::ptr::null_mut()
8533                         } }
8534                 }
8535         }
8536 }
8537 #[no_mangle]
8538 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
8539 /// but with all dynamically-allocated buffers duplicated in new buffers.
8540 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
8541 #[repr(C)]
8542 /// A tuple of 2 elements. See the individual fields for the types contained.
8543 pub struct C2Tuple_BlockHashChannelMonitorZ {
8544         /// The element at position 0
8545         pub a: crate::c_types::ThirtyTwoBytes,
8546         /// The element at position 1
8547         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
8548 }
8549 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
8550         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8551                 Self {
8552                         a: tup.0,
8553                         b: tup.1,
8554                 }
8555         }
8556 }
8557 impl C2Tuple_BlockHashChannelMonitorZ {
8558         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8559                 (self.a, self.b)
8560         }
8561 }
8562 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8563 #[no_mangle]
8564 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8565         C2Tuple_BlockHashChannelMonitorZ { a, b, }
8566 }
8567
8568 #[no_mangle]
8569 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8570 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8571 #[repr(C)]
8572 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8573 /// This corresponds to std::vector in C++
8574 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8575         /// The elements in the array.
8576         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8577         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8578         /// The number of elements pointed to by `data`.
8579         pub datalen: usize
8580 }
8581 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8582         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8583                 if self.datalen == 0 { return Vec::new(); }
8584                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8585                 self.data = core::ptr::null_mut();
8586                 self.datalen = 0;
8587                 ret
8588         }
8589         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8590                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8591         }
8592 }
8593 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8594         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8595                 let datalen = v.len();
8596                 let data = Box::into_raw(v.into_boxed_slice());
8597                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8598         }
8599 }
8600 #[no_mangle]
8601 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8602 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8603 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8604         fn drop(&mut self) {
8605                 if self.datalen == 0 { return; }
8606                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8607         }
8608 }
8609 #[repr(C)]
8610 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8611 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8612         /// A pointer to the contents in the success state.
8613         /// Reading from this pointer when `result_ok` is not set is undefined.
8614         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8615         /// A pointer to the contents in the error state.
8616         /// Reading from this pointer when `result_ok` is set is undefined.
8617         pub err: *mut crate::c_types::IOError,
8618 }
8619 #[repr(C)]
8620 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8621 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8623 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8624         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8625         /// `err` or `result` depending on the state of `result_ok`.
8626         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8627         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8628         pub result_ok: bool,
8629 }
8630 #[no_mangle]
8631 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8632 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8633         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8634                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8635                         result: Box::into_raw(Box::new(o)),
8636                 },
8637                 result_ok: true,
8638         }
8639 }
8640 #[no_mangle]
8641 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8642 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8643         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8644                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8645                         err: Box::into_raw(Box::new(e)),
8646                 },
8647                 result_ok: false,
8648         }
8649 }
8650 /// Checks if the given object is currently in the success state
8651 #[no_mangle]
8652 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8653         o.result_ok
8654 }
8655 #[no_mangle]
8656 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8657 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8658 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8659         fn drop(&mut self) {
8660                 if self.result_ok {
8661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8663                         }
8664                 } else {
8665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8667                         }
8668                 }
8669         }
8670 }
8671 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8672         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8673                 let contents = if o.result_ok {
8674                         let result = unsafe { o.contents.result };
8675                         unsafe { o.contents.result = core::ptr::null_mut() };
8676                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8677                 } else {
8678                         let err = unsafe { o.contents.err };
8679                         unsafe { o.contents.err = core::ptr::null_mut(); }
8680                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8681                 };
8682                 Self {
8683                         contents,
8684                         result_ok: o.result_ok,
8685                 }
8686         }
8687 }
8688 #[repr(C)]
8689 #[derive(Clone)]
8690 /// An enum which can either contain a u16 or not
8691 pub enum COption_u16Z {
8692         /// When we're in this state, this COption_u16Z contains a u16
8693         Some(u16),
8694         /// When we're in this state, this COption_u16Z contains nothing
8695         None
8696 }
8697 impl COption_u16Z {
8698         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8699                 if let Self::None = self { false } else { true }
8700         }
8701         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8702                 !self.is_some()
8703         }
8704         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8705                 if let Self::Some(v) = self { v } else { unreachable!() }
8706         }
8707 }
8708 #[no_mangle]
8709 /// Constructs a new COption_u16Z containing a u16
8710 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8711         COption_u16Z::Some(o)
8712 }
8713 #[no_mangle]
8714 /// Constructs a new COption_u16Z containing nothing
8715 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8716         COption_u16Z::None
8717 }
8718 #[no_mangle]
8719 /// Frees any resources associated with the u16, if we are in the Some state
8720 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8721 #[no_mangle]
8722 /// Creates a new COption_u16Z which has the same data as `orig`
8723 /// but with all dynamically-allocated buffers duplicated in new buffers.
8724 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8725 #[repr(C)]
8726 /// The contents of CResult__u832APIErrorZ
8727 pub union CResult__u832APIErrorZPtr {
8728         /// A pointer to the contents in the success state.
8729         /// Reading from this pointer when `result_ok` is not set is undefined.
8730         pub result: *mut crate::c_types::ThirtyTwoBytes,
8731         /// A pointer to the contents in the error state.
8732         /// Reading from this pointer when `result_ok` is set is undefined.
8733         pub err: *mut crate::lightning::util::errors::APIError,
8734 }
8735 #[repr(C)]
8736 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8737 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8738 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8739 pub struct CResult__u832APIErrorZ {
8740         /// The contents of this CResult__u832APIErrorZ, accessible via either
8741         /// `err` or `result` depending on the state of `result_ok`.
8742         pub contents: CResult__u832APIErrorZPtr,
8743         /// Whether this CResult__u832APIErrorZ represents a success state.
8744         pub result_ok: bool,
8745 }
8746 #[no_mangle]
8747 /// Creates a new CResult__u832APIErrorZ in the success state.
8748 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8749         CResult__u832APIErrorZ {
8750                 contents: CResult__u832APIErrorZPtr {
8751                         result: Box::into_raw(Box::new(o)),
8752                 },
8753                 result_ok: true,
8754         }
8755 }
8756 #[no_mangle]
8757 /// Creates a new CResult__u832APIErrorZ in the error state.
8758 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8759         CResult__u832APIErrorZ {
8760                 contents: CResult__u832APIErrorZPtr {
8761                         err: Box::into_raw(Box::new(e)),
8762                 },
8763                 result_ok: false,
8764         }
8765 }
8766 /// Checks if the given object is currently in the success state
8767 #[no_mangle]
8768 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8769         o.result_ok
8770 }
8771 #[no_mangle]
8772 /// Frees any resources used by the CResult__u832APIErrorZ.
8773 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8774 impl Drop for CResult__u832APIErrorZ {
8775         fn drop(&mut self) {
8776                 if self.result_ok {
8777                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8778                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8779                         }
8780                 } else {
8781                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8782                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8783                         }
8784                 }
8785         }
8786 }
8787 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8788         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8789                 let contents = if o.result_ok {
8790                         let result = unsafe { o.contents.result };
8791                         unsafe { o.contents.result = core::ptr::null_mut() };
8792                         CResult__u832APIErrorZPtr { result }
8793                 } else {
8794                         let err = unsafe { o.contents.err };
8795                         unsafe { o.contents.err = core::ptr::null_mut(); }
8796                         CResult__u832APIErrorZPtr { err }
8797                 };
8798                 Self {
8799                         contents,
8800                         result_ok: o.result_ok,
8801                 }
8802         }
8803 }
8804 impl Clone for CResult__u832APIErrorZ {
8805         fn clone(&self) -> Self {
8806                 if self.result_ok {
8807                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8808                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8809                         } }
8810                 } else {
8811                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8812                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8813                         } }
8814                 }
8815         }
8816 }
8817 #[no_mangle]
8818 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8819 /// but with all dynamically-allocated buffers duplicated in new buffers.
8820 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8821 #[repr(C)]
8822 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8823 /// This corresponds to std::vector in C++
8824 pub struct CVec_RecentPaymentDetailsZ {
8825         /// The elements in the array.
8826         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8827         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8828         /// The number of elements pointed to by `data`.
8829         pub datalen: usize
8830 }
8831 impl CVec_RecentPaymentDetailsZ {
8832         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8833                 if self.datalen == 0 { return Vec::new(); }
8834                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8835                 self.data = core::ptr::null_mut();
8836                 self.datalen = 0;
8837                 ret
8838         }
8839         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8840                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8841         }
8842 }
8843 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8844         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8845                 let datalen = v.len();
8846                 let data = Box::into_raw(v.into_boxed_slice());
8847                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8848         }
8849 }
8850 #[no_mangle]
8851 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8852 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8853 impl Drop for CVec_RecentPaymentDetailsZ {
8854         fn drop(&mut self) {
8855                 if self.datalen == 0 { return; }
8856                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8857         }
8858 }
8859 #[repr(C)]
8860 /// The contents of CResult_NonePaymentSendFailureZ
8861 pub union CResult_NonePaymentSendFailureZPtr {
8862         /// Note that this value is always NULL, as there are no contents in the OK variant
8863         pub result: *mut core::ffi::c_void,
8864         /// A pointer to the contents in the error state.
8865         /// Reading from this pointer when `result_ok` is set is undefined.
8866         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8867 }
8868 #[repr(C)]
8869 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8870 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8872 pub struct CResult_NonePaymentSendFailureZ {
8873         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8874         /// `err` or `result` depending on the state of `result_ok`.
8875         pub contents: CResult_NonePaymentSendFailureZPtr,
8876         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8877         pub result_ok: bool,
8878 }
8879 #[no_mangle]
8880 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8881 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8882         CResult_NonePaymentSendFailureZ {
8883                 contents: CResult_NonePaymentSendFailureZPtr {
8884                         result: core::ptr::null_mut(),
8885                 },
8886                 result_ok: true,
8887         }
8888 }
8889 #[no_mangle]
8890 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8891 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8892         CResult_NonePaymentSendFailureZ {
8893                 contents: CResult_NonePaymentSendFailureZPtr {
8894                         err: Box::into_raw(Box::new(e)),
8895                 },
8896                 result_ok: false,
8897         }
8898 }
8899 /// Checks if the given object is currently in the success state
8900 #[no_mangle]
8901 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8902         o.result_ok
8903 }
8904 #[no_mangle]
8905 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8906 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8907 impl Drop for CResult_NonePaymentSendFailureZ {
8908         fn drop(&mut self) {
8909                 if self.result_ok {
8910                 } else {
8911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8913                         }
8914                 }
8915         }
8916 }
8917 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8918         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8919                 let contents = if o.result_ok {
8920                         let _ = unsafe { Box::from_raw(o.contents.result) };
8921                         o.contents.result = core::ptr::null_mut();
8922                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8923                 } else {
8924                         let err = unsafe { o.contents.err };
8925                         unsafe { o.contents.err = core::ptr::null_mut(); }
8926                         CResult_NonePaymentSendFailureZPtr { err }
8927                 };
8928                 Self {
8929                         contents,
8930                         result_ok: o.result_ok,
8931                 }
8932         }
8933 }
8934 impl Clone for CResult_NonePaymentSendFailureZ {
8935         fn clone(&self) -> Self {
8936                 if self.result_ok {
8937                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8938                                 result: core::ptr::null_mut()
8939                         } }
8940                 } else {
8941                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8943                         } }
8944                 }
8945         }
8946 }
8947 #[no_mangle]
8948 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8949 /// but with all dynamically-allocated buffers duplicated in new buffers.
8950 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8951 #[repr(C)]
8952 /// The contents of CResult_NoneRetryableSendFailureZ
8953 pub union CResult_NoneRetryableSendFailureZPtr {
8954         /// Note that this value is always NULL, as there are no contents in the OK variant
8955         pub result: *mut core::ffi::c_void,
8956         /// A pointer to the contents in the error state.
8957         /// Reading from this pointer when `result_ok` is set is undefined.
8958         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8959 }
8960 #[repr(C)]
8961 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8962 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8964 pub struct CResult_NoneRetryableSendFailureZ {
8965         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8966         /// `err` or `result` depending on the state of `result_ok`.
8967         pub contents: CResult_NoneRetryableSendFailureZPtr,
8968         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8969         pub result_ok: bool,
8970 }
8971 #[no_mangle]
8972 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8973 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8974         CResult_NoneRetryableSendFailureZ {
8975                 contents: CResult_NoneRetryableSendFailureZPtr {
8976                         result: core::ptr::null_mut(),
8977                 },
8978                 result_ok: true,
8979         }
8980 }
8981 #[no_mangle]
8982 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8983 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8984         CResult_NoneRetryableSendFailureZ {
8985                 contents: CResult_NoneRetryableSendFailureZPtr {
8986                         err: Box::into_raw(Box::new(e)),
8987                 },
8988                 result_ok: false,
8989         }
8990 }
8991 /// Checks if the given object is currently in the success state
8992 #[no_mangle]
8993 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8994         o.result_ok
8995 }
8996 #[no_mangle]
8997 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8998 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8999 impl Drop for CResult_NoneRetryableSendFailureZ {
9000         fn drop(&mut self) {
9001                 if self.result_ok {
9002                 } else {
9003                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9004                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9005                         }
9006                 }
9007         }
9008 }
9009 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9010         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9011                 let contents = if o.result_ok {
9012                         let _ = unsafe { Box::from_raw(o.contents.result) };
9013                         o.contents.result = core::ptr::null_mut();
9014                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9015                 } else {
9016                         let err = unsafe { o.contents.err };
9017                         unsafe { o.contents.err = core::ptr::null_mut(); }
9018                         CResult_NoneRetryableSendFailureZPtr { err }
9019                 };
9020                 Self {
9021                         contents,
9022                         result_ok: o.result_ok,
9023                 }
9024         }
9025 }
9026 impl Clone for CResult_NoneRetryableSendFailureZ {
9027         fn clone(&self) -> Self {
9028                 if self.result_ok {
9029                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9030                                 result: core::ptr::null_mut()
9031                         } }
9032                 } else {
9033                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9034                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9035                         } }
9036                 }
9037         }
9038 }
9039 #[no_mangle]
9040 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9041 /// but with all dynamically-allocated buffers duplicated in new buffers.
9042 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9043 #[repr(C)]
9044 /// The contents of CResult_PaymentHashPaymentSendFailureZ
9045 pub union CResult_PaymentHashPaymentSendFailureZPtr {
9046         /// A pointer to the contents in the success state.
9047         /// Reading from this pointer when `result_ok` is not set is undefined.
9048         pub result: *mut crate::c_types::ThirtyTwoBytes,
9049         /// A pointer to the contents in the error state.
9050         /// Reading from this pointer when `result_ok` is set is undefined.
9051         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9052 }
9053 #[repr(C)]
9054 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
9055 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9057 pub struct CResult_PaymentHashPaymentSendFailureZ {
9058         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
9059         /// `err` or `result` depending on the state of `result_ok`.
9060         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
9061         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
9062         pub result_ok: bool,
9063 }
9064 #[no_mangle]
9065 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
9066 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
9067         CResult_PaymentHashPaymentSendFailureZ {
9068                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9069                         result: Box::into_raw(Box::new(o)),
9070                 },
9071                 result_ok: true,
9072         }
9073 }
9074 #[no_mangle]
9075 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
9076 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
9077         CResult_PaymentHashPaymentSendFailureZ {
9078                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
9079                         err: Box::into_raw(Box::new(e)),
9080                 },
9081                 result_ok: false,
9082         }
9083 }
9084 /// Checks if the given object is currently in the success state
9085 #[no_mangle]
9086 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
9087         o.result_ok
9088 }
9089 #[no_mangle]
9090 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
9091 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
9092 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
9093         fn drop(&mut self) {
9094                 if self.result_ok {
9095                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9096                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9097                         }
9098                 } else {
9099                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9100                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9101                         }
9102                 }
9103         }
9104 }
9105 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
9106         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9107                 let contents = if o.result_ok {
9108                         let result = unsafe { o.contents.result };
9109                         unsafe { o.contents.result = core::ptr::null_mut() };
9110                         CResult_PaymentHashPaymentSendFailureZPtr { result }
9111                 } else {
9112                         let err = unsafe { o.contents.err };
9113                         unsafe { o.contents.err = core::ptr::null_mut(); }
9114                         CResult_PaymentHashPaymentSendFailureZPtr { err }
9115                 };
9116                 Self {
9117                         contents,
9118                         result_ok: o.result_ok,
9119                 }
9120         }
9121 }
9122 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
9123         fn clone(&self) -> Self {
9124                 if self.result_ok {
9125                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9126                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9127                         } }
9128                 } else {
9129                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
9130                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9131                         } }
9132                 }
9133         }
9134 }
9135 #[no_mangle]
9136 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
9137 /// but with all dynamically-allocated buffers duplicated in new buffers.
9138 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
9139 #[repr(C)]
9140 /// The contents of CResult_PaymentHashRetryableSendFailureZ
9141 pub union CResult_PaymentHashRetryableSendFailureZPtr {
9142         /// A pointer to the contents in the success state.
9143         /// Reading from this pointer when `result_ok` is not set is undefined.
9144         pub result: *mut crate::c_types::ThirtyTwoBytes,
9145         /// A pointer to the contents in the error state.
9146         /// Reading from this pointer when `result_ok` is set is undefined.
9147         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9148 }
9149 #[repr(C)]
9150 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
9151 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9153 pub struct CResult_PaymentHashRetryableSendFailureZ {
9154         /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
9155         /// `err` or `result` depending on the state of `result_ok`.
9156         pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
9157         /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
9158         pub result_ok: bool,
9159 }
9160 #[no_mangle]
9161 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
9162 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
9163         CResult_PaymentHashRetryableSendFailureZ {
9164                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9165                         result: Box::into_raw(Box::new(o)),
9166                 },
9167                 result_ok: true,
9168         }
9169 }
9170 #[no_mangle]
9171 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
9172 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
9173         CResult_PaymentHashRetryableSendFailureZ {
9174                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
9175                         err: Box::into_raw(Box::new(e)),
9176                 },
9177                 result_ok: false,
9178         }
9179 }
9180 /// Checks if the given object is currently in the success state
9181 #[no_mangle]
9182 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
9183         o.result_ok
9184 }
9185 #[no_mangle]
9186 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
9187 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
9188 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
9189         fn drop(&mut self) {
9190                 if self.result_ok {
9191                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9192                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9193                         }
9194                 } else {
9195                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9196                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9197                         }
9198                 }
9199         }
9200 }
9201 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
9202         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9203                 let contents = if o.result_ok {
9204                         let result = unsafe { o.contents.result };
9205                         unsafe { o.contents.result = core::ptr::null_mut() };
9206                         CResult_PaymentHashRetryableSendFailureZPtr { result }
9207                 } else {
9208                         let err = unsafe { o.contents.err };
9209                         unsafe { o.contents.err = core::ptr::null_mut(); }
9210                         CResult_PaymentHashRetryableSendFailureZPtr { err }
9211                 };
9212                 Self {
9213                         contents,
9214                         result_ok: o.result_ok,
9215                 }
9216         }
9217 }
9218 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
9219         fn clone(&self) -> Self {
9220                 if self.result_ok {
9221                         Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9222                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9223                         } }
9224                 } else {
9225                         Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
9226                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9227                         } }
9228                 }
9229         }
9230 }
9231 #[no_mangle]
9232 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
9233 /// but with all dynamically-allocated buffers duplicated in new buffers.
9234 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
9235 #[repr(C)]
9236 /// A tuple of 2 elements. See the individual fields for the types contained.
9237 pub struct C2Tuple_PaymentHashPaymentIdZ {
9238         /// The element at position 0
9239         pub a: crate::c_types::ThirtyTwoBytes,
9240         /// The element at position 1
9241         pub b: crate::c_types::ThirtyTwoBytes,
9242 }
9243 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
9244         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9245                 Self {
9246                         a: tup.0,
9247                         b: tup.1,
9248                 }
9249         }
9250 }
9251 impl C2Tuple_PaymentHashPaymentIdZ {
9252         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9253                 (self.a, self.b)
9254         }
9255 }
9256 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
9257         fn clone(&self) -> Self {
9258                 Self {
9259                         a: Clone::clone(&self.a),
9260                         b: Clone::clone(&self.b),
9261                 }
9262         }
9263 }
9264 #[no_mangle]
9265 /// Creates a new tuple which has the same data as `orig`
9266 /// but with all dynamically-allocated buffers duplicated in new buffers.
9267 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
9268 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
9269 #[no_mangle]
9270 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
9271         C2Tuple_PaymentHashPaymentIdZ { a, b, }
9272 }
9273
9274 #[no_mangle]
9275 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
9276 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
9277 #[repr(C)]
9278 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
9279 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9280         /// A pointer to the contents in the success state.
9281         /// Reading from this pointer when `result_ok` is not set is undefined.
9282         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
9283         /// A pointer to the contents in the error state.
9284         /// Reading from this pointer when `result_ok` is set is undefined.
9285         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9286 }
9287 #[repr(C)]
9288 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
9289 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9291 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9292         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
9293         /// `err` or `result` depending on the state of `result_ok`.
9294         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
9295         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
9296         pub result_ok: bool,
9297 }
9298 #[no_mangle]
9299 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
9300 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9301         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9302                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9303                         result: Box::into_raw(Box::new(o)),
9304                 },
9305                 result_ok: true,
9306         }
9307 }
9308 #[no_mangle]
9309 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
9310 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9311         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9312                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9313                         err: Box::into_raw(Box::new(e)),
9314                 },
9315                 result_ok: false,
9316         }
9317 }
9318 /// Checks if the given object is currently in the success state
9319 #[no_mangle]
9320 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
9321         o.result_ok
9322 }
9323 #[no_mangle]
9324 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
9325 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
9326 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9327         fn drop(&mut self) {
9328                 if self.result_ok {
9329                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9330                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9331                         }
9332                 } else {
9333                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9334                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9335                         }
9336                 }
9337         }
9338 }
9339 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9340         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9341                 let contents = if o.result_ok {
9342                         let result = unsafe { o.contents.result };
9343                         unsafe { o.contents.result = core::ptr::null_mut() };
9344                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
9345                 } else {
9346                         let err = unsafe { o.contents.err };
9347                         unsafe { o.contents.err = core::ptr::null_mut(); }
9348                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
9349                 };
9350                 Self {
9351                         contents,
9352                         result_ok: o.result_ok,
9353                 }
9354         }
9355 }
9356 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
9357         fn clone(&self) -> Self {
9358                 if self.result_ok {
9359                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9360                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
9361                         } }
9362                 } else {
9363                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
9364                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9365                         } }
9366                 }
9367         }
9368 }
9369 #[no_mangle]
9370 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
9371 /// but with all dynamically-allocated buffers duplicated in new buffers.
9372 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
9373 #[repr(C)]
9374 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
9375 /// This corresponds to std::vector in C++
9376 pub struct CVec_ThirtyTwoBytesZ {
9377         /// The elements in the array.
9378         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9379         pub data: *mut crate::c_types::ThirtyTwoBytes,
9380         /// The number of elements pointed to by `data`.
9381         pub datalen: usize
9382 }
9383 impl CVec_ThirtyTwoBytesZ {
9384         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
9385                 if self.datalen == 0 { return Vec::new(); }
9386                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9387                 self.data = core::ptr::null_mut();
9388                 self.datalen = 0;
9389                 ret
9390         }
9391         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
9392                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9393         }
9394 }
9395 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
9396         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
9397                 let datalen = v.len();
9398                 let data = Box::into_raw(v.into_boxed_slice());
9399                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9400         }
9401 }
9402 #[no_mangle]
9403 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9404 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
9405 impl Drop for CVec_ThirtyTwoBytesZ {
9406         fn drop(&mut self) {
9407                 if self.datalen == 0 { return; }
9408                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9409         }
9410 }
9411 impl Clone for CVec_ThirtyTwoBytesZ {
9412         fn clone(&self) -> Self {
9413                 let mut res = Vec::new();
9414                 if self.datalen == 0 { return Self::from(res); }
9415                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9416                 Self::from(res)
9417         }
9418 }
9419 #[repr(C)]
9420 /// A tuple of 2 elements. See the individual fields for the types contained.
9421 pub struct C2Tuple_PaymentHashPaymentSecretZ {
9422         /// The element at position 0
9423         pub a: crate::c_types::ThirtyTwoBytes,
9424         /// The element at position 1
9425         pub b: crate::c_types::ThirtyTwoBytes,
9426 }
9427 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
9428         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
9429                 Self {
9430                         a: tup.0,
9431                         b: tup.1,
9432                 }
9433         }
9434 }
9435 impl C2Tuple_PaymentHashPaymentSecretZ {
9436         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
9437                 (self.a, self.b)
9438         }
9439 }
9440 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
9441         fn clone(&self) -> Self {
9442                 Self {
9443                         a: Clone::clone(&self.a),
9444                         b: Clone::clone(&self.b),
9445                 }
9446         }
9447 }
9448 #[no_mangle]
9449 /// Creates a new tuple which has the same data as `orig`
9450 /// but with all dynamically-allocated buffers duplicated in new buffers.
9451 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
9452 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9453 #[no_mangle]
9454 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
9455         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
9456 }
9457
9458 #[no_mangle]
9459 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9460 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
9461 #[repr(C)]
9462 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
9463 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9464         /// A pointer to the contents in the success state.
9465         /// Reading from this pointer when `result_ok` is not set is undefined.
9466         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9467         /// Note that this value is always NULL, as there are no contents in the Err variant
9468         pub err: *mut core::ffi::c_void,
9469 }
9470 #[repr(C)]
9471 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
9472 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
9473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9474 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9475         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
9476         /// `err` or `result` depending on the state of `result_ok`.
9477         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
9478         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
9479         pub result_ok: bool,
9480 }
9481 #[no_mangle]
9482 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
9483 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9484         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9485                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9486                         result: Box::into_raw(Box::new(o)),
9487                 },
9488                 result_ok: true,
9489         }
9490 }
9491 #[no_mangle]
9492 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
9493 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9494         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9495                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9496                         err: core::ptr::null_mut(),
9497                 },
9498                 result_ok: false,
9499         }
9500 }
9501 /// Checks if the given object is currently in the success state
9502 #[no_mangle]
9503 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
9504         o.result_ok
9505 }
9506 #[no_mangle]
9507 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
9508 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
9509 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9510         fn drop(&mut self) {
9511                 if self.result_ok {
9512                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9513                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9514                         }
9515                 } else {
9516                 }
9517         }
9518 }
9519 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9520         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
9521                 let contents = if o.result_ok {
9522                         let result = unsafe { o.contents.result };
9523                         unsafe { o.contents.result = core::ptr::null_mut() };
9524                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
9525                 } else {
9526                         let _ = unsafe { Box::from_raw(o.contents.err) };
9527                         o.contents.err = core::ptr::null_mut();
9528                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
9529                 };
9530                 Self {
9531                         contents,
9532                         result_ok: o.result_ok,
9533                 }
9534         }
9535 }
9536 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9537         fn clone(&self) -> Self {
9538                 if self.result_ok {
9539                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9540                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9541                         } }
9542                 } else {
9543                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9544                                 err: core::ptr::null_mut()
9545                         } }
9546                 }
9547         }
9548 }
9549 #[no_mangle]
9550 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
9551 /// but with all dynamically-allocated buffers duplicated in new buffers.
9552 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
9553 #[repr(C)]
9554 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
9555 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9556         /// A pointer to the contents in the success state.
9557         /// Reading from this pointer when `result_ok` is not set is undefined.
9558         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9559         /// A pointer to the contents in the error state.
9560         /// Reading from this pointer when `result_ok` is set is undefined.
9561         pub err: *mut crate::lightning::util::errors::APIError,
9562 }
9563 #[repr(C)]
9564 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
9565 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
9566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9567 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9568         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
9569         /// `err` or `result` depending on the state of `result_ok`.
9570         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
9571         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
9572         pub result_ok: bool,
9573 }
9574 #[no_mangle]
9575 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
9576 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9577         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9578                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9579                         result: Box::into_raw(Box::new(o)),
9580                 },
9581                 result_ok: true,
9582         }
9583 }
9584 #[no_mangle]
9585 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
9586 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9587         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9588                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9589                         err: Box::into_raw(Box::new(e)),
9590                 },
9591                 result_ok: false,
9592         }
9593 }
9594 /// Checks if the given object is currently in the success state
9595 #[no_mangle]
9596 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9597         o.result_ok
9598 }
9599 #[no_mangle]
9600 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9601 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9602 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9603         fn drop(&mut self) {
9604                 if self.result_ok {
9605                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9606                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9607                         }
9608                 } else {
9609                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9610                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9611                         }
9612                 }
9613         }
9614 }
9615 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9616         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9617                 let contents = if o.result_ok {
9618                         let result = unsafe { o.contents.result };
9619                         unsafe { o.contents.result = core::ptr::null_mut() };
9620                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9621                 } else {
9622                         let err = unsafe { o.contents.err };
9623                         unsafe { o.contents.err = core::ptr::null_mut(); }
9624                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9625                 };
9626                 Self {
9627                         contents,
9628                         result_ok: o.result_ok,
9629                 }
9630         }
9631 }
9632 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9633         fn clone(&self) -> Self {
9634                 if self.result_ok {
9635                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9636                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9637                         } }
9638                 } else {
9639                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9640                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9641                         } }
9642                 }
9643         }
9644 }
9645 #[no_mangle]
9646 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9647 /// but with all dynamically-allocated buffers duplicated in new buffers.
9648 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9649 #[repr(C)]
9650 /// The contents of CResult_PaymentSecretNoneZ
9651 pub union CResult_PaymentSecretNoneZPtr {
9652         /// A pointer to the contents in the success state.
9653         /// Reading from this pointer when `result_ok` is not set is undefined.
9654         pub result: *mut crate::c_types::ThirtyTwoBytes,
9655         /// Note that this value is always NULL, as there are no contents in the Err variant
9656         pub err: *mut core::ffi::c_void,
9657 }
9658 #[repr(C)]
9659 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9660 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9661 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9662 pub struct CResult_PaymentSecretNoneZ {
9663         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9664         /// `err` or `result` depending on the state of `result_ok`.
9665         pub contents: CResult_PaymentSecretNoneZPtr,
9666         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9667         pub result_ok: bool,
9668 }
9669 #[no_mangle]
9670 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9671 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9672         CResult_PaymentSecretNoneZ {
9673                 contents: CResult_PaymentSecretNoneZPtr {
9674                         result: Box::into_raw(Box::new(o)),
9675                 },
9676                 result_ok: true,
9677         }
9678 }
9679 #[no_mangle]
9680 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9681 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9682         CResult_PaymentSecretNoneZ {
9683                 contents: CResult_PaymentSecretNoneZPtr {
9684                         err: core::ptr::null_mut(),
9685                 },
9686                 result_ok: false,
9687         }
9688 }
9689 /// Checks if the given object is currently in the success state
9690 #[no_mangle]
9691 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9692         o.result_ok
9693 }
9694 #[no_mangle]
9695 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9696 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9697 impl Drop for CResult_PaymentSecretNoneZ {
9698         fn drop(&mut self) {
9699                 if self.result_ok {
9700                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9701                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9702                         }
9703                 } else {
9704                 }
9705         }
9706 }
9707 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9708         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9709                 let contents = if o.result_ok {
9710                         let result = unsafe { o.contents.result };
9711                         unsafe { o.contents.result = core::ptr::null_mut() };
9712                         CResult_PaymentSecretNoneZPtr { result }
9713                 } else {
9714                         let _ = unsafe { Box::from_raw(o.contents.err) };
9715                         o.contents.err = core::ptr::null_mut();
9716                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9717                 };
9718                 Self {
9719                         contents,
9720                         result_ok: o.result_ok,
9721                 }
9722         }
9723 }
9724 impl Clone for CResult_PaymentSecretNoneZ {
9725         fn clone(&self) -> Self {
9726                 if self.result_ok {
9727                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9728                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9729                         } }
9730                 } else {
9731                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9732                                 err: core::ptr::null_mut()
9733                         } }
9734                 }
9735         }
9736 }
9737 #[no_mangle]
9738 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9739 /// but with all dynamically-allocated buffers duplicated in new buffers.
9740 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9741 #[repr(C)]
9742 /// The contents of CResult_PaymentSecretAPIErrorZ
9743 pub union CResult_PaymentSecretAPIErrorZPtr {
9744         /// A pointer to the contents in the success state.
9745         /// Reading from this pointer when `result_ok` is not set is undefined.
9746         pub result: *mut crate::c_types::ThirtyTwoBytes,
9747         /// A pointer to the contents in the error state.
9748         /// Reading from this pointer when `result_ok` is set is undefined.
9749         pub err: *mut crate::lightning::util::errors::APIError,
9750 }
9751 #[repr(C)]
9752 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9753 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9755 pub struct CResult_PaymentSecretAPIErrorZ {
9756         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9757         /// `err` or `result` depending on the state of `result_ok`.
9758         pub contents: CResult_PaymentSecretAPIErrorZPtr,
9759         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9760         pub result_ok: bool,
9761 }
9762 #[no_mangle]
9763 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9764 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9765         CResult_PaymentSecretAPIErrorZ {
9766                 contents: CResult_PaymentSecretAPIErrorZPtr {
9767                         result: Box::into_raw(Box::new(o)),
9768                 },
9769                 result_ok: true,
9770         }
9771 }
9772 #[no_mangle]
9773 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9774 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9775         CResult_PaymentSecretAPIErrorZ {
9776                 contents: CResult_PaymentSecretAPIErrorZPtr {
9777                         err: Box::into_raw(Box::new(e)),
9778                 },
9779                 result_ok: false,
9780         }
9781 }
9782 /// Checks if the given object is currently in the success state
9783 #[no_mangle]
9784 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9785         o.result_ok
9786 }
9787 #[no_mangle]
9788 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9789 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9790 impl Drop for CResult_PaymentSecretAPIErrorZ {
9791         fn drop(&mut self) {
9792                 if self.result_ok {
9793                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9794                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9795                         }
9796                 } else {
9797                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9798                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9799                         }
9800                 }
9801         }
9802 }
9803 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9804         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9805                 let contents = if o.result_ok {
9806                         let result = unsafe { o.contents.result };
9807                         unsafe { o.contents.result = core::ptr::null_mut() };
9808                         CResult_PaymentSecretAPIErrorZPtr { result }
9809                 } else {
9810                         let err = unsafe { o.contents.err };
9811                         unsafe { o.contents.err = core::ptr::null_mut(); }
9812                         CResult_PaymentSecretAPIErrorZPtr { err }
9813                 };
9814                 Self {
9815                         contents,
9816                         result_ok: o.result_ok,
9817                 }
9818         }
9819 }
9820 impl Clone for CResult_PaymentSecretAPIErrorZ {
9821         fn clone(&self) -> Self {
9822                 if self.result_ok {
9823                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9824                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9825                         } }
9826                 } else {
9827                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9828                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9829                         } }
9830                 }
9831         }
9832 }
9833 #[no_mangle]
9834 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9835 /// but with all dynamically-allocated buffers duplicated in new buffers.
9836 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9837 #[repr(C)]
9838 /// The contents of CResult_PaymentPreimageAPIErrorZ
9839 pub union CResult_PaymentPreimageAPIErrorZPtr {
9840         /// A pointer to the contents in the success state.
9841         /// Reading from this pointer when `result_ok` is not set is undefined.
9842         pub result: *mut crate::c_types::ThirtyTwoBytes,
9843         /// A pointer to the contents in the error state.
9844         /// Reading from this pointer when `result_ok` is set is undefined.
9845         pub err: *mut crate::lightning::util::errors::APIError,
9846 }
9847 #[repr(C)]
9848 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9849 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9851 pub struct CResult_PaymentPreimageAPIErrorZ {
9852         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9853         /// `err` or `result` depending on the state of `result_ok`.
9854         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9855         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9856         pub result_ok: bool,
9857 }
9858 #[no_mangle]
9859 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9860 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9861         CResult_PaymentPreimageAPIErrorZ {
9862                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9863                         result: Box::into_raw(Box::new(o)),
9864                 },
9865                 result_ok: true,
9866         }
9867 }
9868 #[no_mangle]
9869 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9870 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9871         CResult_PaymentPreimageAPIErrorZ {
9872                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9873                         err: Box::into_raw(Box::new(e)),
9874                 },
9875                 result_ok: false,
9876         }
9877 }
9878 /// Checks if the given object is currently in the success state
9879 #[no_mangle]
9880 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9881         o.result_ok
9882 }
9883 #[no_mangle]
9884 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9885 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9886 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9887         fn drop(&mut self) {
9888                 if self.result_ok {
9889                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9890                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9891                         }
9892                 } else {
9893                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9894                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9895                         }
9896                 }
9897         }
9898 }
9899 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9900         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9901                 let contents = if o.result_ok {
9902                         let result = unsafe { o.contents.result };
9903                         unsafe { o.contents.result = core::ptr::null_mut() };
9904                         CResult_PaymentPreimageAPIErrorZPtr { result }
9905                 } else {
9906                         let err = unsafe { o.contents.err };
9907                         unsafe { o.contents.err = core::ptr::null_mut(); }
9908                         CResult_PaymentPreimageAPIErrorZPtr { err }
9909                 };
9910                 Self {
9911                         contents,
9912                         result_ok: o.result_ok,
9913                 }
9914         }
9915 }
9916 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9917         fn clone(&self) -> Self {
9918                 if self.result_ok {
9919                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9920                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9921                         } }
9922                 } else {
9923                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9924                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9925                         } }
9926                 }
9927         }
9928 }
9929 #[no_mangle]
9930 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9931 /// but with all dynamically-allocated buffers duplicated in new buffers.
9932 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9933 #[repr(C)]
9934 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9935 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9936         /// A pointer to the contents in the success state.
9937         /// Reading from this pointer when `result_ok` is not set is undefined.
9938         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9939         /// A pointer to the contents in the error state.
9940         /// Reading from this pointer when `result_ok` is set is undefined.
9941         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9942 }
9943 #[repr(C)]
9944 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9945 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9946 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9947 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9948         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9949         /// `err` or `result` depending on the state of `result_ok`.
9950         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9951         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9952         pub result_ok: bool,
9953 }
9954 #[no_mangle]
9955 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9956 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9957         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9958                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9959                         result: Box::into_raw(Box::new(o)),
9960                 },
9961                 result_ok: true,
9962         }
9963 }
9964 #[no_mangle]
9965 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9966 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9967         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9968                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9969                         err: Box::into_raw(Box::new(e)),
9970                 },
9971                 result_ok: false,
9972         }
9973 }
9974 /// Checks if the given object is currently in the success state
9975 #[no_mangle]
9976 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9977         o.result_ok
9978 }
9979 #[no_mangle]
9980 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9981 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9982 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9983         fn drop(&mut self) {
9984                 if self.result_ok {
9985                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9986                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9987                         }
9988                 } else {
9989                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9990                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9991                         }
9992                 }
9993         }
9994 }
9995 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9996         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9997                 let contents = if o.result_ok {
9998                         let result = unsafe { o.contents.result };
9999                         unsafe { o.contents.result = core::ptr::null_mut() };
10000                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
10001                 } else {
10002                         let err = unsafe { o.contents.err };
10003                         unsafe { o.contents.err = core::ptr::null_mut(); }
10004                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
10005                 };
10006                 Self {
10007                         contents,
10008                         result_ok: o.result_ok,
10009                 }
10010         }
10011 }
10012 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
10013         fn clone(&self) -> Self {
10014                 if self.result_ok {
10015                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10016                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
10017                         } }
10018                 } else {
10019                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
10020                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10021                         } }
10022                 }
10023         }
10024 }
10025 #[no_mangle]
10026 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
10027 /// but with all dynamically-allocated buffers duplicated in new buffers.
10028 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
10029 #[repr(C)]
10030 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
10031 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
10032         /// A pointer to the contents in the success state.
10033         /// Reading from this pointer when `result_ok` is not set is undefined.
10034         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
10035         /// A pointer to the contents in the error state.
10036         /// Reading from this pointer when `result_ok` is set is undefined.
10037         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10038 }
10039 #[repr(C)]
10040 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
10041 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
10042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10043 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
10044         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
10045         /// `err` or `result` depending on the state of `result_ok`.
10046         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
10047         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
10048         pub result_ok: bool,
10049 }
10050 #[no_mangle]
10051 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
10052 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
10053         CResult_ChannelCounterpartyDecodeErrorZ {
10054                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10055                         result: Box::into_raw(Box::new(o)),
10056                 },
10057                 result_ok: true,
10058         }
10059 }
10060 #[no_mangle]
10061 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
10062 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
10063         CResult_ChannelCounterpartyDecodeErrorZ {
10064                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10065                         err: Box::into_raw(Box::new(e)),
10066                 },
10067                 result_ok: false,
10068         }
10069 }
10070 /// Checks if the given object is currently in the success state
10071 #[no_mangle]
10072 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
10073         o.result_ok
10074 }
10075 #[no_mangle]
10076 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
10077 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
10078 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
10079         fn drop(&mut self) {
10080                 if self.result_ok {
10081                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10082                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10083                         }
10084                 } else {
10085                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10086                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10087                         }
10088                 }
10089         }
10090 }
10091 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
10092         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
10093                 let contents = if o.result_ok {
10094                         let result = unsafe { o.contents.result };
10095                         unsafe { o.contents.result = core::ptr::null_mut() };
10096                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
10097                 } else {
10098                         let err = unsafe { o.contents.err };
10099                         unsafe { o.contents.err = core::ptr::null_mut(); }
10100                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
10101                 };
10102                 Self {
10103                         contents,
10104                         result_ok: o.result_ok,
10105                 }
10106         }
10107 }
10108 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
10109         fn clone(&self) -> Self {
10110                 if self.result_ok {
10111                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10112                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
10113                         } }
10114                 } else {
10115                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
10116                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10117                         } }
10118                 }
10119         }
10120 }
10121 #[no_mangle]
10122 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
10123 /// but with all dynamically-allocated buffers duplicated in new buffers.
10124 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
10125 #[repr(C)]
10126 /// The contents of CResult_ChannelDetailsDecodeErrorZ
10127 pub union CResult_ChannelDetailsDecodeErrorZPtr {
10128         /// A pointer to the contents in the success state.
10129         /// Reading from this pointer when `result_ok` is not set is undefined.
10130         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
10131         /// A pointer to the contents in the error state.
10132         /// Reading from this pointer when `result_ok` is set is undefined.
10133         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10134 }
10135 #[repr(C)]
10136 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
10137 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
10138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10139 pub struct CResult_ChannelDetailsDecodeErrorZ {
10140         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
10141         /// `err` or `result` depending on the state of `result_ok`.
10142         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
10143         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
10144         pub result_ok: bool,
10145 }
10146 #[no_mangle]
10147 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
10148 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
10149         CResult_ChannelDetailsDecodeErrorZ {
10150                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10151                         result: Box::into_raw(Box::new(o)),
10152                 },
10153                 result_ok: true,
10154         }
10155 }
10156 #[no_mangle]
10157 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
10158 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
10159         CResult_ChannelDetailsDecodeErrorZ {
10160                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
10161                         err: Box::into_raw(Box::new(e)),
10162                 },
10163                 result_ok: false,
10164         }
10165 }
10166 /// Checks if the given object is currently in the success state
10167 #[no_mangle]
10168 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
10169         o.result_ok
10170 }
10171 #[no_mangle]
10172 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
10173 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
10174 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
10175         fn drop(&mut self) {
10176                 if self.result_ok {
10177                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10178                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10179                         }
10180                 } else {
10181                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10182                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10183                         }
10184                 }
10185         }
10186 }
10187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
10188         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
10189                 let contents = if o.result_ok {
10190                         let result = unsafe { o.contents.result };
10191                         unsafe { o.contents.result = core::ptr::null_mut() };
10192                         CResult_ChannelDetailsDecodeErrorZPtr { result }
10193                 } else {
10194                         let err = unsafe { o.contents.err };
10195                         unsafe { o.contents.err = core::ptr::null_mut(); }
10196                         CResult_ChannelDetailsDecodeErrorZPtr { err }
10197                 };
10198                 Self {
10199                         contents,
10200                         result_ok: o.result_ok,
10201                 }
10202         }
10203 }
10204 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
10205         fn clone(&self) -> Self {
10206                 if self.result_ok {
10207                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10208                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
10209                         } }
10210                 } else {
10211                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
10212                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10213                         } }
10214                 }
10215         }
10216 }
10217 #[no_mangle]
10218 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
10219 /// but with all dynamically-allocated buffers duplicated in new buffers.
10220 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
10221 #[repr(C)]
10222 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
10223 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
10224         /// A pointer to the contents in the success state.
10225         /// Reading from this pointer when `result_ok` is not set is undefined.
10226         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
10227         /// A pointer to the contents in the error state.
10228         /// Reading from this pointer when `result_ok` is set is undefined.
10229         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10230 }
10231 #[repr(C)]
10232 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
10233 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
10234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10235 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
10236         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
10237         /// `err` or `result` depending on the state of `result_ok`.
10238         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
10239         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
10240         pub result_ok: bool,
10241 }
10242 #[no_mangle]
10243 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
10244 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
10245         CResult_PhantomRouteHintsDecodeErrorZ {
10246                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10247                         result: Box::into_raw(Box::new(o)),
10248                 },
10249                 result_ok: true,
10250         }
10251 }
10252 #[no_mangle]
10253 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
10254 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
10255         CResult_PhantomRouteHintsDecodeErrorZ {
10256                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10257                         err: Box::into_raw(Box::new(e)),
10258                 },
10259                 result_ok: false,
10260         }
10261 }
10262 /// Checks if the given object is currently in the success state
10263 #[no_mangle]
10264 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
10265         o.result_ok
10266 }
10267 #[no_mangle]
10268 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
10269 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
10270 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
10271         fn drop(&mut self) {
10272                 if self.result_ok {
10273                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10274                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10275                         }
10276                 } else {
10277                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10278                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10279                         }
10280                 }
10281         }
10282 }
10283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
10284         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
10285                 let contents = if o.result_ok {
10286                         let result = unsafe { o.contents.result };
10287                         unsafe { o.contents.result = core::ptr::null_mut() };
10288                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
10289                 } else {
10290                         let err = unsafe { o.contents.err };
10291                         unsafe { o.contents.err = core::ptr::null_mut(); }
10292                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
10293                 };
10294                 Self {
10295                         contents,
10296                         result_ok: o.result_ok,
10297                 }
10298         }
10299 }
10300 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
10301         fn clone(&self) -> Self {
10302                 if self.result_ok {
10303                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10304                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
10305                         } }
10306                 } else {
10307                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
10308                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10309                         } }
10310                 }
10311         }
10312 }
10313 #[no_mangle]
10314 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
10315 /// but with all dynamically-allocated buffers duplicated in new buffers.
10316 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
10317 #[repr(C)]
10318 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
10319 /// This corresponds to std::vector in C++
10320 pub struct CVec_ChannelMonitorZ {
10321         /// The elements in the array.
10322         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10323         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
10324         /// The number of elements pointed to by `data`.
10325         pub datalen: usize
10326 }
10327 impl CVec_ChannelMonitorZ {
10328         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
10329                 if self.datalen == 0 { return Vec::new(); }
10330                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10331                 self.data = core::ptr::null_mut();
10332                 self.datalen = 0;
10333                 ret
10334         }
10335         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
10336                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10337         }
10338 }
10339 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
10340         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
10341                 let datalen = v.len();
10342                 let data = Box::into_raw(v.into_boxed_slice());
10343                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10344         }
10345 }
10346 #[no_mangle]
10347 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10348 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
10349 impl Drop for CVec_ChannelMonitorZ {
10350         fn drop(&mut self) {
10351                 if self.datalen == 0 { return; }
10352                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10353         }
10354 }
10355 #[repr(C)]
10356 /// A tuple of 2 elements. See the individual fields for the types contained.
10357 pub struct C2Tuple_BlockHashChannelManagerZ {
10358         /// The element at position 0
10359         pub a: crate::c_types::ThirtyTwoBytes,
10360         /// The element at position 1
10361         pub b: crate::lightning::ln::channelmanager::ChannelManager,
10362 }
10363 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
10364         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
10365                 Self {
10366                         a: tup.0,
10367                         b: tup.1,
10368                 }
10369         }
10370 }
10371 impl C2Tuple_BlockHashChannelManagerZ {
10372         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
10373                 (self.a, self.b)
10374         }
10375 }
10376 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10377 #[no_mangle]
10378 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
10379         C2Tuple_BlockHashChannelManagerZ { a, b, }
10380 }
10381
10382 #[no_mangle]
10383 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10384 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
10385 #[repr(C)]
10386 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
10387 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10388         /// A pointer to the contents in the success state.
10389         /// Reading from this pointer when `result_ok` is not set is undefined.
10390         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
10391         /// A pointer to the contents in the error state.
10392         /// Reading from this pointer when `result_ok` is set is undefined.
10393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10394 }
10395 #[repr(C)]
10396 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
10397 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10399 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10400         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
10401         /// `err` or `result` depending on the state of `result_ok`.
10402         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
10403         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
10404         pub result_ok: bool,
10405 }
10406 #[no_mangle]
10407 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10408 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10409         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10410                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10411                         result: Box::into_raw(Box::new(o)),
10412                 },
10413                 result_ok: true,
10414         }
10415 }
10416 #[no_mangle]
10417 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10418 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10419         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10420                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
10421                         err: Box::into_raw(Box::new(e)),
10422                 },
10423                 result_ok: false,
10424         }
10425 }
10426 /// Checks if the given object is currently in the success state
10427 #[no_mangle]
10428 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
10429         o.result_ok
10430 }
10431 #[no_mangle]
10432 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10433 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
10434 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10435         fn drop(&mut self) {
10436                 if self.result_ok {
10437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10439                         }
10440                 } else {
10441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10443                         }
10444                 }
10445         }
10446 }
10447 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
10448         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10449                 let contents = if o.result_ok {
10450                         let result = unsafe { o.contents.result };
10451                         unsafe { o.contents.result = core::ptr::null_mut() };
10452                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
10453                 } else {
10454                         let err = unsafe { o.contents.err };
10455                         unsafe { o.contents.err = core::ptr::null_mut(); }
10456                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
10457                 };
10458                 Self {
10459                         contents,
10460                         result_ok: o.result_ok,
10461                 }
10462         }
10463 }
10464 #[repr(C)]
10465 /// The contents of CResult_ChannelConfigDecodeErrorZ
10466 pub union CResult_ChannelConfigDecodeErrorZPtr {
10467         /// A pointer to the contents in the success state.
10468         /// Reading from this pointer when `result_ok` is not set is undefined.
10469         pub result: *mut crate::lightning::util::config::ChannelConfig,
10470         /// A pointer to the contents in the error state.
10471         /// Reading from this pointer when `result_ok` is set is undefined.
10472         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10473 }
10474 #[repr(C)]
10475 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
10476 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
10477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10478 pub struct CResult_ChannelConfigDecodeErrorZ {
10479         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
10480         /// `err` or `result` depending on the state of `result_ok`.
10481         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
10482         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
10483         pub result_ok: bool,
10484 }
10485 #[no_mangle]
10486 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10487 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
10488         CResult_ChannelConfigDecodeErrorZ {
10489                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10490                         result: Box::into_raw(Box::new(o)),
10491                 },
10492                 result_ok: true,
10493         }
10494 }
10495 #[no_mangle]
10496 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10497 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
10498         CResult_ChannelConfigDecodeErrorZ {
10499                 contents: CResult_ChannelConfigDecodeErrorZPtr {
10500                         err: Box::into_raw(Box::new(e)),
10501                 },
10502                 result_ok: false,
10503         }
10504 }
10505 /// Checks if the given object is currently in the success state
10506 #[no_mangle]
10507 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
10508         o.result_ok
10509 }
10510 #[no_mangle]
10511 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10512 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
10513 impl Drop for CResult_ChannelConfigDecodeErrorZ {
10514         fn drop(&mut self) {
10515                 if self.result_ok {
10516                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10517                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10518                         }
10519                 } else {
10520                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10521                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10522                         }
10523                 }
10524         }
10525 }
10526 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
10527         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
10528                 let contents = if o.result_ok {
10529                         let result = unsafe { o.contents.result };
10530                         unsafe { o.contents.result = core::ptr::null_mut() };
10531                         CResult_ChannelConfigDecodeErrorZPtr { result }
10532                 } else {
10533                         let err = unsafe { o.contents.err };
10534                         unsafe { o.contents.err = core::ptr::null_mut(); }
10535                         CResult_ChannelConfigDecodeErrorZPtr { err }
10536                 };
10537                 Self {
10538                         contents,
10539                         result_ok: o.result_ok,
10540                 }
10541         }
10542 }
10543 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10544         fn clone(&self) -> Self {
10545                 if self.result_ok {
10546                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10547                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10548                         } }
10549                 } else {
10550                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10551                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10552                         } }
10553                 }
10554         }
10555 }
10556 #[no_mangle]
10557 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10558 /// but with all dynamically-allocated buffers duplicated in new buffers.
10559 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10560 #[repr(C)]
10561 #[derive(Clone)]
10562 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10563 pub enum COption_APIErrorZ {
10564         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10565         Some(crate::lightning::util::errors::APIError),
10566         /// When we're in this state, this COption_APIErrorZ contains nothing
10567         None
10568 }
10569 impl COption_APIErrorZ {
10570         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10571                 if let Self::None = self { false } else { true }
10572         }
10573         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10574                 !self.is_some()
10575         }
10576         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10577                 if let Self::Some(v) = self { v } else { unreachable!() }
10578         }
10579 }
10580 #[no_mangle]
10581 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10582 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10583         COption_APIErrorZ::Some(o)
10584 }
10585 #[no_mangle]
10586 /// Constructs a new COption_APIErrorZ containing nothing
10587 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10588         COption_APIErrorZ::None
10589 }
10590 #[no_mangle]
10591 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10592 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10593 #[no_mangle]
10594 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10595 /// but with all dynamically-allocated buffers duplicated in new buffers.
10596 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10597 #[repr(C)]
10598 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10599 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10600         /// A pointer to the contents in the success state.
10601         /// Reading from this pointer when `result_ok` is not set is undefined.
10602         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10603         /// A pointer to the contents in the error state.
10604         /// Reading from this pointer when `result_ok` is set is undefined.
10605         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10606 }
10607 #[repr(C)]
10608 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10609 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10611 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10612         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10613         /// `err` or `result` depending on the state of `result_ok`.
10614         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10615         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10616         pub result_ok: bool,
10617 }
10618 #[no_mangle]
10619 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10620 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10621         CResult_COption_APIErrorZDecodeErrorZ {
10622                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10623                         result: Box::into_raw(Box::new(o)),
10624                 },
10625                 result_ok: true,
10626         }
10627 }
10628 #[no_mangle]
10629 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10630 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10631         CResult_COption_APIErrorZDecodeErrorZ {
10632                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10633                         err: Box::into_raw(Box::new(e)),
10634                 },
10635                 result_ok: false,
10636         }
10637 }
10638 /// Checks if the given object is currently in the success state
10639 #[no_mangle]
10640 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10641         o.result_ok
10642 }
10643 #[no_mangle]
10644 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10645 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10646 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10647         fn drop(&mut self) {
10648                 if self.result_ok {
10649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10651                         }
10652                 } else {
10653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10655                         }
10656                 }
10657         }
10658 }
10659 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10660         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10661                 let contents = if o.result_ok {
10662                         let result = unsafe { o.contents.result };
10663                         unsafe { o.contents.result = core::ptr::null_mut() };
10664                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
10665                 } else {
10666                         let err = unsafe { o.contents.err };
10667                         unsafe { o.contents.err = core::ptr::null_mut(); }
10668                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
10669                 };
10670                 Self {
10671                         contents,
10672                         result_ok: o.result_ok,
10673                 }
10674         }
10675 }
10676 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10677         fn clone(&self) -> Self {
10678                 if self.result_ok {
10679                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10680                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10681                         } }
10682                 } else {
10683                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10685                         } }
10686                 }
10687         }
10688 }
10689 #[no_mangle]
10690 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10691 /// but with all dynamically-allocated buffers duplicated in new buffers.
10692 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10693 #[repr(C)]
10694 /// The contents of CResult_UntrustedStringDecodeErrorZ
10695 pub union CResult_UntrustedStringDecodeErrorZPtr {
10696         /// A pointer to the contents in the success state.
10697         /// Reading from this pointer when `result_ok` is not set is undefined.
10698         pub result: *mut crate::lightning::util::string::UntrustedString,
10699         /// A pointer to the contents in the error state.
10700         /// Reading from this pointer when `result_ok` is set is undefined.
10701         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10702 }
10703 #[repr(C)]
10704 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
10705 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
10706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10707 pub struct CResult_UntrustedStringDecodeErrorZ {
10708         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
10709         /// `err` or `result` depending on the state of `result_ok`.
10710         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
10711         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
10712         pub result_ok: bool,
10713 }
10714 #[no_mangle]
10715 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
10716 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
10717         CResult_UntrustedStringDecodeErrorZ {
10718                 contents: CResult_UntrustedStringDecodeErrorZPtr {
10719                         result: Box::into_raw(Box::new(o)),
10720                 },
10721                 result_ok: true,
10722         }
10723 }
10724 #[no_mangle]
10725 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
10726 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
10727         CResult_UntrustedStringDecodeErrorZ {
10728                 contents: CResult_UntrustedStringDecodeErrorZPtr {
10729                         err: Box::into_raw(Box::new(e)),
10730                 },
10731                 result_ok: false,
10732         }
10733 }
10734 /// Checks if the given object is currently in the success state
10735 #[no_mangle]
10736 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
10737         o.result_ok
10738 }
10739 #[no_mangle]
10740 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
10741 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
10742 impl Drop for CResult_UntrustedStringDecodeErrorZ {
10743         fn drop(&mut self) {
10744                 if self.result_ok {
10745                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10746                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10747                         }
10748                 } else {
10749                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10750                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10751                         }
10752                 }
10753         }
10754 }
10755 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
10756         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
10757                 let contents = if o.result_ok {
10758                         let result = unsafe { o.contents.result };
10759                         unsafe { o.contents.result = core::ptr::null_mut() };
10760                         CResult_UntrustedStringDecodeErrorZPtr { result }
10761                 } else {
10762                         let err = unsafe { o.contents.err };
10763                         unsafe { o.contents.err = core::ptr::null_mut(); }
10764                         CResult_UntrustedStringDecodeErrorZPtr { err }
10765                 };
10766                 Self {
10767                         contents,
10768                         result_ok: o.result_ok,
10769                 }
10770         }
10771 }
10772 impl Clone for CResult_UntrustedStringDecodeErrorZ {
10773         fn clone(&self) -> Self {
10774                 if self.result_ok {
10775                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
10776                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
10777                         } }
10778                 } else {
10779                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
10780                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10781                         } }
10782                 }
10783         }
10784 }
10785 #[no_mangle]
10786 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
10787 /// but with all dynamically-allocated buffers duplicated in new buffers.
10788 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
10789 #[repr(C)]
10790 /// The contents of CResult_OutPointDecodeErrorZ
10791 pub union CResult_OutPointDecodeErrorZPtr {
10792         /// A pointer to the contents in the success state.
10793         /// Reading from this pointer when `result_ok` is not set is undefined.
10794         pub result: *mut crate::lightning::chain::transaction::OutPoint,
10795         /// A pointer to the contents in the error state.
10796         /// Reading from this pointer when `result_ok` is set is undefined.
10797         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10798 }
10799 #[repr(C)]
10800 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
10801 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
10802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10803 pub struct CResult_OutPointDecodeErrorZ {
10804         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
10805         /// `err` or `result` depending on the state of `result_ok`.
10806         pub contents: CResult_OutPointDecodeErrorZPtr,
10807         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
10808         pub result_ok: bool,
10809 }
10810 #[no_mangle]
10811 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
10812 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
10813         CResult_OutPointDecodeErrorZ {
10814                 contents: CResult_OutPointDecodeErrorZPtr {
10815                         result: Box::into_raw(Box::new(o)),
10816                 },
10817                 result_ok: true,
10818         }
10819 }
10820 #[no_mangle]
10821 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
10822 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
10823         CResult_OutPointDecodeErrorZ {
10824                 contents: CResult_OutPointDecodeErrorZPtr {
10825                         err: Box::into_raw(Box::new(e)),
10826                 },
10827                 result_ok: false,
10828         }
10829 }
10830 /// Checks if the given object is currently in the success state
10831 #[no_mangle]
10832 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10833         o.result_ok
10834 }
10835 #[no_mangle]
10836 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10837 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10838 impl Drop for CResult_OutPointDecodeErrorZ {
10839         fn drop(&mut self) {
10840                 if self.result_ok {
10841                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10842                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10843                         }
10844                 } else {
10845                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10846                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10847                         }
10848                 }
10849         }
10850 }
10851 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10852         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10853                 let contents = if o.result_ok {
10854                         let result = unsafe { o.contents.result };
10855                         unsafe { o.contents.result = core::ptr::null_mut() };
10856                         CResult_OutPointDecodeErrorZPtr { result }
10857                 } else {
10858                         let err = unsafe { o.contents.err };
10859                         unsafe { o.contents.err = core::ptr::null_mut(); }
10860                         CResult_OutPointDecodeErrorZPtr { err }
10861                 };
10862                 Self {
10863                         contents,
10864                         result_ok: o.result_ok,
10865                 }
10866         }
10867 }
10868 impl Clone for CResult_OutPointDecodeErrorZ {
10869         fn clone(&self) -> Self {
10870                 if self.result_ok {
10871                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10872                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10873                         } }
10874                 } else {
10875                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10876                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10877                         } }
10878                 }
10879         }
10880 }
10881 #[no_mangle]
10882 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10883 /// but with all dynamically-allocated buffers duplicated in new buffers.
10884 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10885 #[repr(C)]
10886 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10887 pub enum COption_TypeZ {
10888         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10889         Some(crate::lightning::ln::wire::Type),
10890         /// When we're in this state, this COption_TypeZ contains nothing
10891         None
10892 }
10893 impl COption_TypeZ {
10894         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10895                 if let Self::None = self { false } else { true }
10896         }
10897         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10898                 !self.is_some()
10899         }
10900         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10901                 if let Self::Some(v) = self { v } else { unreachable!() }
10902         }
10903 }
10904 #[no_mangle]
10905 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10906 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10907         COption_TypeZ::Some(o)
10908 }
10909 #[no_mangle]
10910 /// Constructs a new COption_TypeZ containing nothing
10911 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10912         COption_TypeZ::None
10913 }
10914 #[no_mangle]
10915 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10916 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10917 #[repr(C)]
10918 /// The contents of CResult_COption_TypeZDecodeErrorZ
10919 pub union CResult_COption_TypeZDecodeErrorZPtr {
10920         /// A pointer to the contents in the success state.
10921         /// Reading from this pointer when `result_ok` is not set is undefined.
10922         pub result: *mut crate::c_types::derived::COption_TypeZ,
10923         /// A pointer to the contents in the error state.
10924         /// Reading from this pointer when `result_ok` is set is undefined.
10925         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10926 }
10927 #[repr(C)]
10928 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10929 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10931 pub struct CResult_COption_TypeZDecodeErrorZ {
10932         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10933         /// `err` or `result` depending on the state of `result_ok`.
10934         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10935         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10936         pub result_ok: bool,
10937 }
10938 #[no_mangle]
10939 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10940 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10941         CResult_COption_TypeZDecodeErrorZ {
10942                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10943                         result: Box::into_raw(Box::new(o)),
10944                 },
10945                 result_ok: true,
10946         }
10947 }
10948 #[no_mangle]
10949 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10950 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10951         CResult_COption_TypeZDecodeErrorZ {
10952                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10953                         err: Box::into_raw(Box::new(e)),
10954                 },
10955                 result_ok: false,
10956         }
10957 }
10958 /// Checks if the given object is currently in the success state
10959 #[no_mangle]
10960 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10961         o.result_ok
10962 }
10963 #[no_mangle]
10964 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10965 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10966 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10967         fn drop(&mut self) {
10968                 if self.result_ok {
10969                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10970                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10971                         }
10972                 } else {
10973                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10974                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10975                         }
10976                 }
10977         }
10978 }
10979 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10980         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10981                 let contents = if o.result_ok {
10982                         let result = unsafe { o.contents.result };
10983                         unsafe { o.contents.result = core::ptr::null_mut() };
10984                         CResult_COption_TypeZDecodeErrorZPtr { result }
10985                 } else {
10986                         let err = unsafe { o.contents.err };
10987                         unsafe { o.contents.err = core::ptr::null_mut(); }
10988                         CResult_COption_TypeZDecodeErrorZPtr { err }
10989                 };
10990                 Self {
10991                         contents,
10992                         result_ok: o.result_ok,
10993                 }
10994         }
10995 }
10996 #[repr(C)]
10997 /// The contents of CResult_PaymentIdPaymentErrorZ
10998 pub union CResult_PaymentIdPaymentErrorZPtr {
10999         /// A pointer to the contents in the success state.
11000         /// Reading from this pointer when `result_ok` is not set is undefined.
11001         pub result: *mut crate::c_types::ThirtyTwoBytes,
11002         /// A pointer to the contents in the error state.
11003         /// Reading from this pointer when `result_ok` is set is undefined.
11004         pub err: *mut crate::lightning_invoice::payment::PaymentError,
11005 }
11006 #[repr(C)]
11007 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
11008 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
11009 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11010 pub struct CResult_PaymentIdPaymentErrorZ {
11011         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
11012         /// `err` or `result` depending on the state of `result_ok`.
11013         pub contents: CResult_PaymentIdPaymentErrorZPtr,
11014         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
11015         pub result_ok: bool,
11016 }
11017 #[no_mangle]
11018 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
11019 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
11020         CResult_PaymentIdPaymentErrorZ {
11021                 contents: CResult_PaymentIdPaymentErrorZPtr {
11022                         result: Box::into_raw(Box::new(o)),
11023                 },
11024                 result_ok: true,
11025         }
11026 }
11027 #[no_mangle]
11028 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
11029 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
11030         CResult_PaymentIdPaymentErrorZ {
11031                 contents: CResult_PaymentIdPaymentErrorZPtr {
11032                         err: Box::into_raw(Box::new(e)),
11033                 },
11034                 result_ok: false,
11035         }
11036 }
11037 /// Checks if the given object is currently in the success state
11038 #[no_mangle]
11039 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
11040         o.result_ok
11041 }
11042 #[no_mangle]
11043 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
11044 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
11045 impl Drop for CResult_PaymentIdPaymentErrorZ {
11046         fn drop(&mut self) {
11047                 if self.result_ok {
11048                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11049                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11050                         }
11051                 } else {
11052                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11053                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11054                         }
11055                 }
11056         }
11057 }
11058 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
11059         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
11060                 let contents = if o.result_ok {
11061                         let result = unsafe { o.contents.result };
11062                         unsafe { o.contents.result = core::ptr::null_mut() };
11063                         CResult_PaymentIdPaymentErrorZPtr { result }
11064                 } else {
11065                         let err = unsafe { o.contents.err };
11066                         unsafe { o.contents.err = core::ptr::null_mut(); }
11067                         CResult_PaymentIdPaymentErrorZPtr { err }
11068                 };
11069                 Self {
11070                         contents,
11071                         result_ok: o.result_ok,
11072                 }
11073         }
11074 }
11075 impl Clone for CResult_PaymentIdPaymentErrorZ {
11076         fn clone(&self) -> Self {
11077                 if self.result_ok {
11078                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
11079                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
11080                         } }
11081                 } else {
11082                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
11083                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11084                         } }
11085                 }
11086         }
11087 }
11088 #[no_mangle]
11089 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
11090 /// but with all dynamically-allocated buffers duplicated in new buffers.
11091 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
11092 #[repr(C)]
11093 /// The contents of CResult_NonePaymentErrorZ
11094 pub union CResult_NonePaymentErrorZPtr {
11095         /// Note that this value is always NULL, as there are no contents in the OK variant
11096         pub result: *mut core::ffi::c_void,
11097         /// A pointer to the contents in the error state.
11098         /// Reading from this pointer when `result_ok` is set is undefined.
11099         pub err: *mut crate::lightning_invoice::payment::PaymentError,
11100 }
11101 #[repr(C)]
11102 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
11103 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
11104 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11105 pub struct CResult_NonePaymentErrorZ {
11106         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
11107         /// `err` or `result` depending on the state of `result_ok`.
11108         pub contents: CResult_NonePaymentErrorZPtr,
11109         /// Whether this CResult_NonePaymentErrorZ represents a success state.
11110         pub result_ok: bool,
11111 }
11112 #[no_mangle]
11113 /// Creates a new CResult_NonePaymentErrorZ in the success state.
11114 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
11115         CResult_NonePaymentErrorZ {
11116                 contents: CResult_NonePaymentErrorZPtr {
11117                         result: core::ptr::null_mut(),
11118                 },
11119                 result_ok: true,
11120         }
11121 }
11122 #[no_mangle]
11123 /// Creates a new CResult_NonePaymentErrorZ in the error state.
11124 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
11125         CResult_NonePaymentErrorZ {
11126                 contents: CResult_NonePaymentErrorZPtr {
11127                         err: Box::into_raw(Box::new(e)),
11128                 },
11129                 result_ok: false,
11130         }
11131 }
11132 /// Checks if the given object is currently in the success state
11133 #[no_mangle]
11134 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
11135         o.result_ok
11136 }
11137 #[no_mangle]
11138 /// Frees any resources used by the CResult_NonePaymentErrorZ.
11139 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
11140 impl Drop for CResult_NonePaymentErrorZ {
11141         fn drop(&mut self) {
11142                 if self.result_ok {
11143                 } else {
11144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11146                         }
11147                 }
11148         }
11149 }
11150 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
11151         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
11152                 let contents = if o.result_ok {
11153                         let _ = unsafe { Box::from_raw(o.contents.result) };
11154                         o.contents.result = core::ptr::null_mut();
11155                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
11156                 } else {
11157                         let err = unsafe { o.contents.err };
11158                         unsafe { o.contents.err = core::ptr::null_mut(); }
11159                         CResult_NonePaymentErrorZPtr { err }
11160                 };
11161                 Self {
11162                         contents,
11163                         result_ok: o.result_ok,
11164                 }
11165         }
11166 }
11167 impl Clone for CResult_NonePaymentErrorZ {
11168         fn clone(&self) -> Self {
11169                 if self.result_ok {
11170                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
11171                                 result: core::ptr::null_mut()
11172                         } }
11173                 } else {
11174                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
11175                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
11176                         } }
11177                 }
11178         }
11179 }
11180 #[no_mangle]
11181 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
11182 /// but with all dynamically-allocated buffers duplicated in new buffers.
11183 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
11184 #[repr(C)]
11185 /// The contents of CResult_StringErrorZ
11186 pub union CResult_StringErrorZPtr {
11187         /// A pointer to the contents in the success state.
11188         /// Reading from this pointer when `result_ok` is not set is undefined.
11189         pub result: *mut crate::c_types::Str,
11190         /// A pointer to the contents in the error state.
11191         /// Reading from this pointer when `result_ok` is set is undefined.
11192         pub err: *mut crate::c_types::Secp256k1Error,
11193 }
11194 #[repr(C)]
11195 /// A CResult_StringErrorZ represents the result of a fallible operation,
11196 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
11197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11198 pub struct CResult_StringErrorZ {
11199         /// The contents of this CResult_StringErrorZ, accessible via either
11200         /// `err` or `result` depending on the state of `result_ok`.
11201         pub contents: CResult_StringErrorZPtr,
11202         /// Whether this CResult_StringErrorZ represents a success state.
11203         pub result_ok: bool,
11204 }
11205 #[no_mangle]
11206 /// Creates a new CResult_StringErrorZ in the success state.
11207 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
11208         CResult_StringErrorZ {
11209                 contents: CResult_StringErrorZPtr {
11210                         result: Box::into_raw(Box::new(o)),
11211                 },
11212                 result_ok: true,
11213         }
11214 }
11215 #[no_mangle]
11216 /// Creates a new CResult_StringErrorZ in the error state.
11217 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
11218         CResult_StringErrorZ {
11219                 contents: CResult_StringErrorZPtr {
11220                         err: Box::into_raw(Box::new(e)),
11221                 },
11222                 result_ok: false,
11223         }
11224 }
11225 /// Checks if the given object is currently in the success state
11226 #[no_mangle]
11227 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
11228         o.result_ok
11229 }
11230 #[no_mangle]
11231 /// Frees any resources used by the CResult_StringErrorZ.
11232 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
11233 impl Drop for CResult_StringErrorZ {
11234         fn drop(&mut self) {
11235                 if self.result_ok {
11236                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11237                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11238                         }
11239                 } else {
11240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11242                         }
11243                 }
11244         }
11245 }
11246 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
11247         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
11248                 let contents = if o.result_ok {
11249                         let result = unsafe { o.contents.result };
11250                         unsafe { o.contents.result = core::ptr::null_mut() };
11251                         CResult_StringErrorZPtr { result }
11252                 } else {
11253                         let err = unsafe { o.contents.err };
11254                         unsafe { o.contents.err = core::ptr::null_mut(); }
11255                         CResult_StringErrorZPtr { err }
11256                 };
11257                 Self {
11258                         contents,
11259                         result_ok: o.result_ok,
11260                 }
11261         }
11262 }
11263 impl Clone for CResult_StringErrorZ {
11264         fn clone(&self) -> Self {
11265                 if self.result_ok {
11266                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
11267                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
11268                         } }
11269                 } else {
11270                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
11271                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
11272                         } }
11273                 }
11274         }
11275 }
11276 #[no_mangle]
11277 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
11278 /// but with all dynamically-allocated buffers duplicated in new buffers.
11279 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
11280 #[repr(C)]
11281 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
11282 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11283         /// A pointer to the contents in the success state.
11284         /// Reading from this pointer when `result_ok` is not set is undefined.
11285         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
11286         /// A pointer to the contents in the error state.
11287         /// Reading from this pointer when `result_ok` is set is undefined.
11288         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11289 }
11290 #[repr(C)]
11291 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
11292 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11294 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
11295         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
11296         /// `err` or `result` depending on the state of `result_ok`.
11297         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
11298         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
11299         pub result_ok: bool,
11300 }
11301 #[no_mangle]
11302 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
11303 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11304         CResult_ChannelMonitorUpdateDecodeErrorZ {
11305                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11306                         result: Box::into_raw(Box::new(o)),
11307                 },
11308                 result_ok: true,
11309         }
11310 }
11311 #[no_mangle]
11312 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
11313 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
11314         CResult_ChannelMonitorUpdateDecodeErrorZ {
11315                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11316                         err: Box::into_raw(Box::new(e)),
11317                 },
11318                 result_ok: false,
11319         }
11320 }
11321 /// Checks if the given object is currently in the success state
11322 #[no_mangle]
11323 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
11324         o.result_ok
11325 }
11326 #[no_mangle]
11327 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
11328 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
11329 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
11330         fn drop(&mut self) {
11331                 if self.result_ok {
11332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11334                         }
11335                 } else {
11336                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11337                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11338                         }
11339                 }
11340         }
11341 }
11342 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
11343         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11344                 let contents = if o.result_ok {
11345                         let result = unsafe { o.contents.result };
11346                         unsafe { o.contents.result = core::ptr::null_mut() };
11347                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
11348                 } else {
11349                         let err = unsafe { o.contents.err };
11350                         unsafe { o.contents.err = core::ptr::null_mut(); }
11351                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
11352                 };
11353                 Self {
11354                         contents,
11355                         result_ok: o.result_ok,
11356                 }
11357         }
11358 }
11359 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
11360         fn clone(&self) -> Self {
11361                 if self.result_ok {
11362                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11363                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
11364                         } }
11365                 } else {
11366                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
11367                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11368                         } }
11369                 }
11370         }
11371 }
11372 #[no_mangle]
11373 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
11374 /// but with all dynamically-allocated buffers duplicated in new buffers.
11375 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
11376 #[repr(C)]
11377 #[derive(Clone)]
11378 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
11379 pub enum COption_MonitorEventZ {
11380         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
11381         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
11382         /// When we're in this state, this COption_MonitorEventZ contains nothing
11383         None
11384 }
11385 impl COption_MonitorEventZ {
11386         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11387                 if let Self::None = self { false } else { true }
11388         }
11389         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11390                 !self.is_some()
11391         }
11392         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
11393                 if let Self::Some(v) = self { v } else { unreachable!() }
11394         }
11395 }
11396 #[no_mangle]
11397 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
11398 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
11399         COption_MonitorEventZ::Some(o)
11400 }
11401 #[no_mangle]
11402 /// Constructs a new COption_MonitorEventZ containing nothing
11403 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
11404         COption_MonitorEventZ::None
11405 }
11406 #[no_mangle]
11407 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11408 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11409 #[no_mangle]
11410 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11411 /// but with all dynamically-allocated buffers duplicated in new buffers.
11412 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11413 #[repr(C)]
11414 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11415 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11416         /// A pointer to the contents in the success state.
11417         /// Reading from this pointer when `result_ok` is not set is undefined.
11418         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11419         /// A pointer to the contents in the error state.
11420         /// Reading from this pointer when `result_ok` is set is undefined.
11421         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11422 }
11423 #[repr(C)]
11424 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11425 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11427 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11428         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11429         /// `err` or `result` depending on the state of `result_ok`.
11430         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11431         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11432         pub result_ok: bool,
11433 }
11434 #[no_mangle]
11435 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11436 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11437         CResult_COption_MonitorEventZDecodeErrorZ {
11438                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11439                         result: Box::into_raw(Box::new(o)),
11440                 },
11441                 result_ok: true,
11442         }
11443 }
11444 #[no_mangle]
11445 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11446 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11447         CResult_COption_MonitorEventZDecodeErrorZ {
11448                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11449                         err: Box::into_raw(Box::new(e)),
11450                 },
11451                 result_ok: false,
11452         }
11453 }
11454 /// Checks if the given object is currently in the success state
11455 #[no_mangle]
11456 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11457         o.result_ok
11458 }
11459 #[no_mangle]
11460 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11461 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11462 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11463         fn drop(&mut self) {
11464                 if self.result_ok {
11465                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11466                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11467                         }
11468                 } else {
11469                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11470                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11471                         }
11472                 }
11473         }
11474 }
11475 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11476         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11477                 let contents = if o.result_ok {
11478                         let result = unsafe { o.contents.result };
11479                         unsafe { o.contents.result = core::ptr::null_mut() };
11480                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11481                 } else {
11482                         let err = unsafe { o.contents.err };
11483                         unsafe { o.contents.err = core::ptr::null_mut(); }
11484                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11485                 };
11486                 Self {
11487                         contents,
11488                         result_ok: o.result_ok,
11489                 }
11490         }
11491 }
11492 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11493         fn clone(&self) -> Self {
11494                 if self.result_ok {
11495                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11496                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11497                         } }
11498                 } else {
11499                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11500                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11501                         } }
11502                 }
11503         }
11504 }
11505 #[no_mangle]
11506 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11507 /// but with all dynamically-allocated buffers duplicated in new buffers.
11508 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11509 #[repr(C)]
11510 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11511 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11512         /// A pointer to the contents in the success state.
11513         /// Reading from this pointer when `result_ok` is not set is undefined.
11514         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11515         /// A pointer to the contents in the error state.
11516         /// Reading from this pointer when `result_ok` is set is undefined.
11517         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11518 }
11519 #[repr(C)]
11520 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11521 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11522 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11523 pub struct CResult_HTLCUpdateDecodeErrorZ {
11524         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11525         /// `err` or `result` depending on the state of `result_ok`.
11526         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11527         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11528         pub result_ok: bool,
11529 }
11530 #[no_mangle]
11531 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11532 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11533         CResult_HTLCUpdateDecodeErrorZ {
11534                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11535                         result: Box::into_raw(Box::new(o)),
11536                 },
11537                 result_ok: true,
11538         }
11539 }
11540 #[no_mangle]
11541 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11542 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11543         CResult_HTLCUpdateDecodeErrorZ {
11544                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11545                         err: Box::into_raw(Box::new(e)),
11546                 },
11547                 result_ok: false,
11548         }
11549 }
11550 /// Checks if the given object is currently in the success state
11551 #[no_mangle]
11552 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11553         o.result_ok
11554 }
11555 #[no_mangle]
11556 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11557 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11558 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11559         fn drop(&mut self) {
11560                 if self.result_ok {
11561                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11562                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11563                         }
11564                 } else {
11565                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11566                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11567                         }
11568                 }
11569         }
11570 }
11571 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11572         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11573                 let contents = if o.result_ok {
11574                         let result = unsafe { o.contents.result };
11575                         unsafe { o.contents.result = core::ptr::null_mut() };
11576                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11577                 } else {
11578                         let err = unsafe { o.contents.err };
11579                         unsafe { o.contents.err = core::ptr::null_mut(); }
11580                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11581                 };
11582                 Self {
11583                         contents,
11584                         result_ok: o.result_ok,
11585                 }
11586         }
11587 }
11588 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11589         fn clone(&self) -> Self {
11590                 if self.result_ok {
11591                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11592                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11593                         } }
11594                 } else {
11595                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11596                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11597                         } }
11598                 }
11599         }
11600 }
11601 #[no_mangle]
11602 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11603 /// but with all dynamically-allocated buffers duplicated in new buffers.
11604 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11605 #[repr(C)]
11606 /// A tuple of 2 elements. See the individual fields for the types contained.
11607 pub struct C2Tuple_OutPointScriptZ {
11608         /// The element at position 0
11609         pub a: crate::lightning::chain::transaction::OutPoint,
11610         /// The element at position 1
11611         pub b: crate::c_types::derived::CVec_u8Z,
11612 }
11613 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11614         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11615                 Self {
11616                         a: tup.0,
11617                         b: tup.1,
11618                 }
11619         }
11620 }
11621 impl C2Tuple_OutPointScriptZ {
11622         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11623                 (self.a, self.b)
11624         }
11625 }
11626 impl Clone for C2Tuple_OutPointScriptZ {
11627         fn clone(&self) -> Self {
11628                 Self {
11629                         a: Clone::clone(&self.a),
11630                         b: Clone::clone(&self.b),
11631                 }
11632         }
11633 }
11634 #[no_mangle]
11635 /// Creates a new tuple which has the same data as `orig`
11636 /// but with all dynamically-allocated buffers duplicated in new buffers.
11637 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11638 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11639 #[no_mangle]
11640 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11641         C2Tuple_OutPointScriptZ { a, b, }
11642 }
11643
11644 #[no_mangle]
11645 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11646 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11647 #[repr(C)]
11648 /// A tuple of 2 elements. See the individual fields for the types contained.
11649 pub struct C2Tuple_u32ScriptZ {
11650         /// The element at position 0
11651         pub a: u32,
11652         /// The element at position 1
11653         pub b: crate::c_types::derived::CVec_u8Z,
11654 }
11655 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11656         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11657                 Self {
11658                         a: tup.0,
11659                         b: tup.1,
11660                 }
11661         }
11662 }
11663 impl C2Tuple_u32ScriptZ {
11664         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11665                 (self.a, self.b)
11666         }
11667 }
11668 impl Clone for C2Tuple_u32ScriptZ {
11669         fn clone(&self) -> Self {
11670                 Self {
11671                         a: Clone::clone(&self.a),
11672                         b: Clone::clone(&self.b),
11673                 }
11674         }
11675 }
11676 #[no_mangle]
11677 /// Creates a new tuple which has the same data as `orig`
11678 /// but with all dynamically-allocated buffers duplicated in new buffers.
11679 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11680 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11681 #[no_mangle]
11682 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11683         C2Tuple_u32ScriptZ { a, b, }
11684 }
11685
11686 #[no_mangle]
11687 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11688 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11689 #[repr(C)]
11690 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11691 /// This corresponds to std::vector in C++
11692 pub struct CVec_C2Tuple_u32ScriptZZ {
11693         /// The elements in the array.
11694         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11695         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11696         /// The number of elements pointed to by `data`.
11697         pub datalen: usize
11698 }
11699 impl CVec_C2Tuple_u32ScriptZZ {
11700         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11701                 if self.datalen == 0 { return Vec::new(); }
11702                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11703                 self.data = core::ptr::null_mut();
11704                 self.datalen = 0;
11705                 ret
11706         }
11707         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11708                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11709         }
11710 }
11711 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11712         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11713                 let datalen = v.len();
11714                 let data = Box::into_raw(v.into_boxed_slice());
11715                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11716         }
11717 }
11718 #[no_mangle]
11719 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11720 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11721 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11722         fn drop(&mut self) {
11723                 if self.datalen == 0 { return; }
11724                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11725         }
11726 }
11727 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11728         fn clone(&self) -> Self {
11729                 let mut res = Vec::new();
11730                 if self.datalen == 0 { return Self::from(res); }
11731                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11732                 Self::from(res)
11733         }
11734 }
11735 #[repr(C)]
11736 /// A tuple of 2 elements. See the individual fields for the types contained.
11737 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11738         /// The element at position 0
11739         pub a: crate::c_types::ThirtyTwoBytes,
11740         /// The element at position 1
11741         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11742 }
11743 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11744         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11745                 Self {
11746                         a: tup.0,
11747                         b: tup.1,
11748                 }
11749         }
11750 }
11751 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11752         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11753                 (self.a, self.b)
11754         }
11755 }
11756 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11757         fn clone(&self) -> Self {
11758                 Self {
11759                         a: Clone::clone(&self.a),
11760                         b: Clone::clone(&self.b),
11761                 }
11762         }
11763 }
11764 #[no_mangle]
11765 /// Creates a new tuple which has the same data as `orig`
11766 /// but with all dynamically-allocated buffers duplicated in new buffers.
11767 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11768 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11769 #[no_mangle]
11770 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11771         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11772 }
11773
11774 #[no_mangle]
11775 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11776 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11777 #[repr(C)]
11778 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11779 /// This corresponds to std::vector in C++
11780 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11781         /// The elements in the array.
11782         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11783         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11784         /// The number of elements pointed to by `data`.
11785         pub datalen: usize
11786 }
11787 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11788         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11789                 if self.datalen == 0 { return Vec::new(); }
11790                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11791                 self.data = core::ptr::null_mut();
11792                 self.datalen = 0;
11793                 ret
11794         }
11795         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11796                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11797         }
11798 }
11799 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11800         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11801                 let datalen = v.len();
11802                 let data = Box::into_raw(v.into_boxed_slice());
11803                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11804         }
11805 }
11806 #[no_mangle]
11807 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11808 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11809 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11810         fn drop(&mut self) {
11811                 if self.datalen == 0 { return; }
11812                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11813         }
11814 }
11815 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11816         fn clone(&self) -> Self {
11817                 let mut res = Vec::new();
11818                 if self.datalen == 0 { return Self::from(res); }
11819                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11820                 Self::from(res)
11821         }
11822 }
11823 #[repr(C)]
11824 /// A dynamically-allocated array of crate::lightning::events::Events of arbitrary size.
11825 /// This corresponds to std::vector in C++
11826 pub struct CVec_EventZ {
11827         /// The elements in the array.
11828         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11829         pub data: *mut crate::lightning::events::Event,
11830         /// The number of elements pointed to by `data`.
11831         pub datalen: usize
11832 }
11833 impl CVec_EventZ {
11834         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::Event> {
11835                 if self.datalen == 0 { return Vec::new(); }
11836                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11837                 self.data = core::ptr::null_mut();
11838                 self.datalen = 0;
11839                 ret
11840         }
11841         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::Event] {
11842                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11843         }
11844 }
11845 impl From<Vec<crate::lightning::events::Event>> for CVec_EventZ {
11846         fn from(v: Vec<crate::lightning::events::Event>) -> Self {
11847                 let datalen = v.len();
11848                 let data = Box::into_raw(v.into_boxed_slice());
11849                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11850         }
11851 }
11852 #[no_mangle]
11853 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11854 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11855 impl Drop for CVec_EventZ {
11856         fn drop(&mut self) {
11857                 if self.datalen == 0 { return; }
11858                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11859         }
11860 }
11861 impl Clone for CVec_EventZ {
11862         fn clone(&self) -> Self {
11863                 let mut res = Vec::new();
11864                 if self.datalen == 0 { return Self::from(res); }
11865                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11866                 Self::from(res)
11867         }
11868 }
11869 #[repr(C)]
11870 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11871 /// This corresponds to std::vector in C++
11872 pub struct CVec_TransactionZ {
11873         /// The elements in the array.
11874         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11875         pub data: *mut crate::c_types::Transaction,
11876         /// The number of elements pointed to by `data`.
11877         pub datalen: usize
11878 }
11879 impl CVec_TransactionZ {
11880         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11881                 if self.datalen == 0 { return Vec::new(); }
11882                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11883                 self.data = core::ptr::null_mut();
11884                 self.datalen = 0;
11885                 ret
11886         }
11887         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11888                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11889         }
11890 }
11891 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11892         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11893                 let datalen = v.len();
11894                 let data = Box::into_raw(v.into_boxed_slice());
11895                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11896         }
11897 }
11898 #[no_mangle]
11899 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11900 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11901 impl Drop for CVec_TransactionZ {
11902         fn drop(&mut self) {
11903                 if self.datalen == 0 { return; }
11904                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11905         }
11906 }
11907 impl Clone for CVec_TransactionZ {
11908         fn clone(&self) -> Self {
11909                 let mut res = Vec::new();
11910                 if self.datalen == 0 { return Self::from(res); }
11911                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11912                 Self::from(res)
11913         }
11914 }
11915 #[repr(C)]
11916 /// A tuple of 2 elements. See the individual fields for the types contained.
11917 pub struct C2Tuple_u32TxOutZ {
11918         /// The element at position 0
11919         pub a: u32,
11920         /// The element at position 1
11921         pub b: crate::c_types::TxOut,
11922 }
11923 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11924         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11925                 Self {
11926                         a: tup.0,
11927                         b: tup.1,
11928                 }
11929         }
11930 }
11931 impl C2Tuple_u32TxOutZ {
11932         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11933                 (self.a, self.b)
11934         }
11935 }
11936 impl Clone for C2Tuple_u32TxOutZ {
11937         fn clone(&self) -> Self {
11938                 Self {
11939                         a: Clone::clone(&self.a),
11940                         b: Clone::clone(&self.b),
11941                 }
11942         }
11943 }
11944 #[no_mangle]
11945 /// Creates a new tuple which has the same data as `orig`
11946 /// but with all dynamically-allocated buffers duplicated in new buffers.
11947 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11948 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11949 #[no_mangle]
11950 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11951         C2Tuple_u32TxOutZ { a, b, }
11952 }
11953
11954 #[no_mangle]
11955 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11956 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11957 #[repr(C)]
11958 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11959 /// This corresponds to std::vector in C++
11960 pub struct CVec_C2Tuple_u32TxOutZZ {
11961         /// The elements in the array.
11962         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11963         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11964         /// The number of elements pointed to by `data`.
11965         pub datalen: usize
11966 }
11967 impl CVec_C2Tuple_u32TxOutZZ {
11968         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11969                 if self.datalen == 0 { return Vec::new(); }
11970                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11971                 self.data = core::ptr::null_mut();
11972                 self.datalen = 0;
11973                 ret
11974         }
11975         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11976                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11977         }
11978 }
11979 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11980         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11981                 let datalen = v.len();
11982                 let data = Box::into_raw(v.into_boxed_slice());
11983                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11984         }
11985 }
11986 #[no_mangle]
11987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11988 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11989 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11990         fn drop(&mut self) {
11991                 if self.datalen == 0 { return; }
11992                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11993         }
11994 }
11995 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11996         fn clone(&self) -> Self {
11997                 let mut res = Vec::new();
11998                 if self.datalen == 0 { return Self::from(res); }
11999                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12000                 Self::from(res)
12001         }
12002 }
12003 #[repr(C)]
12004 /// A tuple of 2 elements. See the individual fields for the types contained.
12005 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12006         /// The element at position 0
12007         pub a: crate::c_types::ThirtyTwoBytes,
12008         /// The element at position 1
12009         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12010 }
12011 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12012         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12013                 Self {
12014                         a: tup.0,
12015                         b: tup.1,
12016                 }
12017         }
12018 }
12019 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12020         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12021                 (self.a, self.b)
12022         }
12023 }
12024 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12025         fn clone(&self) -> Self {
12026                 Self {
12027                         a: Clone::clone(&self.a),
12028                         b: Clone::clone(&self.b),
12029                 }
12030         }
12031 }
12032 #[no_mangle]
12033 /// Creates a new tuple which has the same data as `orig`
12034 /// but with all dynamically-allocated buffers duplicated in new buffers.
12035 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12036 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12037 #[no_mangle]
12038 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
12039         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
12040 }
12041
12042 #[no_mangle]
12043 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
12044 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
12045 #[repr(C)]
12046 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12047 /// This corresponds to std::vector in C++
12048 pub struct CVec_TransactionOutputsZ {
12049         /// The elements in the array.
12050         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12051         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
12052         /// The number of elements pointed to by `data`.
12053         pub datalen: usize
12054 }
12055 impl CVec_TransactionOutputsZ {
12056         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
12057                 if self.datalen == 0 { return Vec::new(); }
12058                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12059                 self.data = core::ptr::null_mut();
12060                 self.datalen = 0;
12061                 ret
12062         }
12063         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
12064                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12065         }
12066 }
12067 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12068         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12069                 let datalen = v.len();
12070                 let data = Box::into_raw(v.into_boxed_slice());
12071                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12072         }
12073 }
12074 #[no_mangle]
12075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12076 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12077 impl Drop for CVec_TransactionOutputsZ {
12078         fn drop(&mut self) {
12079                 if self.datalen == 0 { return; }
12080                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12081         }
12082 }
12083 impl Clone for CVec_TransactionOutputsZ {
12084         fn clone(&self) -> Self {
12085                 let mut res = Vec::new();
12086                 if self.datalen == 0 { return Self::from(res); }
12087                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12088                 Self::from(res)
12089         }
12090 }
12091 #[repr(C)]
12092 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12093 /// This corresponds to std::vector in C++
12094 pub struct CVec_BalanceZ {
12095         /// The elements in the array.
12096         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12097         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12098         /// The number of elements pointed to by `data`.
12099         pub datalen: usize
12100 }
12101 impl CVec_BalanceZ {
12102         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12103                 if self.datalen == 0 { return Vec::new(); }
12104                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12105                 self.data = core::ptr::null_mut();
12106                 self.datalen = 0;
12107                 ret
12108         }
12109         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12110                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12111         }
12112 }
12113 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12114         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12115                 let datalen = v.len();
12116                 let data = Box::into_raw(v.into_boxed_slice());
12117                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12118         }
12119 }
12120 #[no_mangle]
12121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12122 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12123 impl Drop for CVec_BalanceZ {
12124         fn drop(&mut self) {
12125                 if self.datalen == 0 { return; }
12126                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12127         }
12128 }
12129 impl Clone for CVec_BalanceZ {
12130         fn clone(&self) -> Self {
12131                 let mut res = Vec::new();
12132                 if self.datalen == 0 { return Self::from(res); }
12133                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12134                 Self::from(res)
12135         }
12136 }
12137 #[repr(C)]
12138 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
12139 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12140         /// A pointer to the contents in the success state.
12141         /// Reading from this pointer when `result_ok` is not set is undefined.
12142         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
12143         /// A pointer to the contents in the error state.
12144         /// Reading from this pointer when `result_ok` is set is undefined.
12145         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12146 }
12147 #[repr(C)]
12148 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12149 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12151 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12152         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
12153         /// `err` or `result` depending on the state of `result_ok`.
12154         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
12155         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
12156         pub result_ok: bool,
12157 }
12158 #[no_mangle]
12159 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
12160 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12161         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12162                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12163                         result: Box::into_raw(Box::new(o)),
12164                 },
12165                 result_ok: true,
12166         }
12167 }
12168 #[no_mangle]
12169 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
12170 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12171         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12172                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
12173                         err: Box::into_raw(Box::new(e)),
12174                 },
12175                 result_ok: false,
12176         }
12177 }
12178 /// Checks if the given object is currently in the success state
12179 #[no_mangle]
12180 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
12181         o.result_ok
12182 }
12183 #[no_mangle]
12184 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
12185 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
12186 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12187         fn drop(&mut self) {
12188                 if self.result_ok {
12189                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12190                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12191                         }
12192                 } else {
12193                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12194                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12195                         }
12196                 }
12197         }
12198 }
12199 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
12200         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12201                 let contents = if o.result_ok {
12202                         let result = unsafe { o.contents.result };
12203                         unsafe { o.contents.result = core::ptr::null_mut() };
12204                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
12205                 } else {
12206                         let err = unsafe { o.contents.err };
12207                         unsafe { o.contents.err = core::ptr::null_mut(); }
12208                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
12209                 };
12210                 Self {
12211                         contents,
12212                         result_ok: o.result_ok,
12213                 }
12214         }
12215 }
12216 #[repr(C)]
12217 /// A tuple of 2 elements. See the individual fields for the types contained.
12218 pub struct C2Tuple_PublicKeyTypeZ {
12219         /// The element at position 0
12220         pub a: crate::c_types::PublicKey,
12221         /// The element at position 1
12222         pub b: crate::lightning::ln::wire::Type,
12223 }
12224 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12225         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12226                 Self {
12227                         a: tup.0,
12228                         b: tup.1,
12229                 }
12230         }
12231 }
12232 impl C2Tuple_PublicKeyTypeZ {
12233         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
12234                 (self.a, self.b)
12235         }
12236 }
12237 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
12238 #[no_mangle]
12239 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
12240         C2Tuple_PublicKeyTypeZ { a, b, }
12241 }
12242
12243 #[no_mangle]
12244 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
12245 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
12246 #[repr(C)]
12247 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
12248 /// This corresponds to std::vector in C++
12249 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
12250         /// The elements in the array.
12251         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12252         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
12253         /// The number of elements pointed to by `data`.
12254         pub datalen: usize
12255 }
12256 impl CVec_C2Tuple_PublicKeyTypeZZ {
12257         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
12258                 if self.datalen == 0 { return Vec::new(); }
12259                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12260                 self.data = core::ptr::null_mut();
12261                 self.datalen = 0;
12262                 ret
12263         }
12264         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
12265                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12266         }
12267 }
12268 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
12269         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
12270                 let datalen = v.len();
12271                 let data = Box::into_raw(v.into_boxed_slice());
12272                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12273         }
12274 }
12275 #[no_mangle]
12276 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12277 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
12278 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
12279         fn drop(&mut self) {
12280                 if self.datalen == 0 { return; }
12281                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12282         }
12283 }
12284 #[repr(C)]
12285 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
12286 pub enum COption_CustomOnionMessageContentsZ {
12287         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
12288         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
12289         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
12290         None
12291 }
12292 impl COption_CustomOnionMessageContentsZ {
12293         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12294                 if let Self::None = self { false } else { true }
12295         }
12296         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12297                 !self.is_some()
12298         }
12299         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
12300                 if let Self::Some(v) = self { v } else { unreachable!() }
12301         }
12302 }
12303 #[no_mangle]
12304 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
12305 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
12306         COption_CustomOnionMessageContentsZ::Some(o)
12307 }
12308 #[no_mangle]
12309 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
12310 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
12311         COption_CustomOnionMessageContentsZ::None
12312 }
12313 #[no_mangle]
12314 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
12315 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
12316 #[repr(C)]
12317 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
12318 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12319         /// A pointer to the contents in the success state.
12320         /// Reading from this pointer when `result_ok` is not set is undefined.
12321         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
12322         /// A pointer to the contents in the error state.
12323         /// Reading from this pointer when `result_ok` is set is undefined.
12324         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12325 }
12326 #[repr(C)]
12327 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
12328 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12330 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12331         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
12332         /// `err` or `result` depending on the state of `result_ok`.
12333         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
12334         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
12335         pub result_ok: bool,
12336 }
12337 #[no_mangle]
12338 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
12339 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12340         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12341                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12342                         result: Box::into_raw(Box::new(o)),
12343                 },
12344                 result_ok: true,
12345         }
12346 }
12347 #[no_mangle]
12348 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
12349 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12350         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12351                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
12352                         err: Box::into_raw(Box::new(e)),
12353                 },
12354                 result_ok: false,
12355         }
12356 }
12357 /// Checks if the given object is currently in the success state
12358 #[no_mangle]
12359 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
12360         o.result_ok
12361 }
12362 #[no_mangle]
12363 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
12364 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
12365 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12366         fn drop(&mut self) {
12367                 if self.result_ok {
12368                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12369                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12370                         }
12371                 } else {
12372                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12373                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12374                         }
12375                 }
12376         }
12377 }
12378 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
12379         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12380                 let contents = if o.result_ok {
12381                         let result = unsafe { o.contents.result };
12382                         unsafe { o.contents.result = core::ptr::null_mut() };
12383                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
12384                 } else {
12385                         let err = unsafe { o.contents.err };
12386                         unsafe { o.contents.err = core::ptr::null_mut(); }
12387                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
12388                 };
12389                 Self {
12390                         contents,
12391                         result_ok: o.result_ok,
12392                 }
12393         }
12394 }
12395 #[repr(C)]
12396 #[derive(Clone)]
12397 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
12398 pub enum COption_NetAddressZ {
12399         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
12400         Some(crate::lightning::ln::msgs::NetAddress),
12401         /// When we're in this state, this COption_NetAddressZ contains nothing
12402         None
12403 }
12404 impl COption_NetAddressZ {
12405         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12406                 if let Self::None = self { false } else { true }
12407         }
12408         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12409                 !self.is_some()
12410         }
12411         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
12412                 if let Self::Some(v) = self { v } else { unreachable!() }
12413         }
12414 }
12415 #[no_mangle]
12416 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
12417 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
12418         COption_NetAddressZ::Some(o)
12419 }
12420 #[no_mangle]
12421 /// Constructs a new COption_NetAddressZ containing nothing
12422 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
12423         COption_NetAddressZ::None
12424 }
12425 #[no_mangle]
12426 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
12427 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
12428 #[no_mangle]
12429 /// Creates a new COption_NetAddressZ which has the same data as `orig`
12430 /// but with all dynamically-allocated buffers duplicated in new buffers.
12431 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
12432 #[repr(C)]
12433 /// A tuple of 2 elements. See the individual fields for the types contained.
12434 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
12435         /// The element at position 0
12436         pub a: crate::c_types::PublicKey,
12437         /// The element at position 1
12438         pub b: crate::c_types::derived::COption_NetAddressZ,
12439 }
12440 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
12441         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
12442                 Self {
12443                         a: tup.0,
12444                         b: tup.1,
12445                 }
12446         }
12447 }
12448 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
12449         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
12450                 (self.a, self.b)
12451         }
12452 }
12453 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
12454         fn clone(&self) -> Self {
12455                 Self {
12456                         a: Clone::clone(&self.a),
12457                         b: Clone::clone(&self.b),
12458                 }
12459         }
12460 }
12461 #[no_mangle]
12462 /// Creates a new tuple which has the same data as `orig`
12463 /// but with all dynamically-allocated buffers duplicated in new buffers.
12464 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
12465 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
12466 #[no_mangle]
12467 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
12468         C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
12469 }
12470
12471 #[no_mangle]
12472 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
12473 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
12474 #[repr(C)]
12475 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
12476 /// This corresponds to std::vector in C++
12477 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12478         /// The elements in the array.
12479         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12480         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
12481         /// The number of elements pointed to by `data`.
12482         pub datalen: usize
12483 }
12484 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12485         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
12486                 if self.datalen == 0 { return Vec::new(); }
12487                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12488                 self.data = core::ptr::null_mut();
12489                 self.datalen = 0;
12490                 ret
12491         }
12492         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
12493                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12494         }
12495 }
12496 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12497         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
12498                 let datalen = v.len();
12499                 let data = Box::into_raw(v.into_boxed_slice());
12500                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12501         }
12502 }
12503 #[no_mangle]
12504 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12505 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
12506 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12507         fn drop(&mut self) {
12508                 if self.datalen == 0 { return; }
12509                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12510         }
12511 }
12512 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
12513         fn clone(&self) -> Self {
12514                 let mut res = Vec::new();
12515                 if self.datalen == 0 { return Self::from(res); }
12516                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12517                 Self::from(res)
12518         }
12519 }
12520 #[repr(C)]
12521 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
12522 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
12523         /// A pointer to the contents in the success state.
12524         /// Reading from this pointer when `result_ok` is not set is undefined.
12525         pub result: *mut crate::c_types::derived::CVec_u8Z,
12526         /// A pointer to the contents in the error state.
12527         /// Reading from this pointer when `result_ok` is set is undefined.
12528         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12529 }
12530 #[repr(C)]
12531 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
12532 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12533 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12534 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12535         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12536         /// `err` or `result` depending on the state of `result_ok`.
12537         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12538         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12539         pub result_ok: bool,
12540 }
12541 #[no_mangle]
12542 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12543 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12544         CResult_CVec_u8ZPeerHandleErrorZ {
12545                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12546                         result: Box::into_raw(Box::new(o)),
12547                 },
12548                 result_ok: true,
12549         }
12550 }
12551 #[no_mangle]
12552 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12553 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12554         CResult_CVec_u8ZPeerHandleErrorZ {
12555                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12556                         err: Box::into_raw(Box::new(e)),
12557                 },
12558                 result_ok: false,
12559         }
12560 }
12561 /// Checks if the given object is currently in the success state
12562 #[no_mangle]
12563 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12564         o.result_ok
12565 }
12566 #[no_mangle]
12567 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12568 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12569 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12570         fn drop(&mut self) {
12571                 if self.result_ok {
12572                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12573                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12574                         }
12575                 } else {
12576                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12577                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12578                         }
12579                 }
12580         }
12581 }
12582 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12583         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12584                 let contents = if o.result_ok {
12585                         let result = unsafe { o.contents.result };
12586                         unsafe { o.contents.result = core::ptr::null_mut() };
12587                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12588                 } else {
12589                         let err = unsafe { o.contents.err };
12590                         unsafe { o.contents.err = core::ptr::null_mut(); }
12591                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12592                 };
12593                 Self {
12594                         contents,
12595                         result_ok: o.result_ok,
12596                 }
12597         }
12598 }
12599 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12600         fn clone(&self) -> Self {
12601                 if self.result_ok {
12602                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12603                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12604                         } }
12605                 } else {
12606                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12607                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12608                         } }
12609                 }
12610         }
12611 }
12612 #[no_mangle]
12613 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12614 /// but with all dynamically-allocated buffers duplicated in new buffers.
12615 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12616 #[repr(C)]
12617 /// The contents of CResult_NonePeerHandleErrorZ
12618 pub union CResult_NonePeerHandleErrorZPtr {
12619         /// Note that this value is always NULL, as there are no contents in the OK variant
12620         pub result: *mut core::ffi::c_void,
12621         /// A pointer to the contents in the error state.
12622         /// Reading from this pointer when `result_ok` is set is undefined.
12623         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12624 }
12625 #[repr(C)]
12626 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12627 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12628 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12629 pub struct CResult_NonePeerHandleErrorZ {
12630         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12631         /// `err` or `result` depending on the state of `result_ok`.
12632         pub contents: CResult_NonePeerHandleErrorZPtr,
12633         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12634         pub result_ok: bool,
12635 }
12636 #[no_mangle]
12637 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12638 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12639         CResult_NonePeerHandleErrorZ {
12640                 contents: CResult_NonePeerHandleErrorZPtr {
12641                         result: core::ptr::null_mut(),
12642                 },
12643                 result_ok: true,
12644         }
12645 }
12646 #[no_mangle]
12647 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12648 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12649         CResult_NonePeerHandleErrorZ {
12650                 contents: CResult_NonePeerHandleErrorZPtr {
12651                         err: Box::into_raw(Box::new(e)),
12652                 },
12653                 result_ok: false,
12654         }
12655 }
12656 /// Checks if the given object is currently in the success state
12657 #[no_mangle]
12658 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12659         o.result_ok
12660 }
12661 #[no_mangle]
12662 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12663 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12664 impl Drop for CResult_NonePeerHandleErrorZ {
12665         fn drop(&mut self) {
12666                 if self.result_ok {
12667                 } else {
12668                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12669                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12670                         }
12671                 }
12672         }
12673 }
12674 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12675         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12676                 let contents = if o.result_ok {
12677                         let _ = unsafe { Box::from_raw(o.contents.result) };
12678                         o.contents.result = core::ptr::null_mut();
12679                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12680                 } else {
12681                         let err = unsafe { o.contents.err };
12682                         unsafe { o.contents.err = core::ptr::null_mut(); }
12683                         CResult_NonePeerHandleErrorZPtr { err }
12684                 };
12685                 Self {
12686                         contents,
12687                         result_ok: o.result_ok,
12688                 }
12689         }
12690 }
12691 impl Clone for CResult_NonePeerHandleErrorZ {
12692         fn clone(&self) -> Self {
12693                 if self.result_ok {
12694                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12695                                 result: core::ptr::null_mut()
12696                         } }
12697                 } else {
12698                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12699                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12700                         } }
12701                 }
12702         }
12703 }
12704 #[no_mangle]
12705 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12706 /// but with all dynamically-allocated buffers duplicated in new buffers.
12707 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12708 #[repr(C)]
12709 /// The contents of CResult_boolPeerHandleErrorZ
12710 pub union CResult_boolPeerHandleErrorZPtr {
12711         /// A pointer to the contents in the success state.
12712         /// Reading from this pointer when `result_ok` is not set is undefined.
12713         pub result: *mut bool,
12714         /// A pointer to the contents in the error state.
12715         /// Reading from this pointer when `result_ok` is set is undefined.
12716         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12717 }
12718 #[repr(C)]
12719 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12720 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12721 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12722 pub struct CResult_boolPeerHandleErrorZ {
12723         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12724         /// `err` or `result` depending on the state of `result_ok`.
12725         pub contents: CResult_boolPeerHandleErrorZPtr,
12726         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12727         pub result_ok: bool,
12728 }
12729 #[no_mangle]
12730 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12731 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12732         CResult_boolPeerHandleErrorZ {
12733                 contents: CResult_boolPeerHandleErrorZPtr {
12734                         result: Box::into_raw(Box::new(o)),
12735                 },
12736                 result_ok: true,
12737         }
12738 }
12739 #[no_mangle]
12740 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12741 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12742         CResult_boolPeerHandleErrorZ {
12743                 contents: CResult_boolPeerHandleErrorZPtr {
12744                         err: Box::into_raw(Box::new(e)),
12745                 },
12746                 result_ok: false,
12747         }
12748 }
12749 /// Checks if the given object is currently in the success state
12750 #[no_mangle]
12751 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12752         o.result_ok
12753 }
12754 #[no_mangle]
12755 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12756 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12757 impl Drop for CResult_boolPeerHandleErrorZ {
12758         fn drop(&mut self) {
12759                 if self.result_ok {
12760                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12761                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12762                         }
12763                 } else {
12764                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12765                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12766                         }
12767                 }
12768         }
12769 }
12770 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12771         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12772                 let contents = if o.result_ok {
12773                         let result = unsafe { o.contents.result };
12774                         unsafe { o.contents.result = core::ptr::null_mut() };
12775                         CResult_boolPeerHandleErrorZPtr { result }
12776                 } else {
12777                         let err = unsafe { o.contents.err };
12778                         unsafe { o.contents.err = core::ptr::null_mut(); }
12779                         CResult_boolPeerHandleErrorZPtr { err }
12780                 };
12781                 Self {
12782                         contents,
12783                         result_ok: o.result_ok,
12784                 }
12785         }
12786 }
12787 impl Clone for CResult_boolPeerHandleErrorZ {
12788         fn clone(&self) -> Self {
12789                 if self.result_ok {
12790                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12791                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12792                         } }
12793                 } else {
12794                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12795                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12796                         } }
12797                 }
12798         }
12799 }
12800 #[no_mangle]
12801 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12802 /// but with all dynamically-allocated buffers duplicated in new buffers.
12803 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12804 #[repr(C)]
12805 /// The contents of CResult_TxOutUtxoLookupErrorZ
12806 pub union CResult_TxOutUtxoLookupErrorZPtr {
12807         /// A pointer to the contents in the success state.
12808         /// Reading from this pointer when `result_ok` is not set is undefined.
12809         pub result: *mut crate::c_types::TxOut,
12810         /// A pointer to the contents in the error state.
12811         /// Reading from this pointer when `result_ok` is set is undefined.
12812         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
12813 }
12814 #[repr(C)]
12815 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
12816 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
12817 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12818 pub struct CResult_TxOutUtxoLookupErrorZ {
12819         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
12820         /// `err` or `result` depending on the state of `result_ok`.
12821         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
12822         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
12823         pub result_ok: bool,
12824 }
12825 #[no_mangle]
12826 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
12827 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
12828         CResult_TxOutUtxoLookupErrorZ {
12829                 contents: CResult_TxOutUtxoLookupErrorZPtr {
12830                         result: Box::into_raw(Box::new(o)),
12831                 },
12832                 result_ok: true,
12833         }
12834 }
12835 #[no_mangle]
12836 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
12837 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
12838         CResult_TxOutUtxoLookupErrorZ {
12839                 contents: CResult_TxOutUtxoLookupErrorZPtr {
12840                         err: Box::into_raw(Box::new(e)),
12841                 },
12842                 result_ok: false,
12843         }
12844 }
12845 /// Checks if the given object is currently in the success state
12846 #[no_mangle]
12847 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
12848         o.result_ok
12849 }
12850 #[no_mangle]
12851 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
12852 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
12853 impl Drop for CResult_TxOutUtxoLookupErrorZ {
12854         fn drop(&mut self) {
12855                 if self.result_ok {
12856                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12857                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12858                         }
12859                 } else {
12860                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12861                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12862                         }
12863                 }
12864         }
12865 }
12866 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
12867         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
12868                 let contents = if o.result_ok {
12869                         let result = unsafe { o.contents.result };
12870                         unsafe { o.contents.result = core::ptr::null_mut() };
12871                         CResult_TxOutUtxoLookupErrorZPtr { result }
12872                 } else {
12873                         let err = unsafe { o.contents.err };
12874                         unsafe { o.contents.err = core::ptr::null_mut(); }
12875                         CResult_TxOutUtxoLookupErrorZPtr { err }
12876                 };
12877                 Self {
12878                         contents,
12879                         result_ok: o.result_ok,
12880                 }
12881         }
12882 }
12883 impl Clone for CResult_TxOutUtxoLookupErrorZ {
12884         fn clone(&self) -> Self {
12885                 if self.result_ok {
12886                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
12887                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
12888                         } }
12889                 } else {
12890                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
12891                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
12892                         } }
12893                 }
12894         }
12895 }
12896 #[no_mangle]
12897 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
12898 /// but with all dynamically-allocated buffers duplicated in new buffers.
12899 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
12900 #[repr(C)]
12901 /// The contents of CResult_NoneSendErrorZ
12902 pub union CResult_NoneSendErrorZPtr {
12903         /// Note that this value is always NULL, as there are no contents in the OK variant
12904         pub result: *mut core::ffi::c_void,
12905         /// A pointer to the contents in the error state.
12906         /// Reading from this pointer when `result_ok` is set is undefined.
12907         pub err: *mut crate::lightning::onion_message::messenger::SendError,
12908 }
12909 #[repr(C)]
12910 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12911 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12913 pub struct CResult_NoneSendErrorZ {
12914         /// The contents of this CResult_NoneSendErrorZ, accessible via either
12915         /// `err` or `result` depending on the state of `result_ok`.
12916         pub contents: CResult_NoneSendErrorZPtr,
12917         /// Whether this CResult_NoneSendErrorZ represents a success state.
12918         pub result_ok: bool,
12919 }
12920 #[no_mangle]
12921 /// Creates a new CResult_NoneSendErrorZ in the success state.
12922 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12923         CResult_NoneSendErrorZ {
12924                 contents: CResult_NoneSendErrorZPtr {
12925                         result: core::ptr::null_mut(),
12926                 },
12927                 result_ok: true,
12928         }
12929 }
12930 #[no_mangle]
12931 /// Creates a new CResult_NoneSendErrorZ in the error state.
12932 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12933         CResult_NoneSendErrorZ {
12934                 contents: CResult_NoneSendErrorZPtr {
12935                         err: Box::into_raw(Box::new(e)),
12936                 },
12937                 result_ok: false,
12938         }
12939 }
12940 /// Checks if the given object is currently in the success state
12941 #[no_mangle]
12942 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12943         o.result_ok
12944 }
12945 #[no_mangle]
12946 /// Frees any resources used by the CResult_NoneSendErrorZ.
12947 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12948 impl Drop for CResult_NoneSendErrorZ {
12949         fn drop(&mut self) {
12950                 if self.result_ok {
12951                 } else {
12952                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12953                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12954                         }
12955                 }
12956         }
12957 }
12958 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12959         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12960                 let contents = if o.result_ok {
12961                         let _ = unsafe { Box::from_raw(o.contents.result) };
12962                         o.contents.result = core::ptr::null_mut();
12963                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12964                 } else {
12965                         let err = unsafe { o.contents.err };
12966                         unsafe { o.contents.err = core::ptr::null_mut(); }
12967                         CResult_NoneSendErrorZPtr { err }
12968                 };
12969                 Self {
12970                         contents,
12971                         result_ok: o.result_ok,
12972                 }
12973         }
12974 }
12975 #[repr(C)]
12976 /// The contents of CResult_BlindedPathNoneZ
12977 pub union CResult_BlindedPathNoneZPtr {
12978         /// A pointer to the contents in the success state.
12979         /// Reading from this pointer when `result_ok` is not set is undefined.
12980         pub result: *mut crate::lightning::blinded_path::BlindedPath,
12981         /// Note that this value is always NULL, as there are no contents in the Err variant
12982         pub err: *mut core::ffi::c_void,
12983 }
12984 #[repr(C)]
12985 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
12986 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
12987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12988 pub struct CResult_BlindedPathNoneZ {
12989         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
12990         /// `err` or `result` depending on the state of `result_ok`.
12991         pub contents: CResult_BlindedPathNoneZPtr,
12992         /// Whether this CResult_BlindedPathNoneZ represents a success state.
12993         pub result_ok: bool,
12994 }
12995 #[no_mangle]
12996 /// Creates a new CResult_BlindedPathNoneZ in the success state.
12997 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
12998         CResult_BlindedPathNoneZ {
12999                 contents: CResult_BlindedPathNoneZPtr {
13000                         result: Box::into_raw(Box::new(o)),
13001                 },
13002                 result_ok: true,
13003         }
13004 }
13005 #[no_mangle]
13006 /// Creates a new CResult_BlindedPathNoneZ in the error state.
13007 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
13008         CResult_BlindedPathNoneZ {
13009                 contents: CResult_BlindedPathNoneZPtr {
13010                         err: core::ptr::null_mut(),
13011                 },
13012                 result_ok: false,
13013         }
13014 }
13015 /// Checks if the given object is currently in the success state
13016 #[no_mangle]
13017 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
13018         o.result_ok
13019 }
13020 #[no_mangle]
13021 /// Frees any resources used by the CResult_BlindedPathNoneZ.
13022 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
13023 impl Drop for CResult_BlindedPathNoneZ {
13024         fn drop(&mut self) {
13025                 if self.result_ok {
13026                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13027                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13028                         }
13029                 } else {
13030                 }
13031         }
13032 }
13033 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
13034         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
13035                 let contents = if o.result_ok {
13036                         let result = unsafe { o.contents.result };
13037                         unsafe { o.contents.result = core::ptr::null_mut() };
13038                         CResult_BlindedPathNoneZPtr { result }
13039                 } else {
13040                         let _ = unsafe { Box::from_raw(o.contents.err) };
13041                         o.contents.err = core::ptr::null_mut();
13042                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
13043                 };
13044                 Self {
13045                         contents,
13046                         result_ok: o.result_ok,
13047                 }
13048         }
13049 }
13050 impl Clone for CResult_BlindedPathNoneZ {
13051         fn clone(&self) -> Self {
13052                 if self.result_ok {
13053                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
13054                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13055                         } }
13056                 } else {
13057                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
13058                                 err: core::ptr::null_mut()
13059                         } }
13060                 }
13061         }
13062 }
13063 #[no_mangle]
13064 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
13065 /// but with all dynamically-allocated buffers duplicated in new buffers.
13066 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
13067 #[repr(C)]
13068 /// The contents of CResult_BlindedPathDecodeErrorZ
13069 pub union CResult_BlindedPathDecodeErrorZPtr {
13070         /// A pointer to the contents in the success state.
13071         /// Reading from this pointer when `result_ok` is not set is undefined.
13072         pub result: *mut crate::lightning::blinded_path::BlindedPath,
13073         /// A pointer to the contents in the error state.
13074         /// Reading from this pointer when `result_ok` is set is undefined.
13075         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13076 }
13077 #[repr(C)]
13078 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
13079 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
13080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13081 pub struct CResult_BlindedPathDecodeErrorZ {
13082         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
13083         /// `err` or `result` depending on the state of `result_ok`.
13084         pub contents: CResult_BlindedPathDecodeErrorZPtr,
13085         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
13086         pub result_ok: bool,
13087 }
13088 #[no_mangle]
13089 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
13090 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
13091         CResult_BlindedPathDecodeErrorZ {
13092                 contents: CResult_BlindedPathDecodeErrorZPtr {
13093                         result: Box::into_raw(Box::new(o)),
13094                 },
13095                 result_ok: true,
13096         }
13097 }
13098 #[no_mangle]
13099 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
13100 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
13101         CResult_BlindedPathDecodeErrorZ {
13102                 contents: CResult_BlindedPathDecodeErrorZPtr {
13103                         err: Box::into_raw(Box::new(e)),
13104                 },
13105                 result_ok: false,
13106         }
13107 }
13108 /// Checks if the given object is currently in the success state
13109 #[no_mangle]
13110 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
13111         o.result_ok
13112 }
13113 #[no_mangle]
13114 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
13115 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
13116 impl Drop for CResult_BlindedPathDecodeErrorZ {
13117         fn drop(&mut self) {
13118                 if self.result_ok {
13119                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13120                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13121                         }
13122                 } else {
13123                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13124                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13125                         }
13126                 }
13127         }
13128 }
13129 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
13130         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
13131                 let contents = if o.result_ok {
13132                         let result = unsafe { o.contents.result };
13133                         unsafe { o.contents.result = core::ptr::null_mut() };
13134                         CResult_BlindedPathDecodeErrorZPtr { result }
13135                 } else {
13136                         let err = unsafe { o.contents.err };
13137                         unsafe { o.contents.err = core::ptr::null_mut(); }
13138                         CResult_BlindedPathDecodeErrorZPtr { err }
13139                 };
13140                 Self {
13141                         contents,
13142                         result_ok: o.result_ok,
13143                 }
13144         }
13145 }
13146 impl Clone for CResult_BlindedPathDecodeErrorZ {
13147         fn clone(&self) -> Self {
13148                 if self.result_ok {
13149                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
13150                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
13151                         } }
13152                 } else {
13153                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
13154                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13155                         } }
13156                 }
13157         }
13158 }
13159 #[no_mangle]
13160 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
13161 /// but with all dynamically-allocated buffers duplicated in new buffers.
13162 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
13163 #[repr(C)]
13164 /// The contents of CResult_BlindedHopDecodeErrorZ
13165 pub union CResult_BlindedHopDecodeErrorZPtr {
13166         /// A pointer to the contents in the success state.
13167         /// Reading from this pointer when `result_ok` is not set is undefined.
13168         pub result: *mut crate::lightning::blinded_path::BlindedHop,
13169         /// A pointer to the contents in the error state.
13170         /// Reading from this pointer when `result_ok` is set is undefined.
13171         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13172 }
13173 #[repr(C)]
13174 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
13175 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
13176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13177 pub struct CResult_BlindedHopDecodeErrorZ {
13178         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
13179         /// `err` or `result` depending on the state of `result_ok`.
13180         pub contents: CResult_BlindedHopDecodeErrorZPtr,
13181         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
13182         pub result_ok: bool,
13183 }
13184 #[no_mangle]
13185 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
13186 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
13187         CResult_BlindedHopDecodeErrorZ {
13188                 contents: CResult_BlindedHopDecodeErrorZPtr {
13189                         result: Box::into_raw(Box::new(o)),
13190                 },
13191                 result_ok: true,
13192         }
13193 }
13194 #[no_mangle]
13195 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
13196 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
13197         CResult_BlindedHopDecodeErrorZ {
13198                 contents: CResult_BlindedHopDecodeErrorZPtr {
13199                         err: Box::into_raw(Box::new(e)),
13200                 },
13201                 result_ok: false,
13202         }
13203 }
13204 /// Checks if the given object is currently in the success state
13205 #[no_mangle]
13206 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
13207         o.result_ok
13208 }
13209 #[no_mangle]
13210 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
13211 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
13212 impl Drop for CResult_BlindedHopDecodeErrorZ {
13213         fn drop(&mut self) {
13214                 if self.result_ok {
13215                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13216                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13217                         }
13218                 } else {
13219                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13220                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13221                         }
13222                 }
13223         }
13224 }
13225 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
13226         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
13227                 let contents = if o.result_ok {
13228                         let result = unsafe { o.contents.result };
13229                         unsafe { o.contents.result = core::ptr::null_mut() };
13230                         CResult_BlindedHopDecodeErrorZPtr { result }
13231                 } else {
13232                         let err = unsafe { o.contents.err };
13233                         unsafe { o.contents.err = core::ptr::null_mut(); }
13234                         CResult_BlindedHopDecodeErrorZPtr { err }
13235                 };
13236                 Self {
13237                         contents,
13238                         result_ok: o.result_ok,
13239                 }
13240         }
13241 }
13242 impl Clone for CResult_BlindedHopDecodeErrorZ {
13243         fn clone(&self) -> Self {
13244                 if self.result_ok {
13245                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
13246                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
13247                         } }
13248                 } else {
13249                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
13250                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13251                         } }
13252                 }
13253         }
13254 }
13255 #[no_mangle]
13256 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
13257 /// but with all dynamically-allocated buffers duplicated in new buffers.
13258 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
13259 #[repr(C)]
13260 /// The contents of CResult_SiPrefixParseErrorZ
13261 pub union CResult_SiPrefixParseErrorZPtr {
13262         /// A pointer to the contents in the success state.
13263         /// Reading from this pointer when `result_ok` is not set is undefined.
13264         pub result: *mut crate::lightning_invoice::SiPrefix,
13265         /// A pointer to the contents in the error state.
13266         /// Reading from this pointer when `result_ok` is set is undefined.
13267         pub err: *mut crate::lightning_invoice::ParseError,
13268 }
13269 #[repr(C)]
13270 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
13271 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
13272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13273 pub struct CResult_SiPrefixParseErrorZ {
13274         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
13275         /// `err` or `result` depending on the state of `result_ok`.
13276         pub contents: CResult_SiPrefixParseErrorZPtr,
13277         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
13278         pub result_ok: bool,
13279 }
13280 #[no_mangle]
13281 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
13282 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
13283         CResult_SiPrefixParseErrorZ {
13284                 contents: CResult_SiPrefixParseErrorZPtr {
13285                         result: Box::into_raw(Box::new(o)),
13286                 },
13287                 result_ok: true,
13288         }
13289 }
13290 #[no_mangle]
13291 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
13292 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
13293         CResult_SiPrefixParseErrorZ {
13294                 contents: CResult_SiPrefixParseErrorZPtr {
13295                         err: Box::into_raw(Box::new(e)),
13296                 },
13297                 result_ok: false,
13298         }
13299 }
13300 /// Checks if the given object is currently in the success state
13301 #[no_mangle]
13302 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
13303         o.result_ok
13304 }
13305 #[no_mangle]
13306 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
13307 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
13308 impl Drop for CResult_SiPrefixParseErrorZ {
13309         fn drop(&mut self) {
13310                 if self.result_ok {
13311                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13312                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13313                         }
13314                 } else {
13315                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13316                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13317                         }
13318                 }
13319         }
13320 }
13321 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
13322         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
13323                 let contents = if o.result_ok {
13324                         let result = unsafe { o.contents.result };
13325                         unsafe { o.contents.result = core::ptr::null_mut() };
13326                         CResult_SiPrefixParseErrorZPtr { result }
13327                 } else {
13328                         let err = unsafe { o.contents.err };
13329                         unsafe { o.contents.err = core::ptr::null_mut(); }
13330                         CResult_SiPrefixParseErrorZPtr { err }
13331                 };
13332                 Self {
13333                         contents,
13334                         result_ok: o.result_ok,
13335                 }
13336         }
13337 }
13338 impl Clone for CResult_SiPrefixParseErrorZ {
13339         fn clone(&self) -> Self {
13340                 if self.result_ok {
13341                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
13342                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
13343                         } }
13344                 } else {
13345                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
13346                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13347                         } }
13348                 }
13349         }
13350 }
13351 #[no_mangle]
13352 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
13353 /// but with all dynamically-allocated buffers duplicated in new buffers.
13354 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
13355 #[repr(C)]
13356 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
13357 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
13358         /// A pointer to the contents in the success state.
13359         /// Reading from this pointer when `result_ok` is not set is undefined.
13360         pub result: *mut crate::lightning_invoice::Invoice,
13361         /// A pointer to the contents in the error state.
13362         /// Reading from this pointer when `result_ok` is set is undefined.
13363         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
13364 }
13365 #[repr(C)]
13366 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
13367 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
13368 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13369 pub struct CResult_InvoiceParseOrSemanticErrorZ {
13370         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
13371         /// `err` or `result` depending on the state of `result_ok`.
13372         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
13373         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
13374         pub result_ok: bool,
13375 }
13376 #[no_mangle]
13377 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
13378 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
13379         CResult_InvoiceParseOrSemanticErrorZ {
13380                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13381                         result: Box::into_raw(Box::new(o)),
13382                 },
13383                 result_ok: true,
13384         }
13385 }
13386 #[no_mangle]
13387 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
13388 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
13389         CResult_InvoiceParseOrSemanticErrorZ {
13390                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13391                         err: Box::into_raw(Box::new(e)),
13392                 },
13393                 result_ok: false,
13394         }
13395 }
13396 /// Checks if the given object is currently in the success state
13397 #[no_mangle]
13398 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
13399         o.result_ok
13400 }
13401 #[no_mangle]
13402 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
13403 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
13404 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
13405         fn drop(&mut self) {
13406                 if self.result_ok {
13407                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13408                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13409                         }
13410                 } else {
13411                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13412                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13413                         }
13414                 }
13415         }
13416 }
13417 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
13418         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
13419                 let contents = if o.result_ok {
13420                         let result = unsafe { o.contents.result };
13421                         unsafe { o.contents.result = core::ptr::null_mut() };
13422                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
13423                 } else {
13424                         let err = unsafe { o.contents.err };
13425                         unsafe { o.contents.err = core::ptr::null_mut(); }
13426                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
13427                 };
13428                 Self {
13429                         contents,
13430                         result_ok: o.result_ok,
13431                 }
13432         }
13433 }
13434 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
13435         fn clone(&self) -> Self {
13436                 if self.result_ok {
13437                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13438                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13439                         } }
13440                 } else {
13441                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
13442                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
13443                         } }
13444                 }
13445         }
13446 }
13447 #[no_mangle]
13448 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
13449 /// but with all dynamically-allocated buffers duplicated in new buffers.
13450 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
13451 #[repr(C)]
13452 /// The contents of CResult_SignedRawInvoiceParseErrorZ
13453 pub union CResult_SignedRawInvoiceParseErrorZPtr {
13454         /// A pointer to the contents in the success state.
13455         /// Reading from this pointer when `result_ok` is not set is undefined.
13456         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
13457         /// A pointer to the contents in the error state.
13458         /// Reading from this pointer when `result_ok` is set is undefined.
13459         pub err: *mut crate::lightning_invoice::ParseError,
13460 }
13461 #[repr(C)]
13462 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
13463 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
13464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13465 pub struct CResult_SignedRawInvoiceParseErrorZ {
13466         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
13467         /// `err` or `result` depending on the state of `result_ok`.
13468         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
13469         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
13470         pub result_ok: bool,
13471 }
13472 #[no_mangle]
13473 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
13474 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
13475         CResult_SignedRawInvoiceParseErrorZ {
13476                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13477                         result: Box::into_raw(Box::new(o)),
13478                 },
13479                 result_ok: true,
13480         }
13481 }
13482 #[no_mangle]
13483 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
13484 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
13485         CResult_SignedRawInvoiceParseErrorZ {
13486                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
13487                         err: Box::into_raw(Box::new(e)),
13488                 },
13489                 result_ok: false,
13490         }
13491 }
13492 /// Checks if the given object is currently in the success state
13493 #[no_mangle]
13494 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
13495         o.result_ok
13496 }
13497 #[no_mangle]
13498 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
13499 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
13500 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
13501         fn drop(&mut self) {
13502                 if self.result_ok {
13503                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13504                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13505                         }
13506                 } else {
13507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13509                         }
13510                 }
13511         }
13512 }
13513 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
13514         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
13515                 let contents = if o.result_ok {
13516                         let result = unsafe { o.contents.result };
13517                         unsafe { o.contents.result = core::ptr::null_mut() };
13518                         CResult_SignedRawInvoiceParseErrorZPtr { result }
13519                 } else {
13520                         let err = unsafe { o.contents.err };
13521                         unsafe { o.contents.err = core::ptr::null_mut(); }
13522                         CResult_SignedRawInvoiceParseErrorZPtr { err }
13523                 };
13524                 Self {
13525                         contents,
13526                         result_ok: o.result_ok,
13527                 }
13528         }
13529 }
13530 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
13531         fn clone(&self) -> Self {
13532                 if self.result_ok {
13533                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13534                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
13535                         } }
13536                 } else {
13537                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
13538                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
13539                         } }
13540                 }
13541         }
13542 }
13543 #[no_mangle]
13544 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
13545 /// but with all dynamically-allocated buffers duplicated in new buffers.
13546 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
13547 #[repr(C)]
13548 /// A tuple of 3 elements. See the individual fields for the types contained.
13549 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13550         /// The element at position 0
13551         pub a: crate::lightning_invoice::RawInvoice,
13552         /// The element at position 1
13553         pub b: crate::c_types::ThirtyTwoBytes,
13554         /// The element at position 2
13555         pub c: crate::lightning_invoice::InvoiceSignature,
13556 }
13557 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13558         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
13559                 Self {
13560                         a: tup.0,
13561                         b: tup.1,
13562                         c: tup.2,
13563                 }
13564         }
13565 }
13566 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13567         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
13568                 (self.a, self.b, self.c)
13569         }
13570 }
13571 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13572         fn clone(&self) -> Self {
13573                 Self {
13574                         a: Clone::clone(&self.a),
13575                         b: Clone::clone(&self.b),
13576                         c: Clone::clone(&self.c),
13577                 }
13578         }
13579 }
13580 #[no_mangle]
13581 /// Creates a new tuple which has the same data as `orig`
13582 /// but with all dynamically-allocated buffers duplicated in new buffers.
13583 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
13584 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
13585 #[no_mangle]
13586 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ {
13587         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
13588 }
13589
13590 #[no_mangle]
13591 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
13592 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
13593 #[repr(C)]
13594 /// The contents of CResult_PayeePubKeyErrorZ
13595 pub union CResult_PayeePubKeyErrorZPtr {
13596         /// A pointer to the contents in the success state.
13597         /// Reading from this pointer when `result_ok` is not set is undefined.
13598         pub result: *mut crate::lightning_invoice::PayeePubKey,
13599         /// A pointer to the contents in the error state.
13600         /// Reading from this pointer when `result_ok` is set is undefined.
13601         pub err: *mut crate::c_types::Secp256k1Error,
13602 }
13603 #[repr(C)]
13604 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
13605 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
13606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13607 pub struct CResult_PayeePubKeyErrorZ {
13608         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
13609         /// `err` or `result` depending on the state of `result_ok`.
13610         pub contents: CResult_PayeePubKeyErrorZPtr,
13611         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
13612         pub result_ok: bool,
13613 }
13614 #[no_mangle]
13615 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
13616 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
13617         CResult_PayeePubKeyErrorZ {
13618                 contents: CResult_PayeePubKeyErrorZPtr {
13619                         result: Box::into_raw(Box::new(o)),
13620                 },
13621                 result_ok: true,
13622         }
13623 }
13624 #[no_mangle]
13625 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
13626 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
13627         CResult_PayeePubKeyErrorZ {
13628                 contents: CResult_PayeePubKeyErrorZPtr {
13629                         err: Box::into_raw(Box::new(e)),
13630                 },
13631                 result_ok: false,
13632         }
13633 }
13634 /// Checks if the given object is currently in the success state
13635 #[no_mangle]
13636 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
13637         o.result_ok
13638 }
13639 #[no_mangle]
13640 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
13641 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
13642 impl Drop for CResult_PayeePubKeyErrorZ {
13643         fn drop(&mut self) {
13644                 if self.result_ok {
13645                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13646                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13647                         }
13648                 } else {
13649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13651                         }
13652                 }
13653         }
13654 }
13655 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
13656         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
13657                 let contents = if o.result_ok {
13658                         let result = unsafe { o.contents.result };
13659                         unsafe { o.contents.result = core::ptr::null_mut() };
13660                         CResult_PayeePubKeyErrorZPtr { result }
13661                 } else {
13662                         let err = unsafe { o.contents.err };
13663                         unsafe { o.contents.err = core::ptr::null_mut(); }
13664                         CResult_PayeePubKeyErrorZPtr { err }
13665                 };
13666                 Self {
13667                         contents,
13668                         result_ok: o.result_ok,
13669                 }
13670         }
13671 }
13672 impl Clone for CResult_PayeePubKeyErrorZ {
13673         fn clone(&self) -> Self {
13674                 if self.result_ok {
13675                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
13676                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
13677                         } }
13678                 } else {
13679                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
13680                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
13681                         } }
13682                 }
13683         }
13684 }
13685 #[no_mangle]
13686 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
13687 /// but with all dynamically-allocated buffers duplicated in new buffers.
13688 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
13689 #[repr(C)]
13690 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
13691 /// This corresponds to std::vector in C++
13692 pub struct CVec_PrivateRouteZ {
13693         /// The elements in the array.
13694         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13695         pub data: *mut crate::lightning_invoice::PrivateRoute,
13696         /// The number of elements pointed to by `data`.
13697         pub datalen: usize
13698 }
13699 impl CVec_PrivateRouteZ {
13700         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
13701                 if self.datalen == 0 { return Vec::new(); }
13702                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13703                 self.data = core::ptr::null_mut();
13704                 self.datalen = 0;
13705                 ret
13706         }
13707         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
13708                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13709         }
13710 }
13711 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
13712         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
13713                 let datalen = v.len();
13714                 let data = Box::into_raw(v.into_boxed_slice());
13715                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13716         }
13717 }
13718 #[no_mangle]
13719 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13720 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
13721 impl Drop for CVec_PrivateRouteZ {
13722         fn drop(&mut self) {
13723                 if self.datalen == 0 { return; }
13724                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13725         }
13726 }
13727 impl Clone for CVec_PrivateRouteZ {
13728         fn clone(&self) -> Self {
13729                 let mut res = Vec::new();
13730                 if self.datalen == 0 { return Self::from(res); }
13731                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13732                 Self::from(res)
13733         }
13734 }
13735 #[repr(C)]
13736 /// The contents of CResult_PositiveTimestampCreationErrorZ
13737 pub union CResult_PositiveTimestampCreationErrorZPtr {
13738         /// A pointer to the contents in the success state.
13739         /// Reading from this pointer when `result_ok` is not set is undefined.
13740         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
13741         /// A pointer to the contents in the error state.
13742         /// Reading from this pointer when `result_ok` is set is undefined.
13743         pub err: *mut crate::lightning_invoice::CreationError,
13744 }
13745 #[repr(C)]
13746 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
13747 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
13748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13749 pub struct CResult_PositiveTimestampCreationErrorZ {
13750         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
13751         /// `err` or `result` depending on the state of `result_ok`.
13752         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
13753         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
13754         pub result_ok: bool,
13755 }
13756 #[no_mangle]
13757 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
13758 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
13759         CResult_PositiveTimestampCreationErrorZ {
13760                 contents: CResult_PositiveTimestampCreationErrorZPtr {
13761                         result: Box::into_raw(Box::new(o)),
13762                 },
13763                 result_ok: true,
13764         }
13765 }
13766 #[no_mangle]
13767 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
13768 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
13769         CResult_PositiveTimestampCreationErrorZ {
13770                 contents: CResult_PositiveTimestampCreationErrorZPtr {
13771                         err: Box::into_raw(Box::new(e)),
13772                 },
13773                 result_ok: false,
13774         }
13775 }
13776 /// Checks if the given object is currently in the success state
13777 #[no_mangle]
13778 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
13779         o.result_ok
13780 }
13781 #[no_mangle]
13782 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
13783 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
13784 impl Drop for CResult_PositiveTimestampCreationErrorZ {
13785         fn drop(&mut self) {
13786                 if self.result_ok {
13787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13789                         }
13790                 } else {
13791                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13792                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13793                         }
13794                 }
13795         }
13796 }
13797 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
13798         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
13799                 let contents = if o.result_ok {
13800                         let result = unsafe { o.contents.result };
13801                         unsafe { o.contents.result = core::ptr::null_mut() };
13802                         CResult_PositiveTimestampCreationErrorZPtr { result }
13803                 } else {
13804                         let err = unsafe { o.contents.err };
13805                         unsafe { o.contents.err = core::ptr::null_mut(); }
13806                         CResult_PositiveTimestampCreationErrorZPtr { err }
13807                 };
13808                 Self {
13809                         contents,
13810                         result_ok: o.result_ok,
13811                 }
13812         }
13813 }
13814 impl Clone for CResult_PositiveTimestampCreationErrorZ {
13815         fn clone(&self) -> Self {
13816                 if self.result_ok {
13817                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
13818                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
13819                         } }
13820                 } else {
13821                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
13822                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13823                         } }
13824                 }
13825         }
13826 }
13827 #[no_mangle]
13828 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13829 /// but with all dynamically-allocated buffers duplicated in new buffers.
13830 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
13831 #[repr(C)]
13832 /// The contents of CResult_NoneSemanticErrorZ
13833 pub union CResult_NoneSemanticErrorZPtr {
13834         /// Note that this value is always NULL, as there are no contents in the OK variant
13835         pub result: *mut core::ffi::c_void,
13836         /// A pointer to the contents in the error state.
13837         /// Reading from this pointer when `result_ok` is set is undefined.
13838         pub err: *mut crate::lightning_invoice::SemanticError,
13839 }
13840 #[repr(C)]
13841 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
13842 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
13843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13844 pub struct CResult_NoneSemanticErrorZ {
13845         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
13846         /// `err` or `result` depending on the state of `result_ok`.
13847         pub contents: CResult_NoneSemanticErrorZPtr,
13848         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
13849         pub result_ok: bool,
13850 }
13851 #[no_mangle]
13852 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
13853 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
13854         CResult_NoneSemanticErrorZ {
13855                 contents: CResult_NoneSemanticErrorZPtr {
13856                         result: core::ptr::null_mut(),
13857                 },
13858                 result_ok: true,
13859         }
13860 }
13861 #[no_mangle]
13862 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
13863 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
13864         CResult_NoneSemanticErrorZ {
13865                 contents: CResult_NoneSemanticErrorZPtr {
13866                         err: Box::into_raw(Box::new(e)),
13867                 },
13868                 result_ok: false,
13869         }
13870 }
13871 /// Checks if the given object is currently in the success state
13872 #[no_mangle]
13873 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
13874         o.result_ok
13875 }
13876 #[no_mangle]
13877 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
13878 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
13879 impl Drop for CResult_NoneSemanticErrorZ {
13880         fn drop(&mut self) {
13881                 if self.result_ok {
13882                 } else {
13883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13885                         }
13886                 }
13887         }
13888 }
13889 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
13890         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
13891                 let contents = if o.result_ok {
13892                         let _ = unsafe { Box::from_raw(o.contents.result) };
13893                         o.contents.result = core::ptr::null_mut();
13894                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
13895                 } else {
13896                         let err = unsafe { o.contents.err };
13897                         unsafe { o.contents.err = core::ptr::null_mut(); }
13898                         CResult_NoneSemanticErrorZPtr { err }
13899                 };
13900                 Self {
13901                         contents,
13902                         result_ok: o.result_ok,
13903                 }
13904         }
13905 }
13906 impl Clone for CResult_NoneSemanticErrorZ {
13907         fn clone(&self) -> Self {
13908                 if self.result_ok {
13909                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
13910                                 result: core::ptr::null_mut()
13911                         } }
13912                 } else {
13913                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
13914                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13915                         } }
13916                 }
13917         }
13918 }
13919 #[no_mangle]
13920 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13921 /// but with all dynamically-allocated buffers duplicated in new buffers.
13922 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
13923 #[repr(C)]
13924 /// The contents of CResult_InvoiceSemanticErrorZ
13925 pub union CResult_InvoiceSemanticErrorZPtr {
13926         /// A pointer to the contents in the success state.
13927         /// Reading from this pointer when `result_ok` is not set is undefined.
13928         pub result: *mut crate::lightning_invoice::Invoice,
13929         /// A pointer to the contents in the error state.
13930         /// Reading from this pointer when `result_ok` is set is undefined.
13931         pub err: *mut crate::lightning_invoice::SemanticError,
13932 }
13933 #[repr(C)]
13934 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
13935 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
13936 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13937 pub struct CResult_InvoiceSemanticErrorZ {
13938         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
13939         /// `err` or `result` depending on the state of `result_ok`.
13940         pub contents: CResult_InvoiceSemanticErrorZPtr,
13941         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
13942         pub result_ok: bool,
13943 }
13944 #[no_mangle]
13945 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13946 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
13947         CResult_InvoiceSemanticErrorZ {
13948                 contents: CResult_InvoiceSemanticErrorZPtr {
13949                         result: Box::into_raw(Box::new(o)),
13950                 },
13951                 result_ok: true,
13952         }
13953 }
13954 #[no_mangle]
13955 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13956 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
13957         CResult_InvoiceSemanticErrorZ {
13958                 contents: CResult_InvoiceSemanticErrorZPtr {
13959                         err: Box::into_raw(Box::new(e)),
13960                 },
13961                 result_ok: false,
13962         }
13963 }
13964 /// Checks if the given object is currently in the success state
13965 #[no_mangle]
13966 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
13967         o.result_ok
13968 }
13969 #[no_mangle]
13970 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13971 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
13972 impl Drop for CResult_InvoiceSemanticErrorZ {
13973         fn drop(&mut self) {
13974                 if self.result_ok {
13975                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13976                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13977                         }
13978                 } else {
13979                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13980                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13981                         }
13982                 }
13983         }
13984 }
13985 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
13986         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
13987                 let contents = if o.result_ok {
13988                         let result = unsafe { o.contents.result };
13989                         unsafe { o.contents.result = core::ptr::null_mut() };
13990                         CResult_InvoiceSemanticErrorZPtr { result }
13991                 } else {
13992                         let err = unsafe { o.contents.err };
13993                         unsafe { o.contents.err = core::ptr::null_mut(); }
13994                         CResult_InvoiceSemanticErrorZPtr { err }
13995                 };
13996                 Self {
13997                         contents,
13998                         result_ok: o.result_ok,
13999                 }
14000         }
14001 }
14002 impl Clone for CResult_InvoiceSemanticErrorZ {
14003         fn clone(&self) -> Self {
14004                 if self.result_ok {
14005                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
14006                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14007                         } }
14008                 } else {
14009                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
14010                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
14011                         } }
14012                 }
14013         }
14014 }
14015 #[no_mangle]
14016 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14017 /// but with all dynamically-allocated buffers duplicated in new buffers.
14018 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
14019 #[repr(C)]
14020 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14021 /// This corresponds to std::vector in C++
14022 pub struct CVec_AddressZ {
14023         /// The elements in the array.
14024         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14025         pub data: *mut crate::c_types::Str,
14026         /// The number of elements pointed to by `data`.
14027         pub datalen: usize
14028 }
14029 impl CVec_AddressZ {
14030         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14031                 if self.datalen == 0 { return Vec::new(); }
14032                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14033                 self.data = core::ptr::null_mut();
14034                 self.datalen = 0;
14035                 ret
14036         }
14037         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14038                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14039         }
14040 }
14041 impl From<Vec<crate::c_types::Str>> for CVec_AddressZ {
14042         fn from(v: Vec<crate::c_types::Str>) -> Self {
14043                 let datalen = v.len();
14044                 let data = Box::into_raw(v.into_boxed_slice());
14045                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14046         }
14047 }
14048 #[no_mangle]
14049 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14050 pub extern "C" fn CVec_AddressZ_free(_res: CVec_AddressZ) { }
14051 impl Drop for CVec_AddressZ {
14052         fn drop(&mut self) {
14053                 if self.datalen == 0 { return; }
14054                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14055         }
14056 }
14057 impl Clone for CVec_AddressZ {
14058         fn clone(&self) -> Self {
14059                 let mut res = Vec::new();
14060                 if self.datalen == 0 { return Self::from(res); }
14061                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14062                 Self::from(res)
14063         }
14064 }
14065 #[repr(C)]
14066 /// The contents of CResult_DescriptionCreationErrorZ
14067 pub union CResult_DescriptionCreationErrorZPtr {
14068         /// A pointer to the contents in the success state.
14069         /// Reading from this pointer when `result_ok` is not set is undefined.
14070         pub result: *mut crate::lightning_invoice::Description,
14071         /// A pointer to the contents in the error state.
14072         /// Reading from this pointer when `result_ok` is set is undefined.
14073         pub err: *mut crate::lightning_invoice::CreationError,
14074 }
14075 #[repr(C)]
14076 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
14077 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
14078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14079 pub struct CResult_DescriptionCreationErrorZ {
14080         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
14081         /// `err` or `result` depending on the state of `result_ok`.
14082         pub contents: CResult_DescriptionCreationErrorZPtr,
14083         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
14084         pub result_ok: bool,
14085 }
14086 #[no_mangle]
14087 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
14088 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
14089         CResult_DescriptionCreationErrorZ {
14090                 contents: CResult_DescriptionCreationErrorZPtr {
14091                         result: Box::into_raw(Box::new(o)),
14092                 },
14093                 result_ok: true,
14094         }
14095 }
14096 #[no_mangle]
14097 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
14098 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
14099         CResult_DescriptionCreationErrorZ {
14100                 contents: CResult_DescriptionCreationErrorZPtr {
14101                         err: Box::into_raw(Box::new(e)),
14102                 },
14103                 result_ok: false,
14104         }
14105 }
14106 /// Checks if the given object is currently in the success state
14107 #[no_mangle]
14108 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
14109         o.result_ok
14110 }
14111 #[no_mangle]
14112 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
14113 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
14114 impl Drop for CResult_DescriptionCreationErrorZ {
14115         fn drop(&mut self) {
14116                 if self.result_ok {
14117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14119                         }
14120                 } else {
14121                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14122                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14123                         }
14124                 }
14125         }
14126 }
14127 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
14128         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
14129                 let contents = if o.result_ok {
14130                         let result = unsafe { o.contents.result };
14131                         unsafe { o.contents.result = core::ptr::null_mut() };
14132                         CResult_DescriptionCreationErrorZPtr { result }
14133                 } else {
14134                         let err = unsafe { o.contents.err };
14135                         unsafe { o.contents.err = core::ptr::null_mut(); }
14136                         CResult_DescriptionCreationErrorZPtr { err }
14137                 };
14138                 Self {
14139                         contents,
14140                         result_ok: o.result_ok,
14141                 }
14142         }
14143 }
14144 impl Clone for CResult_DescriptionCreationErrorZ {
14145         fn clone(&self) -> Self {
14146                 if self.result_ok {
14147                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
14148                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
14149                         } }
14150                 } else {
14151                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
14152                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14153                         } }
14154                 }
14155         }
14156 }
14157 #[no_mangle]
14158 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14159 /// but with all dynamically-allocated buffers duplicated in new buffers.
14160 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
14161 #[repr(C)]
14162 /// The contents of CResult_PrivateRouteCreationErrorZ
14163 pub union CResult_PrivateRouteCreationErrorZPtr {
14164         /// A pointer to the contents in the success state.
14165         /// Reading from this pointer when `result_ok` is not set is undefined.
14166         pub result: *mut crate::lightning_invoice::PrivateRoute,
14167         /// A pointer to the contents in the error state.
14168         /// Reading from this pointer when `result_ok` is set is undefined.
14169         pub err: *mut crate::lightning_invoice::CreationError,
14170 }
14171 #[repr(C)]
14172 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
14173 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
14174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14175 pub struct CResult_PrivateRouteCreationErrorZ {
14176         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
14177         /// `err` or `result` depending on the state of `result_ok`.
14178         pub contents: CResult_PrivateRouteCreationErrorZPtr,
14179         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
14180         pub result_ok: bool,
14181 }
14182 #[no_mangle]
14183 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14184 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
14185         CResult_PrivateRouteCreationErrorZ {
14186                 contents: CResult_PrivateRouteCreationErrorZPtr {
14187                         result: Box::into_raw(Box::new(o)),
14188                 },
14189                 result_ok: true,
14190         }
14191 }
14192 #[no_mangle]
14193 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14194 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
14195         CResult_PrivateRouteCreationErrorZ {
14196                 contents: CResult_PrivateRouteCreationErrorZPtr {
14197                         err: Box::into_raw(Box::new(e)),
14198                 },
14199                 result_ok: false,
14200         }
14201 }
14202 /// Checks if the given object is currently in the success state
14203 #[no_mangle]
14204 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
14205         o.result_ok
14206 }
14207 #[no_mangle]
14208 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14209 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
14210 impl Drop for CResult_PrivateRouteCreationErrorZ {
14211         fn drop(&mut self) {
14212                 if self.result_ok {
14213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14215                         }
14216                 } else {
14217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14219                         }
14220                 }
14221         }
14222 }
14223 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
14224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
14225                 let contents = if o.result_ok {
14226                         let result = unsafe { o.contents.result };
14227                         unsafe { o.contents.result = core::ptr::null_mut() };
14228                         CResult_PrivateRouteCreationErrorZPtr { result }
14229                 } else {
14230                         let err = unsafe { o.contents.err };
14231                         unsafe { o.contents.err = core::ptr::null_mut(); }
14232                         CResult_PrivateRouteCreationErrorZPtr { err }
14233                 };
14234                 Self {
14235                         contents,
14236                         result_ok: o.result_ok,
14237                 }
14238         }
14239 }
14240 impl Clone for CResult_PrivateRouteCreationErrorZ {
14241         fn clone(&self) -> Self {
14242                 if self.result_ok {
14243                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
14244                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
14245                         } }
14246                 } else {
14247                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
14248                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
14249                         } }
14250                 }
14251         }
14252 }
14253 #[no_mangle]
14254 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14255 /// but with all dynamically-allocated buffers duplicated in new buffers.
14256 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
14257 #[repr(C)]
14258 /// The contents of CResult_NetAddressDecodeErrorZ
14259 pub union CResult_NetAddressDecodeErrorZPtr {
14260         /// A pointer to the contents in the success state.
14261         /// Reading from this pointer when `result_ok` is not set is undefined.
14262         pub result: *mut crate::lightning::ln::msgs::NetAddress,
14263         /// A pointer to the contents in the error state.
14264         /// Reading from this pointer when `result_ok` is set is undefined.
14265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14266 }
14267 #[repr(C)]
14268 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
14269 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
14270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14271 pub struct CResult_NetAddressDecodeErrorZ {
14272         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
14273         /// `err` or `result` depending on the state of `result_ok`.
14274         pub contents: CResult_NetAddressDecodeErrorZPtr,
14275         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
14276         pub result_ok: bool,
14277 }
14278 #[no_mangle]
14279 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
14280 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
14281         CResult_NetAddressDecodeErrorZ {
14282                 contents: CResult_NetAddressDecodeErrorZPtr {
14283                         result: Box::into_raw(Box::new(o)),
14284                 },
14285                 result_ok: true,
14286         }
14287 }
14288 #[no_mangle]
14289 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
14290 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
14291         CResult_NetAddressDecodeErrorZ {
14292                 contents: CResult_NetAddressDecodeErrorZPtr {
14293                         err: Box::into_raw(Box::new(e)),
14294                 },
14295                 result_ok: false,
14296         }
14297 }
14298 /// Checks if the given object is currently in the success state
14299 #[no_mangle]
14300 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
14301         o.result_ok
14302 }
14303 #[no_mangle]
14304 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
14305 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
14306 impl Drop for CResult_NetAddressDecodeErrorZ {
14307         fn drop(&mut self) {
14308                 if self.result_ok {
14309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14311                         }
14312                 } else {
14313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14315                         }
14316                 }
14317         }
14318 }
14319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
14320         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
14321                 let contents = if o.result_ok {
14322                         let result = unsafe { o.contents.result };
14323                         unsafe { o.contents.result = core::ptr::null_mut() };
14324                         CResult_NetAddressDecodeErrorZPtr { result }
14325                 } else {
14326                         let err = unsafe { o.contents.err };
14327                         unsafe { o.contents.err = core::ptr::null_mut(); }
14328                         CResult_NetAddressDecodeErrorZPtr { err }
14329                 };
14330                 Self {
14331                         contents,
14332                         result_ok: o.result_ok,
14333                 }
14334         }
14335 }
14336 impl Clone for CResult_NetAddressDecodeErrorZ {
14337         fn clone(&self) -> Self {
14338                 if self.result_ok {
14339                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
14340                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
14341                         } }
14342                 } else {
14343                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
14344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14345                         } }
14346                 }
14347         }
14348 }
14349 #[no_mangle]
14350 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
14351 /// but with all dynamically-allocated buffers duplicated in new buffers.
14352 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
14353 #[repr(C)]
14354 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
14355 /// This corresponds to std::vector in C++
14356 pub struct CVec_UpdateAddHTLCZ {
14357         /// The elements in the array.
14358         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14359         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14360         /// The number of elements pointed to by `data`.
14361         pub datalen: usize
14362 }
14363 impl CVec_UpdateAddHTLCZ {
14364         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
14365                 if self.datalen == 0 { return Vec::new(); }
14366                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14367                 self.data = core::ptr::null_mut();
14368                 self.datalen = 0;
14369                 ret
14370         }
14371         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
14372                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14373         }
14374 }
14375 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
14376         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
14377                 let datalen = v.len();
14378                 let data = Box::into_raw(v.into_boxed_slice());
14379                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14380         }
14381 }
14382 #[no_mangle]
14383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14384 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
14385 impl Drop for CVec_UpdateAddHTLCZ {
14386         fn drop(&mut self) {
14387                 if self.datalen == 0 { return; }
14388                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14389         }
14390 }
14391 impl Clone for CVec_UpdateAddHTLCZ {
14392         fn clone(&self) -> Self {
14393                 let mut res = Vec::new();
14394                 if self.datalen == 0 { return Self::from(res); }
14395                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14396                 Self::from(res)
14397         }
14398 }
14399 #[repr(C)]
14400 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
14401 /// This corresponds to std::vector in C++
14402 pub struct CVec_UpdateFulfillHTLCZ {
14403         /// The elements in the array.
14404         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14405         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14406         /// The number of elements pointed to by `data`.
14407         pub datalen: usize
14408 }
14409 impl CVec_UpdateFulfillHTLCZ {
14410         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
14411                 if self.datalen == 0 { return Vec::new(); }
14412                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14413                 self.data = core::ptr::null_mut();
14414                 self.datalen = 0;
14415                 ret
14416         }
14417         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
14418                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14419         }
14420 }
14421 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
14422         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
14423                 let datalen = v.len();
14424                 let data = Box::into_raw(v.into_boxed_slice());
14425                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14426         }
14427 }
14428 #[no_mangle]
14429 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14430 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
14431 impl Drop for CVec_UpdateFulfillHTLCZ {
14432         fn drop(&mut self) {
14433                 if self.datalen == 0 { return; }
14434                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14435         }
14436 }
14437 impl Clone for CVec_UpdateFulfillHTLCZ {
14438         fn clone(&self) -> Self {
14439                 let mut res = Vec::new();
14440                 if self.datalen == 0 { return Self::from(res); }
14441                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14442                 Self::from(res)
14443         }
14444 }
14445 #[repr(C)]
14446 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
14447 /// This corresponds to std::vector in C++
14448 pub struct CVec_UpdateFailHTLCZ {
14449         /// The elements in the array.
14450         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14451         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14452         /// The number of elements pointed to by `data`.
14453         pub datalen: usize
14454 }
14455 impl CVec_UpdateFailHTLCZ {
14456         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
14457                 if self.datalen == 0 { return Vec::new(); }
14458                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14459                 self.data = core::ptr::null_mut();
14460                 self.datalen = 0;
14461                 ret
14462         }
14463         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
14464                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14465         }
14466 }
14467 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
14468         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
14469                 let datalen = v.len();
14470                 let data = Box::into_raw(v.into_boxed_slice());
14471                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14472         }
14473 }
14474 #[no_mangle]
14475 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14476 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
14477 impl Drop for CVec_UpdateFailHTLCZ {
14478         fn drop(&mut self) {
14479                 if self.datalen == 0 { return; }
14480                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14481         }
14482 }
14483 impl Clone for CVec_UpdateFailHTLCZ {
14484         fn clone(&self) -> Self {
14485                 let mut res = Vec::new();
14486                 if self.datalen == 0 { return Self::from(res); }
14487                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14488                 Self::from(res)
14489         }
14490 }
14491 #[repr(C)]
14492 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
14493 /// This corresponds to std::vector in C++
14494 pub struct CVec_UpdateFailMalformedHTLCZ {
14495         /// The elements in the array.
14496         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14497         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14498         /// The number of elements pointed to by `data`.
14499         pub datalen: usize
14500 }
14501 impl CVec_UpdateFailMalformedHTLCZ {
14502         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
14503                 if self.datalen == 0 { return Vec::new(); }
14504                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14505                 self.data = core::ptr::null_mut();
14506                 self.datalen = 0;
14507                 ret
14508         }
14509         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
14510                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14511         }
14512 }
14513 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
14514         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
14515                 let datalen = v.len();
14516                 let data = Box::into_raw(v.into_boxed_slice());
14517                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14518         }
14519 }
14520 #[no_mangle]
14521 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14522 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
14523 impl Drop for CVec_UpdateFailMalformedHTLCZ {
14524         fn drop(&mut self) {
14525                 if self.datalen == 0 { return; }
14526                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14527         }
14528 }
14529 impl Clone for CVec_UpdateFailMalformedHTLCZ {
14530         fn clone(&self) -> Self {
14531                 let mut res = Vec::new();
14532                 if self.datalen == 0 { return Self::from(res); }
14533                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14534                 Self::from(res)
14535         }
14536 }
14537 #[repr(C)]
14538 /// The contents of CResult_AcceptChannelDecodeErrorZ
14539 pub union CResult_AcceptChannelDecodeErrorZPtr {
14540         /// A pointer to the contents in the success state.
14541         /// Reading from this pointer when `result_ok` is not set is undefined.
14542         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
14543         /// A pointer to the contents in the error state.
14544         /// Reading from this pointer when `result_ok` is set is undefined.
14545         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14546 }
14547 #[repr(C)]
14548 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
14549 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14551 pub struct CResult_AcceptChannelDecodeErrorZ {
14552         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
14553         /// `err` or `result` depending on the state of `result_ok`.
14554         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
14555         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
14556         pub result_ok: bool,
14557 }
14558 #[no_mangle]
14559 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
14560 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
14561         CResult_AcceptChannelDecodeErrorZ {
14562                 contents: CResult_AcceptChannelDecodeErrorZPtr {
14563                         result: Box::into_raw(Box::new(o)),
14564                 },
14565                 result_ok: true,
14566         }
14567 }
14568 #[no_mangle]
14569 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
14570 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
14571         CResult_AcceptChannelDecodeErrorZ {
14572                 contents: CResult_AcceptChannelDecodeErrorZPtr {
14573                         err: Box::into_raw(Box::new(e)),
14574                 },
14575                 result_ok: false,
14576         }
14577 }
14578 /// Checks if the given object is currently in the success state
14579 #[no_mangle]
14580 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
14581         o.result_ok
14582 }
14583 #[no_mangle]
14584 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
14585 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
14586 impl Drop for CResult_AcceptChannelDecodeErrorZ {
14587         fn drop(&mut self) {
14588                 if self.result_ok {
14589                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14590                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14591                         }
14592                 } else {
14593                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14594                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14595                         }
14596                 }
14597         }
14598 }
14599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
14600         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14601                 let contents = if o.result_ok {
14602                         let result = unsafe { o.contents.result };
14603                         unsafe { o.contents.result = core::ptr::null_mut() };
14604                         CResult_AcceptChannelDecodeErrorZPtr { result }
14605                 } else {
14606                         let err = unsafe { o.contents.err };
14607                         unsafe { o.contents.err = core::ptr::null_mut(); }
14608                         CResult_AcceptChannelDecodeErrorZPtr { err }
14609                 };
14610                 Self {
14611                         contents,
14612                         result_ok: o.result_ok,
14613                 }
14614         }
14615 }
14616 impl Clone for CResult_AcceptChannelDecodeErrorZ {
14617         fn clone(&self) -> Self {
14618                 if self.result_ok {
14619                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
14620                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
14621                         } }
14622                 } else {
14623                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
14624                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14625                         } }
14626                 }
14627         }
14628 }
14629 #[no_mangle]
14630 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
14631 /// but with all dynamically-allocated buffers duplicated in new buffers.
14632 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
14633 #[repr(C)]
14634 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
14635 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
14636         /// A pointer to the contents in the success state.
14637         /// Reading from this pointer when `result_ok` is not set is undefined.
14638         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
14639         /// A pointer to the contents in the error state.
14640         /// Reading from this pointer when `result_ok` is set is undefined.
14641         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14642 }
14643 #[repr(C)]
14644 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
14645 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
14646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14647 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
14648         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
14649         /// `err` or `result` depending on the state of `result_ok`.
14650         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
14651         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
14652         pub result_ok: bool,
14653 }
14654 #[no_mangle]
14655 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
14656 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14657         CResult_AnnouncementSignaturesDecodeErrorZ {
14658                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14659                         result: Box::into_raw(Box::new(o)),
14660                 },
14661                 result_ok: true,
14662         }
14663 }
14664 #[no_mangle]
14665 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
14666 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
14667         CResult_AnnouncementSignaturesDecodeErrorZ {
14668                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14669                         err: Box::into_raw(Box::new(e)),
14670                 },
14671                 result_ok: false,
14672         }
14673 }
14674 /// Checks if the given object is currently in the success state
14675 #[no_mangle]
14676 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
14677         o.result_ok
14678 }
14679 #[no_mangle]
14680 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
14681 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
14682 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
14683         fn drop(&mut self) {
14684                 if self.result_ok {
14685                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14686                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14687                         }
14688                 } else {
14689                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14690                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14691                         }
14692                 }
14693         }
14694 }
14695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
14696         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
14697                 let contents = if o.result_ok {
14698                         let result = unsafe { o.contents.result };
14699                         unsafe { o.contents.result = core::ptr::null_mut() };
14700                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
14701                 } else {
14702                         let err = unsafe { o.contents.err };
14703                         unsafe { o.contents.err = core::ptr::null_mut(); }
14704                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
14705                 };
14706                 Self {
14707                         contents,
14708                         result_ok: o.result_ok,
14709                 }
14710         }
14711 }
14712 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
14713         fn clone(&self) -> Self {
14714                 if self.result_ok {
14715                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14716                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
14717                         } }
14718                 } else {
14719                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
14720                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14721                         } }
14722                 }
14723         }
14724 }
14725 #[no_mangle]
14726 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
14727 /// but with all dynamically-allocated buffers duplicated in new buffers.
14728 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
14729 #[repr(C)]
14730 /// The contents of CResult_ChannelReestablishDecodeErrorZ
14731 pub union CResult_ChannelReestablishDecodeErrorZPtr {
14732         /// A pointer to the contents in the success state.
14733         /// Reading from this pointer when `result_ok` is not set is undefined.
14734         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
14735         /// A pointer to the contents in the error state.
14736         /// Reading from this pointer when `result_ok` is set is undefined.
14737         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14738 }
14739 #[repr(C)]
14740 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
14741 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
14742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14743 pub struct CResult_ChannelReestablishDecodeErrorZ {
14744         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
14745         /// `err` or `result` depending on the state of `result_ok`.
14746         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
14747         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
14748         pub result_ok: bool,
14749 }
14750 #[no_mangle]
14751 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
14752 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
14753         CResult_ChannelReestablishDecodeErrorZ {
14754                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14755                         result: Box::into_raw(Box::new(o)),
14756                 },
14757                 result_ok: true,
14758         }
14759 }
14760 #[no_mangle]
14761 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
14762 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
14763         CResult_ChannelReestablishDecodeErrorZ {
14764                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
14765                         err: Box::into_raw(Box::new(e)),
14766                 },
14767                 result_ok: false,
14768         }
14769 }
14770 /// Checks if the given object is currently in the success state
14771 #[no_mangle]
14772 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
14773         o.result_ok
14774 }
14775 #[no_mangle]
14776 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
14777 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
14778 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
14779         fn drop(&mut self) {
14780                 if self.result_ok {
14781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14783                         }
14784                 } else {
14785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14787                         }
14788                 }
14789         }
14790 }
14791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14792         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14793                 let contents = if o.result_ok {
14794                         let result = unsafe { o.contents.result };
14795                         unsafe { o.contents.result = core::ptr::null_mut() };
14796                         CResult_ChannelReestablishDecodeErrorZPtr { result }
14797                 } else {
14798                         let err = unsafe { o.contents.err };
14799                         unsafe { o.contents.err = core::ptr::null_mut(); }
14800                         CResult_ChannelReestablishDecodeErrorZPtr { err }
14801                 };
14802                 Self {
14803                         contents,
14804                         result_ok: o.result_ok,
14805                 }
14806         }
14807 }
14808 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14809         fn clone(&self) -> Self {
14810                 if self.result_ok {
14811                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14812                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14813                         } }
14814                 } else {
14815                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14816                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14817                         } }
14818                 }
14819         }
14820 }
14821 #[no_mangle]
14822 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14823 /// but with all dynamically-allocated buffers duplicated in new buffers.
14824 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14825 #[repr(C)]
14826 /// The contents of CResult_ClosingSignedDecodeErrorZ
14827 pub union CResult_ClosingSignedDecodeErrorZPtr {
14828         /// A pointer to the contents in the success state.
14829         /// Reading from this pointer when `result_ok` is not set is undefined.
14830         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14831         /// A pointer to the contents in the error state.
14832         /// Reading from this pointer when `result_ok` is set is undefined.
14833         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14834 }
14835 #[repr(C)]
14836 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14837 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14839 pub struct CResult_ClosingSignedDecodeErrorZ {
14840         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14841         /// `err` or `result` depending on the state of `result_ok`.
14842         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14843         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14844         pub result_ok: bool,
14845 }
14846 #[no_mangle]
14847 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14848 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14849         CResult_ClosingSignedDecodeErrorZ {
14850                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14851                         result: Box::into_raw(Box::new(o)),
14852                 },
14853                 result_ok: true,
14854         }
14855 }
14856 #[no_mangle]
14857 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14858 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14859         CResult_ClosingSignedDecodeErrorZ {
14860                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14861                         err: Box::into_raw(Box::new(e)),
14862                 },
14863                 result_ok: false,
14864         }
14865 }
14866 /// Checks if the given object is currently in the success state
14867 #[no_mangle]
14868 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14869         o.result_ok
14870 }
14871 #[no_mangle]
14872 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14873 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14874 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14875         fn drop(&mut self) {
14876                 if self.result_ok {
14877                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14878                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14879                         }
14880                 } else {
14881                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14882                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14883                         }
14884                 }
14885         }
14886 }
14887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14888         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14889                 let contents = if o.result_ok {
14890                         let result = unsafe { o.contents.result };
14891                         unsafe { o.contents.result = core::ptr::null_mut() };
14892                         CResult_ClosingSignedDecodeErrorZPtr { result }
14893                 } else {
14894                         let err = unsafe { o.contents.err };
14895                         unsafe { o.contents.err = core::ptr::null_mut(); }
14896                         CResult_ClosingSignedDecodeErrorZPtr { err }
14897                 };
14898                 Self {
14899                         contents,
14900                         result_ok: o.result_ok,
14901                 }
14902         }
14903 }
14904 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14905         fn clone(&self) -> Self {
14906                 if self.result_ok {
14907                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14908                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14909                         } }
14910                 } else {
14911                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14912                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14913                         } }
14914                 }
14915         }
14916 }
14917 #[no_mangle]
14918 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14919 /// but with all dynamically-allocated buffers duplicated in new buffers.
14920 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14921 #[repr(C)]
14922 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14923 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14924         /// A pointer to the contents in the success state.
14925         /// Reading from this pointer when `result_ok` is not set is undefined.
14926         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14927         /// A pointer to the contents in the error state.
14928         /// Reading from this pointer when `result_ok` is set is undefined.
14929         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14930 }
14931 #[repr(C)]
14932 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14933 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14935 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14936         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14937         /// `err` or `result` depending on the state of `result_ok`.
14938         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14939         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14940         pub result_ok: bool,
14941 }
14942 #[no_mangle]
14943 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14944 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14945         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14946                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14947                         result: Box::into_raw(Box::new(o)),
14948                 },
14949                 result_ok: true,
14950         }
14951 }
14952 #[no_mangle]
14953 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14954 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14955         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14956                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14957                         err: Box::into_raw(Box::new(e)),
14958                 },
14959                 result_ok: false,
14960         }
14961 }
14962 /// Checks if the given object is currently in the success state
14963 #[no_mangle]
14964 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14965         o.result_ok
14966 }
14967 #[no_mangle]
14968 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14969 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14970 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14971         fn drop(&mut self) {
14972                 if self.result_ok {
14973                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14974                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14975                         }
14976                 } else {
14977                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14978                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14979                         }
14980                 }
14981         }
14982 }
14983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14984         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14985                 let contents = if o.result_ok {
14986                         let result = unsafe { o.contents.result };
14987                         unsafe { o.contents.result = core::ptr::null_mut() };
14988                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14989                 } else {
14990                         let err = unsafe { o.contents.err };
14991                         unsafe { o.contents.err = core::ptr::null_mut(); }
14992                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14993                 };
14994                 Self {
14995                         contents,
14996                         result_ok: o.result_ok,
14997                 }
14998         }
14999 }
15000 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
15001         fn clone(&self) -> Self {
15002                 if self.result_ok {
15003                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15004                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
15005                         } }
15006                 } else {
15007                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
15008                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15009                         } }
15010                 }
15011         }
15012 }
15013 #[no_mangle]
15014 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15015 /// but with all dynamically-allocated buffers duplicated in new buffers.
15016 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
15017 #[repr(C)]
15018 /// The contents of CResult_CommitmentSignedDecodeErrorZ
15019 pub union CResult_CommitmentSignedDecodeErrorZPtr {
15020         /// A pointer to the contents in the success state.
15021         /// Reading from this pointer when `result_ok` is not set is undefined.
15022         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
15023         /// A pointer to the contents in the error state.
15024         /// Reading from this pointer when `result_ok` is set is undefined.
15025         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15026 }
15027 #[repr(C)]
15028 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
15029 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15030 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15031 pub struct CResult_CommitmentSignedDecodeErrorZ {
15032         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
15033         /// `err` or `result` depending on the state of `result_ok`.
15034         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
15035         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
15036         pub result_ok: bool,
15037 }
15038 #[no_mangle]
15039 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15040 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
15041         CResult_CommitmentSignedDecodeErrorZ {
15042                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15043                         result: Box::into_raw(Box::new(o)),
15044                 },
15045                 result_ok: true,
15046         }
15047 }
15048 #[no_mangle]
15049 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15050 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
15051         CResult_CommitmentSignedDecodeErrorZ {
15052                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
15053                         err: Box::into_raw(Box::new(e)),
15054                 },
15055                 result_ok: false,
15056         }
15057 }
15058 /// Checks if the given object is currently in the success state
15059 #[no_mangle]
15060 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
15061         o.result_ok
15062 }
15063 #[no_mangle]
15064 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15065 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
15066 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
15067         fn drop(&mut self) {
15068                 if self.result_ok {
15069                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15070                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15071                         }
15072                 } else {
15073                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15074                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15075                         }
15076                 }
15077         }
15078 }
15079 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
15080         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15081                 let contents = if o.result_ok {
15082                         let result = unsafe { o.contents.result };
15083                         unsafe { o.contents.result = core::ptr::null_mut() };
15084                         CResult_CommitmentSignedDecodeErrorZPtr { result }
15085                 } else {
15086                         let err = unsafe { o.contents.err };
15087                         unsafe { o.contents.err = core::ptr::null_mut(); }
15088                         CResult_CommitmentSignedDecodeErrorZPtr { err }
15089                 };
15090                 Self {
15091                         contents,
15092                         result_ok: o.result_ok,
15093                 }
15094         }
15095 }
15096 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
15097         fn clone(&self) -> Self {
15098                 if self.result_ok {
15099                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15100                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
15101                         } }
15102                 } else {
15103                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
15104                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15105                         } }
15106                 }
15107         }
15108 }
15109 #[no_mangle]
15110 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15111 /// but with all dynamically-allocated buffers duplicated in new buffers.
15112 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
15113 #[repr(C)]
15114 /// The contents of CResult_FundingCreatedDecodeErrorZ
15115 pub union CResult_FundingCreatedDecodeErrorZPtr {
15116         /// A pointer to the contents in the success state.
15117         /// Reading from this pointer when `result_ok` is not set is undefined.
15118         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
15119         /// A pointer to the contents in the error state.
15120         /// Reading from this pointer when `result_ok` is set is undefined.
15121         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15122 }
15123 #[repr(C)]
15124 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
15125 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
15126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15127 pub struct CResult_FundingCreatedDecodeErrorZ {
15128         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
15129         /// `err` or `result` depending on the state of `result_ok`.
15130         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
15131         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
15132         pub result_ok: bool,
15133 }
15134 #[no_mangle]
15135 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15136 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
15137         CResult_FundingCreatedDecodeErrorZ {
15138                 contents: CResult_FundingCreatedDecodeErrorZPtr {
15139                         result: Box::into_raw(Box::new(o)),
15140                 },
15141                 result_ok: true,
15142         }
15143 }
15144 #[no_mangle]
15145 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15146 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
15147         CResult_FundingCreatedDecodeErrorZ {
15148                 contents: CResult_FundingCreatedDecodeErrorZPtr {
15149                         err: Box::into_raw(Box::new(e)),
15150                 },
15151                 result_ok: false,
15152         }
15153 }
15154 /// Checks if the given object is currently in the success state
15155 #[no_mangle]
15156 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
15157         o.result_ok
15158 }
15159 #[no_mangle]
15160 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15161 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
15162 impl Drop for CResult_FundingCreatedDecodeErrorZ {
15163         fn drop(&mut self) {
15164                 if self.result_ok {
15165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15167                         }
15168                 } else {
15169                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15170                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15171                         }
15172                 }
15173         }
15174 }
15175 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
15176         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
15177                 let contents = if o.result_ok {
15178                         let result = unsafe { o.contents.result };
15179                         unsafe { o.contents.result = core::ptr::null_mut() };
15180                         CResult_FundingCreatedDecodeErrorZPtr { result }
15181                 } else {
15182                         let err = unsafe { o.contents.err };
15183                         unsafe { o.contents.err = core::ptr::null_mut(); }
15184                         CResult_FundingCreatedDecodeErrorZPtr { err }
15185                 };
15186                 Self {
15187                         contents,
15188                         result_ok: o.result_ok,
15189                 }
15190         }
15191 }
15192 impl Clone for CResult_FundingCreatedDecodeErrorZ {
15193         fn clone(&self) -> Self {
15194                 if self.result_ok {
15195                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
15196                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
15197                         } }
15198                 } else {
15199                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
15200                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15201                         } }
15202                 }
15203         }
15204 }
15205 #[no_mangle]
15206 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15207 /// but with all dynamically-allocated buffers duplicated in new buffers.
15208 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
15209 #[repr(C)]
15210 /// The contents of CResult_FundingSignedDecodeErrorZ
15211 pub union CResult_FundingSignedDecodeErrorZPtr {
15212         /// A pointer to the contents in the success state.
15213         /// Reading from this pointer when `result_ok` is not set is undefined.
15214         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
15215         /// A pointer to the contents in the error state.
15216         /// Reading from this pointer when `result_ok` is set is undefined.
15217         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15218 }
15219 #[repr(C)]
15220 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
15221 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
15222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15223 pub struct CResult_FundingSignedDecodeErrorZ {
15224         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
15225         /// `err` or `result` depending on the state of `result_ok`.
15226         pub contents: CResult_FundingSignedDecodeErrorZPtr,
15227         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
15228         pub result_ok: bool,
15229 }
15230 #[no_mangle]
15231 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15232 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
15233         CResult_FundingSignedDecodeErrorZ {
15234                 contents: CResult_FundingSignedDecodeErrorZPtr {
15235                         result: Box::into_raw(Box::new(o)),
15236                 },
15237                 result_ok: true,
15238         }
15239 }
15240 #[no_mangle]
15241 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15242 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
15243         CResult_FundingSignedDecodeErrorZ {
15244                 contents: CResult_FundingSignedDecodeErrorZPtr {
15245                         err: Box::into_raw(Box::new(e)),
15246                 },
15247                 result_ok: false,
15248         }
15249 }
15250 /// Checks if the given object is currently in the success state
15251 #[no_mangle]
15252 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
15253         o.result_ok
15254 }
15255 #[no_mangle]
15256 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15257 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
15258 impl Drop for CResult_FundingSignedDecodeErrorZ {
15259         fn drop(&mut self) {
15260                 if self.result_ok {
15261                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15262                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15263                         }
15264                 } else {
15265                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15266                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15267                         }
15268                 }
15269         }
15270 }
15271 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
15272         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
15273                 let contents = if o.result_ok {
15274                         let result = unsafe { o.contents.result };
15275                         unsafe { o.contents.result = core::ptr::null_mut() };
15276                         CResult_FundingSignedDecodeErrorZPtr { result }
15277                 } else {
15278                         let err = unsafe { o.contents.err };
15279                         unsafe { o.contents.err = core::ptr::null_mut(); }
15280                         CResult_FundingSignedDecodeErrorZPtr { err }
15281                 };
15282                 Self {
15283                         contents,
15284                         result_ok: o.result_ok,
15285                 }
15286         }
15287 }
15288 impl Clone for CResult_FundingSignedDecodeErrorZ {
15289         fn clone(&self) -> Self {
15290                 if self.result_ok {
15291                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
15292                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
15293                         } }
15294                 } else {
15295                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
15296                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15297                         } }
15298                 }
15299         }
15300 }
15301 #[no_mangle]
15302 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15303 /// but with all dynamically-allocated buffers duplicated in new buffers.
15304 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
15305 #[repr(C)]
15306 /// The contents of CResult_ChannelReadyDecodeErrorZ
15307 pub union CResult_ChannelReadyDecodeErrorZPtr {
15308         /// A pointer to the contents in the success state.
15309         /// Reading from this pointer when `result_ok` is not set is undefined.
15310         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
15311         /// A pointer to the contents in the error state.
15312         /// Reading from this pointer when `result_ok` is set is undefined.
15313         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15314 }
15315 #[repr(C)]
15316 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
15317 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
15318 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15319 pub struct CResult_ChannelReadyDecodeErrorZ {
15320         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
15321         /// `err` or `result` depending on the state of `result_ok`.
15322         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
15323         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
15324         pub result_ok: bool,
15325 }
15326 #[no_mangle]
15327 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
15328 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
15329         CResult_ChannelReadyDecodeErrorZ {
15330                 contents: CResult_ChannelReadyDecodeErrorZPtr {
15331                         result: Box::into_raw(Box::new(o)),
15332                 },
15333                 result_ok: true,
15334         }
15335 }
15336 #[no_mangle]
15337 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
15338 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
15339         CResult_ChannelReadyDecodeErrorZ {
15340                 contents: CResult_ChannelReadyDecodeErrorZPtr {
15341                         err: Box::into_raw(Box::new(e)),
15342                 },
15343                 result_ok: false,
15344         }
15345 }
15346 /// Checks if the given object is currently in the success state
15347 #[no_mangle]
15348 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
15349         o.result_ok
15350 }
15351 #[no_mangle]
15352 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
15353 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
15354 impl Drop for CResult_ChannelReadyDecodeErrorZ {
15355         fn drop(&mut self) {
15356                 if self.result_ok {
15357                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15358                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15359                         }
15360                 } else {
15361                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15362                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15363                         }
15364                 }
15365         }
15366 }
15367 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
15368         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
15369                 let contents = if o.result_ok {
15370                         let result = unsafe { o.contents.result };
15371                         unsafe { o.contents.result = core::ptr::null_mut() };
15372                         CResult_ChannelReadyDecodeErrorZPtr { result }
15373                 } else {
15374                         let err = unsafe { o.contents.err };
15375                         unsafe { o.contents.err = core::ptr::null_mut(); }
15376                         CResult_ChannelReadyDecodeErrorZPtr { err }
15377                 };
15378                 Self {
15379                         contents,
15380                         result_ok: o.result_ok,
15381                 }
15382         }
15383 }
15384 impl Clone for CResult_ChannelReadyDecodeErrorZ {
15385         fn clone(&self) -> Self {
15386                 if self.result_ok {
15387                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
15388                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
15389                         } }
15390                 } else {
15391                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
15392                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15393                         } }
15394                 }
15395         }
15396 }
15397 #[no_mangle]
15398 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
15399 /// but with all dynamically-allocated buffers duplicated in new buffers.
15400 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
15401 #[repr(C)]
15402 /// The contents of CResult_InitDecodeErrorZ
15403 pub union CResult_InitDecodeErrorZPtr {
15404         /// A pointer to the contents in the success state.
15405         /// Reading from this pointer when `result_ok` is not set is undefined.
15406         pub result: *mut crate::lightning::ln::msgs::Init,
15407         /// A pointer to the contents in the error state.
15408         /// Reading from this pointer when `result_ok` is set is undefined.
15409         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15410 }
15411 #[repr(C)]
15412 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
15413 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
15414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15415 pub struct CResult_InitDecodeErrorZ {
15416         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
15417         /// `err` or `result` depending on the state of `result_ok`.
15418         pub contents: CResult_InitDecodeErrorZPtr,
15419         /// Whether this CResult_InitDecodeErrorZ represents a success state.
15420         pub result_ok: bool,
15421 }
15422 #[no_mangle]
15423 /// Creates a new CResult_InitDecodeErrorZ in the success state.
15424 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
15425         CResult_InitDecodeErrorZ {
15426                 contents: CResult_InitDecodeErrorZPtr {
15427                         result: Box::into_raw(Box::new(o)),
15428                 },
15429                 result_ok: true,
15430         }
15431 }
15432 #[no_mangle]
15433 /// Creates a new CResult_InitDecodeErrorZ in the error state.
15434 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
15435         CResult_InitDecodeErrorZ {
15436                 contents: CResult_InitDecodeErrorZPtr {
15437                         err: Box::into_raw(Box::new(e)),
15438                 },
15439                 result_ok: false,
15440         }
15441 }
15442 /// Checks if the given object is currently in the success state
15443 #[no_mangle]
15444 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
15445         o.result_ok
15446 }
15447 #[no_mangle]
15448 /// Frees any resources used by the CResult_InitDecodeErrorZ.
15449 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
15450 impl Drop for CResult_InitDecodeErrorZ {
15451         fn drop(&mut self) {
15452                 if self.result_ok {
15453                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15454                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15455                         }
15456                 } else {
15457                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15458                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15459                         }
15460                 }
15461         }
15462 }
15463 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
15464         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
15465                 let contents = if o.result_ok {
15466                         let result = unsafe { o.contents.result };
15467                         unsafe { o.contents.result = core::ptr::null_mut() };
15468                         CResult_InitDecodeErrorZPtr { result }
15469                 } else {
15470                         let err = unsafe { o.contents.err };
15471                         unsafe { o.contents.err = core::ptr::null_mut(); }
15472                         CResult_InitDecodeErrorZPtr { err }
15473                 };
15474                 Self {
15475                         contents,
15476                         result_ok: o.result_ok,
15477                 }
15478         }
15479 }
15480 impl Clone for CResult_InitDecodeErrorZ {
15481         fn clone(&self) -> Self {
15482                 if self.result_ok {
15483                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
15484                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
15485                         } }
15486                 } else {
15487                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
15488                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15489                         } }
15490                 }
15491         }
15492 }
15493 #[no_mangle]
15494 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15495 /// but with all dynamically-allocated buffers duplicated in new buffers.
15496 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
15497 #[repr(C)]
15498 /// The contents of CResult_OpenChannelDecodeErrorZ
15499 pub union CResult_OpenChannelDecodeErrorZPtr {
15500         /// A pointer to the contents in the success state.
15501         /// Reading from this pointer when `result_ok` is not set is undefined.
15502         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
15503         /// A pointer to the contents in the error state.
15504         /// Reading from this pointer when `result_ok` is set is undefined.
15505         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15506 }
15507 #[repr(C)]
15508 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
15509 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15510 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15511 pub struct CResult_OpenChannelDecodeErrorZ {
15512         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
15513         /// `err` or `result` depending on the state of `result_ok`.
15514         pub contents: CResult_OpenChannelDecodeErrorZPtr,
15515         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
15516         pub result_ok: bool,
15517 }
15518 #[no_mangle]
15519 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15520 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
15521         CResult_OpenChannelDecodeErrorZ {
15522                 contents: CResult_OpenChannelDecodeErrorZPtr {
15523                         result: Box::into_raw(Box::new(o)),
15524                 },
15525                 result_ok: true,
15526         }
15527 }
15528 #[no_mangle]
15529 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15530 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
15531         CResult_OpenChannelDecodeErrorZ {
15532                 contents: CResult_OpenChannelDecodeErrorZPtr {
15533                         err: Box::into_raw(Box::new(e)),
15534                 },
15535                 result_ok: false,
15536         }
15537 }
15538 /// Checks if the given object is currently in the success state
15539 #[no_mangle]
15540 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
15541         o.result_ok
15542 }
15543 #[no_mangle]
15544 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15545 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
15546 impl Drop for CResult_OpenChannelDecodeErrorZ {
15547         fn drop(&mut self) {
15548                 if self.result_ok {
15549                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15550                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15551                         }
15552                 } else {
15553                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15554                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15555                         }
15556                 }
15557         }
15558 }
15559 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
15560         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15561                 let contents = if o.result_ok {
15562                         let result = unsafe { o.contents.result };
15563                         unsafe { o.contents.result = core::ptr::null_mut() };
15564                         CResult_OpenChannelDecodeErrorZPtr { result }
15565                 } else {
15566                         let err = unsafe { o.contents.err };
15567                         unsafe { o.contents.err = core::ptr::null_mut(); }
15568                         CResult_OpenChannelDecodeErrorZPtr { err }
15569                 };
15570                 Self {
15571                         contents,
15572                         result_ok: o.result_ok,
15573                 }
15574         }
15575 }
15576 impl Clone for CResult_OpenChannelDecodeErrorZ {
15577         fn clone(&self) -> Self {
15578                 if self.result_ok {
15579                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
15580                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
15581                         } }
15582                 } else {
15583                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
15584                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15585                         } }
15586                 }
15587         }
15588 }
15589 #[no_mangle]
15590 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15591 /// but with all dynamically-allocated buffers duplicated in new buffers.
15592 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
15593 #[repr(C)]
15594 /// The contents of CResult_RevokeAndACKDecodeErrorZ
15595 pub union CResult_RevokeAndACKDecodeErrorZPtr {
15596         /// A pointer to the contents in the success state.
15597         /// Reading from this pointer when `result_ok` is not set is undefined.
15598         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
15599         /// A pointer to the contents in the error state.
15600         /// Reading from this pointer when `result_ok` is set is undefined.
15601         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15602 }
15603 #[repr(C)]
15604 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
15605 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
15606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15607 pub struct CResult_RevokeAndACKDecodeErrorZ {
15608         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
15609         /// `err` or `result` depending on the state of `result_ok`.
15610         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
15611         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
15612         pub result_ok: bool,
15613 }
15614 #[no_mangle]
15615 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15616 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
15617         CResult_RevokeAndACKDecodeErrorZ {
15618                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15619                         result: Box::into_raw(Box::new(o)),
15620                 },
15621                 result_ok: true,
15622         }
15623 }
15624 #[no_mangle]
15625 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15626 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
15627         CResult_RevokeAndACKDecodeErrorZ {
15628                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
15629                         err: Box::into_raw(Box::new(e)),
15630                 },
15631                 result_ok: false,
15632         }
15633 }
15634 /// Checks if the given object is currently in the success state
15635 #[no_mangle]
15636 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
15637         o.result_ok
15638 }
15639 #[no_mangle]
15640 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15641 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
15642 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
15643         fn drop(&mut self) {
15644                 if self.result_ok {
15645                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15646                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15647                         }
15648                 } else {
15649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15651                         }
15652                 }
15653         }
15654 }
15655 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
15656         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
15657                 let contents = if o.result_ok {
15658                         let result = unsafe { o.contents.result };
15659                         unsafe { o.contents.result = core::ptr::null_mut() };
15660                         CResult_RevokeAndACKDecodeErrorZPtr { result }
15661                 } else {
15662                         let err = unsafe { o.contents.err };
15663                         unsafe { o.contents.err = core::ptr::null_mut(); }
15664                         CResult_RevokeAndACKDecodeErrorZPtr { err }
15665                 };
15666                 Self {
15667                         contents,
15668                         result_ok: o.result_ok,
15669                 }
15670         }
15671 }
15672 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
15673         fn clone(&self) -> Self {
15674                 if self.result_ok {
15675                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15676                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
15677                         } }
15678                 } else {
15679                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
15680                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15681                         } }
15682                 }
15683         }
15684 }
15685 #[no_mangle]
15686 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15687 /// but with all dynamically-allocated buffers duplicated in new buffers.
15688 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
15689 #[repr(C)]
15690 /// The contents of CResult_ShutdownDecodeErrorZ
15691 pub union CResult_ShutdownDecodeErrorZPtr {
15692         /// A pointer to the contents in the success state.
15693         /// Reading from this pointer when `result_ok` is not set is undefined.
15694         pub result: *mut crate::lightning::ln::msgs::Shutdown,
15695         /// A pointer to the contents in the error state.
15696         /// Reading from this pointer when `result_ok` is set is undefined.
15697         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15698 }
15699 #[repr(C)]
15700 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
15701 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
15702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15703 pub struct CResult_ShutdownDecodeErrorZ {
15704         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
15705         /// `err` or `result` depending on the state of `result_ok`.
15706         pub contents: CResult_ShutdownDecodeErrorZPtr,
15707         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
15708         pub result_ok: bool,
15709 }
15710 #[no_mangle]
15711 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15712 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
15713         CResult_ShutdownDecodeErrorZ {
15714                 contents: CResult_ShutdownDecodeErrorZPtr {
15715                         result: Box::into_raw(Box::new(o)),
15716                 },
15717                 result_ok: true,
15718         }
15719 }
15720 #[no_mangle]
15721 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15722 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
15723         CResult_ShutdownDecodeErrorZ {
15724                 contents: CResult_ShutdownDecodeErrorZPtr {
15725                         err: Box::into_raw(Box::new(e)),
15726                 },
15727                 result_ok: false,
15728         }
15729 }
15730 /// Checks if the given object is currently in the success state
15731 #[no_mangle]
15732 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
15733         o.result_ok
15734 }
15735 #[no_mangle]
15736 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15737 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
15738 impl Drop for CResult_ShutdownDecodeErrorZ {
15739         fn drop(&mut self) {
15740                 if self.result_ok {
15741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15743                         }
15744                 } else {
15745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15747                         }
15748                 }
15749         }
15750 }
15751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
15752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
15753                 let contents = if o.result_ok {
15754                         let result = unsafe { o.contents.result };
15755                         unsafe { o.contents.result = core::ptr::null_mut() };
15756                         CResult_ShutdownDecodeErrorZPtr { result }
15757                 } else {
15758                         let err = unsafe { o.contents.err };
15759                         unsafe { o.contents.err = core::ptr::null_mut(); }
15760                         CResult_ShutdownDecodeErrorZPtr { err }
15761                 };
15762                 Self {
15763                         contents,
15764                         result_ok: o.result_ok,
15765                 }
15766         }
15767 }
15768 impl Clone for CResult_ShutdownDecodeErrorZ {
15769         fn clone(&self) -> Self {
15770                 if self.result_ok {
15771                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
15772                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
15773                         } }
15774                 } else {
15775                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
15776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15777                         } }
15778                 }
15779         }
15780 }
15781 #[no_mangle]
15782 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15783 /// but with all dynamically-allocated buffers duplicated in new buffers.
15784 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15785 #[repr(C)]
15786 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15787 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15788         /// A pointer to the contents in the success state.
15789         /// Reading from this pointer when `result_ok` is not set is undefined.
15790         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15791         /// A pointer to the contents in the error state.
15792         /// Reading from this pointer when `result_ok` is set is undefined.
15793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15794 }
15795 #[repr(C)]
15796 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15797 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15799 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15800         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15801         /// `err` or `result` depending on the state of `result_ok`.
15802         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15803         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15804         pub result_ok: bool,
15805 }
15806 #[no_mangle]
15807 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15808 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15809         CResult_UpdateFailHTLCDecodeErrorZ {
15810                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15811                         result: Box::into_raw(Box::new(o)),
15812                 },
15813                 result_ok: true,
15814         }
15815 }
15816 #[no_mangle]
15817 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15818 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15819         CResult_UpdateFailHTLCDecodeErrorZ {
15820                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15821                         err: Box::into_raw(Box::new(e)),
15822                 },
15823                 result_ok: false,
15824         }
15825 }
15826 /// Checks if the given object is currently in the success state
15827 #[no_mangle]
15828 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15829         o.result_ok
15830 }
15831 #[no_mangle]
15832 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15833 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15834 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15835         fn drop(&mut self) {
15836                 if self.result_ok {
15837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15839                         }
15840                 } else {
15841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15843                         }
15844                 }
15845         }
15846 }
15847 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15849                 let contents = if o.result_ok {
15850                         let result = unsafe { o.contents.result };
15851                         unsafe { o.contents.result = core::ptr::null_mut() };
15852                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15853                 } else {
15854                         let err = unsafe { o.contents.err };
15855                         unsafe { o.contents.err = core::ptr::null_mut(); }
15856                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15857                 };
15858                 Self {
15859                         contents,
15860                         result_ok: o.result_ok,
15861                 }
15862         }
15863 }
15864 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15865         fn clone(&self) -> Self {
15866                 if self.result_ok {
15867                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15868                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15869                         } }
15870                 } else {
15871                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15872                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15873                         } }
15874                 }
15875         }
15876 }
15877 #[no_mangle]
15878 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15879 /// but with all dynamically-allocated buffers duplicated in new buffers.
15880 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15881 #[repr(C)]
15882 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15883 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15884         /// A pointer to the contents in the success state.
15885         /// Reading from this pointer when `result_ok` is not set is undefined.
15886         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15887         /// A pointer to the contents in the error state.
15888         /// Reading from this pointer when `result_ok` is set is undefined.
15889         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15890 }
15891 #[repr(C)]
15892 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15893 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15895 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15896         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15897         /// `err` or `result` depending on the state of `result_ok`.
15898         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15899         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15900         pub result_ok: bool,
15901 }
15902 #[no_mangle]
15903 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15904 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15905         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15906                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15907                         result: Box::into_raw(Box::new(o)),
15908                 },
15909                 result_ok: true,
15910         }
15911 }
15912 #[no_mangle]
15913 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15914 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15915         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15916                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15917                         err: Box::into_raw(Box::new(e)),
15918                 },
15919                 result_ok: false,
15920         }
15921 }
15922 /// Checks if the given object is currently in the success state
15923 #[no_mangle]
15924 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15925         o.result_ok
15926 }
15927 #[no_mangle]
15928 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15929 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15930 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15931         fn drop(&mut self) {
15932                 if self.result_ok {
15933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15935                         }
15936                 } else {
15937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15939                         }
15940                 }
15941         }
15942 }
15943 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15945                 let contents = if o.result_ok {
15946                         let result = unsafe { o.contents.result };
15947                         unsafe { o.contents.result = core::ptr::null_mut() };
15948                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15949                 } else {
15950                         let err = unsafe { o.contents.err };
15951                         unsafe { o.contents.err = core::ptr::null_mut(); }
15952                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15953                 };
15954                 Self {
15955                         contents,
15956                         result_ok: o.result_ok,
15957                 }
15958         }
15959 }
15960 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15961         fn clone(&self) -> Self {
15962                 if self.result_ok {
15963                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15964                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15965                         } }
15966                 } else {
15967                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15969                         } }
15970                 }
15971         }
15972 }
15973 #[no_mangle]
15974 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15975 /// but with all dynamically-allocated buffers duplicated in new buffers.
15976 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15977 #[repr(C)]
15978 /// The contents of CResult_UpdateFeeDecodeErrorZ
15979 pub union CResult_UpdateFeeDecodeErrorZPtr {
15980         /// A pointer to the contents in the success state.
15981         /// Reading from this pointer when `result_ok` is not set is undefined.
15982         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15983         /// A pointer to the contents in the error state.
15984         /// Reading from this pointer when `result_ok` is set is undefined.
15985         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15986 }
15987 #[repr(C)]
15988 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15989 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15991 pub struct CResult_UpdateFeeDecodeErrorZ {
15992         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15993         /// `err` or `result` depending on the state of `result_ok`.
15994         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
15995         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15996         pub result_ok: bool,
15997 }
15998 #[no_mangle]
15999 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16000 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
16001         CResult_UpdateFeeDecodeErrorZ {
16002                 contents: CResult_UpdateFeeDecodeErrorZPtr {
16003                         result: Box::into_raw(Box::new(o)),
16004                 },
16005                 result_ok: true,
16006         }
16007 }
16008 #[no_mangle]
16009 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16010 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
16011         CResult_UpdateFeeDecodeErrorZ {
16012                 contents: CResult_UpdateFeeDecodeErrorZPtr {
16013                         err: Box::into_raw(Box::new(e)),
16014                 },
16015                 result_ok: false,
16016         }
16017 }
16018 /// Checks if the given object is currently in the success state
16019 #[no_mangle]
16020 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
16021         o.result_ok
16022 }
16023 #[no_mangle]
16024 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16025 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
16026 impl Drop for CResult_UpdateFeeDecodeErrorZ {
16027         fn drop(&mut self) {
16028                 if self.result_ok {
16029                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16030                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16031                         }
16032                 } else {
16033                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16034                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16035                         }
16036                 }
16037         }
16038 }
16039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
16040         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
16041                 let contents = if o.result_ok {
16042                         let result = unsafe { o.contents.result };
16043                         unsafe { o.contents.result = core::ptr::null_mut() };
16044                         CResult_UpdateFeeDecodeErrorZPtr { result }
16045                 } else {
16046                         let err = unsafe { o.contents.err };
16047                         unsafe { o.contents.err = core::ptr::null_mut(); }
16048                         CResult_UpdateFeeDecodeErrorZPtr { err }
16049                 };
16050                 Self {
16051                         contents,
16052                         result_ok: o.result_ok,
16053                 }
16054         }
16055 }
16056 impl Clone for CResult_UpdateFeeDecodeErrorZ {
16057         fn clone(&self) -> Self {
16058                 if self.result_ok {
16059                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
16060                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
16061                         } }
16062                 } else {
16063                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
16064                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16065                         } }
16066                 }
16067         }
16068 }
16069 #[no_mangle]
16070 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16071 /// but with all dynamically-allocated buffers duplicated in new buffers.
16072 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
16073 #[repr(C)]
16074 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
16075 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16076         /// A pointer to the contents in the success state.
16077         /// Reading from this pointer when `result_ok` is not set is undefined.
16078         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
16079         /// A pointer to the contents in the error state.
16080         /// Reading from this pointer when `result_ok` is set is undefined.
16081         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16082 }
16083 #[repr(C)]
16084 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
16085 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16087 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
16088         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
16089         /// `err` or `result` depending on the state of `result_ok`.
16090         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
16091         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
16092         pub result_ok: bool,
16093 }
16094 #[no_mangle]
16095 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16096 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16097         CResult_UpdateFulfillHTLCDecodeErrorZ {
16098                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16099                         result: Box::into_raw(Box::new(o)),
16100                 },
16101                 result_ok: true,
16102         }
16103 }
16104 #[no_mangle]
16105 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16106 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
16107         CResult_UpdateFulfillHTLCDecodeErrorZ {
16108                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16109                         err: Box::into_raw(Box::new(e)),
16110                 },
16111                 result_ok: false,
16112         }
16113 }
16114 /// Checks if the given object is currently in the success state
16115 #[no_mangle]
16116 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
16117         o.result_ok
16118 }
16119 #[no_mangle]
16120 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16121 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
16122 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
16123         fn drop(&mut self) {
16124                 if self.result_ok {
16125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16127                         }
16128                 } else {
16129                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16130                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16131                         }
16132                 }
16133         }
16134 }
16135 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
16136         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16137                 let contents = if o.result_ok {
16138                         let result = unsafe { o.contents.result };
16139                         unsafe { o.contents.result = core::ptr::null_mut() };
16140                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
16141                 } else {
16142                         let err = unsafe { o.contents.err };
16143                         unsafe { o.contents.err = core::ptr::null_mut(); }
16144                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
16145                 };
16146                 Self {
16147                         contents,
16148                         result_ok: o.result_ok,
16149                 }
16150         }
16151 }
16152 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
16153         fn clone(&self) -> Self {
16154                 if self.result_ok {
16155                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16156                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
16157                         } }
16158                 } else {
16159                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
16160                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16161                         } }
16162                 }
16163         }
16164 }
16165 #[no_mangle]
16166 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16167 /// but with all dynamically-allocated buffers duplicated in new buffers.
16168 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
16169 #[repr(C)]
16170 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
16171 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
16172         /// A pointer to the contents in the success state.
16173         /// Reading from this pointer when `result_ok` is not set is undefined.
16174         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
16175         /// A pointer to the contents in the error state.
16176         /// Reading from this pointer when `result_ok` is set is undefined.
16177         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16178 }
16179 #[repr(C)]
16180 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
16181 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
16182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16183 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
16184         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
16185         /// `err` or `result` depending on the state of `result_ok`.
16186         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
16187         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
16188         pub result_ok: bool,
16189 }
16190 #[no_mangle]
16191 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16192 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
16193         CResult_UpdateAddHTLCDecodeErrorZ {
16194                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16195                         result: Box::into_raw(Box::new(o)),
16196                 },
16197                 result_ok: true,
16198         }
16199 }
16200 #[no_mangle]
16201 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16202 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
16203         CResult_UpdateAddHTLCDecodeErrorZ {
16204                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16205                         err: Box::into_raw(Box::new(e)),
16206                 },
16207                 result_ok: false,
16208         }
16209 }
16210 /// Checks if the given object is currently in the success state
16211 #[no_mangle]
16212 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
16213         o.result_ok
16214 }
16215 #[no_mangle]
16216 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16217 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
16218 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
16219         fn drop(&mut self) {
16220                 if self.result_ok {
16221                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16222                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16223                         }
16224                 } else {
16225                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16226                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16227                         }
16228                 }
16229         }
16230 }
16231 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
16232         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
16233                 let contents = if o.result_ok {
16234                         let result = unsafe { o.contents.result };
16235                         unsafe { o.contents.result = core::ptr::null_mut() };
16236                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
16237                 } else {
16238                         let err = unsafe { o.contents.err };
16239                         unsafe { o.contents.err = core::ptr::null_mut(); }
16240                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
16241                 };
16242                 Self {
16243                         contents,
16244                         result_ok: o.result_ok,
16245                 }
16246         }
16247 }
16248 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
16249         fn clone(&self) -> Self {
16250                 if self.result_ok {
16251                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16252                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
16253                         } }
16254                 } else {
16255                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
16256                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16257                         } }
16258                 }
16259         }
16260 }
16261 #[no_mangle]
16262 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16263 /// but with all dynamically-allocated buffers duplicated in new buffers.
16264 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
16265 #[repr(C)]
16266 /// The contents of CResult_OnionMessageDecodeErrorZ
16267 pub union CResult_OnionMessageDecodeErrorZPtr {
16268         /// A pointer to the contents in the success state.
16269         /// Reading from this pointer when `result_ok` is not set is undefined.
16270         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
16271         /// A pointer to the contents in the error state.
16272         /// Reading from this pointer when `result_ok` is set is undefined.
16273         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16274 }
16275 #[repr(C)]
16276 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
16277 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16279 pub struct CResult_OnionMessageDecodeErrorZ {
16280         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
16281         /// `err` or `result` depending on the state of `result_ok`.
16282         pub contents: CResult_OnionMessageDecodeErrorZPtr,
16283         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
16284         pub result_ok: bool,
16285 }
16286 #[no_mangle]
16287 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
16288 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
16289         CResult_OnionMessageDecodeErrorZ {
16290                 contents: CResult_OnionMessageDecodeErrorZPtr {
16291                         result: Box::into_raw(Box::new(o)),
16292                 },
16293                 result_ok: true,
16294         }
16295 }
16296 #[no_mangle]
16297 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
16298 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
16299         CResult_OnionMessageDecodeErrorZ {
16300                 contents: CResult_OnionMessageDecodeErrorZPtr {
16301                         err: Box::into_raw(Box::new(e)),
16302                 },
16303                 result_ok: false,
16304         }
16305 }
16306 /// Checks if the given object is currently in the success state
16307 #[no_mangle]
16308 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
16309         o.result_ok
16310 }
16311 #[no_mangle]
16312 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
16313 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
16314 impl Drop for CResult_OnionMessageDecodeErrorZ {
16315         fn drop(&mut self) {
16316                 if self.result_ok {
16317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16319                         }
16320                 } else {
16321                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16322                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16323                         }
16324                 }
16325         }
16326 }
16327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
16328         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16329                 let contents = if o.result_ok {
16330                         let result = unsafe { o.contents.result };
16331                         unsafe { o.contents.result = core::ptr::null_mut() };
16332                         CResult_OnionMessageDecodeErrorZPtr { result }
16333                 } else {
16334                         let err = unsafe { o.contents.err };
16335                         unsafe { o.contents.err = core::ptr::null_mut(); }
16336                         CResult_OnionMessageDecodeErrorZPtr { err }
16337                 };
16338                 Self {
16339                         contents,
16340                         result_ok: o.result_ok,
16341                 }
16342         }
16343 }
16344 impl Clone for CResult_OnionMessageDecodeErrorZ {
16345         fn clone(&self) -> Self {
16346                 if self.result_ok {
16347                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
16348                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
16349                         } }
16350                 } else {
16351                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
16352                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16353                         } }
16354                 }
16355         }
16356 }
16357 #[no_mangle]
16358 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
16359 /// but with all dynamically-allocated buffers duplicated in new buffers.
16360 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
16361 #[repr(C)]
16362 /// The contents of CResult_PingDecodeErrorZ
16363 pub union CResult_PingDecodeErrorZPtr {
16364         /// A pointer to the contents in the success state.
16365         /// Reading from this pointer when `result_ok` is not set is undefined.
16366         pub result: *mut crate::lightning::ln::msgs::Ping,
16367         /// A pointer to the contents in the error state.
16368         /// Reading from this pointer when `result_ok` is set is undefined.
16369         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16370 }
16371 #[repr(C)]
16372 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
16373 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
16374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16375 pub struct CResult_PingDecodeErrorZ {
16376         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
16377         /// `err` or `result` depending on the state of `result_ok`.
16378         pub contents: CResult_PingDecodeErrorZPtr,
16379         /// Whether this CResult_PingDecodeErrorZ represents a success state.
16380         pub result_ok: bool,
16381 }
16382 #[no_mangle]
16383 /// Creates a new CResult_PingDecodeErrorZ in the success state.
16384 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
16385         CResult_PingDecodeErrorZ {
16386                 contents: CResult_PingDecodeErrorZPtr {
16387                         result: Box::into_raw(Box::new(o)),
16388                 },
16389                 result_ok: true,
16390         }
16391 }
16392 #[no_mangle]
16393 /// Creates a new CResult_PingDecodeErrorZ in the error state.
16394 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
16395         CResult_PingDecodeErrorZ {
16396                 contents: CResult_PingDecodeErrorZPtr {
16397                         err: Box::into_raw(Box::new(e)),
16398                 },
16399                 result_ok: false,
16400         }
16401 }
16402 /// Checks if the given object is currently in the success state
16403 #[no_mangle]
16404 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
16405         o.result_ok
16406 }
16407 #[no_mangle]
16408 /// Frees any resources used by the CResult_PingDecodeErrorZ.
16409 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
16410 impl Drop for CResult_PingDecodeErrorZ {
16411         fn drop(&mut self) {
16412                 if self.result_ok {
16413                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16414                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16415                         }
16416                 } else {
16417                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16418                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16419                         }
16420                 }
16421         }
16422 }
16423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
16424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
16425                 let contents = if o.result_ok {
16426                         let result = unsafe { o.contents.result };
16427                         unsafe { o.contents.result = core::ptr::null_mut() };
16428                         CResult_PingDecodeErrorZPtr { result }
16429                 } else {
16430                         let err = unsafe { o.contents.err };
16431                         unsafe { o.contents.err = core::ptr::null_mut(); }
16432                         CResult_PingDecodeErrorZPtr { err }
16433                 };
16434                 Self {
16435                         contents,
16436                         result_ok: o.result_ok,
16437                 }
16438         }
16439 }
16440 impl Clone for CResult_PingDecodeErrorZ {
16441         fn clone(&self) -> Self {
16442                 if self.result_ok {
16443                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
16444                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
16445                         } }
16446                 } else {
16447                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
16448                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16449                         } }
16450                 }
16451         }
16452 }
16453 #[no_mangle]
16454 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16455 /// but with all dynamically-allocated buffers duplicated in new buffers.
16456 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
16457 #[repr(C)]
16458 /// The contents of CResult_PongDecodeErrorZ
16459 pub union CResult_PongDecodeErrorZPtr {
16460         /// A pointer to the contents in the success state.
16461         /// Reading from this pointer when `result_ok` is not set is undefined.
16462         pub result: *mut crate::lightning::ln::msgs::Pong,
16463         /// A pointer to the contents in the error state.
16464         /// Reading from this pointer when `result_ok` is set is undefined.
16465         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16466 }
16467 #[repr(C)]
16468 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
16469 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
16470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16471 pub struct CResult_PongDecodeErrorZ {
16472         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
16473         /// `err` or `result` depending on the state of `result_ok`.
16474         pub contents: CResult_PongDecodeErrorZPtr,
16475         /// Whether this CResult_PongDecodeErrorZ represents a success state.
16476         pub result_ok: bool,
16477 }
16478 #[no_mangle]
16479 /// Creates a new CResult_PongDecodeErrorZ in the success state.
16480 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
16481         CResult_PongDecodeErrorZ {
16482                 contents: CResult_PongDecodeErrorZPtr {
16483                         result: Box::into_raw(Box::new(o)),
16484                 },
16485                 result_ok: true,
16486         }
16487 }
16488 #[no_mangle]
16489 /// Creates a new CResult_PongDecodeErrorZ in the error state.
16490 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
16491         CResult_PongDecodeErrorZ {
16492                 contents: CResult_PongDecodeErrorZPtr {
16493                         err: Box::into_raw(Box::new(e)),
16494                 },
16495                 result_ok: false,
16496         }
16497 }
16498 /// Checks if the given object is currently in the success state
16499 #[no_mangle]
16500 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
16501         o.result_ok
16502 }
16503 #[no_mangle]
16504 /// Frees any resources used by the CResult_PongDecodeErrorZ.
16505 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
16506 impl Drop for CResult_PongDecodeErrorZ {
16507         fn drop(&mut self) {
16508                 if self.result_ok {
16509                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16510                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16511                         }
16512                 } else {
16513                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16514                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16515                         }
16516                 }
16517         }
16518 }
16519 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
16520         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
16521                 let contents = if o.result_ok {
16522                         let result = unsafe { o.contents.result };
16523                         unsafe { o.contents.result = core::ptr::null_mut() };
16524                         CResult_PongDecodeErrorZPtr { result }
16525                 } else {
16526                         let err = unsafe { o.contents.err };
16527                         unsafe { o.contents.err = core::ptr::null_mut(); }
16528                         CResult_PongDecodeErrorZPtr { err }
16529                 };
16530                 Self {
16531                         contents,
16532                         result_ok: o.result_ok,
16533                 }
16534         }
16535 }
16536 impl Clone for CResult_PongDecodeErrorZ {
16537         fn clone(&self) -> Self {
16538                 if self.result_ok {
16539                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
16540                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
16541                         } }
16542                 } else {
16543                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
16544                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16545                         } }
16546                 }
16547         }
16548 }
16549 #[no_mangle]
16550 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16551 /// but with all dynamically-allocated buffers duplicated in new buffers.
16552 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
16553 #[repr(C)]
16554 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
16555 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16556         /// A pointer to the contents in the success state.
16557         /// Reading from this pointer when `result_ok` is not set is undefined.
16558         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
16559         /// A pointer to the contents in the error state.
16560         /// Reading from this pointer when `result_ok` is set is undefined.
16561         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16562 }
16563 #[repr(C)]
16564 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16565 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16567 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16568         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
16569         /// `err` or `result` depending on the state of `result_ok`.
16570         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
16571         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
16572         pub result_ok: bool,
16573 }
16574 #[no_mangle]
16575 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16576 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16577         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16578                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16579                         result: Box::into_raw(Box::new(o)),
16580                 },
16581                 result_ok: true,
16582         }
16583 }
16584 #[no_mangle]
16585 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16586 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16587         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16588                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16589                         err: Box::into_raw(Box::new(e)),
16590                 },
16591                 result_ok: false,
16592         }
16593 }
16594 /// Checks if the given object is currently in the success state
16595 #[no_mangle]
16596 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
16597         o.result_ok
16598 }
16599 #[no_mangle]
16600 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16601 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
16602 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16603         fn drop(&mut self) {
16604                 if self.result_ok {
16605                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16606                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16607                         }
16608                 } else {
16609                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16610                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16611                         }
16612                 }
16613         }
16614 }
16615 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16616         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16617                 let contents = if o.result_ok {
16618                         let result = unsafe { o.contents.result };
16619                         unsafe { o.contents.result = core::ptr::null_mut() };
16620                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
16621                 } else {
16622                         let err = unsafe { o.contents.err };
16623                         unsafe { o.contents.err = core::ptr::null_mut(); }
16624                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
16625                 };
16626                 Self {
16627                         contents,
16628                         result_ok: o.result_ok,
16629                 }
16630         }
16631 }
16632 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
16633         fn clone(&self) -> Self {
16634                 if self.result_ok {
16635                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16636                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16637                         } }
16638                 } else {
16639                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
16640                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16641                         } }
16642                 }
16643         }
16644 }
16645 #[no_mangle]
16646 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16647 /// but with all dynamically-allocated buffers duplicated in new buffers.
16648 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16649 #[repr(C)]
16650 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
16651 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
16652         /// A pointer to the contents in the success state.
16653         /// Reading from this pointer when `result_ok` is not set is undefined.
16654         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
16655         /// A pointer to the contents in the error state.
16656         /// Reading from this pointer when `result_ok` is set is undefined.
16657         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16658 }
16659 #[repr(C)]
16660 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
16661 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16663 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
16664         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
16665         /// `err` or `result` depending on the state of `result_ok`.
16666         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
16667         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
16668         pub result_ok: bool,
16669 }
16670 #[no_mangle]
16671 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16672 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
16673         CResult_ChannelAnnouncementDecodeErrorZ {
16674                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16675                         result: Box::into_raw(Box::new(o)),
16676                 },
16677                 result_ok: true,
16678         }
16679 }
16680 #[no_mangle]
16681 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16682 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
16683         CResult_ChannelAnnouncementDecodeErrorZ {
16684                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16685                         err: Box::into_raw(Box::new(e)),
16686                 },
16687                 result_ok: false,
16688         }
16689 }
16690 /// Checks if the given object is currently in the success state
16691 #[no_mangle]
16692 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
16693         o.result_ok
16694 }
16695 #[no_mangle]
16696 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16697 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
16698 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
16699         fn drop(&mut self) {
16700                 if self.result_ok {
16701                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16702                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16703                         }
16704                 } else {
16705                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16706                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16707                         }
16708                 }
16709         }
16710 }
16711 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
16712         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16713                 let contents = if o.result_ok {
16714                         let result = unsafe { o.contents.result };
16715                         unsafe { o.contents.result = core::ptr::null_mut() };
16716                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
16717                 } else {
16718                         let err = unsafe { o.contents.err };
16719                         unsafe { o.contents.err = core::ptr::null_mut(); }
16720                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
16721                 };
16722                 Self {
16723                         contents,
16724                         result_ok: o.result_ok,
16725                 }
16726         }
16727 }
16728 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
16729         fn clone(&self) -> Self {
16730                 if self.result_ok {
16731                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16732                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
16733                         } }
16734                 } else {
16735                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
16736                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16737                         } }
16738                 }
16739         }
16740 }
16741 #[no_mangle]
16742 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16743 /// but with all dynamically-allocated buffers duplicated in new buffers.
16744 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16745 #[repr(C)]
16746 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
16747 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16748         /// A pointer to the contents in the success state.
16749         /// Reading from this pointer when `result_ok` is not set is undefined.
16750         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
16751         /// A pointer to the contents in the error state.
16752         /// Reading from this pointer when `result_ok` is set is undefined.
16753         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16754 }
16755 #[repr(C)]
16756 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16757 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16759 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
16760         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
16761         /// `err` or `result` depending on the state of `result_ok`.
16762         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
16763         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
16764         pub result_ok: bool,
16765 }
16766 #[no_mangle]
16767 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16768 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16769         CResult_UnsignedChannelUpdateDecodeErrorZ {
16770                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16771                         result: Box::into_raw(Box::new(o)),
16772                 },
16773                 result_ok: true,
16774         }
16775 }
16776 #[no_mangle]
16777 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16778 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
16779         CResult_UnsignedChannelUpdateDecodeErrorZ {
16780                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16781                         err: Box::into_raw(Box::new(e)),
16782                 },
16783                 result_ok: false,
16784         }
16785 }
16786 /// Checks if the given object is currently in the success state
16787 #[no_mangle]
16788 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16789         o.result_ok
16790 }
16791 #[no_mangle]
16792 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16793 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16794 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16795         fn drop(&mut self) {
16796                 if self.result_ok {
16797                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16798                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16799                         }
16800                 } else {
16801                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16802                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16803                         }
16804                 }
16805         }
16806 }
16807 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16808         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16809                 let contents = if o.result_ok {
16810                         let result = unsafe { o.contents.result };
16811                         unsafe { o.contents.result = core::ptr::null_mut() };
16812                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16813                 } else {
16814                         let err = unsafe { o.contents.err };
16815                         unsafe { o.contents.err = core::ptr::null_mut(); }
16816                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16817                 };
16818                 Self {
16819                         contents,
16820                         result_ok: o.result_ok,
16821                 }
16822         }
16823 }
16824 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16825         fn clone(&self) -> Self {
16826                 if self.result_ok {
16827                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16828                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16829                         } }
16830                 } else {
16831                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16832                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16833                         } }
16834                 }
16835         }
16836 }
16837 #[no_mangle]
16838 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16839 /// but with all dynamically-allocated buffers duplicated in new buffers.
16840 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16841 #[repr(C)]
16842 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16843 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16844         /// A pointer to the contents in the success state.
16845         /// Reading from this pointer when `result_ok` is not set is undefined.
16846         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16847         /// A pointer to the contents in the error state.
16848         /// Reading from this pointer when `result_ok` is set is undefined.
16849         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16850 }
16851 #[repr(C)]
16852 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16853 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16854 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16855 pub struct CResult_ChannelUpdateDecodeErrorZ {
16856         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16857         /// `err` or `result` depending on the state of `result_ok`.
16858         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16859         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16860         pub result_ok: bool,
16861 }
16862 #[no_mangle]
16863 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16864 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16865         CResult_ChannelUpdateDecodeErrorZ {
16866                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16867                         result: Box::into_raw(Box::new(o)),
16868                 },
16869                 result_ok: true,
16870         }
16871 }
16872 #[no_mangle]
16873 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16874 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16875         CResult_ChannelUpdateDecodeErrorZ {
16876                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16877                         err: Box::into_raw(Box::new(e)),
16878                 },
16879                 result_ok: false,
16880         }
16881 }
16882 /// Checks if the given object is currently in the success state
16883 #[no_mangle]
16884 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16885         o.result_ok
16886 }
16887 #[no_mangle]
16888 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16889 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16890 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16891         fn drop(&mut self) {
16892                 if self.result_ok {
16893                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16894                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16895                         }
16896                 } else {
16897                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16898                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16899                         }
16900                 }
16901         }
16902 }
16903 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16904         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16905                 let contents = if o.result_ok {
16906                         let result = unsafe { o.contents.result };
16907                         unsafe { o.contents.result = core::ptr::null_mut() };
16908                         CResult_ChannelUpdateDecodeErrorZPtr { result }
16909                 } else {
16910                         let err = unsafe { o.contents.err };
16911                         unsafe { o.contents.err = core::ptr::null_mut(); }
16912                         CResult_ChannelUpdateDecodeErrorZPtr { err }
16913                 };
16914                 Self {
16915                         contents,
16916                         result_ok: o.result_ok,
16917                 }
16918         }
16919 }
16920 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16921         fn clone(&self) -> Self {
16922                 if self.result_ok {
16923                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16924                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16925                         } }
16926                 } else {
16927                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16928                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16929                         } }
16930                 }
16931         }
16932 }
16933 #[no_mangle]
16934 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16935 /// but with all dynamically-allocated buffers duplicated in new buffers.
16936 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16937 #[repr(C)]
16938 /// The contents of CResult_ErrorMessageDecodeErrorZ
16939 pub union CResult_ErrorMessageDecodeErrorZPtr {
16940         /// A pointer to the contents in the success state.
16941         /// Reading from this pointer when `result_ok` is not set is undefined.
16942         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16943         /// A pointer to the contents in the error state.
16944         /// Reading from this pointer when `result_ok` is set is undefined.
16945         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16946 }
16947 #[repr(C)]
16948 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16949 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16951 pub struct CResult_ErrorMessageDecodeErrorZ {
16952         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16953         /// `err` or `result` depending on the state of `result_ok`.
16954         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16955         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16956         pub result_ok: bool,
16957 }
16958 #[no_mangle]
16959 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16960 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16961         CResult_ErrorMessageDecodeErrorZ {
16962                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16963                         result: Box::into_raw(Box::new(o)),
16964                 },
16965                 result_ok: true,
16966         }
16967 }
16968 #[no_mangle]
16969 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16970 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16971         CResult_ErrorMessageDecodeErrorZ {
16972                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16973                         err: Box::into_raw(Box::new(e)),
16974                 },
16975                 result_ok: false,
16976         }
16977 }
16978 /// Checks if the given object is currently in the success state
16979 #[no_mangle]
16980 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16981         o.result_ok
16982 }
16983 #[no_mangle]
16984 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16985 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16986 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16987         fn drop(&mut self) {
16988                 if self.result_ok {
16989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16991                         }
16992                 } else {
16993                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16994                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16995                         }
16996                 }
16997         }
16998 }
16999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
17000         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17001                 let contents = if o.result_ok {
17002                         let result = unsafe { o.contents.result };
17003                         unsafe { o.contents.result = core::ptr::null_mut() };
17004                         CResult_ErrorMessageDecodeErrorZPtr { result }
17005                 } else {
17006                         let err = unsafe { o.contents.err };
17007                         unsafe { o.contents.err = core::ptr::null_mut(); }
17008                         CResult_ErrorMessageDecodeErrorZPtr { err }
17009                 };
17010                 Self {
17011                         contents,
17012                         result_ok: o.result_ok,
17013                 }
17014         }
17015 }
17016 impl Clone for CResult_ErrorMessageDecodeErrorZ {
17017         fn clone(&self) -> Self {
17018                 if self.result_ok {
17019                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
17020                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
17021                         } }
17022                 } else {
17023                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
17024                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17025                         } }
17026                 }
17027         }
17028 }
17029 #[no_mangle]
17030 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17031 /// but with all dynamically-allocated buffers duplicated in new buffers.
17032 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
17033 #[repr(C)]
17034 /// The contents of CResult_WarningMessageDecodeErrorZ
17035 pub union CResult_WarningMessageDecodeErrorZPtr {
17036         /// A pointer to the contents in the success state.
17037         /// Reading from this pointer when `result_ok` is not set is undefined.
17038         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
17039         /// A pointer to the contents in the error state.
17040         /// Reading from this pointer when `result_ok` is set is undefined.
17041         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17042 }
17043 #[repr(C)]
17044 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
17045 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
17046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17047 pub struct CResult_WarningMessageDecodeErrorZ {
17048         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
17049         /// `err` or `result` depending on the state of `result_ok`.
17050         pub contents: CResult_WarningMessageDecodeErrorZPtr,
17051         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
17052         pub result_ok: bool,
17053 }
17054 #[no_mangle]
17055 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17056 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
17057         CResult_WarningMessageDecodeErrorZ {
17058                 contents: CResult_WarningMessageDecodeErrorZPtr {
17059                         result: Box::into_raw(Box::new(o)),
17060                 },
17061                 result_ok: true,
17062         }
17063 }
17064 #[no_mangle]
17065 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17066 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
17067         CResult_WarningMessageDecodeErrorZ {
17068                 contents: CResult_WarningMessageDecodeErrorZPtr {
17069                         err: Box::into_raw(Box::new(e)),
17070                 },
17071                 result_ok: false,
17072         }
17073 }
17074 /// Checks if the given object is currently in the success state
17075 #[no_mangle]
17076 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
17077         o.result_ok
17078 }
17079 #[no_mangle]
17080 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17081 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
17082 impl Drop for CResult_WarningMessageDecodeErrorZ {
17083         fn drop(&mut self) {
17084                 if self.result_ok {
17085                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17086                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17087                         }
17088                 } else {
17089                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17090                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17091                         }
17092                 }
17093         }
17094 }
17095 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
17096         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
17097                 let contents = if o.result_ok {
17098                         let result = unsafe { o.contents.result };
17099                         unsafe { o.contents.result = core::ptr::null_mut() };
17100                         CResult_WarningMessageDecodeErrorZPtr { result }
17101                 } else {
17102                         let err = unsafe { o.contents.err };
17103                         unsafe { o.contents.err = core::ptr::null_mut(); }
17104                         CResult_WarningMessageDecodeErrorZPtr { err }
17105                 };
17106                 Self {
17107                         contents,
17108                         result_ok: o.result_ok,
17109                 }
17110         }
17111 }
17112 impl Clone for CResult_WarningMessageDecodeErrorZ {
17113         fn clone(&self) -> Self {
17114                 if self.result_ok {
17115                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
17116                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
17117                         } }
17118                 } else {
17119                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
17120                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17121                         } }
17122                 }
17123         }
17124 }
17125 #[no_mangle]
17126 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17127 /// but with all dynamically-allocated buffers duplicated in new buffers.
17128 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
17129 #[repr(C)]
17130 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
17131 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17132         /// A pointer to the contents in the success state.
17133         /// Reading from this pointer when `result_ok` is not set is undefined.
17134         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
17135         /// A pointer to the contents in the error state.
17136         /// Reading from this pointer when `result_ok` is set is undefined.
17137         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17138 }
17139 #[repr(C)]
17140 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17141 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17143 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17144         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
17145         /// `err` or `result` depending on the state of `result_ok`.
17146         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
17147         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
17148         pub result_ok: bool,
17149 }
17150 #[no_mangle]
17151 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17152 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17153         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17154                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17155                         result: Box::into_raw(Box::new(o)),
17156                 },
17157                 result_ok: true,
17158         }
17159 }
17160 #[no_mangle]
17161 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17162 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17163         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17164                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17165                         err: Box::into_raw(Box::new(e)),
17166                 },
17167                 result_ok: false,
17168         }
17169 }
17170 /// Checks if the given object is currently in the success state
17171 #[no_mangle]
17172 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
17173         o.result_ok
17174 }
17175 #[no_mangle]
17176 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17177 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
17178 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17179         fn drop(&mut self) {
17180                 if self.result_ok {
17181                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17182                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17183                         }
17184                 } else {
17185                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17186                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17187                         }
17188                 }
17189         }
17190 }
17191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17192         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17193                 let contents = if o.result_ok {
17194                         let result = unsafe { o.contents.result };
17195                         unsafe { o.contents.result = core::ptr::null_mut() };
17196                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
17197                 } else {
17198                         let err = unsafe { o.contents.err };
17199                         unsafe { o.contents.err = core::ptr::null_mut(); }
17200                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
17201                 };
17202                 Self {
17203                         contents,
17204                         result_ok: o.result_ok,
17205                 }
17206         }
17207 }
17208 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
17209         fn clone(&self) -> Self {
17210                 if self.result_ok {
17211                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17212                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17213                         } }
17214                 } else {
17215                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
17216                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17217                         } }
17218                 }
17219         }
17220 }
17221 #[no_mangle]
17222 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17223 /// but with all dynamically-allocated buffers duplicated in new buffers.
17224 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17225 #[repr(C)]
17226 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
17227 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
17228         /// A pointer to the contents in the success state.
17229         /// Reading from this pointer when `result_ok` is not set is undefined.
17230         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
17231         /// A pointer to the contents in the error state.
17232         /// Reading from this pointer when `result_ok` is set is undefined.
17233         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17234 }
17235 #[repr(C)]
17236 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
17237 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
17238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17239 pub struct CResult_NodeAnnouncementDecodeErrorZ {
17240         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
17241         /// `err` or `result` depending on the state of `result_ok`.
17242         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
17243         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
17244         pub result_ok: bool,
17245 }
17246 #[no_mangle]
17247 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17248 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
17249         CResult_NodeAnnouncementDecodeErrorZ {
17250                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17251                         result: Box::into_raw(Box::new(o)),
17252                 },
17253                 result_ok: true,
17254         }
17255 }
17256 #[no_mangle]
17257 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17258 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
17259         CResult_NodeAnnouncementDecodeErrorZ {
17260                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17261                         err: Box::into_raw(Box::new(e)),
17262                 },
17263                 result_ok: false,
17264         }
17265 }
17266 /// Checks if the given object is currently in the success state
17267 #[no_mangle]
17268 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
17269         o.result_ok
17270 }
17271 #[no_mangle]
17272 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17273 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
17274 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
17275         fn drop(&mut self) {
17276                 if self.result_ok {
17277                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17278                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17279                         }
17280                 } else {
17281                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17282                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17283                         }
17284                 }
17285         }
17286 }
17287 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
17288         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
17289                 let contents = if o.result_ok {
17290                         let result = unsafe { o.contents.result };
17291                         unsafe { o.contents.result = core::ptr::null_mut() };
17292                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
17293                 } else {
17294                         let err = unsafe { o.contents.err };
17295                         unsafe { o.contents.err = core::ptr::null_mut(); }
17296                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
17297                 };
17298                 Self {
17299                         contents,
17300                         result_ok: o.result_ok,
17301                 }
17302         }
17303 }
17304 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
17305         fn clone(&self) -> Self {
17306                 if self.result_ok {
17307                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17308                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
17309                         } }
17310                 } else {
17311                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
17312                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17313                         } }
17314                 }
17315         }
17316 }
17317 #[no_mangle]
17318 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17319 /// but with all dynamically-allocated buffers duplicated in new buffers.
17320 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
17321 #[repr(C)]
17322 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
17323 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
17324         /// A pointer to the contents in the success state.
17325         /// Reading from this pointer when `result_ok` is not set is undefined.
17326         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
17327         /// A pointer to the contents in the error state.
17328         /// Reading from this pointer when `result_ok` is set is undefined.
17329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17330 }
17331 #[repr(C)]
17332 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
17333 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
17334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17335 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
17336         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
17337         /// `err` or `result` depending on the state of `result_ok`.
17338         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
17339         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
17340         pub result_ok: bool,
17341 }
17342 #[no_mangle]
17343 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17344 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17345         CResult_QueryShortChannelIdsDecodeErrorZ {
17346                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17347                         result: Box::into_raw(Box::new(o)),
17348                 },
17349                 result_ok: true,
17350         }
17351 }
17352 #[no_mangle]
17353 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17354 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
17355         CResult_QueryShortChannelIdsDecodeErrorZ {
17356                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17357                         err: Box::into_raw(Box::new(e)),
17358                 },
17359                 result_ok: false,
17360         }
17361 }
17362 /// Checks if the given object is currently in the success state
17363 #[no_mangle]
17364 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
17365         o.result_ok
17366 }
17367 #[no_mangle]
17368 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17369 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
17370 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
17371         fn drop(&mut self) {
17372                 if self.result_ok {
17373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17375                         }
17376                 } else {
17377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17379                         }
17380                 }
17381         }
17382 }
17383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
17384         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
17385                 let contents = if o.result_ok {
17386                         let result = unsafe { o.contents.result };
17387                         unsafe { o.contents.result = core::ptr::null_mut() };
17388                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
17389                 } else {
17390                         let err = unsafe { o.contents.err };
17391                         unsafe { o.contents.err = core::ptr::null_mut(); }
17392                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
17393                 };
17394                 Self {
17395                         contents,
17396                         result_ok: o.result_ok,
17397                 }
17398         }
17399 }
17400 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
17401         fn clone(&self) -> Self {
17402                 if self.result_ok {
17403                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17404                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
17405                         } }
17406                 } else {
17407                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
17408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17409                         } }
17410                 }
17411         }
17412 }
17413 #[no_mangle]
17414 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17415 /// but with all dynamically-allocated buffers duplicated in new buffers.
17416 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
17417 #[repr(C)]
17418 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
17419 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17420         /// A pointer to the contents in the success state.
17421         /// Reading from this pointer when `result_ok` is not set is undefined.
17422         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
17423         /// A pointer to the contents in the error state.
17424         /// Reading from this pointer when `result_ok` is set is undefined.
17425         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17426 }
17427 #[repr(C)]
17428 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
17429 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
17430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17431 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17432         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
17433         /// `err` or `result` depending on the state of `result_ok`.
17434         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
17435         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
17436         pub result_ok: bool,
17437 }
17438 #[no_mangle]
17439 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17440 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17441         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17442                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17443                         result: Box::into_raw(Box::new(o)),
17444                 },
17445                 result_ok: true,
17446         }
17447 }
17448 #[no_mangle]
17449 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17450 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17451         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17452                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17453                         err: Box::into_raw(Box::new(e)),
17454                 },
17455                 result_ok: false,
17456         }
17457 }
17458 /// Checks if the given object is currently in the success state
17459 #[no_mangle]
17460 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
17461         o.result_ok
17462 }
17463 #[no_mangle]
17464 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17465 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
17466 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17467         fn drop(&mut self) {
17468                 if self.result_ok {
17469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17471                         }
17472                 } else {
17473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17475                         }
17476                 }
17477         }
17478 }
17479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
17481                 let contents = if o.result_ok {
17482                         let result = unsafe { o.contents.result };
17483                         unsafe { o.contents.result = core::ptr::null_mut() };
17484                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
17485                 } else {
17486                         let err = unsafe { o.contents.err };
17487                         unsafe { o.contents.err = core::ptr::null_mut(); }
17488                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
17489                 };
17490                 Self {
17491                         contents,
17492                         result_ok: o.result_ok,
17493                 }
17494         }
17495 }
17496 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
17497         fn clone(&self) -> Self {
17498                 if self.result_ok {
17499                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
17501                         } }
17502                 } else {
17503                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
17504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17505                         } }
17506                 }
17507         }
17508 }
17509 #[no_mangle]
17510 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17511 /// but with all dynamically-allocated buffers duplicated in new buffers.
17512 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
17513 #[repr(C)]
17514 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
17515 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
17516         /// A pointer to the contents in the success state.
17517         /// Reading from this pointer when `result_ok` is not set is undefined.
17518         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
17519         /// A pointer to the contents in the error state.
17520         /// Reading from this pointer when `result_ok` is set is undefined.
17521         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17522 }
17523 #[repr(C)]
17524 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
17525 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17527 pub struct CResult_QueryChannelRangeDecodeErrorZ {
17528         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
17529         /// `err` or `result` depending on the state of `result_ok`.
17530         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
17531         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
17532         pub result_ok: bool,
17533 }
17534 #[no_mangle]
17535 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17536 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
17537         CResult_QueryChannelRangeDecodeErrorZ {
17538                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17539                         result: Box::into_raw(Box::new(o)),
17540                 },
17541                 result_ok: true,
17542         }
17543 }
17544 #[no_mangle]
17545 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17546 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
17547         CResult_QueryChannelRangeDecodeErrorZ {
17548                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17549                         err: Box::into_raw(Box::new(e)),
17550                 },
17551                 result_ok: false,
17552         }
17553 }
17554 /// Checks if the given object is currently in the success state
17555 #[no_mangle]
17556 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
17557         o.result_ok
17558 }
17559 #[no_mangle]
17560 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17561 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
17562 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
17563         fn drop(&mut self) {
17564                 if self.result_ok {
17565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17567                         }
17568                 } else {
17569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17571                         }
17572                 }
17573         }
17574 }
17575 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
17576         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17577                 let contents = if o.result_ok {
17578                         let result = unsafe { o.contents.result };
17579                         unsafe { o.contents.result = core::ptr::null_mut() };
17580                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
17581                 } else {
17582                         let err = unsafe { o.contents.err };
17583                         unsafe { o.contents.err = core::ptr::null_mut(); }
17584                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
17585                 };
17586                 Self {
17587                         contents,
17588                         result_ok: o.result_ok,
17589                 }
17590         }
17591 }
17592 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
17593         fn clone(&self) -> Self {
17594                 if self.result_ok {
17595                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17596                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
17597                         } }
17598                 } else {
17599                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
17600                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17601                         } }
17602                 }
17603         }
17604 }
17605 #[no_mangle]
17606 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17607 /// but with all dynamically-allocated buffers duplicated in new buffers.
17608 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17609 #[repr(C)]
17610 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
17611 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
17612         /// A pointer to the contents in the success state.
17613         /// Reading from this pointer when `result_ok` is not set is undefined.
17614         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
17615         /// A pointer to the contents in the error state.
17616         /// Reading from this pointer when `result_ok` is set is undefined.
17617         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17618 }
17619 #[repr(C)]
17620 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
17621 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17623 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
17624         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
17625         /// `err` or `result` depending on the state of `result_ok`.
17626         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
17627         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
17628         pub result_ok: bool,
17629 }
17630 #[no_mangle]
17631 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17632 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
17633         CResult_ReplyChannelRangeDecodeErrorZ {
17634                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17635                         result: Box::into_raw(Box::new(o)),
17636                 },
17637                 result_ok: true,
17638         }
17639 }
17640 #[no_mangle]
17641 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17642 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
17643         CResult_ReplyChannelRangeDecodeErrorZ {
17644                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17645                         err: Box::into_raw(Box::new(e)),
17646                 },
17647                 result_ok: false,
17648         }
17649 }
17650 /// Checks if the given object is currently in the success state
17651 #[no_mangle]
17652 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
17653         o.result_ok
17654 }
17655 #[no_mangle]
17656 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17657 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
17658 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
17659         fn drop(&mut self) {
17660                 if self.result_ok {
17661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17663                         }
17664                 } else {
17665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17667                         }
17668                 }
17669         }
17670 }
17671 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
17672         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17673                 let contents = if o.result_ok {
17674                         let result = unsafe { o.contents.result };
17675                         unsafe { o.contents.result = core::ptr::null_mut() };
17676                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
17677                 } else {
17678                         let err = unsafe { o.contents.err };
17679                         unsafe { o.contents.err = core::ptr::null_mut(); }
17680                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
17681                 };
17682                 Self {
17683                         contents,
17684                         result_ok: o.result_ok,
17685                 }
17686         }
17687 }
17688 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
17689         fn clone(&self) -> Self {
17690                 if self.result_ok {
17691                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17692                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
17693                         } }
17694                 } else {
17695                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
17696                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17697                         } }
17698                 }
17699         }
17700 }
17701 #[no_mangle]
17702 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17703 /// but with all dynamically-allocated buffers duplicated in new buffers.
17704 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
17705 #[repr(C)]
17706 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
17707 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
17708         /// A pointer to the contents in the success state.
17709         /// Reading from this pointer when `result_ok` is not set is undefined.
17710         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
17711         /// A pointer to the contents in the error state.
17712         /// Reading from this pointer when `result_ok` is set is undefined.
17713         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17714 }
17715 #[repr(C)]
17716 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
17717 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
17718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17719 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
17720         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
17721         /// `err` or `result` depending on the state of `result_ok`.
17722         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
17723         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
17724         pub result_ok: bool,
17725 }
17726 #[no_mangle]
17727 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17728 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
17729         CResult_GossipTimestampFilterDecodeErrorZ {
17730                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17731                         result: Box::into_raw(Box::new(o)),
17732                 },
17733                 result_ok: true,
17734         }
17735 }
17736 #[no_mangle]
17737 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17738 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
17739         CResult_GossipTimestampFilterDecodeErrorZ {
17740                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17741                         err: Box::into_raw(Box::new(e)),
17742                 },
17743                 result_ok: false,
17744         }
17745 }
17746 /// Checks if the given object is currently in the success state
17747 #[no_mangle]
17748 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
17749         o.result_ok
17750 }
17751 #[no_mangle]
17752 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17753 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
17754 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
17755         fn drop(&mut self) {
17756                 if self.result_ok {
17757                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17758                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17759                         }
17760                 } else {
17761                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17762                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17763                         }
17764                 }
17765         }
17766 }
17767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
17768         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
17769                 let contents = if o.result_ok {
17770                         let result = unsafe { o.contents.result };
17771                         unsafe { o.contents.result = core::ptr::null_mut() };
17772                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
17773                 } else {
17774                         let err = unsafe { o.contents.err };
17775                         unsafe { o.contents.err = core::ptr::null_mut(); }
17776                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
17777                 };
17778                 Self {
17779                         contents,
17780                         result_ok: o.result_ok,
17781                 }
17782         }
17783 }
17784 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17785         fn clone(&self) -> Self {
17786                 if self.result_ok {
17787                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17788                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17789                         } }
17790                 } else {
17791                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17792                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17793                         } }
17794                 }
17795         }
17796 }
17797 #[no_mangle]
17798 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17799 /// but with all dynamically-allocated buffers duplicated in new buffers.
17800 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17801 #[repr(C)]
17802 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17803 /// This corresponds to std::vector in C++
17804 pub struct CVec_PhantomRouteHintsZ {
17805         /// The elements in the array.
17806         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17807         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17808         /// The number of elements pointed to by `data`.
17809         pub datalen: usize
17810 }
17811 impl CVec_PhantomRouteHintsZ {
17812         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17813                 if self.datalen == 0 { return Vec::new(); }
17814                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17815                 self.data = core::ptr::null_mut();
17816                 self.datalen = 0;
17817                 ret
17818         }
17819         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17820                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17821         }
17822 }
17823 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17824         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17825                 let datalen = v.len();
17826                 let data = Box::into_raw(v.into_boxed_slice());
17827                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17828         }
17829 }
17830 #[no_mangle]
17831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17832 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17833 impl Drop for CVec_PhantomRouteHintsZ {
17834         fn drop(&mut self) {
17835                 if self.datalen == 0 { return; }
17836                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17837         }
17838 }
17839 impl Clone for CVec_PhantomRouteHintsZ {
17840         fn clone(&self) -> Self {
17841                 let mut res = Vec::new();
17842                 if self.datalen == 0 { return Self::from(res); }
17843                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17844                 Self::from(res)
17845         }
17846 }
17847 #[repr(C)]
17848 /// The contents of CResult_InvoiceSignOrCreationErrorZ
17849 pub union CResult_InvoiceSignOrCreationErrorZPtr {
17850         /// A pointer to the contents in the success state.
17851         /// Reading from this pointer when `result_ok` is not set is undefined.
17852         pub result: *mut crate::lightning_invoice::Invoice,
17853         /// A pointer to the contents in the error state.
17854         /// Reading from this pointer when `result_ok` is set is undefined.
17855         pub err: *mut crate::lightning_invoice::SignOrCreationError,
17856 }
17857 #[repr(C)]
17858 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17859 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17861 pub struct CResult_InvoiceSignOrCreationErrorZ {
17862         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
17863         /// `err` or `result` depending on the state of `result_ok`.
17864         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
17865         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
17866         pub result_ok: bool,
17867 }
17868 #[no_mangle]
17869 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17870 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
17871         CResult_InvoiceSignOrCreationErrorZ {
17872                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17873                         result: Box::into_raw(Box::new(o)),
17874                 },
17875                 result_ok: true,
17876         }
17877 }
17878 #[no_mangle]
17879 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17880 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
17881         CResult_InvoiceSignOrCreationErrorZ {
17882                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17883                         err: Box::into_raw(Box::new(e)),
17884                 },
17885                 result_ok: false,
17886         }
17887 }
17888 /// Checks if the given object is currently in the success state
17889 #[no_mangle]
17890 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
17891         o.result_ok
17892 }
17893 #[no_mangle]
17894 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17895 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
17896 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
17897         fn drop(&mut self) {
17898                 if self.result_ok {
17899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17901                         }
17902                 } else {
17903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17905                         }
17906                 }
17907         }
17908 }
17909 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
17910         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17911                 let contents = if o.result_ok {
17912                         let result = unsafe { o.contents.result };
17913                         unsafe { o.contents.result = core::ptr::null_mut() };
17914                         CResult_InvoiceSignOrCreationErrorZPtr { result }
17915                 } else {
17916                         let err = unsafe { o.contents.err };
17917                         unsafe { o.contents.err = core::ptr::null_mut(); }
17918                         CResult_InvoiceSignOrCreationErrorZPtr { err }
17919                 };
17920                 Self {
17921                         contents,
17922                         result_ok: o.result_ok,
17923                 }
17924         }
17925 }
17926 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
17927         fn clone(&self) -> Self {
17928                 if self.result_ok {
17929                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17930                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
17931                         } }
17932                 } else {
17933                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17934                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17935                         } }
17936                 }
17937         }
17938 }
17939 #[no_mangle]
17940 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17941 /// but with all dynamically-allocated buffers duplicated in new buffers.
17942 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17943 #[repr(C)]
17944 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
17945 /// This corresponds to std::vector in C++
17946 pub struct CVec_FutureZ {
17947         /// The elements in the array.
17948         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17949         pub data: *mut crate::lightning::util::wakers::Future,
17950         /// The number of elements pointed to by `data`.
17951         pub datalen: usize
17952 }
17953 impl CVec_FutureZ {
17954         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
17955                 if self.datalen == 0 { return Vec::new(); }
17956                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17957                 self.data = core::ptr::null_mut();
17958                 self.datalen = 0;
17959                 ret
17960         }
17961         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
17962                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17963         }
17964 }
17965 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
17966         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
17967                 let datalen = v.len();
17968                 let data = Box::into_raw(v.into_boxed_slice());
17969                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17970         }
17971 }
17972 #[no_mangle]
17973 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17974 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
17975 impl Drop for CVec_FutureZ {
17976         fn drop(&mut self) {
17977                 if self.datalen == 0 { return; }
17978                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17979         }
17980 }
17981 impl Clone for CVec_FutureZ {
17982         fn clone(&self) -> Self {
17983                 let mut res = Vec::new();
17984                 if self.datalen == 0 { return Self::from(res); }
17985                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17986                 Self::from(res)
17987         }
17988 }
17989 #[repr(C)]
17990 /// An enum which can either contain a crate::lightning::chain::Filter or not
17991 pub enum COption_FilterZ {
17992         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
17993         Some(crate::lightning::chain::Filter),
17994         /// When we're in this state, this COption_FilterZ contains nothing
17995         None
17996 }
17997 impl COption_FilterZ {
17998         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
17999                 if let Self::None = self { false } else { true }
18000         }
18001         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
18002                 !self.is_some()
18003         }
18004         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
18005                 if let Self::Some(v) = self { v } else { unreachable!() }
18006         }
18007 }
18008 #[no_mangle]
18009 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
18010 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
18011         COption_FilterZ::Some(o)
18012 }
18013 #[no_mangle]
18014 /// Constructs a new COption_FilterZ containing nothing
18015 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
18016         COption_FilterZ::None
18017 }
18018 #[no_mangle]
18019 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
18020 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
18021 #[repr(C)]
18022 /// The contents of CResult_LockedChannelMonitorNoneZ
18023 pub union CResult_LockedChannelMonitorNoneZPtr {
18024         /// A pointer to the contents in the success state.
18025         /// Reading from this pointer when `result_ok` is not set is undefined.
18026         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
18027         /// Note that this value is always NULL, as there are no contents in the Err variant
18028         pub err: *mut core::ffi::c_void,
18029 }
18030 #[repr(C)]
18031 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
18032 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
18033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18034 pub struct CResult_LockedChannelMonitorNoneZ {
18035         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
18036         /// `err` or `result` depending on the state of `result_ok`.
18037         pub contents: CResult_LockedChannelMonitorNoneZPtr,
18038         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
18039         pub result_ok: bool,
18040 }
18041 #[no_mangle]
18042 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
18043 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
18044         CResult_LockedChannelMonitorNoneZ {
18045                 contents: CResult_LockedChannelMonitorNoneZPtr {
18046                         result: Box::into_raw(Box::new(o)),
18047                 },
18048                 result_ok: true,
18049         }
18050 }
18051 #[no_mangle]
18052 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
18053 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
18054         CResult_LockedChannelMonitorNoneZ {
18055                 contents: CResult_LockedChannelMonitorNoneZPtr {
18056                         err: core::ptr::null_mut(),
18057                 },
18058                 result_ok: false,
18059         }
18060 }
18061 /// Checks if the given object is currently in the success state
18062 #[no_mangle]
18063 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
18064         o.result_ok
18065 }
18066 #[no_mangle]
18067 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
18068 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
18069 impl Drop for CResult_LockedChannelMonitorNoneZ {
18070         fn drop(&mut self) {
18071                 if self.result_ok {
18072                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18073                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18074                         }
18075                 } else {
18076                 }
18077         }
18078 }
18079 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
18080         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
18081                 let contents = if o.result_ok {
18082                         let result = unsafe { o.contents.result };
18083                         unsafe { o.contents.result = core::ptr::null_mut() };
18084                         CResult_LockedChannelMonitorNoneZPtr { result }
18085                 } else {
18086                         let _ = unsafe { Box::from_raw(o.contents.err) };
18087                         o.contents.err = core::ptr::null_mut();
18088                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
18089                 };
18090                 Self {
18091                         contents,
18092                         result_ok: o.result_ok,
18093                 }
18094         }
18095 }
18096 #[repr(C)]
18097 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
18098 /// This corresponds to std::vector in C++
18099 pub struct CVec_OutPointZ {
18100         /// The elements in the array.
18101         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18102         pub data: *mut crate::lightning::chain::transaction::OutPoint,
18103         /// The number of elements pointed to by `data`.
18104         pub datalen: usize
18105 }
18106 impl CVec_OutPointZ {
18107         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
18108                 if self.datalen == 0 { return Vec::new(); }
18109                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18110                 self.data = core::ptr::null_mut();
18111                 self.datalen = 0;
18112                 ret
18113         }
18114         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
18115                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18116         }
18117 }
18118 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
18119         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
18120                 let datalen = v.len();
18121                 let data = Box::into_raw(v.into_boxed_slice());
18122                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18123         }
18124 }
18125 #[no_mangle]
18126 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18127 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
18128 impl Drop for CVec_OutPointZ {
18129         fn drop(&mut self) {
18130                 if self.datalen == 0 { return; }
18131                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18132         }
18133 }
18134 impl Clone for CVec_OutPointZ {
18135         fn clone(&self) -> Self {
18136                 let mut res = Vec::new();
18137                 if self.datalen == 0 { return Self::from(res); }
18138                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18139                 Self::from(res)
18140         }
18141 }
18142 #[repr(C)]
18143 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
18144 /// This corresponds to std::vector in C++
18145 pub struct CVec_MonitorUpdateIdZ {
18146         /// The elements in the array.
18147         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18148         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
18149         /// The number of elements pointed to by `data`.
18150         pub datalen: usize
18151 }
18152 impl CVec_MonitorUpdateIdZ {
18153         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
18154                 if self.datalen == 0 { return Vec::new(); }
18155                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18156                 self.data = core::ptr::null_mut();
18157                 self.datalen = 0;
18158                 ret
18159         }
18160         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
18161                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18162         }
18163 }
18164 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
18165         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
18166                 let datalen = v.len();
18167                 let data = Box::into_raw(v.into_boxed_slice());
18168                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18169         }
18170 }
18171 #[no_mangle]
18172 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18173 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
18174 impl Drop for CVec_MonitorUpdateIdZ {
18175         fn drop(&mut self) {
18176                 if self.datalen == 0 { return; }
18177                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18178         }
18179 }
18180 impl Clone for CVec_MonitorUpdateIdZ {
18181         fn clone(&self) -> Self {
18182                 let mut res = Vec::new();
18183                 if self.datalen == 0 { return Self::from(res); }
18184                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18185                 Self::from(res)
18186         }
18187 }
18188 #[repr(C)]
18189 /// A tuple of 2 elements. See the individual fields for the types contained.
18190 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18191         /// The element at position 0
18192         pub a: crate::lightning::chain::transaction::OutPoint,
18193         /// The element at position 1
18194         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
18195 }
18196 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18197         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
18198                 Self {
18199                         a: tup.0,
18200                         b: tup.1,
18201                 }
18202         }
18203 }
18204 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18205         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
18206                 (self.a, self.b)
18207         }
18208 }
18209 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18210         fn clone(&self) -> Self {
18211                 Self {
18212                         a: Clone::clone(&self.a),
18213                         b: Clone::clone(&self.b),
18214                 }
18215         }
18216 }
18217 #[no_mangle]
18218 /// Creates a new tuple which has the same data as `orig`
18219 /// but with all dynamically-allocated buffers duplicated in new buffers.
18220 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
18221 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
18222 #[no_mangle]
18223 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
18224         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
18225 }
18226
18227 #[no_mangle]
18228 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
18229 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
18230 #[repr(C)]
18231 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
18232 /// This corresponds to std::vector in C++
18233 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18234         /// The elements in the array.
18235         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
18236         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
18237         /// The number of elements pointed to by `data`.
18238         pub datalen: usize
18239 }
18240 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18241         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
18242                 if self.datalen == 0 { return Vec::new(); }
18243                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
18244                 self.data = core::ptr::null_mut();
18245                 self.datalen = 0;
18246                 ret
18247         }
18248         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
18249                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
18250         }
18251 }
18252 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18253         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
18254                 let datalen = v.len();
18255                 let data = Box::into_raw(v.into_boxed_slice());
18256                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
18257         }
18258 }
18259 #[no_mangle]
18260 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
18261 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
18262 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18263         fn drop(&mut self) {
18264                 if self.datalen == 0 { return; }
18265                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
18266         }
18267 }
18268 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
18269         fn clone(&self) -> Self {
18270                 let mut res = Vec::new();
18271                 if self.datalen == 0 { return Self::from(res); }
18272                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
18273                 Self::from(res)
18274         }
18275 }
18276 #[repr(C)]
18277 /// The contents of CResult_u32GraphSyncErrorZ
18278 pub union CResult_u32GraphSyncErrorZPtr {
18279         /// A pointer to the contents in the success state.
18280         /// Reading from this pointer when `result_ok` is not set is undefined.
18281         pub result: *mut u32,
18282         /// A pointer to the contents in the error state.
18283         /// Reading from this pointer when `result_ok` is set is undefined.
18284         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
18285 }
18286 #[repr(C)]
18287 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
18288 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
18289 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18290 pub struct CResult_u32GraphSyncErrorZ {
18291         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
18292         /// `err` or `result` depending on the state of `result_ok`.
18293         pub contents: CResult_u32GraphSyncErrorZPtr,
18294         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
18295         pub result_ok: bool,
18296 }
18297 #[no_mangle]
18298 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
18299 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
18300         CResult_u32GraphSyncErrorZ {
18301                 contents: CResult_u32GraphSyncErrorZPtr {
18302                         result: Box::into_raw(Box::new(o)),
18303                 },
18304                 result_ok: true,
18305         }
18306 }
18307 #[no_mangle]
18308 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
18309 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
18310         CResult_u32GraphSyncErrorZ {
18311                 contents: CResult_u32GraphSyncErrorZPtr {
18312                         err: Box::into_raw(Box::new(e)),
18313                 },
18314                 result_ok: false,
18315         }
18316 }
18317 /// Checks if the given object is currently in the success state
18318 #[no_mangle]
18319 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
18320         o.result_ok
18321 }
18322 #[no_mangle]
18323 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
18324 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
18325 impl Drop for CResult_u32GraphSyncErrorZ {
18326         fn drop(&mut self) {
18327                 if self.result_ok {
18328                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18329                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18330                         }
18331                 } else {
18332                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18333                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18334                         }
18335                 }
18336         }
18337 }
18338 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
18339         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
18340                 let contents = if o.result_ok {
18341                         let result = unsafe { o.contents.result };
18342                         unsafe { o.contents.result = core::ptr::null_mut() };
18343                         CResult_u32GraphSyncErrorZPtr { result }
18344                 } else {
18345                         let err = unsafe { o.contents.err };
18346                         unsafe { o.contents.err = core::ptr::null_mut(); }
18347                         CResult_u32GraphSyncErrorZPtr { err }
18348                 };
18349                 Self {
18350                         contents,
18351                         result_ok: o.result_ok,
18352                 }
18353         }
18354 }