Update auto-generated bindings
[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 /// The contents of CResult_NoneAPIErrorZ
12 pub union CResult_NoneAPIErrorZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// A pointer to the contents in the error state.
16         /// Reading from this pointer when `result_ok` is set is undefined.
17         pub err: *mut crate::lightning::util::errors::APIError,
18 }
19 #[repr(C)]
20 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
21 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
22 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23 pub struct CResult_NoneAPIErrorZ {
24         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
25         /// `err` or `result` depending on the state of `result_ok`.
26         pub contents: CResult_NoneAPIErrorZPtr,
27         /// Whether this CResult_NoneAPIErrorZ represents a success state.
28         pub result_ok: bool,
29 }
30 #[no_mangle]
31 /// Creates a new CResult_NoneAPIErrorZ in the success state.
32 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
33         CResult_NoneAPIErrorZ {
34                 contents: CResult_NoneAPIErrorZPtr {
35                         result: core::ptr::null_mut(),
36                 },
37                 result_ok: true,
38         }
39 }
40 #[no_mangle]
41 /// Creates a new CResult_NoneAPIErrorZ in the error state.
42 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
43         CResult_NoneAPIErrorZ {
44                 contents: CResult_NoneAPIErrorZPtr {
45                         err: Box::into_raw(Box::new(e)),
46                 },
47                 result_ok: false,
48         }
49 }
50 /// Checks if the given object is currently in the success state
51 #[no_mangle]
52 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
53         o.result_ok
54 }
55 #[no_mangle]
56 /// Frees any resources used by the CResult_NoneAPIErrorZ.
57 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
58 impl Drop for CResult_NoneAPIErrorZ {
59         fn drop(&mut self) {
60                 if self.result_ok {
61                 } else {
62                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
63                                 let _ = unsafe { Box::from_raw(self.contents.err) };
64                         }
65                 }
66         }
67 }
68 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
69         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
70                 let contents = if o.result_ok {
71                         let _ = unsafe { Box::from_raw(o.contents.result) };
72                         o.contents.result = core::ptr::null_mut();
73                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
74                 } else {
75                         let err = unsafe { o.contents.err };
76                         unsafe { o.contents.err = core::ptr::null_mut(); }
77                         CResult_NoneAPIErrorZPtr { err }
78                 };
79                 Self {
80                         contents,
81                         result_ok: o.result_ok,
82                 }
83         }
84 }
85 impl Clone for CResult_NoneAPIErrorZ {
86         fn clone(&self) -> Self {
87                 if self.result_ok {
88                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
89                                 result: core::ptr::null_mut()
90                         } }
91                 } else {
92                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
93                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
94                         } }
95                 }
96         }
97 }
98 #[no_mangle]
99 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
100 /// but with all dynamically-allocated buffers duplicated in new buffers.
101 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
102 #[repr(C)]
103 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
104 /// This corresponds to std::vector in C++
105 pub struct CVec_CResult_NoneAPIErrorZZ {
106         /// The elements in the array.
107         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
108         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
109         /// The number of elements pointed to by `data`.
110         pub datalen: usize
111 }
112 impl CVec_CResult_NoneAPIErrorZZ {
113         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
114                 if self.datalen == 0 { return Vec::new(); }
115                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
116                 self.data = core::ptr::null_mut();
117                 self.datalen = 0;
118                 ret
119         }
120         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
121                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
122         }
123 }
124 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
125         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
126                 let datalen = v.len();
127                 let data = Box::into_raw(v.into_boxed_slice());
128                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
129         }
130 }
131 #[no_mangle]
132 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
133 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
134 impl Drop for CVec_CResult_NoneAPIErrorZZ {
135         fn drop(&mut self) {
136                 if self.datalen == 0 { return; }
137                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
138         }
139 }
140 impl Clone for CVec_CResult_NoneAPIErrorZZ {
141         fn clone(&self) -> Self {
142                 let mut res = Vec::new();
143                 if self.datalen == 0 { return Self::from(res); }
144                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
145                 Self::from(res)
146         }
147 }
148 #[repr(C)]
149 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
150 /// This corresponds to std::vector in C++
151 pub struct CVec_APIErrorZ {
152         /// The elements in the array.
153         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
154         pub data: *mut crate::lightning::util::errors::APIError,
155         /// The number of elements pointed to by `data`.
156         pub datalen: usize
157 }
158 impl CVec_APIErrorZ {
159         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
160                 if self.datalen == 0 { return Vec::new(); }
161                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
162                 self.data = core::ptr::null_mut();
163                 self.datalen = 0;
164                 ret
165         }
166         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
167                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
168         }
169 }
170 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
171         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
172                 let datalen = v.len();
173                 let data = Box::into_raw(v.into_boxed_slice());
174                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
175         }
176 }
177 #[no_mangle]
178 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
179 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
180 impl Drop for CVec_APIErrorZ {
181         fn drop(&mut self) {
182                 if self.datalen == 0 { return; }
183                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
184         }
185 }
186 impl Clone for CVec_APIErrorZ {
187         fn clone(&self) -> Self {
188                 let mut res = Vec::new();
189                 if self.datalen == 0 { return Self::from(res); }
190                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
191                 Self::from(res)
192         }
193 }
194 #[repr(C)]
195 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
196 pub enum COption_HTLCClaimZ {
197         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
198         Some(crate::lightning::ln::chan_utils::HTLCClaim),
199         /// When we're in this state, this COption_HTLCClaimZ contains nothing
200         None
201 }
202 impl COption_HTLCClaimZ {
203         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
204                 if let Self::None = self { false } else { true }
205         }
206         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
207                 !self.is_some()
208         }
209         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
210                 if let Self::Some(v) = self { v } else { unreachable!() }
211         }
212 }
213 #[no_mangle]
214 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
215 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
216         COption_HTLCClaimZ::Some(o)
217 }
218 #[no_mangle]
219 /// Constructs a new COption_HTLCClaimZ containing nothing
220 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
221         COption_HTLCClaimZ::None
222 }
223 #[no_mangle]
224 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
225 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
226 #[repr(C)]
227 /// The contents of CResult_NoneNoneZ
228 pub union CResult_NoneNoneZPtr {
229         /// Note that this value is always NULL, as there are no contents in the OK variant
230         pub result: *mut core::ffi::c_void,
231         /// Note that this value is always NULL, as there are no contents in the Err variant
232         pub err: *mut core::ffi::c_void,
233 }
234 #[repr(C)]
235 /// A CResult_NoneNoneZ represents the result of a fallible operation,
236 /// containing a () on success and a () on failure.
237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
238 pub struct CResult_NoneNoneZ {
239         /// The contents of this CResult_NoneNoneZ, accessible via either
240         /// `err` or `result` depending on the state of `result_ok`.
241         pub contents: CResult_NoneNoneZPtr,
242         /// Whether this CResult_NoneNoneZ represents a success state.
243         pub result_ok: bool,
244 }
245 #[no_mangle]
246 /// Creates a new CResult_NoneNoneZ in the success state.
247 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
248         CResult_NoneNoneZ {
249                 contents: CResult_NoneNoneZPtr {
250                         result: core::ptr::null_mut(),
251                 },
252                 result_ok: true,
253         }
254 }
255 #[no_mangle]
256 /// Creates a new CResult_NoneNoneZ in the error state.
257 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
258         CResult_NoneNoneZ {
259                 contents: CResult_NoneNoneZPtr {
260                         err: core::ptr::null_mut(),
261                 },
262                 result_ok: false,
263         }
264 }
265 /// Checks if the given object is currently in the success state
266 #[no_mangle]
267 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
268         o.result_ok
269 }
270 #[no_mangle]
271 /// Frees any resources used by the CResult_NoneNoneZ.
272 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
273 impl Drop for CResult_NoneNoneZ {
274         fn drop(&mut self) {
275                 if self.result_ok {
276                 } else {
277                 }
278         }
279 }
280 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
281         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
282                 let contents = if o.result_ok {
283                         let _ = unsafe { Box::from_raw(o.contents.result) };
284                         o.contents.result = core::ptr::null_mut();
285                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
286                 } else {
287                         let _ = unsafe { Box::from_raw(o.contents.err) };
288                         o.contents.err = core::ptr::null_mut();
289                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
290                 };
291                 Self {
292                         contents,
293                         result_ok: o.result_ok,
294                 }
295         }
296 }
297 impl Clone for CResult_NoneNoneZ {
298         fn clone(&self) -> Self {
299                 if self.result_ok {
300                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
301                                 result: core::ptr::null_mut()
302                         } }
303                 } else {
304                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
305                                 err: core::ptr::null_mut()
306                         } }
307                 }
308         }
309 }
310 #[no_mangle]
311 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
312 /// but with all dynamically-allocated buffers duplicated in new buffers.
313 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
314 #[repr(C)]
315 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
316 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
317         /// A pointer to the contents in the success state.
318         /// Reading from this pointer when `result_ok` is not set is undefined.
319         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
320         /// A pointer to the contents in the error state.
321         /// Reading from this pointer when `result_ok` is set is undefined.
322         pub err: *mut crate::lightning::ln::msgs::DecodeError,
323 }
324 #[repr(C)]
325 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
326 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
328 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
329         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
330         /// `err` or `result` depending on the state of `result_ok`.
331         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
332         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
333         pub result_ok: bool,
334 }
335 #[no_mangle]
336 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
337 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
338         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
339                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
340                         result: Box::into_raw(Box::new(o)),
341                 },
342                 result_ok: true,
343         }
344 }
345 #[no_mangle]
346 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
347 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
348         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
349                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
350                         err: Box::into_raw(Box::new(e)),
351                 },
352                 result_ok: false,
353         }
354 }
355 /// Checks if the given object is currently in the success state
356 #[no_mangle]
357 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
358         o.result_ok
359 }
360 #[no_mangle]
361 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
362 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
363 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
364         fn drop(&mut self) {
365                 if self.result_ok {
366                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
367                                 let _ = unsafe { Box::from_raw(self.contents.result) };
368                         }
369                 } else {
370                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
371                                 let _ = unsafe { Box::from_raw(self.contents.err) };
372                         }
373                 }
374         }
375 }
376 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
377         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
378                 let contents = if o.result_ok {
379                         let result = unsafe { o.contents.result };
380                         unsafe { o.contents.result = core::ptr::null_mut() };
381                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
382                 } else {
383                         let err = unsafe { o.contents.err };
384                         unsafe { o.contents.err = core::ptr::null_mut(); }
385                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
386                 };
387                 Self {
388                         contents,
389                         result_ok: o.result_ok,
390                 }
391         }
392 }
393 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
394         fn clone(&self) -> Self {
395                 if self.result_ok {
396                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
397                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
398                         } }
399                 } else {
400                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
401                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
402                         } }
403                 }
404         }
405 }
406 #[no_mangle]
407 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
408 /// but with all dynamically-allocated buffers duplicated in new buffers.
409 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
410 #[repr(C)]
411 /// The contents of CResult_TxCreationKeysDecodeErrorZ
412 pub union CResult_TxCreationKeysDecodeErrorZPtr {
413         /// A pointer to the contents in the success state.
414         /// Reading from this pointer when `result_ok` is not set is undefined.
415         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
416         /// A pointer to the contents in the error state.
417         /// Reading from this pointer when `result_ok` is set is undefined.
418         pub err: *mut crate::lightning::ln::msgs::DecodeError,
419 }
420 #[repr(C)]
421 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
422 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
423 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
424 pub struct CResult_TxCreationKeysDecodeErrorZ {
425         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
426         /// `err` or `result` depending on the state of `result_ok`.
427         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
428         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
429         pub result_ok: bool,
430 }
431 #[no_mangle]
432 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
433 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
434         CResult_TxCreationKeysDecodeErrorZ {
435                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
436                         result: Box::into_raw(Box::new(o)),
437                 },
438                 result_ok: true,
439         }
440 }
441 #[no_mangle]
442 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
443 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
444         CResult_TxCreationKeysDecodeErrorZ {
445                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
446                         err: Box::into_raw(Box::new(e)),
447                 },
448                 result_ok: false,
449         }
450 }
451 /// Checks if the given object is currently in the success state
452 #[no_mangle]
453 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
454         o.result_ok
455 }
456 #[no_mangle]
457 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
458 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
459 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
460         fn drop(&mut self) {
461                 if self.result_ok {
462                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
463                                 let _ = unsafe { Box::from_raw(self.contents.result) };
464                         }
465                 } else {
466                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
467                                 let _ = unsafe { Box::from_raw(self.contents.err) };
468                         }
469                 }
470         }
471 }
472 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
473         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
474                 let contents = if o.result_ok {
475                         let result = unsafe { o.contents.result };
476                         unsafe { o.contents.result = core::ptr::null_mut() };
477                         CResult_TxCreationKeysDecodeErrorZPtr { result }
478                 } else {
479                         let err = unsafe { o.contents.err };
480                         unsafe { o.contents.err = core::ptr::null_mut(); }
481                         CResult_TxCreationKeysDecodeErrorZPtr { err }
482                 };
483                 Self {
484                         contents,
485                         result_ok: o.result_ok,
486                 }
487         }
488 }
489 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
490         fn clone(&self) -> Self {
491                 if self.result_ok {
492                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
493                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
494                         } }
495                 } else {
496                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
497                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
498                         } }
499                 }
500         }
501 }
502 #[no_mangle]
503 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
504 /// but with all dynamically-allocated buffers duplicated in new buffers.
505 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
506 #[repr(C)]
507 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
508 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
509         /// A pointer to the contents in the success state.
510         /// Reading from this pointer when `result_ok` is not set is undefined.
511         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
512         /// A pointer to the contents in the error state.
513         /// Reading from this pointer when `result_ok` is set is undefined.
514         pub err: *mut crate::lightning::ln::msgs::DecodeError,
515 }
516 #[repr(C)]
517 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
518 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
520 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
521         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
522         /// `err` or `result` depending on the state of `result_ok`.
523         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
524         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
525         pub result_ok: bool,
526 }
527 #[no_mangle]
528 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
529 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
530         CResult_ChannelPublicKeysDecodeErrorZ {
531                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
532                         result: Box::into_raw(Box::new(o)),
533                 },
534                 result_ok: true,
535         }
536 }
537 #[no_mangle]
538 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
539 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
540         CResult_ChannelPublicKeysDecodeErrorZ {
541                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
542                         err: Box::into_raw(Box::new(e)),
543                 },
544                 result_ok: false,
545         }
546 }
547 /// Checks if the given object is currently in the success state
548 #[no_mangle]
549 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
550         o.result_ok
551 }
552 #[no_mangle]
553 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
554 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
555 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
556         fn drop(&mut self) {
557                 if self.result_ok {
558                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
559                                 let _ = unsafe { Box::from_raw(self.contents.result) };
560                         }
561                 } else {
562                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
563                                 let _ = unsafe { Box::from_raw(self.contents.err) };
564                         }
565                 }
566         }
567 }
568 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
569         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
570                 let contents = if o.result_ok {
571                         let result = unsafe { o.contents.result };
572                         unsafe { o.contents.result = core::ptr::null_mut() };
573                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
574                 } else {
575                         let err = unsafe { o.contents.err };
576                         unsafe { o.contents.err = core::ptr::null_mut(); }
577                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
578                 };
579                 Self {
580                         contents,
581                         result_ok: o.result_ok,
582                 }
583         }
584 }
585 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
586         fn clone(&self) -> Self {
587                 if self.result_ok {
588                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
589                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
590                         } }
591                 } else {
592                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
593                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
594                         } }
595                 }
596         }
597 }
598 #[no_mangle]
599 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
600 /// but with all dynamically-allocated buffers duplicated in new buffers.
601 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
602 #[repr(C)]
603 #[derive(Clone)]
604 /// An enum which can either contain a u32 or not
605 pub enum COption_u32Z {
606         /// When we're in this state, this COption_u32Z contains a u32
607         Some(u32),
608         /// When we're in this state, this COption_u32Z contains nothing
609         None
610 }
611 impl COption_u32Z {
612         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
613                 if let Self::None = self { false } else { true }
614         }
615         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
616                 !self.is_some()
617         }
618         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
619                 if let Self::Some(v) = self { v } else { unreachable!() }
620         }
621 }
622 #[no_mangle]
623 /// Constructs a new COption_u32Z containing a u32
624 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
625         COption_u32Z::Some(o)
626 }
627 #[no_mangle]
628 /// Constructs a new COption_u32Z containing nothing
629 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
630         COption_u32Z::None
631 }
632 #[no_mangle]
633 /// Frees any resources associated with the u32, if we are in the Some state
634 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
635 #[no_mangle]
636 /// Creates a new COption_u32Z which has the same data as `orig`
637 /// but with all dynamically-allocated buffers duplicated in new buffers.
638 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
639 #[repr(C)]
640 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
641 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
642         /// A pointer to the contents in the success state.
643         /// Reading from this pointer when `result_ok` is not set is undefined.
644         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
645         /// A pointer to the contents in the error state.
646         /// Reading from this pointer when `result_ok` is set is undefined.
647         pub err: *mut crate::lightning::ln::msgs::DecodeError,
648 }
649 #[repr(C)]
650 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
651 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
653 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
654         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
655         /// `err` or `result` depending on the state of `result_ok`.
656         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
657         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
658         pub result_ok: bool,
659 }
660 #[no_mangle]
661 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
662 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
663         CResult_HTLCOutputInCommitmentDecodeErrorZ {
664                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
665                         result: Box::into_raw(Box::new(o)),
666                 },
667                 result_ok: true,
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
672 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
673         CResult_HTLCOutputInCommitmentDecodeErrorZ {
674                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
675                         err: Box::into_raw(Box::new(e)),
676                 },
677                 result_ok: false,
678         }
679 }
680 /// Checks if the given object is currently in the success state
681 #[no_mangle]
682 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
683         o.result_ok
684 }
685 #[no_mangle]
686 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
687 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
688 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
689         fn drop(&mut self) {
690                 if self.result_ok {
691                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
692                                 let _ = unsafe { Box::from_raw(self.contents.result) };
693                         }
694                 } else {
695                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
696                                 let _ = unsafe { Box::from_raw(self.contents.err) };
697                         }
698                 }
699         }
700 }
701 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
703                 let contents = if o.result_ok {
704                         let result = unsafe { o.contents.result };
705                         unsafe { o.contents.result = core::ptr::null_mut() };
706                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
707                 } else {
708                         let err = unsafe { o.contents.err };
709                         unsafe { o.contents.err = core::ptr::null_mut(); }
710                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
711                 };
712                 Self {
713                         contents,
714                         result_ok: o.result_ok,
715                 }
716         }
717 }
718 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
719         fn clone(&self) -> Self {
720                 if self.result_ok {
721                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
722                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
723                         } }
724                 } else {
725                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
726                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
727                         } }
728                 }
729         }
730 }
731 #[no_mangle]
732 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
733 /// but with all dynamically-allocated buffers duplicated in new buffers.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
735 #[repr(C)]
736 /// An enum which can either contain a  or not
737 pub enum COption_NoneZ {
738         /// When we're in this state, this COption_NoneZ contains a 
739         Some,
740         /// When we're in this state, this COption_NoneZ contains nothing
741         None
742 }
743 impl COption_NoneZ {
744         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
745                 if let Self::None = self { false } else { true }
746         }
747         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
748                 !self.is_some()
749         }
750 }
751 #[no_mangle]
752 /// Constructs a new COption_NoneZ containing a 
753 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
754         COption_NoneZ::Some
755 }
756 #[no_mangle]
757 /// Constructs a new COption_NoneZ containing nothing
758 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
759         COption_NoneZ::None
760 }
761 #[no_mangle]
762 /// Frees any resources associated with the , if we are in the Some state
763 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
764 #[repr(C)]
765 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
766 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
767         /// A pointer to the contents in the success state.
768         /// Reading from this pointer when `result_ok` is not set is undefined.
769         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
770         /// A pointer to the contents in the error state.
771         /// Reading from this pointer when `result_ok` is set is undefined.
772         pub err: *mut crate::lightning::ln::msgs::DecodeError,
773 }
774 #[repr(C)]
775 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
776 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
777 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
778 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
779         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
780         /// `err` or `result` depending on the state of `result_ok`.
781         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
782         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
783         pub result_ok: bool,
784 }
785 #[no_mangle]
786 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
787 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
788         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
789                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
790                         result: Box::into_raw(Box::new(o)),
791                 },
792                 result_ok: true,
793         }
794 }
795 #[no_mangle]
796 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
797 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
798         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
799                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
800                         err: Box::into_raw(Box::new(e)),
801                 },
802                 result_ok: false,
803         }
804 }
805 /// Checks if the given object is currently in the success state
806 #[no_mangle]
807 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
808         o.result_ok
809 }
810 #[no_mangle]
811 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
812 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
813 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
814         fn drop(&mut self) {
815                 if self.result_ok {
816                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
817                                 let _ = unsafe { Box::from_raw(self.contents.result) };
818                         }
819                 } else {
820                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
821                                 let _ = unsafe { Box::from_raw(self.contents.err) };
822                         }
823                 }
824         }
825 }
826 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
827         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
828                 let contents = if o.result_ok {
829                         let result = unsafe { o.contents.result };
830                         unsafe { o.contents.result = core::ptr::null_mut() };
831                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
832                 } else {
833                         let err = unsafe { o.contents.err };
834                         unsafe { o.contents.err = core::ptr::null_mut(); }
835                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
836                 };
837                 Self {
838                         contents,
839                         result_ok: o.result_ok,
840                 }
841         }
842 }
843 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
844         fn clone(&self) -> Self {
845                 if self.result_ok {
846                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
847                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
848                         } }
849                 } else {
850                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
851                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
852                         } }
853                 }
854         }
855 }
856 #[no_mangle]
857 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
858 /// but with all dynamically-allocated buffers duplicated in new buffers.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
860 #[repr(C)]
861 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
862 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
863         /// A pointer to the contents in the success state.
864         /// Reading from this pointer when `result_ok` is not set is undefined.
865         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
866         /// A pointer to the contents in the error state.
867         /// Reading from this pointer when `result_ok` is set is undefined.
868         pub err: *mut crate::lightning::ln::msgs::DecodeError,
869 }
870 #[repr(C)]
871 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
872 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
874 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
875         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
876         /// `err` or `result` depending on the state of `result_ok`.
877         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
878         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
879         pub result_ok: bool,
880 }
881 #[no_mangle]
882 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
883 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
884         CResult_ChannelTransactionParametersDecodeErrorZ {
885                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
886                         result: Box::into_raw(Box::new(o)),
887                 },
888                 result_ok: true,
889         }
890 }
891 #[no_mangle]
892 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
893 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
894         CResult_ChannelTransactionParametersDecodeErrorZ {
895                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
896                         err: Box::into_raw(Box::new(e)),
897                 },
898                 result_ok: false,
899         }
900 }
901 /// Checks if the given object is currently in the success state
902 #[no_mangle]
903 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
904         o.result_ok
905 }
906 #[no_mangle]
907 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
908 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
909 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
910         fn drop(&mut self) {
911                 if self.result_ok {
912                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
913                                 let _ = unsafe { Box::from_raw(self.contents.result) };
914                         }
915                 } else {
916                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
917                                 let _ = unsafe { Box::from_raw(self.contents.err) };
918                         }
919                 }
920         }
921 }
922 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
923         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
924                 let contents = if o.result_ok {
925                         let result = unsafe { o.contents.result };
926                         unsafe { o.contents.result = core::ptr::null_mut() };
927                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
928                 } else {
929                         let err = unsafe { o.contents.err };
930                         unsafe { o.contents.err = core::ptr::null_mut(); }
931                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
932                 };
933                 Self {
934                         contents,
935                         result_ok: o.result_ok,
936                 }
937         }
938 }
939 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
940         fn clone(&self) -> Self {
941                 if self.result_ok {
942                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
943                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
944                         } }
945                 } else {
946                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
947                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
948                         } }
949                 }
950         }
951 }
952 #[no_mangle]
953 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
954 /// but with all dynamically-allocated buffers duplicated in new buffers.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
956 #[repr(C)]
957 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
958 /// This corresponds to std::vector in C++
959 pub struct CVec_SignatureZ {
960         /// The elements in the array.
961         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
962         pub data: *mut crate::c_types::Signature,
963         /// The number of elements pointed to by `data`.
964         pub datalen: usize
965 }
966 impl CVec_SignatureZ {
967         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
968                 if self.datalen == 0 { return Vec::new(); }
969                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
970                 self.data = core::ptr::null_mut();
971                 self.datalen = 0;
972                 ret
973         }
974         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
975                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
976         }
977 }
978 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
979         fn from(v: Vec<crate::c_types::Signature>) -> Self {
980                 let datalen = v.len();
981                 let data = Box::into_raw(v.into_boxed_slice());
982                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
983         }
984 }
985 #[no_mangle]
986 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
987 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
988 impl Drop for CVec_SignatureZ {
989         fn drop(&mut self) {
990                 if self.datalen == 0 { return; }
991                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
992         }
993 }
994 impl Clone for CVec_SignatureZ {
995         fn clone(&self) -> Self {
996                 let mut res = Vec::new();
997                 if self.datalen == 0 { return Self::from(res); }
998                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
999                 Self::from(res)
1000         }
1001 }
1002 #[repr(C)]
1003 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1004 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1005         /// A pointer to the contents in the success state.
1006         /// Reading from this pointer when `result_ok` is not set is undefined.
1007         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1008         /// A pointer to the contents in the error state.
1009         /// Reading from this pointer when `result_ok` is set is undefined.
1010         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1011 }
1012 #[repr(C)]
1013 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1014 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1015 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1016 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1017         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1018         /// `err` or `result` depending on the state of `result_ok`.
1019         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1020         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1021         pub result_ok: bool,
1022 }
1023 #[no_mangle]
1024 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1025 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1026         CResult_HolderCommitmentTransactionDecodeErrorZ {
1027                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1028                         result: Box::into_raw(Box::new(o)),
1029                 },
1030                 result_ok: true,
1031         }
1032 }
1033 #[no_mangle]
1034 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1035 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1036         CResult_HolderCommitmentTransactionDecodeErrorZ {
1037                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1038                         err: Box::into_raw(Box::new(e)),
1039                 },
1040                 result_ok: false,
1041         }
1042 }
1043 /// Checks if the given object is currently in the success state
1044 #[no_mangle]
1045 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1046         o.result_ok
1047 }
1048 #[no_mangle]
1049 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1050 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1051 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1052         fn drop(&mut self) {
1053                 if self.result_ok {
1054                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1055                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1056                         }
1057                 } else {
1058                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1059                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1060                         }
1061                 }
1062         }
1063 }
1064 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1065         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1066                 let contents = if o.result_ok {
1067                         let result = unsafe { o.contents.result };
1068                         unsafe { o.contents.result = core::ptr::null_mut() };
1069                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1070                 } else {
1071                         let err = unsafe { o.contents.err };
1072                         unsafe { o.contents.err = core::ptr::null_mut(); }
1073                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1074                 };
1075                 Self {
1076                         contents,
1077                         result_ok: o.result_ok,
1078                 }
1079         }
1080 }
1081 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1082         fn clone(&self) -> Self {
1083                 if self.result_ok {
1084                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1085                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1086                         } }
1087                 } else {
1088                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1089                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1090                         } }
1091                 }
1092         }
1093 }
1094 #[no_mangle]
1095 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1096 /// but with all dynamically-allocated buffers duplicated in new buffers.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1098 #[repr(C)]
1099 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1100 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1101         /// A pointer to the contents in the success state.
1102         /// Reading from this pointer when `result_ok` is not set is undefined.
1103         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1104         /// A pointer to the contents in the error state.
1105         /// Reading from this pointer when `result_ok` is set is undefined.
1106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1107 }
1108 #[repr(C)]
1109 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1110 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1112 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1113         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1114         /// `err` or `result` depending on the state of `result_ok`.
1115         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1116         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1117         pub result_ok: bool,
1118 }
1119 #[no_mangle]
1120 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1121 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1122         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1123                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1124                         result: Box::into_raw(Box::new(o)),
1125                 },
1126                 result_ok: true,
1127         }
1128 }
1129 #[no_mangle]
1130 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1131 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1132         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1133                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1134                         err: Box::into_raw(Box::new(e)),
1135                 },
1136                 result_ok: false,
1137         }
1138 }
1139 /// Checks if the given object is currently in the success state
1140 #[no_mangle]
1141 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1142         o.result_ok
1143 }
1144 #[no_mangle]
1145 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1146 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1147 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1148         fn drop(&mut self) {
1149                 if self.result_ok {
1150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1152                         }
1153                 } else {
1154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1156                         }
1157                 }
1158         }
1159 }
1160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1162                 let contents = if o.result_ok {
1163                         let result = unsafe { o.contents.result };
1164                         unsafe { o.contents.result = core::ptr::null_mut() };
1165                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1166                 } else {
1167                         let err = unsafe { o.contents.err };
1168                         unsafe { o.contents.err = core::ptr::null_mut(); }
1169                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1170                 };
1171                 Self {
1172                         contents,
1173                         result_ok: o.result_ok,
1174                 }
1175         }
1176 }
1177 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1178         fn clone(&self) -> Self {
1179                 if self.result_ok {
1180                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1182                         } }
1183                 } else {
1184                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1186                         } }
1187                 }
1188         }
1189 }
1190 #[no_mangle]
1191 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1192 /// but with all dynamically-allocated buffers duplicated in new buffers.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1194 #[repr(C)]
1195 /// The contents of CResult_TrustedClosingTransactionNoneZ
1196 pub union CResult_TrustedClosingTransactionNoneZPtr {
1197         /// A pointer to the contents in the success state.
1198         /// Reading from this pointer when `result_ok` is not set is undefined.
1199         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1200         /// Note that this value is always NULL, as there are no contents in the Err variant
1201         pub err: *mut core::ffi::c_void,
1202 }
1203 #[repr(C)]
1204 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1205 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1207 pub struct CResult_TrustedClosingTransactionNoneZ {
1208         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1209         /// `err` or `result` depending on the state of `result_ok`.
1210         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1211         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1212         pub result_ok: bool,
1213 }
1214 #[no_mangle]
1215 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1216 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1217         CResult_TrustedClosingTransactionNoneZ {
1218                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1219                         result: Box::into_raw(Box::new(o)),
1220                 },
1221                 result_ok: true,
1222         }
1223 }
1224 #[no_mangle]
1225 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1226 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1227         CResult_TrustedClosingTransactionNoneZ {
1228                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1229                         err: core::ptr::null_mut(),
1230                 },
1231                 result_ok: false,
1232         }
1233 }
1234 /// Checks if the given object is currently in the success state
1235 #[no_mangle]
1236 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1237         o.result_ok
1238 }
1239 #[no_mangle]
1240 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1241 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1242 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1243         fn drop(&mut self) {
1244                 if self.result_ok {
1245                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1246                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1247                         }
1248                 } else {
1249                 }
1250         }
1251 }
1252 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1253         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1254                 let contents = if o.result_ok {
1255                         let result = unsafe { o.contents.result };
1256                         unsafe { o.contents.result = core::ptr::null_mut() };
1257                         CResult_TrustedClosingTransactionNoneZPtr { result }
1258                 } else {
1259                         let _ = unsafe { Box::from_raw(o.contents.err) };
1260                         o.contents.err = core::ptr::null_mut();
1261                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1262                 };
1263                 Self {
1264                         contents,
1265                         result_ok: o.result_ok,
1266                 }
1267         }
1268 }
1269 #[repr(C)]
1270 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1271 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1272         /// A pointer to the contents in the success state.
1273         /// Reading from this pointer when `result_ok` is not set is undefined.
1274         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1275         /// A pointer to the contents in the error state.
1276         /// Reading from this pointer when `result_ok` is set is undefined.
1277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1278 }
1279 #[repr(C)]
1280 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1281 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1283 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1284         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1285         /// `err` or `result` depending on the state of `result_ok`.
1286         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1287         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1288         pub result_ok: bool,
1289 }
1290 #[no_mangle]
1291 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1292 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1293         CResult_CommitmentTransactionDecodeErrorZ {
1294                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1295                         result: Box::into_raw(Box::new(o)),
1296                 },
1297                 result_ok: true,
1298         }
1299 }
1300 #[no_mangle]
1301 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1302 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1303         CResult_CommitmentTransactionDecodeErrorZ {
1304                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1305                         err: Box::into_raw(Box::new(e)),
1306                 },
1307                 result_ok: false,
1308         }
1309 }
1310 /// Checks if the given object is currently in the success state
1311 #[no_mangle]
1312 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1313         o.result_ok
1314 }
1315 #[no_mangle]
1316 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1317 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1318 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1319         fn drop(&mut self) {
1320                 if self.result_ok {
1321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1323                         }
1324                 } else {
1325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1327                         }
1328                 }
1329         }
1330 }
1331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1332         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1333                 let contents = if o.result_ok {
1334                         let result = unsafe { o.contents.result };
1335                         unsafe { o.contents.result = core::ptr::null_mut() };
1336                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1337                 } else {
1338                         let err = unsafe { o.contents.err };
1339                         unsafe { o.contents.err = core::ptr::null_mut(); }
1340                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1341                 };
1342                 Self {
1343                         contents,
1344                         result_ok: o.result_ok,
1345                 }
1346         }
1347 }
1348 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1349         fn clone(&self) -> Self {
1350                 if self.result_ok {
1351                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1352                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1353                         } }
1354                 } else {
1355                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1357                         } }
1358                 }
1359         }
1360 }
1361 #[no_mangle]
1362 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1363 /// but with all dynamically-allocated buffers duplicated in new buffers.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1365 #[repr(C)]
1366 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1367 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1368         /// A pointer to the contents in the success state.
1369         /// Reading from this pointer when `result_ok` is not set is undefined.
1370         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1371         /// Note that this value is always NULL, as there are no contents in the Err variant
1372         pub err: *mut core::ffi::c_void,
1373 }
1374 #[repr(C)]
1375 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1376 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1378 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1379         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1380         /// `err` or `result` depending on the state of `result_ok`.
1381         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1382         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1383         pub result_ok: bool,
1384 }
1385 #[no_mangle]
1386 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1387 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1388         CResult_TrustedCommitmentTransactionNoneZ {
1389                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1390                         result: Box::into_raw(Box::new(o)),
1391                 },
1392                 result_ok: true,
1393         }
1394 }
1395 #[no_mangle]
1396 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1397 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1398         CResult_TrustedCommitmentTransactionNoneZ {
1399                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1400                         err: core::ptr::null_mut(),
1401                 },
1402                 result_ok: false,
1403         }
1404 }
1405 /// Checks if the given object is currently in the success state
1406 #[no_mangle]
1407 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1408         o.result_ok
1409 }
1410 #[no_mangle]
1411 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1412 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1413 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1414         fn drop(&mut self) {
1415                 if self.result_ok {
1416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1418                         }
1419                 } else {
1420                 }
1421         }
1422 }
1423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1425                 let contents = if o.result_ok {
1426                         let result = unsafe { o.contents.result };
1427                         unsafe { o.contents.result = core::ptr::null_mut() };
1428                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1429                 } else {
1430                         let _ = unsafe { Box::from_raw(o.contents.err) };
1431                         o.contents.err = core::ptr::null_mut();
1432                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1433                 };
1434                 Self {
1435                         contents,
1436                         result_ok: o.result_ok,
1437                 }
1438         }
1439 }
1440 #[repr(C)]
1441 /// The contents of CResult_CVec_SignatureZNoneZ
1442 pub union CResult_CVec_SignatureZNoneZPtr {
1443         /// A pointer to the contents in the success state.
1444         /// Reading from this pointer when `result_ok` is not set is undefined.
1445         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1446         /// Note that this value is always NULL, as there are no contents in the Err variant
1447         pub err: *mut core::ffi::c_void,
1448 }
1449 #[repr(C)]
1450 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1451 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1453 pub struct CResult_CVec_SignatureZNoneZ {
1454         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1455         /// `err` or `result` depending on the state of `result_ok`.
1456         pub contents: CResult_CVec_SignatureZNoneZPtr,
1457         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1458         pub result_ok: bool,
1459 }
1460 #[no_mangle]
1461 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1462 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1463         CResult_CVec_SignatureZNoneZ {
1464                 contents: CResult_CVec_SignatureZNoneZPtr {
1465                         result: Box::into_raw(Box::new(o)),
1466                 },
1467                 result_ok: true,
1468         }
1469 }
1470 #[no_mangle]
1471 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1472 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1473         CResult_CVec_SignatureZNoneZ {
1474                 contents: CResult_CVec_SignatureZNoneZPtr {
1475                         err: core::ptr::null_mut(),
1476                 },
1477                 result_ok: false,
1478         }
1479 }
1480 /// Checks if the given object is currently in the success state
1481 #[no_mangle]
1482 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1483         o.result_ok
1484 }
1485 #[no_mangle]
1486 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1487 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1488 impl Drop for CResult_CVec_SignatureZNoneZ {
1489         fn drop(&mut self) {
1490                 if self.result_ok {
1491                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1492                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1493                         }
1494                 } else {
1495                 }
1496         }
1497 }
1498 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1499         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1500                 let contents = if o.result_ok {
1501                         let result = unsafe { o.contents.result };
1502                         unsafe { o.contents.result = core::ptr::null_mut() };
1503                         CResult_CVec_SignatureZNoneZPtr { result }
1504                 } else {
1505                         let _ = unsafe { Box::from_raw(o.contents.err) };
1506                         o.contents.err = core::ptr::null_mut();
1507                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1508                 };
1509                 Self {
1510                         contents,
1511                         result_ok: o.result_ok,
1512                 }
1513         }
1514 }
1515 impl Clone for CResult_CVec_SignatureZNoneZ {
1516         fn clone(&self) -> Self {
1517                 if self.result_ok {
1518                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1519                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1520                         } }
1521                 } else {
1522                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1523                                 err: core::ptr::null_mut()
1524                         } }
1525                 }
1526         }
1527 }
1528 #[no_mangle]
1529 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1530 /// but with all dynamically-allocated buffers duplicated in new buffers.
1531 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1532 #[repr(C)]
1533 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1534 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1535         /// A pointer to the contents in the success state.
1536         /// Reading from this pointer when `result_ok` is not set is undefined.
1537         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1538         /// A pointer to the contents in the error state.
1539         /// Reading from this pointer when `result_ok` is set is undefined.
1540         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1541 }
1542 #[repr(C)]
1543 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1544 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1546 pub struct CResult_ShutdownScriptDecodeErrorZ {
1547         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1548         /// `err` or `result` depending on the state of `result_ok`.
1549         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1550         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1551         pub result_ok: bool,
1552 }
1553 #[no_mangle]
1554 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1555 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1556         CResult_ShutdownScriptDecodeErrorZ {
1557                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1558                         result: Box::into_raw(Box::new(o)),
1559                 },
1560                 result_ok: true,
1561         }
1562 }
1563 #[no_mangle]
1564 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1565 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1566         CResult_ShutdownScriptDecodeErrorZ {
1567                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1568                         err: Box::into_raw(Box::new(e)),
1569                 },
1570                 result_ok: false,
1571         }
1572 }
1573 /// Checks if the given object is currently in the success state
1574 #[no_mangle]
1575 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1576         o.result_ok
1577 }
1578 #[no_mangle]
1579 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1580 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1581 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1582         fn drop(&mut self) {
1583                 if self.result_ok {
1584                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1585                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1586                         }
1587                 } else {
1588                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1589                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1590                         }
1591                 }
1592         }
1593 }
1594 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1595         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1596                 let contents = if o.result_ok {
1597                         let result = unsafe { o.contents.result };
1598                         unsafe { o.contents.result = core::ptr::null_mut() };
1599                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1600                 } else {
1601                         let err = unsafe { o.contents.err };
1602                         unsafe { o.contents.err = core::ptr::null_mut(); }
1603                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1604                 };
1605                 Self {
1606                         contents,
1607                         result_ok: o.result_ok,
1608                 }
1609         }
1610 }
1611 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1612         fn clone(&self) -> Self {
1613                 if self.result_ok {
1614                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1615                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1616                         } }
1617                 } else {
1618                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1619                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1620                         } }
1621                 }
1622         }
1623 }
1624 #[no_mangle]
1625 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1626 /// but with all dynamically-allocated buffers duplicated in new buffers.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1628 #[repr(C)]
1629 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1630 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1631         /// A pointer to the contents in the success state.
1632         /// Reading from this pointer when `result_ok` is not set is undefined.
1633         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1634         /// A pointer to the contents in the error state.
1635         /// Reading from this pointer when `result_ok` is set is undefined.
1636         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1637 }
1638 #[repr(C)]
1639 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1640 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1641 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1642 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1643         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1644         /// `err` or `result` depending on the state of `result_ok`.
1645         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1646         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1647         pub result_ok: bool,
1648 }
1649 #[no_mangle]
1650 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1651 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1652         CResult_ShutdownScriptInvalidShutdownScriptZ {
1653                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1654                         result: Box::into_raw(Box::new(o)),
1655                 },
1656                 result_ok: true,
1657         }
1658 }
1659 #[no_mangle]
1660 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1661 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1662         CResult_ShutdownScriptInvalidShutdownScriptZ {
1663                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1664                         err: Box::into_raw(Box::new(e)),
1665                 },
1666                 result_ok: false,
1667         }
1668 }
1669 /// Checks if the given object is currently in the success state
1670 #[no_mangle]
1671 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1672         o.result_ok
1673 }
1674 #[no_mangle]
1675 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1676 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1677 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1678         fn drop(&mut self) {
1679                 if self.result_ok {
1680                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1681                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1682                         }
1683                 } else {
1684                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1685                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1686                         }
1687                 }
1688         }
1689 }
1690 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1691         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1692                 let contents = if o.result_ok {
1693                         let result = unsafe { o.contents.result };
1694                         unsafe { o.contents.result = core::ptr::null_mut() };
1695                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1696                 } else {
1697                         let err = unsafe { o.contents.err };
1698                         unsafe { o.contents.err = core::ptr::null_mut(); }
1699                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1700                 };
1701                 Self {
1702                         contents,
1703                         result_ok: o.result_ok,
1704                 }
1705         }
1706 }
1707 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1708         fn clone(&self) -> Self {
1709                 if self.result_ok {
1710                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1711                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1712                         } }
1713                 } else {
1714                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1715                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1716                         } }
1717                 }
1718         }
1719 }
1720 #[no_mangle]
1721 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1722 /// but with all dynamically-allocated buffers duplicated in new buffers.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1724 #[repr(C)]
1725 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1726 /// This corresponds to std::vector in C++
1727 pub struct CVec_PublicKeyZ {
1728         /// The elements in the array.
1729         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1730         pub data: *mut crate::c_types::PublicKey,
1731         /// The number of elements pointed to by `data`.
1732         pub datalen: usize
1733 }
1734 impl CVec_PublicKeyZ {
1735         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1736                 if self.datalen == 0 { return Vec::new(); }
1737                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1738                 self.data = core::ptr::null_mut();
1739                 self.datalen = 0;
1740                 ret
1741         }
1742         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1743                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1744         }
1745 }
1746 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1747         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1748                 let datalen = v.len();
1749                 let data = Box::into_raw(v.into_boxed_slice());
1750                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1751         }
1752 }
1753 #[no_mangle]
1754 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1755 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1756 impl Drop for CVec_PublicKeyZ {
1757         fn drop(&mut self) {
1758                 if self.datalen == 0 { return; }
1759                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1760         }
1761 }
1762 impl Clone for CVec_PublicKeyZ {
1763         fn clone(&self) -> Self {
1764                 let mut res = Vec::new();
1765                 if self.datalen == 0 { return Self::from(res); }
1766                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1767                 Self::from(res)
1768         }
1769 }
1770 #[repr(C)]
1771 /// The contents of CResult_BlindedPathNoneZ
1772 pub union CResult_BlindedPathNoneZPtr {
1773         /// A pointer to the contents in the success state.
1774         /// Reading from this pointer when `result_ok` is not set is undefined.
1775         pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1776         /// Note that this value is always NULL, as there are no contents in the Err variant
1777         pub err: *mut core::ffi::c_void,
1778 }
1779 #[repr(C)]
1780 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
1781 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
1782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1783 pub struct CResult_BlindedPathNoneZ {
1784         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
1785         /// `err` or `result` depending on the state of `result_ok`.
1786         pub contents: CResult_BlindedPathNoneZPtr,
1787         /// Whether this CResult_BlindedPathNoneZ represents a success state.
1788         pub result_ok: bool,
1789 }
1790 #[no_mangle]
1791 /// Creates a new CResult_BlindedPathNoneZ in the success state.
1792 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
1793         CResult_BlindedPathNoneZ {
1794                 contents: CResult_BlindedPathNoneZPtr {
1795                         result: Box::into_raw(Box::new(o)),
1796                 },
1797                 result_ok: true,
1798         }
1799 }
1800 #[no_mangle]
1801 /// Creates a new CResult_BlindedPathNoneZ in the error state.
1802 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
1803         CResult_BlindedPathNoneZ {
1804                 contents: CResult_BlindedPathNoneZPtr {
1805                         err: core::ptr::null_mut(),
1806                 },
1807                 result_ok: false,
1808         }
1809 }
1810 /// Checks if the given object is currently in the success state
1811 #[no_mangle]
1812 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
1813         o.result_ok
1814 }
1815 #[no_mangle]
1816 /// Frees any resources used by the CResult_BlindedPathNoneZ.
1817 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
1818 impl Drop for CResult_BlindedPathNoneZ {
1819         fn drop(&mut self) {
1820                 if self.result_ok {
1821                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1822                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1823                         }
1824                 } else {
1825                 }
1826         }
1827 }
1828 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
1829         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>) -> Self {
1830                 let contents = if o.result_ok {
1831                         let result = unsafe { o.contents.result };
1832                         unsafe { o.contents.result = core::ptr::null_mut() };
1833                         CResult_BlindedPathNoneZPtr { result }
1834                 } else {
1835                         let _ = unsafe { Box::from_raw(o.contents.err) };
1836                         o.contents.err = core::ptr::null_mut();
1837                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
1838                 };
1839                 Self {
1840                         contents,
1841                         result_ok: o.result_ok,
1842                 }
1843         }
1844 }
1845 impl Clone for CResult_BlindedPathNoneZ {
1846         fn clone(&self) -> Self {
1847                 if self.result_ok {
1848                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
1849                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1850                         } }
1851                 } else {
1852                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
1853                                 err: core::ptr::null_mut()
1854                         } }
1855                 }
1856         }
1857 }
1858 #[no_mangle]
1859 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
1860 /// but with all dynamically-allocated buffers duplicated in new buffers.
1861 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
1862 #[repr(C)]
1863 /// The contents of CResult_BlindedPathDecodeErrorZ
1864 pub union CResult_BlindedPathDecodeErrorZPtr {
1865         /// A pointer to the contents in the success state.
1866         /// Reading from this pointer when `result_ok` is not set is undefined.
1867         pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1868         /// A pointer to the contents in the error state.
1869         /// Reading from this pointer when `result_ok` is set is undefined.
1870         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1871 }
1872 #[repr(C)]
1873 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
1874 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
1875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1876 pub struct CResult_BlindedPathDecodeErrorZ {
1877         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
1878         /// `err` or `result` depending on the state of `result_ok`.
1879         pub contents: CResult_BlindedPathDecodeErrorZPtr,
1880         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
1881         pub result_ok: bool,
1882 }
1883 #[no_mangle]
1884 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
1885 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
1886         CResult_BlindedPathDecodeErrorZ {
1887                 contents: CResult_BlindedPathDecodeErrorZPtr {
1888                         result: Box::into_raw(Box::new(o)),
1889                 },
1890                 result_ok: true,
1891         }
1892 }
1893 #[no_mangle]
1894 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
1895 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
1896         CResult_BlindedPathDecodeErrorZ {
1897                 contents: CResult_BlindedPathDecodeErrorZPtr {
1898                         err: Box::into_raw(Box::new(e)),
1899                 },
1900                 result_ok: false,
1901         }
1902 }
1903 /// Checks if the given object is currently in the success state
1904 #[no_mangle]
1905 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
1906         o.result_ok
1907 }
1908 #[no_mangle]
1909 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
1910 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
1911 impl Drop for CResult_BlindedPathDecodeErrorZ {
1912         fn drop(&mut self) {
1913                 if self.result_ok {
1914                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1915                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1916                         }
1917                 } else {
1918                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1919                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1920                         }
1921                 }
1922         }
1923 }
1924 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
1925         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
1926                 let contents = if o.result_ok {
1927                         let result = unsafe { o.contents.result };
1928                         unsafe { o.contents.result = core::ptr::null_mut() };
1929                         CResult_BlindedPathDecodeErrorZPtr { result }
1930                 } else {
1931                         let err = unsafe { o.contents.err };
1932                         unsafe { o.contents.err = core::ptr::null_mut(); }
1933                         CResult_BlindedPathDecodeErrorZPtr { err }
1934                 };
1935                 Self {
1936                         contents,
1937                         result_ok: o.result_ok,
1938                 }
1939         }
1940 }
1941 impl Clone for CResult_BlindedPathDecodeErrorZ {
1942         fn clone(&self) -> Self {
1943                 if self.result_ok {
1944                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
1945                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1946                         } }
1947                 } else {
1948                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
1949                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1950                         } }
1951                 }
1952         }
1953 }
1954 #[no_mangle]
1955 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
1956 /// but with all dynamically-allocated buffers duplicated in new buffers.
1957 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
1958 #[repr(C)]
1959 /// The contents of CResult_BlindedHopDecodeErrorZ
1960 pub union CResult_BlindedHopDecodeErrorZPtr {
1961         /// A pointer to the contents in the success state.
1962         /// Reading from this pointer when `result_ok` is not set is undefined.
1963         pub result: *mut crate::lightning::onion_message::blinded_path::BlindedHop,
1964         /// A pointer to the contents in the error state.
1965         /// Reading from this pointer when `result_ok` is set is undefined.
1966         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1967 }
1968 #[repr(C)]
1969 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
1970 /// containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1972 pub struct CResult_BlindedHopDecodeErrorZ {
1973         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
1974         /// `err` or `result` depending on the state of `result_ok`.
1975         pub contents: CResult_BlindedHopDecodeErrorZPtr,
1976         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
1977         pub result_ok: bool,
1978 }
1979 #[no_mangle]
1980 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
1981 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
1982         CResult_BlindedHopDecodeErrorZ {
1983                 contents: CResult_BlindedHopDecodeErrorZPtr {
1984                         result: Box::into_raw(Box::new(o)),
1985                 },
1986                 result_ok: true,
1987         }
1988 }
1989 #[no_mangle]
1990 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
1991 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
1992         CResult_BlindedHopDecodeErrorZ {
1993                 contents: CResult_BlindedHopDecodeErrorZPtr {
1994                         err: Box::into_raw(Box::new(e)),
1995                 },
1996                 result_ok: false,
1997         }
1998 }
1999 /// Checks if the given object is currently in the success state
2000 #[no_mangle]
2001 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
2002         o.result_ok
2003 }
2004 #[no_mangle]
2005 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
2006 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
2007 impl Drop for CResult_BlindedHopDecodeErrorZ {
2008         fn drop(&mut self) {
2009                 if self.result_ok {
2010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2012                         }
2013                 } else {
2014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2016                         }
2017                 }
2018         }
2019 }
2020 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
2021         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2022                 let contents = if o.result_ok {
2023                         let result = unsafe { o.contents.result };
2024                         unsafe { o.contents.result = core::ptr::null_mut() };
2025                         CResult_BlindedHopDecodeErrorZPtr { result }
2026                 } else {
2027                         let err = unsafe { o.contents.err };
2028                         unsafe { o.contents.err = core::ptr::null_mut(); }
2029                         CResult_BlindedHopDecodeErrorZPtr { err }
2030                 };
2031                 Self {
2032                         contents,
2033                         result_ok: o.result_ok,
2034                 }
2035         }
2036 }
2037 impl Clone for CResult_BlindedHopDecodeErrorZ {
2038         fn clone(&self) -> Self {
2039                 if self.result_ok {
2040                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
2041                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
2042                         } }
2043                 } else {
2044                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
2045                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2046                         } }
2047                 }
2048         }
2049 }
2050 #[no_mangle]
2051 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
2052 /// but with all dynamically-allocated buffers duplicated in new buffers.
2053 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
2054 #[repr(C)]
2055 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
2056 pub enum COption_WriteableScoreZ {
2057         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
2058         Some(crate::lightning::routing::scoring::WriteableScore),
2059         /// When we're in this state, this COption_WriteableScoreZ contains nothing
2060         None
2061 }
2062 impl COption_WriteableScoreZ {
2063         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2064                 if let Self::None = self { false } else { true }
2065         }
2066         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2067                 !self.is_some()
2068         }
2069         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
2070                 if let Self::Some(v) = self { v } else { unreachable!() }
2071         }
2072 }
2073 #[no_mangle]
2074 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
2075 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
2076         COption_WriteableScoreZ::Some(o)
2077 }
2078 #[no_mangle]
2079 /// Constructs a new COption_WriteableScoreZ containing nothing
2080 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
2081         COption_WriteableScoreZ::None
2082 }
2083 #[no_mangle]
2084 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
2085 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
2086 #[repr(C)]
2087 /// The contents of CResult_NoneErrorZ
2088 pub union CResult_NoneErrorZPtr {
2089         /// Note that this value is always NULL, as there are no contents in the OK variant
2090         pub result: *mut core::ffi::c_void,
2091         /// A pointer to the contents in the error state.
2092         /// Reading from this pointer when `result_ok` is set is undefined.
2093         pub err: *mut crate::c_types::IOError,
2094 }
2095 #[repr(C)]
2096 /// A CResult_NoneErrorZ represents the result of a fallible operation,
2097 /// containing a () on success and a crate::c_types::IOError on failure.
2098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2099 pub struct CResult_NoneErrorZ {
2100         /// The contents of this CResult_NoneErrorZ, accessible via either
2101         /// `err` or `result` depending on the state of `result_ok`.
2102         pub contents: CResult_NoneErrorZPtr,
2103         /// Whether this CResult_NoneErrorZ represents a success state.
2104         pub result_ok: bool,
2105 }
2106 #[no_mangle]
2107 /// Creates a new CResult_NoneErrorZ in the success state.
2108 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
2109         CResult_NoneErrorZ {
2110                 contents: CResult_NoneErrorZPtr {
2111                         result: core::ptr::null_mut(),
2112                 },
2113                 result_ok: true,
2114         }
2115 }
2116 #[no_mangle]
2117 /// Creates a new CResult_NoneErrorZ in the error state.
2118 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
2119         CResult_NoneErrorZ {
2120                 contents: CResult_NoneErrorZPtr {
2121                         err: Box::into_raw(Box::new(e)),
2122                 },
2123                 result_ok: false,
2124         }
2125 }
2126 /// Checks if the given object is currently in the success state
2127 #[no_mangle]
2128 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
2129         o.result_ok
2130 }
2131 #[no_mangle]
2132 /// Frees any resources used by the CResult_NoneErrorZ.
2133 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
2134 impl Drop for CResult_NoneErrorZ {
2135         fn drop(&mut self) {
2136                 if self.result_ok {
2137                 } else {
2138                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2139                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2140                         }
2141                 }
2142         }
2143 }
2144 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
2145         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
2146                 let contents = if o.result_ok {
2147                         let _ = unsafe { Box::from_raw(o.contents.result) };
2148                         o.contents.result = core::ptr::null_mut();
2149                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
2150                 } else {
2151                         let err = unsafe { o.contents.err };
2152                         unsafe { o.contents.err = core::ptr::null_mut(); }
2153                         CResult_NoneErrorZPtr { err }
2154                 };
2155                 Self {
2156                         contents,
2157                         result_ok: o.result_ok,
2158                 }
2159         }
2160 }
2161 impl Clone for CResult_NoneErrorZ {
2162         fn clone(&self) -> Self {
2163                 if self.result_ok {
2164                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
2165                                 result: core::ptr::null_mut()
2166                         } }
2167                 } else {
2168                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
2169                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
2170                         } }
2171                 }
2172         }
2173 }
2174 #[no_mangle]
2175 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
2176 /// but with all dynamically-allocated buffers duplicated in new buffers.
2177 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
2178 #[repr(C)]
2179 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2180 /// This corresponds to std::vector in C++
2181 pub struct CVec_ChannelDetailsZ {
2182         /// The elements in the array.
2183         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2184         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2185         /// The number of elements pointed to by `data`.
2186         pub datalen: usize
2187 }
2188 impl CVec_ChannelDetailsZ {
2189         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2190                 if self.datalen == 0 { return Vec::new(); }
2191                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2192                 self.data = core::ptr::null_mut();
2193                 self.datalen = 0;
2194                 ret
2195         }
2196         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2197                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2198         }
2199 }
2200 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2201         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2202                 let datalen = v.len();
2203                 let data = Box::into_raw(v.into_boxed_slice());
2204                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2205         }
2206 }
2207 #[no_mangle]
2208 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2209 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2210 impl Drop for CVec_ChannelDetailsZ {
2211         fn drop(&mut self) {
2212                 if self.datalen == 0 { return; }
2213                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2214         }
2215 }
2216 impl Clone for CVec_ChannelDetailsZ {
2217         fn clone(&self) -> Self {
2218                 let mut res = Vec::new();
2219                 if self.datalen == 0 { return Self::from(res); }
2220                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2221                 Self::from(res)
2222         }
2223 }
2224 #[repr(C)]
2225 /// The contents of CResult_RouteLightningErrorZ
2226 pub union CResult_RouteLightningErrorZPtr {
2227         /// A pointer to the contents in the success state.
2228         /// Reading from this pointer when `result_ok` is not set is undefined.
2229         pub result: *mut crate::lightning::routing::router::Route,
2230         /// A pointer to the contents in the error state.
2231         /// Reading from this pointer when `result_ok` is set is undefined.
2232         pub err: *mut crate::lightning::ln::msgs::LightningError,
2233 }
2234 #[repr(C)]
2235 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2236 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2238 pub struct CResult_RouteLightningErrorZ {
2239         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2240         /// `err` or `result` depending on the state of `result_ok`.
2241         pub contents: CResult_RouteLightningErrorZPtr,
2242         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2243         pub result_ok: bool,
2244 }
2245 #[no_mangle]
2246 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2247 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2248         CResult_RouteLightningErrorZ {
2249                 contents: CResult_RouteLightningErrorZPtr {
2250                         result: Box::into_raw(Box::new(o)),
2251                 },
2252                 result_ok: true,
2253         }
2254 }
2255 #[no_mangle]
2256 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2257 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2258         CResult_RouteLightningErrorZ {
2259                 contents: CResult_RouteLightningErrorZPtr {
2260                         err: Box::into_raw(Box::new(e)),
2261                 },
2262                 result_ok: false,
2263         }
2264 }
2265 /// Checks if the given object is currently in the success state
2266 #[no_mangle]
2267 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2268         o.result_ok
2269 }
2270 #[no_mangle]
2271 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2272 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2273 impl Drop for CResult_RouteLightningErrorZ {
2274         fn drop(&mut self) {
2275                 if self.result_ok {
2276                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2277                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2278                         }
2279                 } else {
2280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2282                         }
2283                 }
2284         }
2285 }
2286 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2287         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2288                 let contents = if o.result_ok {
2289                         let result = unsafe { o.contents.result };
2290                         unsafe { o.contents.result = core::ptr::null_mut() };
2291                         CResult_RouteLightningErrorZPtr { result }
2292                 } else {
2293                         let err = unsafe { o.contents.err };
2294                         unsafe { o.contents.err = core::ptr::null_mut(); }
2295                         CResult_RouteLightningErrorZPtr { err }
2296                 };
2297                 Self {
2298                         contents,
2299                         result_ok: o.result_ok,
2300                 }
2301         }
2302 }
2303 impl Clone for CResult_RouteLightningErrorZ {
2304         fn clone(&self) -> Self {
2305                 if self.result_ok {
2306                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2307                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2308                         } }
2309                 } else {
2310                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2311                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2312                         } }
2313                 }
2314         }
2315 }
2316 #[no_mangle]
2317 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2318 /// but with all dynamically-allocated buffers duplicated in new buffers.
2319 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2320 #[repr(C)]
2321 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2322 /// This corresponds to std::vector in C++
2323 pub struct CVec_RouteHopZ {
2324         /// The elements in the array.
2325         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2326         pub data: *mut crate::lightning::routing::router::RouteHop,
2327         /// The number of elements pointed to by `data`.
2328         pub datalen: usize
2329 }
2330 impl CVec_RouteHopZ {
2331         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2332                 if self.datalen == 0 { return Vec::new(); }
2333                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2334                 self.data = core::ptr::null_mut();
2335                 self.datalen = 0;
2336                 ret
2337         }
2338         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2339                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2340         }
2341 }
2342 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2343         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2344                 let datalen = v.len();
2345                 let data = Box::into_raw(v.into_boxed_slice());
2346                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2347         }
2348 }
2349 #[no_mangle]
2350 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2351 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2352 impl Drop for CVec_RouteHopZ {
2353         fn drop(&mut self) {
2354                 if self.datalen == 0 { return; }
2355                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2356         }
2357 }
2358 impl Clone for CVec_RouteHopZ {
2359         fn clone(&self) -> Self {
2360                 let mut res = Vec::new();
2361                 if self.datalen == 0 { return Self::from(res); }
2362                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2363                 Self::from(res)
2364         }
2365 }
2366 #[repr(C)]
2367 #[derive(Clone)]
2368 /// An enum which can either contain a u64 or not
2369 pub enum COption_u64Z {
2370         /// When we're in this state, this COption_u64Z contains a u64
2371         Some(u64),
2372         /// When we're in this state, this COption_u64Z contains nothing
2373         None
2374 }
2375 impl COption_u64Z {
2376         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2377                 if let Self::None = self { false } else { true }
2378         }
2379         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2380                 !self.is_some()
2381         }
2382         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2383                 if let Self::Some(v) = self { v } else { unreachable!() }
2384         }
2385 }
2386 #[no_mangle]
2387 /// Constructs a new COption_u64Z containing a u64
2388 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2389         COption_u64Z::Some(o)
2390 }
2391 #[no_mangle]
2392 /// Constructs a new COption_u64Z containing nothing
2393 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2394         COption_u64Z::None
2395 }
2396 #[no_mangle]
2397 /// Frees any resources associated with the u64, if we are in the Some state
2398 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2399 #[no_mangle]
2400 /// Creates a new COption_u64Z which has the same data as `orig`
2401 /// but with all dynamically-allocated buffers duplicated in new buffers.
2402 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2403 #[repr(C)]
2404 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2405 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2406         /// A pointer to the contents in the success state.
2407         /// Reading from this pointer when `result_ok` is not set is undefined.
2408         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2409         /// A pointer to the contents in the error state.
2410         /// Reading from this pointer when `result_ok` is set is undefined.
2411         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2412 }
2413 #[repr(C)]
2414 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2415 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2417 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2418         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2419         /// `err` or `result` depending on the state of `result_ok`.
2420         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2421         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2422         pub result_ok: bool,
2423 }
2424 #[no_mangle]
2425 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2426 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2427         CResult_InFlightHtlcsDecodeErrorZ {
2428                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2429                         result: Box::into_raw(Box::new(o)),
2430                 },
2431                 result_ok: true,
2432         }
2433 }
2434 #[no_mangle]
2435 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2436 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2437         CResult_InFlightHtlcsDecodeErrorZ {
2438                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2439                         err: Box::into_raw(Box::new(e)),
2440                 },
2441                 result_ok: false,
2442         }
2443 }
2444 /// Checks if the given object is currently in the success state
2445 #[no_mangle]
2446 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2447         o.result_ok
2448 }
2449 #[no_mangle]
2450 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2451 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2452 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2453         fn drop(&mut self) {
2454                 if self.result_ok {
2455                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2456                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2457                         }
2458                 } else {
2459                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2460                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2461                         }
2462                 }
2463         }
2464 }
2465 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2467                 let contents = if o.result_ok {
2468                         let result = unsafe { o.contents.result };
2469                         unsafe { o.contents.result = core::ptr::null_mut() };
2470                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
2471                 } else {
2472                         let err = unsafe { o.contents.err };
2473                         unsafe { o.contents.err = core::ptr::null_mut(); }
2474                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
2475                 };
2476                 Self {
2477                         contents,
2478                         result_ok: o.result_ok,
2479                 }
2480         }
2481 }
2482 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2483         fn clone(&self) -> Self {
2484                 if self.result_ok {
2485                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2486                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2487                         } }
2488                 } else {
2489                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2490                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2491                         } }
2492                 }
2493         }
2494 }
2495 #[no_mangle]
2496 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2497 /// but with all dynamically-allocated buffers duplicated in new buffers.
2498 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2499 #[repr(C)]
2500 /// The contents of CResult_RouteHopDecodeErrorZ
2501 pub union CResult_RouteHopDecodeErrorZPtr {
2502         /// A pointer to the contents in the success state.
2503         /// Reading from this pointer when `result_ok` is not set is undefined.
2504         pub result: *mut crate::lightning::routing::router::RouteHop,
2505         /// A pointer to the contents in the error state.
2506         /// Reading from this pointer when `result_ok` is set is undefined.
2507         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2508 }
2509 #[repr(C)]
2510 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2511 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2513 pub struct CResult_RouteHopDecodeErrorZ {
2514         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2515         /// `err` or `result` depending on the state of `result_ok`.
2516         pub contents: CResult_RouteHopDecodeErrorZPtr,
2517         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2518         pub result_ok: bool,
2519 }
2520 #[no_mangle]
2521 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2522 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2523         CResult_RouteHopDecodeErrorZ {
2524                 contents: CResult_RouteHopDecodeErrorZPtr {
2525                         result: Box::into_raw(Box::new(o)),
2526                 },
2527                 result_ok: true,
2528         }
2529 }
2530 #[no_mangle]
2531 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2532 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2533         CResult_RouteHopDecodeErrorZ {
2534                 contents: CResult_RouteHopDecodeErrorZPtr {
2535                         err: Box::into_raw(Box::new(e)),
2536                 },
2537                 result_ok: false,
2538         }
2539 }
2540 /// Checks if the given object is currently in the success state
2541 #[no_mangle]
2542 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2543         o.result_ok
2544 }
2545 #[no_mangle]
2546 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2547 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2548 impl Drop for CResult_RouteHopDecodeErrorZ {
2549         fn drop(&mut self) {
2550                 if self.result_ok {
2551                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2552                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2553                         }
2554                 } else {
2555                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2556                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2557                         }
2558                 }
2559         }
2560 }
2561 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2562         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2563                 let contents = if o.result_ok {
2564                         let result = unsafe { o.contents.result };
2565                         unsafe { o.contents.result = core::ptr::null_mut() };
2566                         CResult_RouteHopDecodeErrorZPtr { result }
2567                 } else {
2568                         let err = unsafe { o.contents.err };
2569                         unsafe { o.contents.err = core::ptr::null_mut(); }
2570                         CResult_RouteHopDecodeErrorZPtr { err }
2571                 };
2572                 Self {
2573                         contents,
2574                         result_ok: o.result_ok,
2575                 }
2576         }
2577 }
2578 impl Clone for CResult_RouteHopDecodeErrorZ {
2579         fn clone(&self) -> Self {
2580                 if self.result_ok {
2581                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2582                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2583                         } }
2584                 } else {
2585                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2586                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2587                         } }
2588                 }
2589         }
2590 }
2591 #[no_mangle]
2592 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2593 /// but with all dynamically-allocated buffers duplicated in new buffers.
2594 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2595 #[repr(C)]
2596 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2597 /// This corresponds to std::vector in C++
2598 pub struct CVec_CVec_RouteHopZZ {
2599         /// The elements in the array.
2600         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2601         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2602         /// The number of elements pointed to by `data`.
2603         pub datalen: usize
2604 }
2605 impl CVec_CVec_RouteHopZZ {
2606         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2607                 if self.datalen == 0 { return Vec::new(); }
2608                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2609                 self.data = core::ptr::null_mut();
2610                 self.datalen = 0;
2611                 ret
2612         }
2613         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2614                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2615         }
2616 }
2617 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2618         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2619                 let datalen = v.len();
2620                 let data = Box::into_raw(v.into_boxed_slice());
2621                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2622         }
2623 }
2624 #[no_mangle]
2625 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2626 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2627 impl Drop for CVec_CVec_RouteHopZZ {
2628         fn drop(&mut self) {
2629                 if self.datalen == 0 { return; }
2630                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2631         }
2632 }
2633 impl Clone for CVec_CVec_RouteHopZZ {
2634         fn clone(&self) -> Self {
2635                 let mut res = Vec::new();
2636                 if self.datalen == 0 { return Self::from(res); }
2637                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2638                 Self::from(res)
2639         }
2640 }
2641 #[repr(C)]
2642 /// The contents of CResult_RouteDecodeErrorZ
2643 pub union CResult_RouteDecodeErrorZPtr {
2644         /// A pointer to the contents in the success state.
2645         /// Reading from this pointer when `result_ok` is not set is undefined.
2646         pub result: *mut crate::lightning::routing::router::Route,
2647         /// A pointer to the contents in the error state.
2648         /// Reading from this pointer when `result_ok` is set is undefined.
2649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2650 }
2651 #[repr(C)]
2652 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2653 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2655 pub struct CResult_RouteDecodeErrorZ {
2656         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2657         /// `err` or `result` depending on the state of `result_ok`.
2658         pub contents: CResult_RouteDecodeErrorZPtr,
2659         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2660         pub result_ok: bool,
2661 }
2662 #[no_mangle]
2663 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2664 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2665         CResult_RouteDecodeErrorZ {
2666                 contents: CResult_RouteDecodeErrorZPtr {
2667                         result: Box::into_raw(Box::new(o)),
2668                 },
2669                 result_ok: true,
2670         }
2671 }
2672 #[no_mangle]
2673 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2674 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2675         CResult_RouteDecodeErrorZ {
2676                 contents: CResult_RouteDecodeErrorZPtr {
2677                         err: Box::into_raw(Box::new(e)),
2678                 },
2679                 result_ok: false,
2680         }
2681 }
2682 /// Checks if the given object is currently in the success state
2683 #[no_mangle]
2684 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2685         o.result_ok
2686 }
2687 #[no_mangle]
2688 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2689 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2690 impl Drop for CResult_RouteDecodeErrorZ {
2691         fn drop(&mut self) {
2692                 if self.result_ok {
2693                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2694                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2695                         }
2696                 } else {
2697                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2698                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2699                         }
2700                 }
2701         }
2702 }
2703 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2704         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2705                 let contents = if o.result_ok {
2706                         let result = unsafe { o.contents.result };
2707                         unsafe { o.contents.result = core::ptr::null_mut() };
2708                         CResult_RouteDecodeErrorZPtr { result }
2709                 } else {
2710                         let err = unsafe { o.contents.err };
2711                         unsafe { o.contents.err = core::ptr::null_mut(); }
2712                         CResult_RouteDecodeErrorZPtr { err }
2713                 };
2714                 Self {
2715                         contents,
2716                         result_ok: o.result_ok,
2717                 }
2718         }
2719 }
2720 impl Clone for CResult_RouteDecodeErrorZ {
2721         fn clone(&self) -> Self {
2722                 if self.result_ok {
2723                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2724                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2725                         } }
2726                 } else {
2727                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2728                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2729                         } }
2730                 }
2731         }
2732 }
2733 #[no_mangle]
2734 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2735 /// but with all dynamically-allocated buffers duplicated in new buffers.
2736 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2737 #[repr(C)]
2738 /// The contents of CResult_RouteParametersDecodeErrorZ
2739 pub union CResult_RouteParametersDecodeErrorZPtr {
2740         /// A pointer to the contents in the success state.
2741         /// Reading from this pointer when `result_ok` is not set is undefined.
2742         pub result: *mut crate::lightning::routing::router::RouteParameters,
2743         /// A pointer to the contents in the error state.
2744         /// Reading from this pointer when `result_ok` is set is undefined.
2745         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2746 }
2747 #[repr(C)]
2748 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2749 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2751 pub struct CResult_RouteParametersDecodeErrorZ {
2752         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2753         /// `err` or `result` depending on the state of `result_ok`.
2754         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2755         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2756         pub result_ok: bool,
2757 }
2758 #[no_mangle]
2759 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2760 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2761         CResult_RouteParametersDecodeErrorZ {
2762                 contents: CResult_RouteParametersDecodeErrorZPtr {
2763                         result: Box::into_raw(Box::new(o)),
2764                 },
2765                 result_ok: true,
2766         }
2767 }
2768 #[no_mangle]
2769 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2770 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2771         CResult_RouteParametersDecodeErrorZ {
2772                 contents: CResult_RouteParametersDecodeErrorZPtr {
2773                         err: Box::into_raw(Box::new(e)),
2774                 },
2775                 result_ok: false,
2776         }
2777 }
2778 /// Checks if the given object is currently in the success state
2779 #[no_mangle]
2780 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2781         o.result_ok
2782 }
2783 #[no_mangle]
2784 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2785 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2786 impl Drop for CResult_RouteParametersDecodeErrorZ {
2787         fn drop(&mut self) {
2788                 if self.result_ok {
2789                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2790                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2791                         }
2792                 } else {
2793                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2794                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2795                         }
2796                 }
2797         }
2798 }
2799 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2800         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2801                 let contents = if o.result_ok {
2802                         let result = unsafe { o.contents.result };
2803                         unsafe { o.contents.result = core::ptr::null_mut() };
2804                         CResult_RouteParametersDecodeErrorZPtr { result }
2805                 } else {
2806                         let err = unsafe { o.contents.err };
2807                         unsafe { o.contents.err = core::ptr::null_mut(); }
2808                         CResult_RouteParametersDecodeErrorZPtr { err }
2809                 };
2810                 Self {
2811                         contents,
2812                         result_ok: o.result_ok,
2813                 }
2814         }
2815 }
2816 impl Clone for CResult_RouteParametersDecodeErrorZ {
2817         fn clone(&self) -> Self {
2818                 if self.result_ok {
2819                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2820                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2821                         } }
2822                 } else {
2823                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2824                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2825                         } }
2826                 }
2827         }
2828 }
2829 #[no_mangle]
2830 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2831 /// but with all dynamically-allocated buffers duplicated in new buffers.
2832 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2833 #[repr(C)]
2834 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2835 /// This corresponds to std::vector in C++
2836 pub struct CVec_RouteHintZ {
2837         /// The elements in the array.
2838         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2839         pub data: *mut crate::lightning::routing::router::RouteHint,
2840         /// The number of elements pointed to by `data`.
2841         pub datalen: usize
2842 }
2843 impl CVec_RouteHintZ {
2844         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2845                 if self.datalen == 0 { return Vec::new(); }
2846                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2847                 self.data = core::ptr::null_mut();
2848                 self.datalen = 0;
2849                 ret
2850         }
2851         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2852                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2853         }
2854 }
2855 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2856         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2857                 let datalen = v.len();
2858                 let data = Box::into_raw(v.into_boxed_slice());
2859                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2860         }
2861 }
2862 #[no_mangle]
2863 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2864 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2865 impl Drop for CVec_RouteHintZ {
2866         fn drop(&mut self) {
2867                 if self.datalen == 0 { return; }
2868                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2869         }
2870 }
2871 impl Clone for CVec_RouteHintZ {
2872         fn clone(&self) -> Self {
2873                 let mut res = Vec::new();
2874                 if self.datalen == 0 { return Self::from(res); }
2875                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2876                 Self::from(res)
2877         }
2878 }
2879 #[repr(C)]
2880 /// A dynamically-allocated array of u64s of arbitrary size.
2881 /// This corresponds to std::vector in C++
2882 pub struct CVec_u64Z {
2883         /// The elements in the array.
2884         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2885         pub data: *mut u64,
2886         /// The number of elements pointed to by `data`.
2887         pub datalen: usize
2888 }
2889 impl CVec_u64Z {
2890         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2891                 if self.datalen == 0 { return Vec::new(); }
2892                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2893                 self.data = core::ptr::null_mut();
2894                 self.datalen = 0;
2895                 ret
2896         }
2897         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2898                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2899         }
2900 }
2901 impl From<Vec<u64>> for CVec_u64Z {
2902         fn from(v: Vec<u64>) -> Self {
2903                 let datalen = v.len();
2904                 let data = Box::into_raw(v.into_boxed_slice());
2905                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2906         }
2907 }
2908 #[no_mangle]
2909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2910 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2911 impl Drop for CVec_u64Z {
2912         fn drop(&mut self) {
2913                 if self.datalen == 0 { return; }
2914                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2915         }
2916 }
2917 impl Clone for CVec_u64Z {
2918         fn clone(&self) -> Self {
2919                 let mut res = Vec::new();
2920                 if self.datalen == 0 { return Self::from(res); }
2921                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2922                 Self::from(res)
2923         }
2924 }
2925 #[repr(C)]
2926 /// The contents of CResult_PaymentParametersDecodeErrorZ
2927 pub union CResult_PaymentParametersDecodeErrorZPtr {
2928         /// A pointer to the contents in the success state.
2929         /// Reading from this pointer when `result_ok` is not set is undefined.
2930         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2931         /// A pointer to the contents in the error state.
2932         /// Reading from this pointer when `result_ok` is set is undefined.
2933         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2934 }
2935 #[repr(C)]
2936 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2937 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2939 pub struct CResult_PaymentParametersDecodeErrorZ {
2940         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2941         /// `err` or `result` depending on the state of `result_ok`.
2942         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2943         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2944         pub result_ok: bool,
2945 }
2946 #[no_mangle]
2947 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2948 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2949         CResult_PaymentParametersDecodeErrorZ {
2950                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2951                         result: Box::into_raw(Box::new(o)),
2952                 },
2953                 result_ok: true,
2954         }
2955 }
2956 #[no_mangle]
2957 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2958 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2959         CResult_PaymentParametersDecodeErrorZ {
2960                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2961                         err: Box::into_raw(Box::new(e)),
2962                 },
2963                 result_ok: false,
2964         }
2965 }
2966 /// Checks if the given object is currently in the success state
2967 #[no_mangle]
2968 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2969         o.result_ok
2970 }
2971 #[no_mangle]
2972 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2973 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2974 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2975         fn drop(&mut self) {
2976                 if self.result_ok {
2977                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2978                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2979                         }
2980                 } else {
2981                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2982                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2983                         }
2984                 }
2985         }
2986 }
2987 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2988         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2989                 let contents = if o.result_ok {
2990                         let result = unsafe { o.contents.result };
2991                         unsafe { o.contents.result = core::ptr::null_mut() };
2992                         CResult_PaymentParametersDecodeErrorZPtr { result }
2993                 } else {
2994                         let err = unsafe { o.contents.err };
2995                         unsafe { o.contents.err = core::ptr::null_mut(); }
2996                         CResult_PaymentParametersDecodeErrorZPtr { err }
2997                 };
2998                 Self {
2999                         contents,
3000                         result_ok: o.result_ok,
3001                 }
3002         }
3003 }
3004 impl Clone for CResult_PaymentParametersDecodeErrorZ {
3005         fn clone(&self) -> Self {
3006                 if self.result_ok {
3007                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
3008                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
3009                         } }
3010                 } else {
3011                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
3012                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3013                         } }
3014                 }
3015         }
3016 }
3017 #[no_mangle]
3018 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
3019 /// but with all dynamically-allocated buffers duplicated in new buffers.
3020 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
3021 #[repr(C)]
3022 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
3023 /// This corresponds to std::vector in C++
3024 pub struct CVec_RouteHintHopZ {
3025         /// The elements in the array.
3026         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3027         pub data: *mut crate::lightning::routing::router::RouteHintHop,
3028         /// The number of elements pointed to by `data`.
3029         pub datalen: usize
3030 }
3031 impl CVec_RouteHintHopZ {
3032         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
3033                 if self.datalen == 0 { return Vec::new(); }
3034                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3035                 self.data = core::ptr::null_mut();
3036                 self.datalen = 0;
3037                 ret
3038         }
3039         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
3040                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3041         }
3042 }
3043 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
3044         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
3045                 let datalen = v.len();
3046                 let data = Box::into_raw(v.into_boxed_slice());
3047                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3048         }
3049 }
3050 #[no_mangle]
3051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3052 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
3053 impl Drop for CVec_RouteHintHopZ {
3054         fn drop(&mut self) {
3055                 if self.datalen == 0 { return; }
3056                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3057         }
3058 }
3059 impl Clone for CVec_RouteHintHopZ {
3060         fn clone(&self) -> Self {
3061                 let mut res = Vec::new();
3062                 if self.datalen == 0 { return Self::from(res); }
3063                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3064                 Self::from(res)
3065         }
3066 }
3067 #[repr(C)]
3068 /// The contents of CResult_RouteHintDecodeErrorZ
3069 pub union CResult_RouteHintDecodeErrorZPtr {
3070         /// A pointer to the contents in the success state.
3071         /// Reading from this pointer when `result_ok` is not set is undefined.
3072         pub result: *mut crate::lightning::routing::router::RouteHint,
3073         /// A pointer to the contents in the error state.
3074         /// Reading from this pointer when `result_ok` is set is undefined.
3075         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3076 }
3077 #[repr(C)]
3078 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
3079 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
3080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3081 pub struct CResult_RouteHintDecodeErrorZ {
3082         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
3083         /// `err` or `result` depending on the state of `result_ok`.
3084         pub contents: CResult_RouteHintDecodeErrorZPtr,
3085         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
3086         pub result_ok: bool,
3087 }
3088 #[no_mangle]
3089 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
3090 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
3091         CResult_RouteHintDecodeErrorZ {
3092                 contents: CResult_RouteHintDecodeErrorZPtr {
3093                         result: Box::into_raw(Box::new(o)),
3094                 },
3095                 result_ok: true,
3096         }
3097 }
3098 #[no_mangle]
3099 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
3100 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
3101         CResult_RouteHintDecodeErrorZ {
3102                 contents: CResult_RouteHintDecodeErrorZPtr {
3103                         err: Box::into_raw(Box::new(e)),
3104                 },
3105                 result_ok: false,
3106         }
3107 }
3108 /// Checks if the given object is currently in the success state
3109 #[no_mangle]
3110 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
3111         o.result_ok
3112 }
3113 #[no_mangle]
3114 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
3115 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
3116 impl Drop for CResult_RouteHintDecodeErrorZ {
3117         fn drop(&mut self) {
3118                 if self.result_ok {
3119                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3120                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3121                         }
3122                 } else {
3123                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3124                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3125                         }
3126                 }
3127         }
3128 }
3129 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
3130         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
3131                 let contents = if o.result_ok {
3132                         let result = unsafe { o.contents.result };
3133                         unsafe { o.contents.result = core::ptr::null_mut() };
3134                         CResult_RouteHintDecodeErrorZPtr { result }
3135                 } else {
3136                         let err = unsafe { o.contents.err };
3137                         unsafe { o.contents.err = core::ptr::null_mut(); }
3138                         CResult_RouteHintDecodeErrorZPtr { err }
3139                 };
3140                 Self {
3141                         contents,
3142                         result_ok: o.result_ok,
3143                 }
3144         }
3145 }
3146 impl Clone for CResult_RouteHintDecodeErrorZ {
3147         fn clone(&self) -> Self {
3148                 if self.result_ok {
3149                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
3150                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
3151                         } }
3152                 } else {
3153                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
3154                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3155                         } }
3156                 }
3157         }
3158 }
3159 #[no_mangle]
3160 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
3161 /// but with all dynamically-allocated buffers duplicated in new buffers.
3162 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
3163 #[repr(C)]
3164 /// The contents of CResult_RouteHintHopDecodeErrorZ
3165 pub union CResult_RouteHintHopDecodeErrorZPtr {
3166         /// A pointer to the contents in the success state.
3167         /// Reading from this pointer when `result_ok` is not set is undefined.
3168         pub result: *mut crate::lightning::routing::router::RouteHintHop,
3169         /// A pointer to the contents in the error state.
3170         /// Reading from this pointer when `result_ok` is set is undefined.
3171         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3172 }
3173 #[repr(C)]
3174 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
3175 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
3176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3177 pub struct CResult_RouteHintHopDecodeErrorZ {
3178         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
3179         /// `err` or `result` depending on the state of `result_ok`.
3180         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
3181         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
3182         pub result_ok: bool,
3183 }
3184 #[no_mangle]
3185 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3186 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3187         CResult_RouteHintHopDecodeErrorZ {
3188                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3189                         result: Box::into_raw(Box::new(o)),
3190                 },
3191                 result_ok: true,
3192         }
3193 }
3194 #[no_mangle]
3195 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3196 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3197         CResult_RouteHintHopDecodeErrorZ {
3198                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3199                         err: Box::into_raw(Box::new(e)),
3200                 },
3201                 result_ok: false,
3202         }
3203 }
3204 /// Checks if the given object is currently in the success state
3205 #[no_mangle]
3206 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3207         o.result_ok
3208 }
3209 #[no_mangle]
3210 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3211 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3212 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3213         fn drop(&mut self) {
3214                 if self.result_ok {
3215                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3216                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3217                         }
3218                 } else {
3219                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3220                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3221                         }
3222                 }
3223         }
3224 }
3225 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3226         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3227                 let contents = if o.result_ok {
3228                         let result = unsafe { o.contents.result };
3229                         unsafe { o.contents.result = core::ptr::null_mut() };
3230                         CResult_RouteHintHopDecodeErrorZPtr { result }
3231                 } else {
3232                         let err = unsafe { o.contents.err };
3233                         unsafe { o.contents.err = core::ptr::null_mut(); }
3234                         CResult_RouteHintHopDecodeErrorZPtr { err }
3235                 };
3236                 Self {
3237                         contents,
3238                         result_ok: o.result_ok,
3239                 }
3240         }
3241 }
3242 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3243         fn clone(&self) -> Self {
3244                 if self.result_ok {
3245                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3246                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3247                         } }
3248                 } else {
3249                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3250                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3251                         } }
3252                 }
3253         }
3254 }
3255 #[no_mangle]
3256 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3257 /// but with all dynamically-allocated buffers duplicated in new buffers.
3258 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3259 #[repr(C)]
3260 /// The contents of CResult_PaymentPurposeDecodeErrorZ
3261 pub union CResult_PaymentPurposeDecodeErrorZPtr {
3262         /// A pointer to the contents in the success state.
3263         /// Reading from this pointer when `result_ok` is not set is undefined.
3264         pub result: *mut crate::lightning::util::events::PaymentPurpose,
3265         /// A pointer to the contents in the error state.
3266         /// Reading from this pointer when `result_ok` is set is undefined.
3267         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3268 }
3269 #[repr(C)]
3270 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3271 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3273 pub struct CResult_PaymentPurposeDecodeErrorZ {
3274         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3275         /// `err` or `result` depending on the state of `result_ok`.
3276         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
3277         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
3278         pub result_ok: bool,
3279 }
3280 #[no_mangle]
3281 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
3282 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
3283         CResult_PaymentPurposeDecodeErrorZ {
3284                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3285                         result: Box::into_raw(Box::new(o)),
3286                 },
3287                 result_ok: true,
3288         }
3289 }
3290 #[no_mangle]
3291 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
3292 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
3293         CResult_PaymentPurposeDecodeErrorZ {
3294                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3295                         err: Box::into_raw(Box::new(e)),
3296                 },
3297                 result_ok: false,
3298         }
3299 }
3300 /// Checks if the given object is currently in the success state
3301 #[no_mangle]
3302 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
3303         o.result_ok
3304 }
3305 #[no_mangle]
3306 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
3307 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
3308 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
3309         fn drop(&mut self) {
3310                 if self.result_ok {
3311                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3312                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3313                         }
3314                 } else {
3315                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3316                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3317                         }
3318                 }
3319         }
3320 }
3321 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
3322         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
3323                 let contents = if o.result_ok {
3324                         let result = unsafe { o.contents.result };
3325                         unsafe { o.contents.result = core::ptr::null_mut() };
3326                         CResult_PaymentPurposeDecodeErrorZPtr { result }
3327                 } else {
3328                         let err = unsafe { o.contents.err };
3329                         unsafe { o.contents.err = core::ptr::null_mut(); }
3330                         CResult_PaymentPurposeDecodeErrorZPtr { err }
3331                 };
3332                 Self {
3333                         contents,
3334                         result_ok: o.result_ok,
3335                 }
3336         }
3337 }
3338 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
3339         fn clone(&self) -> Self {
3340                 if self.result_ok {
3341                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3342                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3343                         } }
3344                 } else {
3345                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3346                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3347                         } }
3348                 }
3349         }
3350 }
3351 #[no_mangle]
3352 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3353 /// but with all dynamically-allocated buffers duplicated in new buffers.
3354 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3355 #[repr(C)]
3356 #[derive(Clone)]
3357 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3358 pub enum COption_NetworkUpdateZ {
3359         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3360         Some(crate::lightning::routing::gossip::NetworkUpdate),
3361         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3362         None
3363 }
3364 impl COption_NetworkUpdateZ {
3365         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3366                 if let Self::None = self { false } else { true }
3367         }
3368         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3369                 !self.is_some()
3370         }
3371         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3372                 if let Self::Some(v) = self { v } else { unreachable!() }
3373         }
3374 }
3375 #[no_mangle]
3376 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3377 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3378         COption_NetworkUpdateZ::Some(o)
3379 }
3380 #[no_mangle]
3381 /// Constructs a new COption_NetworkUpdateZ containing nothing
3382 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3383         COption_NetworkUpdateZ::None
3384 }
3385 #[no_mangle]
3386 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3387 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3388 #[no_mangle]
3389 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3390 /// but with all dynamically-allocated buffers duplicated in new buffers.
3391 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3392 #[repr(C)]
3393 #[derive(Clone)]
3394 /// An enum which can either contain a crate::lightning::util::events::PathFailure or not
3395 pub enum COption_PathFailureZ {
3396         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure
3397         Some(crate::lightning::util::events::PathFailure),
3398         /// When we're in this state, this COption_PathFailureZ contains nothing
3399         None
3400 }
3401 impl COption_PathFailureZ {
3402         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3403                 if let Self::None = self { false } else { true }
3404         }
3405         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3406                 !self.is_some()
3407         }
3408         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::PathFailure {
3409                 if let Self::Some(v) = self { v } else { unreachable!() }
3410         }
3411 }
3412 #[no_mangle]
3413 /// Constructs a new COption_PathFailureZ containing a crate::lightning::util::events::PathFailure
3414 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::util::events::PathFailure) -> COption_PathFailureZ {
3415         COption_PathFailureZ::Some(o)
3416 }
3417 #[no_mangle]
3418 /// Constructs a new COption_PathFailureZ containing nothing
3419 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
3420         COption_PathFailureZ::None
3421 }
3422 #[no_mangle]
3423 /// Frees any resources associated with the crate::lightning::util::events::PathFailure, if we are in the Some state
3424 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
3425 #[no_mangle]
3426 /// Creates a new COption_PathFailureZ which has the same data as `orig`
3427 /// but with all dynamically-allocated buffers duplicated in new buffers.
3428 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
3429 #[repr(C)]
3430 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
3431 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
3432         /// A pointer to the contents in the success state.
3433         /// Reading from this pointer when `result_ok` is not set is undefined.
3434         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
3435         /// A pointer to the contents in the error state.
3436         /// Reading from this pointer when `result_ok` is set is undefined.
3437         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3438 }
3439 #[repr(C)]
3440 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
3441 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3443 pub struct CResult_COption_PathFailureZDecodeErrorZ {
3444         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
3445         /// `err` or `result` depending on the state of `result_ok`.
3446         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
3447         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
3448         pub result_ok: bool,
3449 }
3450 #[no_mangle]
3451 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
3452 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
3453         CResult_COption_PathFailureZDecodeErrorZ {
3454                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3455                         result: Box::into_raw(Box::new(o)),
3456                 },
3457                 result_ok: true,
3458         }
3459 }
3460 #[no_mangle]
3461 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
3462 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
3463         CResult_COption_PathFailureZDecodeErrorZ {
3464                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3465                         err: Box::into_raw(Box::new(e)),
3466                 },
3467                 result_ok: false,
3468         }
3469 }
3470 /// Checks if the given object is currently in the success state
3471 #[no_mangle]
3472 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
3473         o.result_ok
3474 }
3475 #[no_mangle]
3476 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
3477 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
3478 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
3479         fn drop(&mut self) {
3480                 if self.result_ok {
3481                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3482                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3483                         }
3484                 } else {
3485                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3486                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3487                         }
3488                 }
3489         }
3490 }
3491 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
3492         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3493                 let contents = if o.result_ok {
3494                         let result = unsafe { o.contents.result };
3495                         unsafe { o.contents.result = core::ptr::null_mut() };
3496                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
3497                 } else {
3498                         let err = unsafe { o.contents.err };
3499                         unsafe { o.contents.err = core::ptr::null_mut(); }
3500                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
3501                 };
3502                 Self {
3503                         contents,
3504                         result_ok: o.result_ok,
3505                 }
3506         }
3507 }
3508 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
3509         fn clone(&self) -> Self {
3510                 if self.result_ok {
3511                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3512                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
3513                         } }
3514                 } else {
3515                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
3516                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3517                         } }
3518                 }
3519         }
3520 }
3521 #[no_mangle]
3522 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
3523 /// but with all dynamically-allocated buffers duplicated in new buffers.
3524 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
3525 #[repr(C)]
3526 #[derive(Clone)]
3527 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3528 pub enum COption_ClosureReasonZ {
3529         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3530         Some(crate::lightning::util::events::ClosureReason),
3531         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3532         None
3533 }
3534 impl COption_ClosureReasonZ {
3535         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3536                 if let Self::None = self { false } else { true }
3537         }
3538         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3539                 !self.is_some()
3540         }
3541         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3542                 if let Self::Some(v) = self { v } else { unreachable!() }
3543         }
3544 }
3545 #[no_mangle]
3546 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3547 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3548         COption_ClosureReasonZ::Some(o)
3549 }
3550 #[no_mangle]
3551 /// Constructs a new COption_ClosureReasonZ containing nothing
3552 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3553         COption_ClosureReasonZ::None
3554 }
3555 #[no_mangle]
3556 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3557 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3558 #[no_mangle]
3559 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3560 /// but with all dynamically-allocated buffers duplicated in new buffers.
3561 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3562 #[repr(C)]
3563 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3564 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3565         /// A pointer to the contents in the success state.
3566         /// Reading from this pointer when `result_ok` is not set is undefined.
3567         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3568         /// A pointer to the contents in the error state.
3569         /// Reading from this pointer when `result_ok` is set is undefined.
3570         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3571 }
3572 #[repr(C)]
3573 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3574 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3576 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3577         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3578         /// `err` or `result` depending on the state of `result_ok`.
3579         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3580         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3581         pub result_ok: bool,
3582 }
3583 #[no_mangle]
3584 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3585 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3586         CResult_COption_ClosureReasonZDecodeErrorZ {
3587                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3588                         result: Box::into_raw(Box::new(o)),
3589                 },
3590                 result_ok: true,
3591         }
3592 }
3593 #[no_mangle]
3594 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3595 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3596         CResult_COption_ClosureReasonZDecodeErrorZ {
3597                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3598                         err: Box::into_raw(Box::new(e)),
3599                 },
3600                 result_ok: false,
3601         }
3602 }
3603 /// Checks if the given object is currently in the success state
3604 #[no_mangle]
3605 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3606         o.result_ok
3607 }
3608 #[no_mangle]
3609 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3610 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3611 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3612         fn drop(&mut self) {
3613                 if self.result_ok {
3614                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3615                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3616                         }
3617                 } else {
3618                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3619                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3620                         }
3621                 }
3622         }
3623 }
3624 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3625         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3626                 let contents = if o.result_ok {
3627                         let result = unsafe { o.contents.result };
3628                         unsafe { o.contents.result = core::ptr::null_mut() };
3629                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3630                 } else {
3631                         let err = unsafe { o.contents.err };
3632                         unsafe { o.contents.err = core::ptr::null_mut(); }
3633                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3634                 };
3635                 Self {
3636                         contents,
3637                         result_ok: o.result_ok,
3638                 }
3639         }
3640 }
3641 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3642         fn clone(&self) -> Self {
3643                 if self.result_ok {
3644                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3645                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3646                         } }
3647                 } else {
3648                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3649                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3650                         } }
3651                 }
3652         }
3653 }
3654 #[no_mangle]
3655 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3656 /// but with all dynamically-allocated buffers duplicated in new buffers.
3657 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3658 #[repr(C)]
3659 #[derive(Clone)]
3660 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3661 pub enum COption_HTLCDestinationZ {
3662         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3663         Some(crate::lightning::util::events::HTLCDestination),
3664         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3665         None
3666 }
3667 impl COption_HTLCDestinationZ {
3668         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3669                 if let Self::None = self { false } else { true }
3670         }
3671         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3672                 !self.is_some()
3673         }
3674         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3675                 if let Self::Some(v) = self { v } else { unreachable!() }
3676         }
3677 }
3678 #[no_mangle]
3679 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3680 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3681         COption_HTLCDestinationZ::Some(o)
3682 }
3683 #[no_mangle]
3684 /// Constructs a new COption_HTLCDestinationZ containing nothing
3685 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3686         COption_HTLCDestinationZ::None
3687 }
3688 #[no_mangle]
3689 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3690 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3691 #[no_mangle]
3692 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3693 /// but with all dynamically-allocated buffers duplicated in new buffers.
3694 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3695 #[repr(C)]
3696 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3697 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3698         /// A pointer to the contents in the success state.
3699         /// Reading from this pointer when `result_ok` is not set is undefined.
3700         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3701         /// A pointer to the contents in the error state.
3702         /// Reading from this pointer when `result_ok` is set is undefined.
3703         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3704 }
3705 #[repr(C)]
3706 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3707 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3709 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3710         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3711         /// `err` or `result` depending on the state of `result_ok`.
3712         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3713         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3714         pub result_ok: bool,
3715 }
3716 #[no_mangle]
3717 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3718 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3719         CResult_COption_HTLCDestinationZDecodeErrorZ {
3720                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3721                         result: Box::into_raw(Box::new(o)),
3722                 },
3723                 result_ok: true,
3724         }
3725 }
3726 #[no_mangle]
3727 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3728 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3729         CResult_COption_HTLCDestinationZDecodeErrorZ {
3730                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3731                         err: Box::into_raw(Box::new(e)),
3732                 },
3733                 result_ok: false,
3734         }
3735 }
3736 /// Checks if the given object is currently in the success state
3737 #[no_mangle]
3738 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3739         o.result_ok
3740 }
3741 #[no_mangle]
3742 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3743 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3744 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3745         fn drop(&mut self) {
3746                 if self.result_ok {
3747                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3748                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3749                         }
3750                 } else {
3751                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3752                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3753                         }
3754                 }
3755         }
3756 }
3757 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3758         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3759                 let contents = if o.result_ok {
3760                         let result = unsafe { o.contents.result };
3761                         unsafe { o.contents.result = core::ptr::null_mut() };
3762                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3763                 } else {
3764                         let err = unsafe { o.contents.err };
3765                         unsafe { o.contents.err = core::ptr::null_mut(); }
3766                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3767                 };
3768                 Self {
3769                         contents,
3770                         result_ok: o.result_ok,
3771                 }
3772         }
3773 }
3774 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3775         fn clone(&self) -> Self {
3776                 if self.result_ok {
3777                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3778                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3779                         } }
3780                 } else {
3781                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3782                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3783                         } }
3784                 }
3785         }
3786 }
3787 #[no_mangle]
3788 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3789 /// but with all dynamically-allocated buffers duplicated in new buffers.
3790 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3791 #[repr(C)]
3792 #[derive(Clone)]
3793 /// An enum which can either contain a crate::c_types::U128 or not
3794 pub enum COption_u128Z {
3795         /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
3796         Some(crate::c_types::U128),
3797         /// When we're in this state, this COption_u128Z contains nothing
3798         None
3799 }
3800 impl COption_u128Z {
3801         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3802                 if let Self::None = self { false } else { true }
3803         }
3804         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3805                 !self.is_some()
3806         }
3807         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
3808                 if let Self::Some(v) = self { v } else { unreachable!() }
3809         }
3810 }
3811 #[no_mangle]
3812 /// Constructs a new COption_u128Z containing a crate::c_types::U128
3813 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
3814         COption_u128Z::Some(o)
3815 }
3816 #[no_mangle]
3817 /// Constructs a new COption_u128Z containing nothing
3818 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
3819         COption_u128Z::None
3820 }
3821 #[no_mangle]
3822 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
3823 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
3824 #[no_mangle]
3825 /// Creates a new COption_u128Z which has the same data as `orig`
3826 /// but with all dynamically-allocated buffers duplicated in new buffers.
3827 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
3828 #[repr(C)]
3829 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3830 /// This corresponds to std::vector in C++
3831 pub struct CVec_SpendableOutputDescriptorZ {
3832         /// The elements in the array.
3833         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3834         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3835         /// The number of elements pointed to by `data`.
3836         pub datalen: usize
3837 }
3838 impl CVec_SpendableOutputDescriptorZ {
3839         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3840                 if self.datalen == 0 { return Vec::new(); }
3841                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3842                 self.data = core::ptr::null_mut();
3843                 self.datalen = 0;
3844                 ret
3845         }
3846         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3847                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3848         }
3849 }
3850 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3851         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3852                 let datalen = v.len();
3853                 let data = Box::into_raw(v.into_boxed_slice());
3854                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3855         }
3856 }
3857 #[no_mangle]
3858 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3859 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3860 impl Drop for CVec_SpendableOutputDescriptorZ {
3861         fn drop(&mut self) {
3862                 if self.datalen == 0 { return; }
3863                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3864         }
3865 }
3866 impl Clone for CVec_SpendableOutputDescriptorZ {
3867         fn clone(&self) -> Self {
3868                 let mut res = Vec::new();
3869                 if self.datalen == 0 { return Self::from(res); }
3870                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3871                 Self::from(res)
3872         }
3873 }
3874 #[repr(C)]
3875 #[derive(Clone)]
3876 /// An enum which can either contain a crate::lightning::util::events::Event or not
3877 pub enum COption_EventZ {
3878         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3879         Some(crate::lightning::util::events::Event),
3880         /// When we're in this state, this COption_EventZ contains nothing
3881         None
3882 }
3883 impl COption_EventZ {
3884         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3885                 if let Self::None = self { false } else { true }
3886         }
3887         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3888                 !self.is_some()
3889         }
3890         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3891                 if let Self::Some(v) = self { v } else { unreachable!() }
3892         }
3893 }
3894 #[no_mangle]
3895 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3896 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3897         COption_EventZ::Some(o)
3898 }
3899 #[no_mangle]
3900 /// Constructs a new COption_EventZ containing nothing
3901 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3902         COption_EventZ::None
3903 }
3904 #[no_mangle]
3905 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3906 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3907 #[no_mangle]
3908 /// Creates a new COption_EventZ which has the same data as `orig`
3909 /// but with all dynamically-allocated buffers duplicated in new buffers.
3910 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3911 #[repr(C)]
3912 /// The contents of CResult_COption_EventZDecodeErrorZ
3913 pub union CResult_COption_EventZDecodeErrorZPtr {
3914         /// A pointer to the contents in the success state.
3915         /// Reading from this pointer when `result_ok` is not set is undefined.
3916         pub result: *mut crate::c_types::derived::COption_EventZ,
3917         /// A pointer to the contents in the error state.
3918         /// Reading from this pointer when `result_ok` is set is undefined.
3919         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3920 }
3921 #[repr(C)]
3922 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3923 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3924 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3925 pub struct CResult_COption_EventZDecodeErrorZ {
3926         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3927         /// `err` or `result` depending on the state of `result_ok`.
3928         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3929         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3930         pub result_ok: bool,
3931 }
3932 #[no_mangle]
3933 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3934 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3935         CResult_COption_EventZDecodeErrorZ {
3936                 contents: CResult_COption_EventZDecodeErrorZPtr {
3937                         result: Box::into_raw(Box::new(o)),
3938                 },
3939                 result_ok: true,
3940         }
3941 }
3942 #[no_mangle]
3943 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3944 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3945         CResult_COption_EventZDecodeErrorZ {
3946                 contents: CResult_COption_EventZDecodeErrorZPtr {
3947                         err: Box::into_raw(Box::new(e)),
3948                 },
3949                 result_ok: false,
3950         }
3951 }
3952 /// Checks if the given object is currently in the success state
3953 #[no_mangle]
3954 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3955         o.result_ok
3956 }
3957 #[no_mangle]
3958 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3959 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3960 impl Drop for CResult_COption_EventZDecodeErrorZ {
3961         fn drop(&mut self) {
3962                 if self.result_ok {
3963                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3964                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3965                         }
3966                 } else {
3967                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3968                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3969                         }
3970                 }
3971         }
3972 }
3973 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3974         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3975                 let contents = if o.result_ok {
3976                         let result = unsafe { o.contents.result };
3977                         unsafe { o.contents.result = core::ptr::null_mut() };
3978                         CResult_COption_EventZDecodeErrorZPtr { result }
3979                 } else {
3980                         let err = unsafe { o.contents.err };
3981                         unsafe { o.contents.err = core::ptr::null_mut(); }
3982                         CResult_COption_EventZDecodeErrorZPtr { err }
3983                 };
3984                 Self {
3985                         contents,
3986                         result_ok: o.result_ok,
3987                 }
3988         }
3989 }
3990 impl Clone for CResult_COption_EventZDecodeErrorZ {
3991         fn clone(&self) -> Self {
3992                 if self.result_ok {
3993                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3994                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3995                         } }
3996                 } else {
3997                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3998                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3999                         } }
4000                 }
4001         }
4002 }
4003 #[no_mangle]
4004 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
4005 /// but with all dynamically-allocated buffers duplicated in new buffers.
4006 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
4007 #[repr(C)]
4008 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4009 /// This corresponds to std::vector in C++
4010 pub struct CVec_MessageSendEventZ {
4011         /// The elements in the array.
4012         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4013         pub data: *mut crate::lightning::util::events::MessageSendEvent,
4014         /// The number of elements pointed to by `data`.
4015         pub datalen: usize
4016 }
4017 impl CVec_MessageSendEventZ {
4018         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
4019                 if self.datalen == 0 { return Vec::new(); }
4020                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4021                 self.data = core::ptr::null_mut();
4022                 self.datalen = 0;
4023                 ret
4024         }
4025         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
4026                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4027         }
4028 }
4029 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
4030         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
4031                 let datalen = v.len();
4032                 let data = Box::into_raw(v.into_boxed_slice());
4033                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4034         }
4035 }
4036 #[no_mangle]
4037 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4038 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
4039 impl Drop for CVec_MessageSendEventZ {
4040         fn drop(&mut self) {
4041                 if self.datalen == 0 { return; }
4042                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4043         }
4044 }
4045 impl Clone for CVec_MessageSendEventZ {
4046         fn clone(&self) -> Self {
4047                 let mut res = Vec::new();
4048                 if self.datalen == 0 { return Self::from(res); }
4049                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4050                 Self::from(res)
4051         }
4052 }
4053 #[repr(C)]
4054 /// A tuple of 2 elements. See the individual fields for the types contained.
4055 pub struct C2Tuple_usizeTransactionZ {
4056         /// The element at position 0
4057         pub a: usize,
4058         /// The element at position 1
4059         pub b: crate::c_types::Transaction,
4060 }
4061 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
4062         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
4063                 Self {
4064                         a: tup.0,
4065                         b: tup.1,
4066                 }
4067         }
4068 }
4069 impl C2Tuple_usizeTransactionZ {
4070         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
4071                 (self.a, self.b)
4072         }
4073 }
4074 impl Clone for C2Tuple_usizeTransactionZ {
4075         fn clone(&self) -> Self {
4076                 Self {
4077                         a: Clone::clone(&self.a),
4078                         b: Clone::clone(&self.b),
4079                 }
4080         }
4081 }
4082 #[no_mangle]
4083 /// Creates a new tuple which has the same data as `orig`
4084 /// but with all dynamically-allocated buffers duplicated in new buffers.
4085 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
4086 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
4087 #[no_mangle]
4088 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
4089         C2Tuple_usizeTransactionZ { a, b, }
4090 }
4091
4092 #[no_mangle]
4093 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
4094 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
4095 #[repr(C)]
4096 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4097 /// This corresponds to std::vector in C++
4098 pub struct CVec_C2Tuple_usizeTransactionZZ {
4099         /// The elements in the array.
4100         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4101         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
4102         /// The number of elements pointed to by `data`.
4103         pub datalen: usize
4104 }
4105 impl CVec_C2Tuple_usizeTransactionZZ {
4106         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
4107                 if self.datalen == 0 { return Vec::new(); }
4108                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4109                 self.data = core::ptr::null_mut();
4110                 self.datalen = 0;
4111                 ret
4112         }
4113         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
4114                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4115         }
4116 }
4117 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
4118         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
4119                 let datalen = v.len();
4120                 let data = Box::into_raw(v.into_boxed_slice());
4121                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4122         }
4123 }
4124 #[no_mangle]
4125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4126 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
4127 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
4128         fn drop(&mut self) {
4129                 if self.datalen == 0 { return; }
4130                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4131         }
4132 }
4133 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
4134         fn clone(&self) -> Self {
4135                 let mut res = Vec::new();
4136                 if self.datalen == 0 { return Self::from(res); }
4137                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4138                 Self::from(res)
4139         }
4140 }
4141 #[repr(C)]
4142 /// A tuple of 2 elements. See the individual fields for the types contained.
4143 pub struct C2Tuple_TxidBlockHashZ {
4144         /// The element at position 0
4145         pub a: crate::c_types::ThirtyTwoBytes,
4146         /// The element at position 1
4147         pub b: crate::c_types::ThirtyTwoBytes,
4148 }
4149 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
4150         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
4151                 Self {
4152                         a: tup.0,
4153                         b: tup.1,
4154                 }
4155         }
4156 }
4157 impl C2Tuple_TxidBlockHashZ {
4158         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
4159                 (self.a, self.b)
4160         }
4161 }
4162 impl Clone for C2Tuple_TxidBlockHashZ {
4163         fn clone(&self) -> Self {
4164                 Self {
4165                         a: Clone::clone(&self.a),
4166                         b: Clone::clone(&self.b),
4167                 }
4168         }
4169 }
4170 #[no_mangle]
4171 /// Creates a new tuple which has the same data as `orig`
4172 /// but with all dynamically-allocated buffers duplicated in new buffers.
4173 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
4174 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
4175 #[no_mangle]
4176 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
4177         C2Tuple_TxidBlockHashZ { a, b, }
4178 }
4179
4180 #[no_mangle]
4181 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
4182 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
4183 #[repr(C)]
4184 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
4185 /// This corresponds to std::vector in C++
4186 pub struct CVec_C2Tuple_TxidBlockHashZZ {
4187         /// The elements in the array.
4188         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4189         pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
4190         /// The number of elements pointed to by `data`.
4191         pub datalen: usize
4192 }
4193 impl CVec_C2Tuple_TxidBlockHashZZ {
4194         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
4195                 if self.datalen == 0 { return Vec::new(); }
4196                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4197                 self.data = core::ptr::null_mut();
4198                 self.datalen = 0;
4199                 ret
4200         }
4201         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
4202                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4203         }
4204 }
4205 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
4206         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
4207                 let datalen = v.len();
4208                 let data = Box::into_raw(v.into_boxed_slice());
4209                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4210         }
4211 }
4212 #[no_mangle]
4213 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4214 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
4215 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
4216         fn drop(&mut self) {
4217                 if self.datalen == 0 { return; }
4218                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4219         }
4220 }
4221 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
4222         fn clone(&self) -> Self {
4223                 let mut res = Vec::new();
4224                 if self.datalen == 0 { return Self::from(res); }
4225                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4226                 Self::from(res)
4227         }
4228 }
4229 #[repr(C)]
4230 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4231 /// This corresponds to std::vector in C++
4232 pub struct CVec_MonitorEventZ {
4233         /// The elements in the array.
4234         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4235         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4236         /// The number of elements pointed to by `data`.
4237         pub datalen: usize
4238 }
4239 impl CVec_MonitorEventZ {
4240         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4241                 if self.datalen == 0 { return Vec::new(); }
4242                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4243                 self.data = core::ptr::null_mut();
4244                 self.datalen = 0;
4245                 ret
4246         }
4247         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4248                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4249         }
4250 }
4251 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4252         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4253                 let datalen = v.len();
4254                 let data = Box::into_raw(v.into_boxed_slice());
4255                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4256         }
4257 }
4258 #[no_mangle]
4259 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4260 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4261 impl Drop for CVec_MonitorEventZ {
4262         fn drop(&mut self) {
4263                 if self.datalen == 0 { return; }
4264                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4265         }
4266 }
4267 impl Clone for CVec_MonitorEventZ {
4268         fn clone(&self) -> Self {
4269                 let mut res = Vec::new();
4270                 if self.datalen == 0 { return Self::from(res); }
4271                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4272                 Self::from(res)
4273         }
4274 }
4275 #[repr(C)]
4276 /// A tuple of 3 elements. See the individual fields for the types contained.
4277 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4278         /// The element at position 0
4279         pub a: crate::lightning::chain::transaction::OutPoint,
4280         /// The element at position 1
4281         pub b: crate::c_types::derived::CVec_MonitorEventZ,
4282         /// The element at position 2
4283         pub c: crate::c_types::PublicKey,
4284 }
4285 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4286         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4287                 Self {
4288                         a: tup.0,
4289                         b: tup.1,
4290                         c: tup.2,
4291                 }
4292         }
4293 }
4294 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4295         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4296                 (self.a, self.b, self.c)
4297         }
4298 }
4299 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4300         fn clone(&self) -> Self {
4301                 Self {
4302                         a: Clone::clone(&self.a),
4303                         b: Clone::clone(&self.b),
4304                         c: Clone::clone(&self.c),
4305                 }
4306         }
4307 }
4308 #[no_mangle]
4309 /// Creates a new tuple which has the same data as `orig`
4310 /// but with all dynamically-allocated buffers duplicated in new buffers.
4311 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4312 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4313 #[no_mangle]
4314 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 {
4315         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4316 }
4317
4318 #[no_mangle]
4319 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4320 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4321 #[repr(C)]
4322 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4323 /// This corresponds to std::vector in C++
4324 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4325         /// The elements in the array.
4326         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4327         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4328         /// The number of elements pointed to by `data`.
4329         pub datalen: usize
4330 }
4331 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4332         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4333                 if self.datalen == 0 { return Vec::new(); }
4334                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4335                 self.data = core::ptr::null_mut();
4336                 self.datalen = 0;
4337                 ret
4338         }
4339         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4340                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4341         }
4342 }
4343 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4344         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4345                 let datalen = v.len();
4346                 let data = Box::into_raw(v.into_boxed_slice());
4347                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4348         }
4349 }
4350 #[no_mangle]
4351 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4352 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4353 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4354         fn drop(&mut self) {
4355                 if self.datalen == 0 { return; }
4356                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4357         }
4358 }
4359 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4360         fn clone(&self) -> Self {
4361                 let mut res = Vec::new();
4362                 if self.datalen == 0 { return Self::from(res); }
4363                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4364                 Self::from(res)
4365         }
4366 }
4367 #[repr(C)]
4368 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4369 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4370         /// A pointer to the contents in the success state.
4371         /// Reading from this pointer when `result_ok` is not set is undefined.
4372         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4373         /// A pointer to the contents in the error state.
4374         /// Reading from this pointer when `result_ok` is set is undefined.
4375         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4376 }
4377 #[repr(C)]
4378 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4379 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4381 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4382         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4383         /// `err` or `result` depending on the state of `result_ok`.
4384         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4385         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4386         pub result_ok: bool,
4387 }
4388 #[no_mangle]
4389 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4390 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4391         CResult_FixedPenaltyScorerDecodeErrorZ {
4392                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4393                         result: Box::into_raw(Box::new(o)),
4394                 },
4395                 result_ok: true,
4396         }
4397 }
4398 #[no_mangle]
4399 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4400 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4401         CResult_FixedPenaltyScorerDecodeErrorZ {
4402                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4403                         err: Box::into_raw(Box::new(e)),
4404                 },
4405                 result_ok: false,
4406         }
4407 }
4408 /// Checks if the given object is currently in the success state
4409 #[no_mangle]
4410 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4411         o.result_ok
4412 }
4413 #[no_mangle]
4414 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4415 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4416 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4417         fn drop(&mut self) {
4418                 if self.result_ok {
4419                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4420                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4421                         }
4422                 } else {
4423                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4424                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4425                         }
4426                 }
4427         }
4428 }
4429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4430         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4431                 let contents = if o.result_ok {
4432                         let result = unsafe { o.contents.result };
4433                         unsafe { o.contents.result = core::ptr::null_mut() };
4434                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4435                 } else {
4436                         let err = unsafe { o.contents.err };
4437                         unsafe { o.contents.err = core::ptr::null_mut(); }
4438                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4439                 };
4440                 Self {
4441                         contents,
4442                         result_ok: o.result_ok,
4443                 }
4444         }
4445 }
4446 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4447         fn clone(&self) -> Self {
4448                 if self.result_ok {
4449                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4450                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4451                         } }
4452                 } else {
4453                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4454                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4455                         } }
4456                 }
4457         }
4458 }
4459 #[no_mangle]
4460 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4461 /// but with all dynamically-allocated buffers duplicated in new buffers.
4462 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4463 #[repr(C)]
4464 /// A tuple of 2 elements. See the individual fields for the types contained.
4465 pub struct C2Tuple_u64u64Z {
4466         /// The element at position 0
4467         pub a: u64,
4468         /// The element at position 1
4469         pub b: u64,
4470 }
4471 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4472         fn from (tup: (u64, u64)) -> Self {
4473                 Self {
4474                         a: tup.0,
4475                         b: tup.1,
4476                 }
4477         }
4478 }
4479 impl C2Tuple_u64u64Z {
4480         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4481                 (self.a, self.b)
4482         }
4483 }
4484 impl Clone for C2Tuple_u64u64Z {
4485         fn clone(&self) -> Self {
4486                 Self {
4487                         a: Clone::clone(&self.a),
4488                         b: Clone::clone(&self.b),
4489                 }
4490         }
4491 }
4492 #[no_mangle]
4493 /// Creates a new tuple which has the same data as `orig`
4494 /// but with all dynamically-allocated buffers duplicated in new buffers.
4495 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4496 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4497 #[no_mangle]
4498 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4499         C2Tuple_u64u64Z { a, b, }
4500 }
4501
4502 #[no_mangle]
4503 /// Frees any resources used by the C2Tuple_u64u64Z.
4504 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4505 #[repr(C)]
4506 #[derive(Clone)]
4507 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4508 pub enum COption_C2Tuple_u64u64ZZ {
4509         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4510         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4511         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4512         None
4513 }
4514 impl COption_C2Tuple_u64u64ZZ {
4515         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4516                 if let Self::None = self { false } else { true }
4517         }
4518         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4519                 !self.is_some()
4520         }
4521         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4522                 if let Self::Some(v) = self { v } else { unreachable!() }
4523         }
4524 }
4525 #[no_mangle]
4526 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4527 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4528         COption_C2Tuple_u64u64ZZ::Some(o)
4529 }
4530 #[no_mangle]
4531 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4532 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4533         COption_C2Tuple_u64u64ZZ::None
4534 }
4535 #[no_mangle]
4536 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4537 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4538 #[no_mangle]
4539 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4540 /// but with all dynamically-allocated buffers duplicated in new buffers.
4541 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4542 #[repr(C)]
4543 /// A tuple of 2 elements. See the individual fields for the types contained.
4544 pub struct C2Tuple_Z {
4545         /// The element at position 0
4546         pub a: crate::c_types::EightU16s,
4547         /// The element at position 1
4548         pub b: crate::c_types::EightU16s,
4549 }
4550 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple_Z {
4551         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4552                 Self {
4553                         a: tup.0,
4554                         b: tup.1,
4555                 }
4556         }
4557 }
4558 impl C2Tuple_Z {
4559         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4560                 (self.a, self.b)
4561         }
4562 }
4563 impl Clone for C2Tuple_Z {
4564         fn clone(&self) -> Self {
4565                 Self {
4566                         a: Clone::clone(&self.a),
4567                         b: Clone::clone(&self.b),
4568                 }
4569         }
4570 }
4571 #[no_mangle]
4572 /// Creates a new tuple which has the same data as `orig`
4573 /// but with all dynamically-allocated buffers duplicated in new buffers.
4574 pub extern "C" fn C2Tuple_Z_clone(orig: &C2Tuple_Z) -> C2Tuple_Z { Clone::clone(&orig) }
4575 /// Creates a new C2Tuple_Z from the contained elements.
4576 #[no_mangle]
4577 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple_Z {
4578         C2Tuple_Z { a, b, }
4579 }
4580
4581 #[no_mangle]
4582 /// Frees any resources used by the C2Tuple_Z.
4583 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
4584 #[repr(C)]
4585 /// A tuple of 2 elements. See the individual fields for the types contained.
4586 pub struct C2Tuple__u168_u168Z {
4587         /// The element at position 0
4588         pub a: crate::c_types::EightU16s,
4589         /// The element at position 1
4590         pub b: crate::c_types::EightU16s,
4591 }
4592 impl From<(crate::c_types::EightU16s, crate::c_types::EightU16s)> for C2Tuple__u168_u168Z {
4593         fn from (tup: (crate::c_types::EightU16s, crate::c_types::EightU16s)) -> Self {
4594                 Self {
4595                         a: tup.0,
4596                         b: tup.1,
4597                 }
4598         }
4599 }
4600 impl C2Tuple__u168_u168Z {
4601         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::EightU16s, crate::c_types::EightU16s) {
4602                 (self.a, self.b)
4603         }
4604 }
4605 impl Clone for C2Tuple__u168_u168Z {
4606         fn clone(&self) -> Self {
4607                 Self {
4608                         a: Clone::clone(&self.a),
4609                         b: Clone::clone(&self.b),
4610                 }
4611         }
4612 }
4613 #[no_mangle]
4614 /// Creates a new tuple which has the same data as `orig`
4615 /// but with all dynamically-allocated buffers duplicated in new buffers.
4616 pub extern "C" fn C2Tuple__u168_u168Z_clone(orig: &C2Tuple__u168_u168Z) -> C2Tuple__u168_u168Z { Clone::clone(&orig) }
4617 /// Creates a new C2Tuple__u168_u168Z from the contained elements.
4618 #[no_mangle]
4619 pub extern "C" fn C2Tuple__u168_u168Z_new(a: crate::c_types::EightU16s, b: crate::c_types::EightU16s) -> C2Tuple__u168_u168Z {
4620         C2Tuple__u168_u168Z { a, b, }
4621 }
4622
4623 #[no_mangle]
4624 /// Frees any resources used by the C2Tuple__u168_u168Z.
4625 pub extern "C" fn C2Tuple__u168_u168Z_free(_res: C2Tuple__u168_u168Z) { }
4626 #[repr(C)]
4627 #[derive(Clone)]
4628 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
4629 pub enum COption_C2Tuple_EightU16sEightU16sZZ {
4630         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
4631         Some(crate::c_types::derived::C2Tuple__u168_u168Z),
4632         /// When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
4633         None
4634 }
4635 impl COption_C2Tuple_EightU16sEightU16sZZ {
4636         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4637                 if let Self::None = self { false } else { true }
4638         }
4639         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4640                 !self.is_some()
4641         }
4642         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u168_u168Z {
4643                 if let Self::Some(v) = self { v } else { unreachable!() }
4644         }
4645 }
4646 #[no_mangle]
4647 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z
4648 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_some(o: crate::c_types::derived::C2Tuple__u168_u168Z) -> COption_C2Tuple_EightU16sEightU16sZZ {
4649         COption_C2Tuple_EightU16sEightU16sZZ::Some(o)
4650 }
4651 #[no_mangle]
4652 /// Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing
4653 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_none() -> COption_C2Tuple_EightU16sEightU16sZZ {
4654         COption_C2Tuple_EightU16sEightU16sZZ::None
4655 }
4656 #[no_mangle]
4657 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state
4658 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_free(_res: COption_C2Tuple_EightU16sEightU16sZZ) { }
4659 #[no_mangle]
4660 /// Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig`
4661 /// but with all dynamically-allocated buffers duplicated in new buffers.
4662 pub extern "C" fn COption_C2Tuple_EightU16sEightU16sZZ_clone(orig: &COption_C2Tuple_EightU16sEightU16sZZ) -> COption_C2Tuple_EightU16sEightU16sZZ { Clone::clone(&orig) }
4663 #[repr(C)]
4664 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4665 /// This corresponds to std::vector in C++
4666 pub struct CVec_NodeIdZ {
4667         /// The elements in the array.
4668         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4669         pub data: *mut crate::lightning::routing::gossip::NodeId,
4670         /// The number of elements pointed to by `data`.
4671         pub datalen: usize
4672 }
4673 impl CVec_NodeIdZ {
4674         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4675                 if self.datalen == 0 { return Vec::new(); }
4676                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4677                 self.data = core::ptr::null_mut();
4678                 self.datalen = 0;
4679                 ret
4680         }
4681         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4682                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4683         }
4684 }
4685 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4686         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4687                 let datalen = v.len();
4688                 let data = Box::into_raw(v.into_boxed_slice());
4689                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4690         }
4691 }
4692 #[no_mangle]
4693 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4694 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4695 impl Drop for CVec_NodeIdZ {
4696         fn drop(&mut self) {
4697                 if self.datalen == 0 { return; }
4698                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4699         }
4700 }
4701 impl Clone for CVec_NodeIdZ {
4702         fn clone(&self) -> Self {
4703                 let mut res = Vec::new();
4704                 if self.datalen == 0 { return Self::from(res); }
4705                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4706                 Self::from(res)
4707         }
4708 }
4709 #[repr(C)]
4710 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4711 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4712         /// A pointer to the contents in the success state.
4713         /// Reading from this pointer when `result_ok` is not set is undefined.
4714         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4715         /// A pointer to the contents in the error state.
4716         /// Reading from this pointer when `result_ok` is set is undefined.
4717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4718 }
4719 #[repr(C)]
4720 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4721 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4723 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4724         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4725         /// `err` or `result` depending on the state of `result_ok`.
4726         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4727         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4728         pub result_ok: bool,
4729 }
4730 #[no_mangle]
4731 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4732 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4733         CResult_ProbabilisticScorerDecodeErrorZ {
4734                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4735                         result: Box::into_raw(Box::new(o)),
4736                 },
4737                 result_ok: true,
4738         }
4739 }
4740 #[no_mangle]
4741 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4742 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4743         CResult_ProbabilisticScorerDecodeErrorZ {
4744                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4745                         err: Box::into_raw(Box::new(e)),
4746                 },
4747                 result_ok: false,
4748         }
4749 }
4750 /// Checks if the given object is currently in the success state
4751 #[no_mangle]
4752 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4753         o.result_ok
4754 }
4755 #[no_mangle]
4756 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4757 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4758 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4759         fn drop(&mut self) {
4760                 if self.result_ok {
4761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4763                         }
4764                 } else {
4765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4767                         }
4768                 }
4769         }
4770 }
4771 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4773                 let contents = if o.result_ok {
4774                         let result = unsafe { o.contents.result };
4775                         unsafe { o.contents.result = core::ptr::null_mut() };
4776                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4777                 } else {
4778                         let err = unsafe { o.contents.err };
4779                         unsafe { o.contents.err = core::ptr::null_mut(); }
4780                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4781                 };
4782                 Self {
4783                         contents,
4784                         result_ok: o.result_ok,
4785                 }
4786         }
4787 }
4788 #[repr(C)]
4789 /// The contents of CResult_InitFeaturesDecodeErrorZ
4790 pub union CResult_InitFeaturesDecodeErrorZPtr {
4791         /// A pointer to the contents in the success state.
4792         /// Reading from this pointer when `result_ok` is not set is undefined.
4793         pub result: *mut crate::lightning::ln::features::InitFeatures,
4794         /// A pointer to the contents in the error state.
4795         /// Reading from this pointer when `result_ok` is set is undefined.
4796         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4797 }
4798 #[repr(C)]
4799 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4800 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4801 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4802 pub struct CResult_InitFeaturesDecodeErrorZ {
4803         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4804         /// `err` or `result` depending on the state of `result_ok`.
4805         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4806         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4807         pub result_ok: bool,
4808 }
4809 #[no_mangle]
4810 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4811 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4812         CResult_InitFeaturesDecodeErrorZ {
4813                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4814                         result: Box::into_raw(Box::new(o)),
4815                 },
4816                 result_ok: true,
4817         }
4818 }
4819 #[no_mangle]
4820 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4821 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4822         CResult_InitFeaturesDecodeErrorZ {
4823                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4824                         err: Box::into_raw(Box::new(e)),
4825                 },
4826                 result_ok: false,
4827         }
4828 }
4829 /// Checks if the given object is currently in the success state
4830 #[no_mangle]
4831 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4832         o.result_ok
4833 }
4834 #[no_mangle]
4835 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4836 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4837 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4838         fn drop(&mut self) {
4839                 if self.result_ok {
4840                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4841                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4842                         }
4843                 } else {
4844                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4845                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4846                         }
4847                 }
4848         }
4849 }
4850 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4851         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4852                 let contents = if o.result_ok {
4853                         let result = unsafe { o.contents.result };
4854                         unsafe { o.contents.result = core::ptr::null_mut() };
4855                         CResult_InitFeaturesDecodeErrorZPtr { result }
4856                 } else {
4857                         let err = unsafe { o.contents.err };
4858                         unsafe { o.contents.err = core::ptr::null_mut(); }
4859                         CResult_InitFeaturesDecodeErrorZPtr { err }
4860                 };
4861                 Self {
4862                         contents,
4863                         result_ok: o.result_ok,
4864                 }
4865         }
4866 }
4867 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4868         fn clone(&self) -> Self {
4869                 if self.result_ok {
4870                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4871                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4872                         } }
4873                 } else {
4874                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4875                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4876                         } }
4877                 }
4878         }
4879 }
4880 #[no_mangle]
4881 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4882 /// but with all dynamically-allocated buffers duplicated in new buffers.
4883 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4884 #[repr(C)]
4885 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4886 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4887         /// A pointer to the contents in the success state.
4888         /// Reading from this pointer when `result_ok` is not set is undefined.
4889         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4890         /// A pointer to the contents in the error state.
4891         /// Reading from this pointer when `result_ok` is set is undefined.
4892         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4893 }
4894 #[repr(C)]
4895 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4896 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4897 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4898 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4899         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4900         /// `err` or `result` depending on the state of `result_ok`.
4901         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4902         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4903         pub result_ok: bool,
4904 }
4905 #[no_mangle]
4906 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4907 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4908         CResult_ChannelFeaturesDecodeErrorZ {
4909                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4910                         result: Box::into_raw(Box::new(o)),
4911                 },
4912                 result_ok: true,
4913         }
4914 }
4915 #[no_mangle]
4916 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4917 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4918         CResult_ChannelFeaturesDecodeErrorZ {
4919                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4920                         err: Box::into_raw(Box::new(e)),
4921                 },
4922                 result_ok: false,
4923         }
4924 }
4925 /// Checks if the given object is currently in the success state
4926 #[no_mangle]
4927 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4928         o.result_ok
4929 }
4930 #[no_mangle]
4931 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4932 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4933 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4934         fn drop(&mut self) {
4935                 if self.result_ok {
4936                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4937                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4938                         }
4939                 } else {
4940                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4941                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4942                         }
4943                 }
4944         }
4945 }
4946 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4947         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4948                 let contents = if o.result_ok {
4949                         let result = unsafe { o.contents.result };
4950                         unsafe { o.contents.result = core::ptr::null_mut() };
4951                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4952                 } else {
4953                         let err = unsafe { o.contents.err };
4954                         unsafe { o.contents.err = core::ptr::null_mut(); }
4955                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4956                 };
4957                 Self {
4958                         contents,
4959                         result_ok: o.result_ok,
4960                 }
4961         }
4962 }
4963 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4964         fn clone(&self) -> Self {
4965                 if self.result_ok {
4966                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4967                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4968                         } }
4969                 } else {
4970                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4971                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4972                         } }
4973                 }
4974         }
4975 }
4976 #[no_mangle]
4977 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4978 /// but with all dynamically-allocated buffers duplicated in new buffers.
4979 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4980 #[repr(C)]
4981 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4982 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4983         /// A pointer to the contents in the success state.
4984         /// Reading from this pointer when `result_ok` is not set is undefined.
4985         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4986         /// A pointer to the contents in the error state.
4987         /// Reading from this pointer when `result_ok` is set is undefined.
4988         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4989 }
4990 #[repr(C)]
4991 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4992 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4993 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4994 pub struct CResult_NodeFeaturesDecodeErrorZ {
4995         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4996         /// `err` or `result` depending on the state of `result_ok`.
4997         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4998         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4999         pub result_ok: bool,
5000 }
5001 #[no_mangle]
5002 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
5003 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
5004         CResult_NodeFeaturesDecodeErrorZ {
5005                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5006                         result: Box::into_raw(Box::new(o)),
5007                 },
5008                 result_ok: true,
5009         }
5010 }
5011 #[no_mangle]
5012 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
5013 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
5014         CResult_NodeFeaturesDecodeErrorZ {
5015                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
5016                         err: Box::into_raw(Box::new(e)),
5017                 },
5018                 result_ok: false,
5019         }
5020 }
5021 /// Checks if the given object is currently in the success state
5022 #[no_mangle]
5023 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
5024         o.result_ok
5025 }
5026 #[no_mangle]
5027 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
5028 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
5029 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
5030         fn drop(&mut self) {
5031                 if self.result_ok {
5032                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5033                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5034                         }
5035                 } else {
5036                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5037                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5038                         }
5039                 }
5040         }
5041 }
5042 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
5043         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5044                 let contents = if o.result_ok {
5045                         let result = unsafe { o.contents.result };
5046                         unsafe { o.contents.result = core::ptr::null_mut() };
5047                         CResult_NodeFeaturesDecodeErrorZPtr { result }
5048                 } else {
5049                         let err = unsafe { o.contents.err };
5050                         unsafe { o.contents.err = core::ptr::null_mut(); }
5051                         CResult_NodeFeaturesDecodeErrorZPtr { err }
5052                 };
5053                 Self {
5054                         contents,
5055                         result_ok: o.result_ok,
5056                 }
5057         }
5058 }
5059 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
5060         fn clone(&self) -> Self {
5061                 if self.result_ok {
5062                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5063                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
5064                         } }
5065                 } else {
5066                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
5067                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5068                         } }
5069                 }
5070         }
5071 }
5072 #[no_mangle]
5073 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
5074 /// but with all dynamically-allocated buffers duplicated in new buffers.
5075 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5076 #[repr(C)]
5077 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
5078 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
5079         /// A pointer to the contents in the success state.
5080         /// Reading from this pointer when `result_ok` is not set is undefined.
5081         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
5082         /// A pointer to the contents in the error state.
5083         /// Reading from this pointer when `result_ok` is set is undefined.
5084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5085 }
5086 #[repr(C)]
5087 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5088 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5090 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
5091         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5092         /// `err` or `result` depending on the state of `result_ok`.
5093         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
5094         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5095         pub result_ok: bool,
5096 }
5097 #[no_mangle]
5098 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
5099 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
5100         CResult_InvoiceFeaturesDecodeErrorZ {
5101                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5102                         result: Box::into_raw(Box::new(o)),
5103                 },
5104                 result_ok: true,
5105         }
5106 }
5107 #[no_mangle]
5108 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
5109 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
5110         CResult_InvoiceFeaturesDecodeErrorZ {
5111                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5112                         err: Box::into_raw(Box::new(e)),
5113                 },
5114                 result_ok: false,
5115         }
5116 }
5117 /// Checks if the given object is currently in the success state
5118 #[no_mangle]
5119 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
5120         o.result_ok
5121 }
5122 #[no_mangle]
5123 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
5124 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
5125 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
5126         fn drop(&mut self) {
5127                 if self.result_ok {
5128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5130                         }
5131                 } else {
5132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5134                         }
5135                 }
5136         }
5137 }
5138 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
5139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5140                 let contents = if o.result_ok {
5141                         let result = unsafe { o.contents.result };
5142                         unsafe { o.contents.result = core::ptr::null_mut() };
5143                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
5144                 } else {
5145                         let err = unsafe { o.contents.err };
5146                         unsafe { o.contents.err = core::ptr::null_mut(); }
5147                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
5148                 };
5149                 Self {
5150                         contents,
5151                         result_ok: o.result_ok,
5152                 }
5153         }
5154 }
5155 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
5156         fn clone(&self) -> Self {
5157                 if self.result_ok {
5158                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5159                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
5160                         } }
5161                 } else {
5162                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
5163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5164                         } }
5165                 }
5166         }
5167 }
5168 #[no_mangle]
5169 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
5170 /// but with all dynamically-allocated buffers duplicated in new buffers.
5171 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
5172 #[repr(C)]
5173 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
5174 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
5175         /// A pointer to the contents in the success state.
5176         /// Reading from this pointer when `result_ok` is not set is undefined.
5177         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
5178         /// A pointer to the contents in the error state.
5179         /// Reading from this pointer when `result_ok` is set is undefined.
5180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5181 }
5182 #[repr(C)]
5183 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
5184 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5186 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
5187         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
5188         /// `err` or `result` depending on the state of `result_ok`.
5189         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
5190         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
5191         pub result_ok: bool,
5192 }
5193 #[no_mangle]
5194 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
5195 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5196         CResult_BlindedHopFeaturesDecodeErrorZ {
5197                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5198                         result: Box::into_raw(Box::new(o)),
5199                 },
5200                 result_ok: true,
5201         }
5202 }
5203 #[no_mangle]
5204 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
5205 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
5206         CResult_BlindedHopFeaturesDecodeErrorZ {
5207                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5208                         err: Box::into_raw(Box::new(e)),
5209                 },
5210                 result_ok: false,
5211         }
5212 }
5213 /// Checks if the given object is currently in the success state
5214 #[no_mangle]
5215 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
5216         o.result_ok
5217 }
5218 #[no_mangle]
5219 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
5220 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
5221 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
5222         fn drop(&mut self) {
5223                 if self.result_ok {
5224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5226                         }
5227                 } else {
5228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5230                         }
5231                 }
5232         }
5233 }
5234 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
5235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5236                 let contents = if o.result_ok {
5237                         let result = unsafe { o.contents.result };
5238                         unsafe { o.contents.result = core::ptr::null_mut() };
5239                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
5240                 } else {
5241                         let err = unsafe { o.contents.err };
5242                         unsafe { o.contents.err = core::ptr::null_mut(); }
5243                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
5244                 };
5245                 Self {
5246                         contents,
5247                         result_ok: o.result_ok,
5248                 }
5249         }
5250 }
5251 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
5252         fn clone(&self) -> Self {
5253                 if self.result_ok {
5254                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5255                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
5256                         } }
5257                 } else {
5258                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
5259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5260                         } }
5261                 }
5262         }
5263 }
5264 #[no_mangle]
5265 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
5266 /// but with all dynamically-allocated buffers duplicated in new buffers.
5267 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
5268 #[repr(C)]
5269 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5270 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5271         /// A pointer to the contents in the success state.
5272         /// Reading from this pointer when `result_ok` is not set is undefined.
5273         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
5274         /// A pointer to the contents in the error state.
5275         /// Reading from this pointer when `result_ok` is set is undefined.
5276         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5277 }
5278 #[repr(C)]
5279 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5280 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5282 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
5283         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5284         /// `err` or `result` depending on the state of `result_ok`.
5285         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
5286         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5287         pub result_ok: bool,
5288 }
5289 #[no_mangle]
5290 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
5291 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5292         CResult_ChannelTypeFeaturesDecodeErrorZ {
5293                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5294                         result: Box::into_raw(Box::new(o)),
5295                 },
5296                 result_ok: true,
5297         }
5298 }
5299 #[no_mangle]
5300 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
5301 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
5302         CResult_ChannelTypeFeaturesDecodeErrorZ {
5303                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5304                         err: Box::into_raw(Box::new(e)),
5305                 },
5306                 result_ok: false,
5307         }
5308 }
5309 /// Checks if the given object is currently in the success state
5310 #[no_mangle]
5311 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
5312         o.result_ok
5313 }
5314 #[no_mangle]
5315 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
5316 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
5317 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
5318         fn drop(&mut self) {
5319                 if self.result_ok {
5320                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5321                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5322                         }
5323                 } else {
5324                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5325                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5326                         }
5327                 }
5328         }
5329 }
5330 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
5331         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5332                 let contents = if o.result_ok {
5333                         let result = unsafe { o.contents.result };
5334                         unsafe { o.contents.result = core::ptr::null_mut() };
5335                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
5336                 } else {
5337                         let err = unsafe { o.contents.err };
5338                         unsafe { o.contents.err = core::ptr::null_mut(); }
5339                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
5340                 };
5341                 Self {
5342                         contents,
5343                         result_ok: o.result_ok,
5344                 }
5345         }
5346 }
5347 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
5348         fn clone(&self) -> Self {
5349                 if self.result_ok {
5350                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5351                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
5352                         } }
5353                 } else {
5354                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
5355                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5356                         } }
5357                 }
5358         }
5359 }
5360 #[no_mangle]
5361 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
5362 /// but with all dynamically-allocated buffers duplicated in new buffers.
5363 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
5364 #[repr(C)]
5365 /// The contents of CResult_NodeIdDecodeErrorZ
5366 pub union CResult_NodeIdDecodeErrorZPtr {
5367         /// A pointer to the contents in the success state.
5368         /// Reading from this pointer when `result_ok` is not set is undefined.
5369         pub result: *mut crate::lightning::routing::gossip::NodeId,
5370         /// A pointer to the contents in the error state.
5371         /// Reading from this pointer when `result_ok` is set is undefined.
5372         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5373 }
5374 #[repr(C)]
5375 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5376 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5378 pub struct CResult_NodeIdDecodeErrorZ {
5379         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5380         /// `err` or `result` depending on the state of `result_ok`.
5381         pub contents: CResult_NodeIdDecodeErrorZPtr,
5382         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5383         pub result_ok: bool,
5384 }
5385 #[no_mangle]
5386 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5387 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5388         CResult_NodeIdDecodeErrorZ {
5389                 contents: CResult_NodeIdDecodeErrorZPtr {
5390                         result: Box::into_raw(Box::new(o)),
5391                 },
5392                 result_ok: true,
5393         }
5394 }
5395 #[no_mangle]
5396 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5397 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5398         CResult_NodeIdDecodeErrorZ {
5399                 contents: CResult_NodeIdDecodeErrorZPtr {
5400                         err: Box::into_raw(Box::new(e)),
5401                 },
5402                 result_ok: false,
5403         }
5404 }
5405 /// Checks if the given object is currently in the success state
5406 #[no_mangle]
5407 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5408         o.result_ok
5409 }
5410 #[no_mangle]
5411 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5412 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5413 impl Drop for CResult_NodeIdDecodeErrorZ {
5414         fn drop(&mut self) {
5415                 if self.result_ok {
5416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5418                         }
5419                 } else {
5420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5422                         }
5423                 }
5424         }
5425 }
5426 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5427         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5428                 let contents = if o.result_ok {
5429                         let result = unsafe { o.contents.result };
5430                         unsafe { o.contents.result = core::ptr::null_mut() };
5431                         CResult_NodeIdDecodeErrorZPtr { result }
5432                 } else {
5433                         let err = unsafe { o.contents.err };
5434                         unsafe { o.contents.err = core::ptr::null_mut(); }
5435                         CResult_NodeIdDecodeErrorZPtr { err }
5436                 };
5437                 Self {
5438                         contents,
5439                         result_ok: o.result_ok,
5440                 }
5441         }
5442 }
5443 impl Clone for CResult_NodeIdDecodeErrorZ {
5444         fn clone(&self) -> Self {
5445                 if self.result_ok {
5446                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5447                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5448                         } }
5449                 } else {
5450                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5451                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5452                         } }
5453                 }
5454         }
5455 }
5456 #[no_mangle]
5457 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5458 /// but with all dynamically-allocated buffers duplicated in new buffers.
5459 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5460 #[repr(C)]
5461 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5462 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5463         /// A pointer to the contents in the success state.
5464         /// Reading from this pointer when `result_ok` is not set is undefined.
5465         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5466         /// A pointer to the contents in the error state.
5467         /// Reading from this pointer when `result_ok` is set is undefined.
5468         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5469 }
5470 #[repr(C)]
5471 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5472 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5474 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5475         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5476         /// `err` or `result` depending on the state of `result_ok`.
5477         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5478         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5479         pub result_ok: bool,
5480 }
5481 #[no_mangle]
5482 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5483 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5484         CResult_COption_NetworkUpdateZDecodeErrorZ {
5485                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5486                         result: Box::into_raw(Box::new(o)),
5487                 },
5488                 result_ok: true,
5489         }
5490 }
5491 #[no_mangle]
5492 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5493 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5494         CResult_COption_NetworkUpdateZDecodeErrorZ {
5495                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5496                         err: Box::into_raw(Box::new(e)),
5497                 },
5498                 result_ok: false,
5499         }
5500 }
5501 /// Checks if the given object is currently in the success state
5502 #[no_mangle]
5503 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5504         o.result_ok
5505 }
5506 #[no_mangle]
5507 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5508 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5509 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5510         fn drop(&mut self) {
5511                 if self.result_ok {
5512                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5513                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5514                         }
5515                 } else {
5516                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5517                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5518                         }
5519                 }
5520         }
5521 }
5522 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5523         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5524                 let contents = if o.result_ok {
5525                         let result = unsafe { o.contents.result };
5526                         unsafe { o.contents.result = core::ptr::null_mut() };
5527                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5528                 } else {
5529                         let err = unsafe { o.contents.err };
5530                         unsafe { o.contents.err = core::ptr::null_mut(); }
5531                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5532                 };
5533                 Self {
5534                         contents,
5535                         result_ok: o.result_ok,
5536                 }
5537         }
5538 }
5539 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5540         fn clone(&self) -> Self {
5541                 if self.result_ok {
5542                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5543                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5544                         } }
5545                 } else {
5546                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5547                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5548                         } }
5549                 }
5550         }
5551 }
5552 #[no_mangle]
5553 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5554 /// but with all dynamically-allocated buffers duplicated in new buffers.
5555 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5556 #[repr(C)]
5557 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
5558 pub enum COption_UtxoLookupZ {
5559         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
5560         Some(crate::lightning::routing::utxo::UtxoLookup),
5561         /// When we're in this state, this COption_UtxoLookupZ contains nothing
5562         None
5563 }
5564 impl COption_UtxoLookupZ {
5565         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5566                 if let Self::None = self { false } else { true }
5567         }
5568         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5569                 !self.is_some()
5570         }
5571         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
5572                 if let Self::Some(v) = self { v } else { unreachable!() }
5573         }
5574 }
5575 #[no_mangle]
5576 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
5577 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
5578         COption_UtxoLookupZ::Some(o)
5579 }
5580 #[no_mangle]
5581 /// Constructs a new COption_UtxoLookupZ containing nothing
5582 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
5583         COption_UtxoLookupZ::None
5584 }
5585 #[no_mangle]
5586 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
5587 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
5588 #[repr(C)]
5589 /// The contents of CResult_boolLightningErrorZ
5590 pub union CResult_boolLightningErrorZPtr {
5591         /// A pointer to the contents in the success state.
5592         /// Reading from this pointer when `result_ok` is not set is undefined.
5593         pub result: *mut bool,
5594         /// A pointer to the contents in the error state.
5595         /// Reading from this pointer when `result_ok` is set is undefined.
5596         pub err: *mut crate::lightning::ln::msgs::LightningError,
5597 }
5598 #[repr(C)]
5599 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5600 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5602 pub struct CResult_boolLightningErrorZ {
5603         /// The contents of this CResult_boolLightningErrorZ, accessible via either
5604         /// `err` or `result` depending on the state of `result_ok`.
5605         pub contents: CResult_boolLightningErrorZPtr,
5606         /// Whether this CResult_boolLightningErrorZ represents a success state.
5607         pub result_ok: bool,
5608 }
5609 #[no_mangle]
5610 /// Creates a new CResult_boolLightningErrorZ in the success state.
5611 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5612         CResult_boolLightningErrorZ {
5613                 contents: CResult_boolLightningErrorZPtr {
5614                         result: Box::into_raw(Box::new(o)),
5615                 },
5616                 result_ok: true,
5617         }
5618 }
5619 #[no_mangle]
5620 /// Creates a new CResult_boolLightningErrorZ in the error state.
5621 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5622         CResult_boolLightningErrorZ {
5623                 contents: CResult_boolLightningErrorZPtr {
5624                         err: Box::into_raw(Box::new(e)),
5625                 },
5626                 result_ok: false,
5627         }
5628 }
5629 /// Checks if the given object is currently in the success state
5630 #[no_mangle]
5631 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5632         o.result_ok
5633 }
5634 #[no_mangle]
5635 /// Frees any resources used by the CResult_boolLightningErrorZ.
5636 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5637 impl Drop for CResult_boolLightningErrorZ {
5638         fn drop(&mut self) {
5639                 if self.result_ok {
5640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5642                         }
5643                 } else {
5644                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5645                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5646                         }
5647                 }
5648         }
5649 }
5650 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5651         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5652                 let contents = if o.result_ok {
5653                         let result = unsafe { o.contents.result };
5654                         unsafe { o.contents.result = core::ptr::null_mut() };
5655                         CResult_boolLightningErrorZPtr { result }
5656                 } else {
5657                         let err = unsafe { o.contents.err };
5658                         unsafe { o.contents.err = core::ptr::null_mut(); }
5659                         CResult_boolLightningErrorZPtr { err }
5660                 };
5661                 Self {
5662                         contents,
5663                         result_ok: o.result_ok,
5664                 }
5665         }
5666 }
5667 impl Clone for CResult_boolLightningErrorZ {
5668         fn clone(&self) -> Self {
5669                 if self.result_ok {
5670                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5671                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5672                         } }
5673                 } else {
5674                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5675                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5676                         } }
5677                 }
5678         }
5679 }
5680 #[no_mangle]
5681 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5682 /// but with all dynamically-allocated buffers duplicated in new buffers.
5683 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5684 #[repr(C)]
5685 /// A tuple of 3 elements. See the individual fields for the types contained.
5686 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5687         /// The element at position 0
5688         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5689         /// The element at position 1
5690         pub b: crate::lightning::ln::msgs::ChannelUpdate,
5691         /// The element at position 2
5692         pub c: crate::lightning::ln::msgs::ChannelUpdate,
5693 }
5694 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5695         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5696                 Self {
5697                         a: tup.0,
5698                         b: tup.1,
5699                         c: tup.2,
5700                 }
5701         }
5702 }
5703 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5704         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5705                 (self.a, self.b, self.c)
5706         }
5707 }
5708 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5709         fn clone(&self) -> Self {
5710                 Self {
5711                         a: Clone::clone(&self.a),
5712                         b: Clone::clone(&self.b),
5713                         c: Clone::clone(&self.c),
5714                 }
5715         }
5716 }
5717 #[no_mangle]
5718 /// Creates a new tuple which has the same data as `orig`
5719 /// but with all dynamically-allocated buffers duplicated in new buffers.
5720 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5721 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5722 #[no_mangle]
5723 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 {
5724         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5725 }
5726
5727 #[no_mangle]
5728 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5729 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5730 #[repr(C)]
5731 #[derive(Clone)]
5732 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5733 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5734         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5735         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5736         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5737         None
5738 }
5739 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5740         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5741                 if let Self::None = self { false } else { true }
5742         }
5743         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5744                 !self.is_some()
5745         }
5746         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5747                 if let Self::Some(v) = self { v } else { unreachable!() }
5748         }
5749 }
5750 #[no_mangle]
5751 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5752 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5753         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5754 }
5755 #[no_mangle]
5756 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5757 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5758         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5759 }
5760 #[no_mangle]
5761 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5762 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5763 #[no_mangle]
5764 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5765 /// but with all dynamically-allocated buffers duplicated in new buffers.
5766 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5767 #[repr(C)]
5768 /// The contents of CResult_NoneLightningErrorZ
5769 pub union CResult_NoneLightningErrorZPtr {
5770         /// Note that this value is always NULL, as there are no contents in the OK variant
5771         pub result: *mut core::ffi::c_void,
5772         /// A pointer to the contents in the error state.
5773         /// Reading from this pointer when `result_ok` is set is undefined.
5774         pub err: *mut crate::lightning::ln::msgs::LightningError,
5775 }
5776 #[repr(C)]
5777 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5778 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5780 pub struct CResult_NoneLightningErrorZ {
5781         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5782         /// `err` or `result` depending on the state of `result_ok`.
5783         pub contents: CResult_NoneLightningErrorZPtr,
5784         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5785         pub result_ok: bool,
5786 }
5787 #[no_mangle]
5788 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5789 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5790         CResult_NoneLightningErrorZ {
5791                 contents: CResult_NoneLightningErrorZPtr {
5792                         result: core::ptr::null_mut(),
5793                 },
5794                 result_ok: true,
5795         }
5796 }
5797 #[no_mangle]
5798 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5799 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5800         CResult_NoneLightningErrorZ {
5801                 contents: CResult_NoneLightningErrorZPtr {
5802                         err: Box::into_raw(Box::new(e)),
5803                 },
5804                 result_ok: false,
5805         }
5806 }
5807 /// Checks if the given object is currently in the success state
5808 #[no_mangle]
5809 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5810         o.result_ok
5811 }
5812 #[no_mangle]
5813 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5814 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5815 impl Drop for CResult_NoneLightningErrorZ {
5816         fn drop(&mut self) {
5817                 if self.result_ok {
5818                 } else {
5819                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5820                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5821                         }
5822                 }
5823         }
5824 }
5825 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5826         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5827                 let contents = if o.result_ok {
5828                         let _ = unsafe { Box::from_raw(o.contents.result) };
5829                         o.contents.result = core::ptr::null_mut();
5830                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5831                 } else {
5832                         let err = unsafe { o.contents.err };
5833                         unsafe { o.contents.err = core::ptr::null_mut(); }
5834                         CResult_NoneLightningErrorZPtr { err }
5835                 };
5836                 Self {
5837                         contents,
5838                         result_ok: o.result_ok,
5839                 }
5840         }
5841 }
5842 impl Clone for CResult_NoneLightningErrorZ {
5843         fn clone(&self) -> Self {
5844                 if self.result_ok {
5845                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5846                                 result: core::ptr::null_mut()
5847                         } }
5848                 } else {
5849                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5850                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5851                         } }
5852                 }
5853         }
5854 }
5855 #[no_mangle]
5856 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5857 /// but with all dynamically-allocated buffers duplicated in new buffers.
5858 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5859 #[repr(C)]
5860 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5861 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5862         /// A pointer to the contents in the success state.
5863         /// Reading from this pointer when `result_ok` is not set is undefined.
5864         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5865         /// A pointer to the contents in the error state.
5866         /// Reading from this pointer when `result_ok` is set is undefined.
5867         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5868 }
5869 #[repr(C)]
5870 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5871 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5872 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5873 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5874         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5875         /// `err` or `result` depending on the state of `result_ok`.
5876         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5877         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5878         pub result_ok: bool,
5879 }
5880 #[no_mangle]
5881 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5882 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5883         CResult_ChannelUpdateInfoDecodeErrorZ {
5884                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5885                         result: Box::into_raw(Box::new(o)),
5886                 },
5887                 result_ok: true,
5888         }
5889 }
5890 #[no_mangle]
5891 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5892 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5893         CResult_ChannelUpdateInfoDecodeErrorZ {
5894                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5895                         err: Box::into_raw(Box::new(e)),
5896                 },
5897                 result_ok: false,
5898         }
5899 }
5900 /// Checks if the given object is currently in the success state
5901 #[no_mangle]
5902 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5903         o.result_ok
5904 }
5905 #[no_mangle]
5906 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5907 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5908 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5909         fn drop(&mut self) {
5910                 if self.result_ok {
5911                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5912                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5913                         }
5914                 } else {
5915                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5916                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5917                         }
5918                 }
5919         }
5920 }
5921 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5922         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5923                 let contents = if o.result_ok {
5924                         let result = unsafe { o.contents.result };
5925                         unsafe { o.contents.result = core::ptr::null_mut() };
5926                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5927                 } else {
5928                         let err = unsafe { o.contents.err };
5929                         unsafe { o.contents.err = core::ptr::null_mut(); }
5930                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5931                 };
5932                 Self {
5933                         contents,
5934                         result_ok: o.result_ok,
5935                 }
5936         }
5937 }
5938 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5939         fn clone(&self) -> Self {
5940                 if self.result_ok {
5941                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5942                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5943                         } }
5944                 } else {
5945                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5946                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5947                         } }
5948                 }
5949         }
5950 }
5951 #[no_mangle]
5952 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5953 /// but with all dynamically-allocated buffers duplicated in new buffers.
5954 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5955 #[repr(C)]
5956 /// The contents of CResult_ChannelInfoDecodeErrorZ
5957 pub union CResult_ChannelInfoDecodeErrorZPtr {
5958         /// A pointer to the contents in the success state.
5959         /// Reading from this pointer when `result_ok` is not set is undefined.
5960         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5961         /// A pointer to the contents in the error state.
5962         /// Reading from this pointer when `result_ok` is set is undefined.
5963         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5964 }
5965 #[repr(C)]
5966 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5967 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5968 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5969 pub struct CResult_ChannelInfoDecodeErrorZ {
5970         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5971         /// `err` or `result` depending on the state of `result_ok`.
5972         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5973         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5974         pub result_ok: bool,
5975 }
5976 #[no_mangle]
5977 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5978 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5979         CResult_ChannelInfoDecodeErrorZ {
5980                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5981                         result: Box::into_raw(Box::new(o)),
5982                 },
5983                 result_ok: true,
5984         }
5985 }
5986 #[no_mangle]
5987 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5988 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5989         CResult_ChannelInfoDecodeErrorZ {
5990                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5991                         err: Box::into_raw(Box::new(e)),
5992                 },
5993                 result_ok: false,
5994         }
5995 }
5996 /// Checks if the given object is currently in the success state
5997 #[no_mangle]
5998 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5999         o.result_ok
6000 }
6001 #[no_mangle]
6002 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
6003 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
6004 impl Drop for CResult_ChannelInfoDecodeErrorZ {
6005         fn drop(&mut self) {
6006                 if self.result_ok {
6007                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6008                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6009                         }
6010                 } else {
6011                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6012                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6013                         }
6014                 }
6015         }
6016 }
6017 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
6018         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6019                 let contents = if o.result_ok {
6020                         let result = unsafe { o.contents.result };
6021                         unsafe { o.contents.result = core::ptr::null_mut() };
6022                         CResult_ChannelInfoDecodeErrorZPtr { result }
6023                 } else {
6024                         let err = unsafe { o.contents.err };
6025                         unsafe { o.contents.err = core::ptr::null_mut(); }
6026                         CResult_ChannelInfoDecodeErrorZPtr { err }
6027                 };
6028                 Self {
6029                         contents,
6030                         result_ok: o.result_ok,
6031                 }
6032         }
6033 }
6034 impl Clone for CResult_ChannelInfoDecodeErrorZ {
6035         fn clone(&self) -> Self {
6036                 if self.result_ok {
6037                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
6038                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
6039                         } }
6040                 } else {
6041                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
6042                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6043                         } }
6044                 }
6045         }
6046 }
6047 #[no_mangle]
6048 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
6049 /// but with all dynamically-allocated buffers duplicated in new buffers.
6050 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
6051 #[repr(C)]
6052 /// The contents of CResult_RoutingFeesDecodeErrorZ
6053 pub union CResult_RoutingFeesDecodeErrorZPtr {
6054         /// A pointer to the contents in the success state.
6055         /// Reading from this pointer when `result_ok` is not set is undefined.
6056         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
6057         /// A pointer to the contents in the error state.
6058         /// Reading from this pointer when `result_ok` is set is undefined.
6059         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6060 }
6061 #[repr(C)]
6062 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6063 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6065 pub struct CResult_RoutingFeesDecodeErrorZ {
6066         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6067         /// `err` or `result` depending on the state of `result_ok`.
6068         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
6069         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6070         pub result_ok: bool,
6071 }
6072 #[no_mangle]
6073 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
6074 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
6075         CResult_RoutingFeesDecodeErrorZ {
6076                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6077                         result: Box::into_raw(Box::new(o)),
6078                 },
6079                 result_ok: true,
6080         }
6081 }
6082 #[no_mangle]
6083 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
6084 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
6085         CResult_RoutingFeesDecodeErrorZ {
6086                 contents: CResult_RoutingFeesDecodeErrorZPtr {
6087                         err: Box::into_raw(Box::new(e)),
6088                 },
6089                 result_ok: false,
6090         }
6091 }
6092 /// Checks if the given object is currently in the success state
6093 #[no_mangle]
6094 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
6095         o.result_ok
6096 }
6097 #[no_mangle]
6098 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
6099 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
6100 impl Drop for CResult_RoutingFeesDecodeErrorZ {
6101         fn drop(&mut self) {
6102                 if self.result_ok {
6103                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6104                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6105                         }
6106                 } else {
6107                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6108                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6109                         }
6110                 }
6111         }
6112 }
6113 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
6114         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
6115                 let contents = if o.result_ok {
6116                         let result = unsafe { o.contents.result };
6117                         unsafe { o.contents.result = core::ptr::null_mut() };
6118                         CResult_RoutingFeesDecodeErrorZPtr { result }
6119                 } else {
6120                         let err = unsafe { o.contents.err };
6121                         unsafe { o.contents.err = core::ptr::null_mut(); }
6122                         CResult_RoutingFeesDecodeErrorZPtr { err }
6123                 };
6124                 Self {
6125                         contents,
6126                         result_ok: o.result_ok,
6127                 }
6128         }
6129 }
6130 impl Clone for CResult_RoutingFeesDecodeErrorZ {
6131         fn clone(&self) -> Self {
6132                 if self.result_ok {
6133                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
6134                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
6135                         } }
6136                 } else {
6137                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
6138                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6139                         } }
6140                 }
6141         }
6142 }
6143 #[no_mangle]
6144 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
6145 /// but with all dynamically-allocated buffers duplicated in new buffers.
6146 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
6147 #[repr(C)]
6148 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6149 /// This corresponds to std::vector in C++
6150 pub struct CVec_NetAddressZ {
6151         /// The elements in the array.
6152         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6153         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6154         /// The number of elements pointed to by `data`.
6155         pub datalen: usize
6156 }
6157 impl CVec_NetAddressZ {
6158         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6159                 if self.datalen == 0 { return Vec::new(); }
6160                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6161                 self.data = core::ptr::null_mut();
6162                 self.datalen = 0;
6163                 ret
6164         }
6165         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6166                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6167         }
6168 }
6169 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6170         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6171                 let datalen = v.len();
6172                 let data = Box::into_raw(v.into_boxed_slice());
6173                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6174         }
6175 }
6176 #[no_mangle]
6177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6178 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6179 impl Drop for CVec_NetAddressZ {
6180         fn drop(&mut self) {
6181                 if self.datalen == 0 { return; }
6182                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6183         }
6184 }
6185 impl Clone for CVec_NetAddressZ {
6186         fn clone(&self) -> Self {
6187                 let mut res = Vec::new();
6188                 if self.datalen == 0 { return Self::from(res); }
6189                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6190                 Self::from(res)
6191         }
6192 }
6193 #[repr(C)]
6194 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6195 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6196         /// A pointer to the contents in the success state.
6197         /// Reading from this pointer when `result_ok` is not set is undefined.
6198         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
6199         /// A pointer to the contents in the error state.
6200         /// Reading from this pointer when `result_ok` is set is undefined.
6201         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6202 }
6203 #[repr(C)]
6204 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6205 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6207 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
6208         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6209         /// `err` or `result` depending on the state of `result_ok`.
6210         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
6211         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6212         pub result_ok: bool,
6213 }
6214 #[no_mangle]
6215 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
6216 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6217         CResult_NodeAnnouncementInfoDecodeErrorZ {
6218                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6219                         result: Box::into_raw(Box::new(o)),
6220                 },
6221                 result_ok: true,
6222         }
6223 }
6224 #[no_mangle]
6225 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
6226 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
6227         CResult_NodeAnnouncementInfoDecodeErrorZ {
6228                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6229                         err: Box::into_raw(Box::new(e)),
6230                 },
6231                 result_ok: false,
6232         }
6233 }
6234 /// Checks if the given object is currently in the success state
6235 #[no_mangle]
6236 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
6237         o.result_ok
6238 }
6239 #[no_mangle]
6240 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
6241 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
6242 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
6243         fn drop(&mut self) {
6244                 if self.result_ok {
6245                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6246                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6247                         }
6248                 } else {
6249                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6250                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6251                         }
6252                 }
6253         }
6254 }
6255 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6256         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6257                 let contents = if o.result_ok {
6258                         let result = unsafe { o.contents.result };
6259                         unsafe { o.contents.result = core::ptr::null_mut() };
6260                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6261                 } else {
6262                         let err = unsafe { o.contents.err };
6263                         unsafe { o.contents.err = core::ptr::null_mut(); }
6264                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6265                 };
6266                 Self {
6267                         contents,
6268                         result_ok: o.result_ok,
6269                 }
6270         }
6271 }
6272 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6273         fn clone(&self) -> Self {
6274                 if self.result_ok {
6275                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6276                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6277                         } }
6278                 } else {
6279                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6280                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6281                         } }
6282                 }
6283         }
6284 }
6285 #[no_mangle]
6286 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6287 /// but with all dynamically-allocated buffers duplicated in new buffers.
6288 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6289 #[repr(C)]
6290 /// The contents of CResult_NodeAliasDecodeErrorZ
6291 pub union CResult_NodeAliasDecodeErrorZPtr {
6292         /// A pointer to the contents in the success state.
6293         /// Reading from this pointer when `result_ok` is not set is undefined.
6294         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6295         /// A pointer to the contents in the error state.
6296         /// Reading from this pointer when `result_ok` is set is undefined.
6297         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6298 }
6299 #[repr(C)]
6300 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6301 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6303 pub struct CResult_NodeAliasDecodeErrorZ {
6304         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6305         /// `err` or `result` depending on the state of `result_ok`.
6306         pub contents: CResult_NodeAliasDecodeErrorZPtr,
6307         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6308         pub result_ok: bool,
6309 }
6310 #[no_mangle]
6311 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6312 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6313         CResult_NodeAliasDecodeErrorZ {
6314                 contents: CResult_NodeAliasDecodeErrorZPtr {
6315                         result: Box::into_raw(Box::new(o)),
6316                 },
6317                 result_ok: true,
6318         }
6319 }
6320 #[no_mangle]
6321 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6322 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6323         CResult_NodeAliasDecodeErrorZ {
6324                 contents: CResult_NodeAliasDecodeErrorZPtr {
6325                         err: Box::into_raw(Box::new(e)),
6326                 },
6327                 result_ok: false,
6328         }
6329 }
6330 /// Checks if the given object is currently in the success state
6331 #[no_mangle]
6332 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6333         o.result_ok
6334 }
6335 #[no_mangle]
6336 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6337 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6338 impl Drop for CResult_NodeAliasDecodeErrorZ {
6339         fn drop(&mut self) {
6340                 if self.result_ok {
6341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6343                         }
6344                 } else {
6345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6347                         }
6348                 }
6349         }
6350 }
6351 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6353                 let contents = if o.result_ok {
6354                         let result = unsafe { o.contents.result };
6355                         unsafe { o.contents.result = core::ptr::null_mut() };
6356                         CResult_NodeAliasDecodeErrorZPtr { result }
6357                 } else {
6358                         let err = unsafe { o.contents.err };
6359                         unsafe { o.contents.err = core::ptr::null_mut(); }
6360                         CResult_NodeAliasDecodeErrorZPtr { err }
6361                 };
6362                 Self {
6363                         contents,
6364                         result_ok: o.result_ok,
6365                 }
6366         }
6367 }
6368 impl Clone for CResult_NodeAliasDecodeErrorZ {
6369         fn clone(&self) -> Self {
6370                 if self.result_ok {
6371                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6372                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6373                         } }
6374                 } else {
6375                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6377                         } }
6378                 }
6379         }
6380 }
6381 #[no_mangle]
6382 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6383 /// but with all dynamically-allocated buffers duplicated in new buffers.
6384 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6385 #[repr(C)]
6386 /// The contents of CResult_NodeInfoDecodeErrorZ
6387 pub union CResult_NodeInfoDecodeErrorZPtr {
6388         /// A pointer to the contents in the success state.
6389         /// Reading from this pointer when `result_ok` is not set is undefined.
6390         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6391         /// A pointer to the contents in the error state.
6392         /// Reading from this pointer when `result_ok` is set is undefined.
6393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6394 }
6395 #[repr(C)]
6396 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6397 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6399 pub struct CResult_NodeInfoDecodeErrorZ {
6400         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6401         /// `err` or `result` depending on the state of `result_ok`.
6402         pub contents: CResult_NodeInfoDecodeErrorZPtr,
6403         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6404         pub result_ok: bool,
6405 }
6406 #[no_mangle]
6407 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6408 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6409         CResult_NodeInfoDecodeErrorZ {
6410                 contents: CResult_NodeInfoDecodeErrorZPtr {
6411                         result: Box::into_raw(Box::new(o)),
6412                 },
6413                 result_ok: true,
6414         }
6415 }
6416 #[no_mangle]
6417 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6418 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6419         CResult_NodeInfoDecodeErrorZ {
6420                 contents: CResult_NodeInfoDecodeErrorZPtr {
6421                         err: Box::into_raw(Box::new(e)),
6422                 },
6423                 result_ok: false,
6424         }
6425 }
6426 /// Checks if the given object is currently in the success state
6427 #[no_mangle]
6428 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6429         o.result_ok
6430 }
6431 #[no_mangle]
6432 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6433 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6434 impl Drop for CResult_NodeInfoDecodeErrorZ {
6435         fn drop(&mut self) {
6436                 if self.result_ok {
6437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6439                         }
6440                 } else {
6441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6443                         }
6444                 }
6445         }
6446 }
6447 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6449                 let contents = if o.result_ok {
6450                         let result = unsafe { o.contents.result };
6451                         unsafe { o.contents.result = core::ptr::null_mut() };
6452                         CResult_NodeInfoDecodeErrorZPtr { result }
6453                 } else {
6454                         let err = unsafe { o.contents.err };
6455                         unsafe { o.contents.err = core::ptr::null_mut(); }
6456                         CResult_NodeInfoDecodeErrorZPtr { err }
6457                 };
6458                 Self {
6459                         contents,
6460                         result_ok: o.result_ok,
6461                 }
6462         }
6463 }
6464 impl Clone for CResult_NodeInfoDecodeErrorZ {
6465         fn clone(&self) -> Self {
6466                 if self.result_ok {
6467                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6468                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6469                         } }
6470                 } else {
6471                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6473                         } }
6474                 }
6475         }
6476 }
6477 #[no_mangle]
6478 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6479 /// but with all dynamically-allocated buffers duplicated in new buffers.
6480 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6481 #[repr(C)]
6482 /// The contents of CResult_NetworkGraphDecodeErrorZ
6483 pub union CResult_NetworkGraphDecodeErrorZPtr {
6484         /// A pointer to the contents in the success state.
6485         /// Reading from this pointer when `result_ok` is not set is undefined.
6486         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6487         /// A pointer to the contents in the error state.
6488         /// Reading from this pointer when `result_ok` is set is undefined.
6489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6490 }
6491 #[repr(C)]
6492 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6493 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6495 pub struct CResult_NetworkGraphDecodeErrorZ {
6496         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6497         /// `err` or `result` depending on the state of `result_ok`.
6498         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6499         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6500         pub result_ok: bool,
6501 }
6502 #[no_mangle]
6503 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6504 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6505         CResult_NetworkGraphDecodeErrorZ {
6506                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6507                         result: Box::into_raw(Box::new(o)),
6508                 },
6509                 result_ok: true,
6510         }
6511 }
6512 #[no_mangle]
6513 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6514 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6515         CResult_NetworkGraphDecodeErrorZ {
6516                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6517                         err: Box::into_raw(Box::new(e)),
6518                 },
6519                 result_ok: false,
6520         }
6521 }
6522 /// Checks if the given object is currently in the success state
6523 #[no_mangle]
6524 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6525         o.result_ok
6526 }
6527 #[no_mangle]
6528 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6529 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6530 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6531         fn drop(&mut self) {
6532                 if self.result_ok {
6533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6535                         }
6536                 } else {
6537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6539                         }
6540                 }
6541         }
6542 }
6543 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6545                 let contents = if o.result_ok {
6546                         let result = unsafe { o.contents.result };
6547                         unsafe { o.contents.result = core::ptr::null_mut() };
6548                         CResult_NetworkGraphDecodeErrorZPtr { result }
6549                 } else {
6550                         let err = unsafe { o.contents.err };
6551                         unsafe { o.contents.err = core::ptr::null_mut(); }
6552                         CResult_NetworkGraphDecodeErrorZPtr { err }
6553                 };
6554                 Self {
6555                         contents,
6556                         result_ok: o.result_ok,
6557                 }
6558         }
6559 }
6560 #[repr(C)]
6561 #[derive(Clone)]
6562 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6563 pub enum COption_CVec_NetAddressZZ {
6564         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6565         Some(crate::c_types::derived::CVec_NetAddressZ),
6566         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6567         None
6568 }
6569 impl COption_CVec_NetAddressZZ {
6570         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6571                 if let Self::None = self { false } else { true }
6572         }
6573         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6574                 !self.is_some()
6575         }
6576         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6577                 if let Self::Some(v) = self { v } else { unreachable!() }
6578         }
6579 }
6580 #[no_mangle]
6581 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6582 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6583         COption_CVec_NetAddressZZ::Some(o)
6584 }
6585 #[no_mangle]
6586 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6587 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6588         COption_CVec_NetAddressZZ::None
6589 }
6590 #[no_mangle]
6591 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6592 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6593 #[no_mangle]
6594 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6595 /// but with all dynamically-allocated buffers duplicated in new buffers.
6596 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6597 #[repr(C)]
6598 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6599 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6600         /// A pointer to the contents in the success state.
6601         /// Reading from this pointer when `result_ok` is not set is undefined.
6602         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6603         /// A pointer to the contents in the error state.
6604         /// Reading from this pointer when `result_ok` is set is undefined.
6605         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6606 }
6607 #[repr(C)]
6608 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6609 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6611 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6612         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6613         /// `err` or `result` depending on the state of `result_ok`.
6614         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6615         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6616         pub result_ok: bool,
6617 }
6618 #[no_mangle]
6619 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6620 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6621         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6622                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6623                         result: Box::into_raw(Box::new(o)),
6624                 },
6625                 result_ok: true,
6626         }
6627 }
6628 #[no_mangle]
6629 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6630 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6631         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6632                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6633                         err: Box::into_raw(Box::new(e)),
6634                 },
6635                 result_ok: false,
6636         }
6637 }
6638 /// Checks if the given object is currently in the success state
6639 #[no_mangle]
6640 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6641         o.result_ok
6642 }
6643 #[no_mangle]
6644 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6645 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6646 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6647         fn drop(&mut self) {
6648                 if self.result_ok {
6649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6651                         }
6652                 } else {
6653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6655                         }
6656                 }
6657         }
6658 }
6659 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6660         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6661                 let contents = if o.result_ok {
6662                         let result = unsafe { o.contents.result };
6663                         unsafe { o.contents.result = core::ptr::null_mut() };
6664                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6665                 } else {
6666                         let err = unsafe { o.contents.err };
6667                         unsafe { o.contents.err = core::ptr::null_mut(); }
6668                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6669                 };
6670                 Self {
6671                         contents,
6672                         result_ok: o.result_ok,
6673                 }
6674         }
6675 }
6676 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6677         fn clone(&self) -> Self {
6678                 if self.result_ok {
6679                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6680                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6681                         } }
6682                 } else {
6683                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6685                         } }
6686                 }
6687         }
6688 }
6689 #[no_mangle]
6690 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6691 /// but with all dynamically-allocated buffers duplicated in new buffers.
6692 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6693 #[repr(C)]
6694 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6695 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6696         /// A pointer to the contents in the success state.
6697         /// Reading from this pointer when `result_ok` is not set is undefined.
6698         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6699         /// A pointer to the contents in the error state.
6700         /// Reading from this pointer when `result_ok` is set is undefined.
6701         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6702 }
6703 #[repr(C)]
6704 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6705 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6707 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6708         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6709         /// `err` or `result` depending on the state of `result_ok`.
6710         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6711         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6712         pub result_ok: bool,
6713 }
6714 #[no_mangle]
6715 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6716 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6717         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6718                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6719                         result: Box::into_raw(Box::new(o)),
6720                 },
6721                 result_ok: true,
6722         }
6723 }
6724 #[no_mangle]
6725 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6726 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6727         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6728                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6729                         err: Box::into_raw(Box::new(e)),
6730                 },
6731                 result_ok: false,
6732         }
6733 }
6734 /// Checks if the given object is currently in the success state
6735 #[no_mangle]
6736 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6737         o.result_ok
6738 }
6739 #[no_mangle]
6740 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6741 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6742 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6743         fn drop(&mut self) {
6744                 if self.result_ok {
6745                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6746                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6747                         }
6748                 } else {
6749                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6750                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6751                         }
6752                 }
6753         }
6754 }
6755 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6756         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6757                 let contents = if o.result_ok {
6758                         let result = unsafe { o.contents.result };
6759                         unsafe { o.contents.result = core::ptr::null_mut() };
6760                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6761                 } else {
6762                         let err = unsafe { o.contents.err };
6763                         unsafe { o.contents.err = core::ptr::null_mut(); }
6764                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6765                 };
6766                 Self {
6767                         contents,
6768                         result_ok: o.result_ok,
6769                 }
6770         }
6771 }
6772 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6773         fn clone(&self) -> Self {
6774                 if self.result_ok {
6775                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6776                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6777                         } }
6778                 } else {
6779                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6780                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6781                         } }
6782                 }
6783         }
6784 }
6785 #[no_mangle]
6786 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6787 /// but with all dynamically-allocated buffers duplicated in new buffers.
6788 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6789 #[repr(C)]
6790 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6791 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6792         /// A pointer to the contents in the success state.
6793         /// Reading from this pointer when `result_ok` is not set is undefined.
6794         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6795         /// A pointer to the contents in the error state.
6796         /// Reading from this pointer when `result_ok` is set is undefined.
6797         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6798 }
6799 #[repr(C)]
6800 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6801 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6803 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6804         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6805         /// `err` or `result` depending on the state of `result_ok`.
6806         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6807         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6808         pub result_ok: bool,
6809 }
6810 #[no_mangle]
6811 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6812 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6813         CResult_SpendableOutputDescriptorDecodeErrorZ {
6814                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6815                         result: Box::into_raw(Box::new(o)),
6816                 },
6817                 result_ok: true,
6818         }
6819 }
6820 #[no_mangle]
6821 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6822 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6823         CResult_SpendableOutputDescriptorDecodeErrorZ {
6824                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6825                         err: Box::into_raw(Box::new(e)),
6826                 },
6827                 result_ok: false,
6828         }
6829 }
6830 /// Checks if the given object is currently in the success state
6831 #[no_mangle]
6832 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6833         o.result_ok
6834 }
6835 #[no_mangle]
6836 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6837 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6838 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6839         fn drop(&mut self) {
6840                 if self.result_ok {
6841                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6842                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6843                         }
6844                 } else {
6845                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6846                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6847                         }
6848                 }
6849         }
6850 }
6851 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6852         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6853                 let contents = if o.result_ok {
6854                         let result = unsafe { o.contents.result };
6855                         unsafe { o.contents.result = core::ptr::null_mut() };
6856                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6857                 } else {
6858                         let err = unsafe { o.contents.err };
6859                         unsafe { o.contents.err = core::ptr::null_mut(); }
6860                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6861                 };
6862                 Self {
6863                         contents,
6864                         result_ok: o.result_ok,
6865                 }
6866         }
6867 }
6868 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6869         fn clone(&self) -> Self {
6870                 if self.result_ok {
6871                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6872                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6873                         } }
6874                 } else {
6875                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6876                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6877                         } }
6878                 }
6879         }
6880 }
6881 #[no_mangle]
6882 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6883 /// but with all dynamically-allocated buffers duplicated in new buffers.
6884 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6885 #[repr(C)]
6886 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6887 /// This corresponds to std::vector in C++
6888 pub struct CVec_PaymentPreimageZ {
6889         /// The elements in the array.
6890         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6891         pub data: *mut crate::c_types::ThirtyTwoBytes,
6892         /// The number of elements pointed to by `data`.
6893         pub datalen: usize
6894 }
6895 impl CVec_PaymentPreimageZ {
6896         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6897                 if self.datalen == 0 { return Vec::new(); }
6898                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6899                 self.data = core::ptr::null_mut();
6900                 self.datalen = 0;
6901                 ret
6902         }
6903         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6904                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6905         }
6906 }
6907 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6908         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6909                 let datalen = v.len();
6910                 let data = Box::into_raw(v.into_boxed_slice());
6911                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6912         }
6913 }
6914 #[no_mangle]
6915 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6916 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6917 impl Drop for CVec_PaymentPreimageZ {
6918         fn drop(&mut self) {
6919                 if self.datalen == 0 { return; }
6920                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6921         }
6922 }
6923 impl Clone for CVec_PaymentPreimageZ {
6924         fn clone(&self) -> Self {
6925                 let mut res = Vec::new();
6926                 if self.datalen == 0 { return Self::from(res); }
6927                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6928                 Self::from(res)
6929         }
6930 }
6931 #[repr(C)]
6932 /// A tuple of 2 elements. See the individual fields for the types contained.
6933 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6934         /// The element at position 0
6935         pub a: crate::c_types::Signature,
6936         /// The element at position 1
6937         pub b: crate::c_types::derived::CVec_SignatureZ,
6938 }
6939 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6940         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6941                 Self {
6942                         a: tup.0,
6943                         b: tup.1,
6944                 }
6945         }
6946 }
6947 impl C2Tuple_SignatureCVec_SignatureZZ {
6948         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6949                 (self.a, self.b)
6950         }
6951 }
6952 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6953         fn clone(&self) -> Self {
6954                 Self {
6955                         a: Clone::clone(&self.a),
6956                         b: Clone::clone(&self.b),
6957                 }
6958         }
6959 }
6960 #[no_mangle]
6961 /// Creates a new tuple which has the same data as `orig`
6962 /// but with all dynamically-allocated buffers duplicated in new buffers.
6963 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6964 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6965 #[no_mangle]
6966 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6967         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6968 }
6969
6970 #[no_mangle]
6971 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6972 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6973 #[repr(C)]
6974 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6975 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6976         /// A pointer to the contents in the success state.
6977         /// Reading from this pointer when `result_ok` is not set is undefined.
6978         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6979         /// Note that this value is always NULL, as there are no contents in the Err variant
6980         pub err: *mut core::ffi::c_void,
6981 }
6982 #[repr(C)]
6983 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6984 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6986 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6987         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6988         /// `err` or `result` depending on the state of `result_ok`.
6989         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6990         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6991         pub result_ok: bool,
6992 }
6993 #[no_mangle]
6994 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6995 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6996         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6997                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6998                         result: Box::into_raw(Box::new(o)),
6999                 },
7000                 result_ok: true,
7001         }
7002 }
7003 #[no_mangle]
7004 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
7005 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7006         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7007                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7008                         err: core::ptr::null_mut(),
7009                 },
7010                 result_ok: false,
7011         }
7012 }
7013 /// Checks if the given object is currently in the success state
7014 #[no_mangle]
7015 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
7016         o.result_ok
7017 }
7018 #[no_mangle]
7019 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
7020 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
7021 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7022         fn drop(&mut self) {
7023                 if self.result_ok {
7024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7026                         }
7027                 } else {
7028                 }
7029         }
7030 }
7031 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7032         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
7033                 let contents = if o.result_ok {
7034                         let result = unsafe { o.contents.result };
7035                         unsafe { o.contents.result = core::ptr::null_mut() };
7036                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
7037                 } else {
7038                         let _ = unsafe { Box::from_raw(o.contents.err) };
7039                         o.contents.err = core::ptr::null_mut();
7040                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
7041                 };
7042                 Self {
7043                         contents,
7044                         result_ok: o.result_ok,
7045                 }
7046         }
7047 }
7048 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7049         fn clone(&self) -> Self {
7050                 if self.result_ok {
7051                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7052                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
7053                         } }
7054                 } else {
7055                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7056                                 err: core::ptr::null_mut()
7057                         } }
7058                 }
7059         }
7060 }
7061 #[no_mangle]
7062 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
7063 /// but with all dynamically-allocated buffers duplicated in new buffers.
7064 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
7065 #[repr(C)]
7066 /// The contents of CResult_SignatureNoneZ
7067 pub union CResult_SignatureNoneZPtr {
7068         /// A pointer to the contents in the success state.
7069         /// Reading from this pointer when `result_ok` is not set is undefined.
7070         pub result: *mut crate::c_types::Signature,
7071         /// Note that this value is always NULL, as there are no contents in the Err variant
7072         pub err: *mut core::ffi::c_void,
7073 }
7074 #[repr(C)]
7075 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
7076 /// containing a crate::c_types::Signature on success and a () on failure.
7077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7078 pub struct CResult_SignatureNoneZ {
7079         /// The contents of this CResult_SignatureNoneZ, accessible via either
7080         /// `err` or `result` depending on the state of `result_ok`.
7081         pub contents: CResult_SignatureNoneZPtr,
7082         /// Whether this CResult_SignatureNoneZ represents a success state.
7083         pub result_ok: bool,
7084 }
7085 #[no_mangle]
7086 /// Creates a new CResult_SignatureNoneZ in the success state.
7087 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
7088         CResult_SignatureNoneZ {
7089                 contents: CResult_SignatureNoneZPtr {
7090                         result: Box::into_raw(Box::new(o)),
7091                 },
7092                 result_ok: true,
7093         }
7094 }
7095 #[no_mangle]
7096 /// Creates a new CResult_SignatureNoneZ in the error state.
7097 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
7098         CResult_SignatureNoneZ {
7099                 contents: CResult_SignatureNoneZPtr {
7100                         err: core::ptr::null_mut(),
7101                 },
7102                 result_ok: false,
7103         }
7104 }
7105 /// Checks if the given object is currently in the success state
7106 #[no_mangle]
7107 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
7108         o.result_ok
7109 }
7110 #[no_mangle]
7111 /// Frees any resources used by the CResult_SignatureNoneZ.
7112 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
7113 impl Drop for CResult_SignatureNoneZ {
7114         fn drop(&mut self) {
7115                 if self.result_ok {
7116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7118                         }
7119                 } else {
7120                 }
7121         }
7122 }
7123 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
7124         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
7125                 let contents = if o.result_ok {
7126                         let result = unsafe { o.contents.result };
7127                         unsafe { o.contents.result = core::ptr::null_mut() };
7128                         CResult_SignatureNoneZPtr { result }
7129                 } else {
7130                         let _ = unsafe { Box::from_raw(o.contents.err) };
7131                         o.contents.err = core::ptr::null_mut();
7132                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
7133                 };
7134                 Self {
7135                         contents,
7136                         result_ok: o.result_ok,
7137                 }
7138         }
7139 }
7140 impl Clone for CResult_SignatureNoneZ {
7141         fn clone(&self) -> Self {
7142                 if self.result_ok {
7143                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
7144                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
7145                         } }
7146                 } else {
7147                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
7148                                 err: core::ptr::null_mut()
7149                         } }
7150                 }
7151         }
7152 }
7153 #[no_mangle]
7154 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
7155 /// but with all dynamically-allocated buffers duplicated in new buffers.
7156 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
7157 #[repr(C)]
7158 /// The contents of CResult_PublicKeyNoneZ
7159 pub union CResult_PublicKeyNoneZPtr {
7160         /// A pointer to the contents in the success state.
7161         /// Reading from this pointer when `result_ok` is not set is undefined.
7162         pub result: *mut crate::c_types::PublicKey,
7163         /// Note that this value is always NULL, as there are no contents in the Err variant
7164         pub err: *mut core::ffi::c_void,
7165 }
7166 #[repr(C)]
7167 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7168 /// containing a crate::c_types::PublicKey on success and a () on failure.
7169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7170 pub struct CResult_PublicKeyNoneZ {
7171         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7172         /// `err` or `result` depending on the state of `result_ok`.
7173         pub contents: CResult_PublicKeyNoneZPtr,
7174         /// Whether this CResult_PublicKeyNoneZ represents a success state.
7175         pub result_ok: bool,
7176 }
7177 #[no_mangle]
7178 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7179 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7180         CResult_PublicKeyNoneZ {
7181                 contents: CResult_PublicKeyNoneZPtr {
7182                         result: Box::into_raw(Box::new(o)),
7183                 },
7184                 result_ok: true,
7185         }
7186 }
7187 #[no_mangle]
7188 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7189 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7190         CResult_PublicKeyNoneZ {
7191                 contents: CResult_PublicKeyNoneZPtr {
7192                         err: core::ptr::null_mut(),
7193                 },
7194                 result_ok: false,
7195         }
7196 }
7197 /// Checks if the given object is currently in the success state
7198 #[no_mangle]
7199 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7200         o.result_ok
7201 }
7202 #[no_mangle]
7203 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7204 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7205 impl Drop for CResult_PublicKeyNoneZ {
7206         fn drop(&mut self) {
7207                 if self.result_ok {
7208                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7209                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7210                         }
7211                 } else {
7212                 }
7213         }
7214 }
7215 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7216         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7217                 let contents = if o.result_ok {
7218                         let result = unsafe { o.contents.result };
7219                         unsafe { o.contents.result = core::ptr::null_mut() };
7220                         CResult_PublicKeyNoneZPtr { result }
7221                 } else {
7222                         let _ = unsafe { Box::from_raw(o.contents.err) };
7223                         o.contents.err = core::ptr::null_mut();
7224                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7225                 };
7226                 Self {
7227                         contents,
7228                         result_ok: o.result_ok,
7229                 }
7230         }
7231 }
7232 impl Clone for CResult_PublicKeyNoneZ {
7233         fn clone(&self) -> Self {
7234                 if self.result_ok {
7235                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7236                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7237                         } }
7238                 } else {
7239                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7240                                 err: core::ptr::null_mut()
7241                         } }
7242                 }
7243         }
7244 }
7245 #[no_mangle]
7246 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7247 /// but with all dynamically-allocated buffers duplicated in new buffers.
7248 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7249 #[repr(C)]
7250 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7251 pub enum COption_ScalarZ {
7252         /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7253         Some(crate::c_types::BigEndianScalar),
7254         /// When we're in this state, this COption_ScalarZ contains nothing
7255         None
7256 }
7257 impl COption_ScalarZ {
7258         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7259                 if let Self::None = self { false } else { true }
7260         }
7261         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7262                 !self.is_some()
7263         }
7264         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7265                 if let Self::Some(v) = self { v } else { unreachable!() }
7266         }
7267 }
7268 #[no_mangle]
7269 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7270 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7271         COption_ScalarZ::Some(o)
7272 }
7273 #[no_mangle]
7274 /// Constructs a new COption_ScalarZ containing nothing
7275 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7276         COption_ScalarZ::None
7277 }
7278 #[no_mangle]
7279 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7280 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7281 #[repr(C)]
7282 /// The contents of CResult_SharedSecretNoneZ
7283 pub union CResult_SharedSecretNoneZPtr {
7284         /// A pointer to the contents in the success state.
7285         /// Reading from this pointer when `result_ok` is not set is undefined.
7286         pub result: *mut crate::c_types::ThirtyTwoBytes,
7287         /// Note that this value is always NULL, as there are no contents in the Err variant
7288         pub err: *mut core::ffi::c_void,
7289 }
7290 #[repr(C)]
7291 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7292 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7294 pub struct CResult_SharedSecretNoneZ {
7295         /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7296         /// `err` or `result` depending on the state of `result_ok`.
7297         pub contents: CResult_SharedSecretNoneZPtr,
7298         /// Whether this CResult_SharedSecretNoneZ represents a success state.
7299         pub result_ok: bool,
7300 }
7301 #[no_mangle]
7302 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7303 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7304         CResult_SharedSecretNoneZ {
7305                 contents: CResult_SharedSecretNoneZPtr {
7306                         result: Box::into_raw(Box::new(o)),
7307                 },
7308                 result_ok: true,
7309         }
7310 }
7311 #[no_mangle]
7312 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7313 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7314         CResult_SharedSecretNoneZ {
7315                 contents: CResult_SharedSecretNoneZPtr {
7316                         err: core::ptr::null_mut(),
7317                 },
7318                 result_ok: false,
7319         }
7320 }
7321 /// Checks if the given object is currently in the success state
7322 #[no_mangle]
7323 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7324         o.result_ok
7325 }
7326 #[no_mangle]
7327 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7328 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7329 impl Drop for CResult_SharedSecretNoneZ {
7330         fn drop(&mut self) {
7331                 if self.result_ok {
7332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7334                         }
7335                 } else {
7336                 }
7337         }
7338 }
7339 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7340         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7341                 let contents = if o.result_ok {
7342                         let result = unsafe { o.contents.result };
7343                         unsafe { o.contents.result = core::ptr::null_mut() };
7344                         CResult_SharedSecretNoneZPtr { result }
7345                 } else {
7346                         let _ = unsafe { Box::from_raw(o.contents.err) };
7347                         o.contents.err = core::ptr::null_mut();
7348                         CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7349                 };
7350                 Self {
7351                         contents,
7352                         result_ok: o.result_ok,
7353                 }
7354         }
7355 }
7356 impl Clone for CResult_SharedSecretNoneZ {
7357         fn clone(&self) -> Self {
7358                 if self.result_ok {
7359                         Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7360                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7361                         } }
7362                 } else {
7363                         Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7364                                 err: core::ptr::null_mut()
7365                         } }
7366                 }
7367         }
7368 }
7369 #[no_mangle]
7370 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7371 /// but with all dynamically-allocated buffers duplicated in new buffers.
7372 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7373 #[repr(C)]
7374 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7375 /// This corresponds to std::vector in C++
7376 pub struct CVec_U5Z {
7377         /// The elements in the array.
7378         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7379         pub data: *mut crate::c_types::U5,
7380         /// The number of elements pointed to by `data`.
7381         pub datalen: usize
7382 }
7383 impl CVec_U5Z {
7384         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7385                 if self.datalen == 0 { return Vec::new(); }
7386                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7387                 self.data = core::ptr::null_mut();
7388                 self.datalen = 0;
7389                 ret
7390         }
7391         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7392                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7393         }
7394 }
7395 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7396         fn from(v: Vec<crate::c_types::U5>) -> Self {
7397                 let datalen = v.len();
7398                 let data = Box::into_raw(v.into_boxed_slice());
7399                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7400         }
7401 }
7402 #[no_mangle]
7403 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7404 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7405 impl Drop for CVec_U5Z {
7406         fn drop(&mut self) {
7407                 if self.datalen == 0 { return; }
7408                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7409         }
7410 }
7411 impl Clone for CVec_U5Z {
7412         fn clone(&self) -> Self {
7413                 let mut res = Vec::new();
7414                 if self.datalen == 0 { return Self::from(res); }
7415                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7416                 Self::from(res)
7417         }
7418 }
7419 #[repr(C)]
7420 /// The contents of CResult_RecoverableSignatureNoneZ
7421 pub union CResult_RecoverableSignatureNoneZPtr {
7422         /// A pointer to the contents in the success state.
7423         /// Reading from this pointer when `result_ok` is not set is undefined.
7424         pub result: *mut crate::c_types::RecoverableSignature,
7425         /// Note that this value is always NULL, as there are no contents in the Err variant
7426         pub err: *mut core::ffi::c_void,
7427 }
7428 #[repr(C)]
7429 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7430 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7432 pub struct CResult_RecoverableSignatureNoneZ {
7433         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7434         /// `err` or `result` depending on the state of `result_ok`.
7435         pub contents: CResult_RecoverableSignatureNoneZPtr,
7436         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7437         pub result_ok: bool,
7438 }
7439 #[no_mangle]
7440 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7441 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7442         CResult_RecoverableSignatureNoneZ {
7443                 contents: CResult_RecoverableSignatureNoneZPtr {
7444                         result: Box::into_raw(Box::new(o)),
7445                 },
7446                 result_ok: true,
7447         }
7448 }
7449 #[no_mangle]
7450 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7451 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7452         CResult_RecoverableSignatureNoneZ {
7453                 contents: CResult_RecoverableSignatureNoneZPtr {
7454                         err: core::ptr::null_mut(),
7455                 },
7456                 result_ok: false,
7457         }
7458 }
7459 /// Checks if the given object is currently in the success state
7460 #[no_mangle]
7461 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7462         o.result_ok
7463 }
7464 #[no_mangle]
7465 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7466 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7467 impl Drop for CResult_RecoverableSignatureNoneZ {
7468         fn drop(&mut self) {
7469                 if self.result_ok {
7470                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7471                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7472                         }
7473                 } else {
7474                 }
7475         }
7476 }
7477 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7478         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7479                 let contents = if o.result_ok {
7480                         let result = unsafe { o.contents.result };
7481                         unsafe { o.contents.result = core::ptr::null_mut() };
7482                         CResult_RecoverableSignatureNoneZPtr { result }
7483                 } else {
7484                         let _ = unsafe { Box::from_raw(o.contents.err) };
7485                         o.contents.err = core::ptr::null_mut();
7486                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7487                 };
7488                 Self {
7489                         contents,
7490                         result_ok: o.result_ok,
7491                 }
7492         }
7493 }
7494 impl Clone for CResult_RecoverableSignatureNoneZ {
7495         fn clone(&self) -> Self {
7496                 if self.result_ok {
7497                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7498                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7499                         } }
7500                 } else {
7501                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7502                                 err: core::ptr::null_mut()
7503                         } }
7504                 }
7505         }
7506 }
7507 #[no_mangle]
7508 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7509 /// but with all dynamically-allocated buffers duplicated in new buffers.
7510 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7511 #[repr(C)]
7512 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
7513 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7514         /// A pointer to the contents in the success state.
7515         /// Reading from this pointer when `result_ok` is not set is undefined.
7516         pub result: *mut crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner,
7517         /// A pointer to the contents in the error state.
7518         /// Reading from this pointer when `result_ok` is set is undefined.
7519         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7520 }
7521 #[repr(C)]
7522 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
7523 /// containing a crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7525 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7526         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
7527         /// `err` or `result` depending on the state of `result_ok`.
7528         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
7529         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
7530         pub result_ok: bool,
7531 }
7532 #[no_mangle]
7533 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
7534 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7535         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7536                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7537                         result: Box::into_raw(Box::new(o)),
7538                 },
7539                 result_ok: true,
7540         }
7541 }
7542 #[no_mangle]
7543 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
7544 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7545         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7546                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
7547                         err: Box::into_raw(Box::new(e)),
7548                 },
7549                 result_ok: false,
7550         }
7551 }
7552 /// Checks if the given object is currently in the success state
7553 #[no_mangle]
7554 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
7555         o.result_ok
7556 }
7557 #[no_mangle]
7558 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
7559 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
7560 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7561         fn drop(&mut self) {
7562                 if self.result_ok {
7563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7565                         }
7566                 } else {
7567                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7568                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7569                         }
7570                 }
7571         }
7572 }
7573 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
7574         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7575                 let contents = if o.result_ok {
7576                         let result = unsafe { o.contents.result };
7577                         unsafe { o.contents.result = core::ptr::null_mut() };
7578                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
7579                 } else {
7580                         let err = unsafe { o.contents.err };
7581                         unsafe { o.contents.err = core::ptr::null_mut(); }
7582                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
7583                 };
7584                 Self {
7585                         contents,
7586                         result_ok: o.result_ok,
7587                 }
7588         }
7589 }
7590 #[repr(C)]
7591 /// A dynamically-allocated array of u8s of arbitrary size.
7592 /// This corresponds to std::vector in C++
7593 pub struct CVec_u8Z {
7594         /// The elements in the array.
7595         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7596         pub data: *mut u8,
7597         /// The number of elements pointed to by `data`.
7598         pub datalen: usize
7599 }
7600 impl CVec_u8Z {
7601         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7602                 if self.datalen == 0 { return Vec::new(); }
7603                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7604                 self.data = core::ptr::null_mut();
7605                 self.datalen = 0;
7606                 ret
7607         }
7608         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7609                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7610         }
7611 }
7612 impl From<Vec<u8>> for CVec_u8Z {
7613         fn from(v: Vec<u8>) -> Self {
7614                 let datalen = v.len();
7615                 let data = Box::into_raw(v.into_boxed_slice());
7616                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7617         }
7618 }
7619 #[no_mangle]
7620 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7621 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7622 impl Drop for CVec_u8Z {
7623         fn drop(&mut self) {
7624                 if self.datalen == 0 { return; }
7625                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7626         }
7627 }
7628 impl Clone for CVec_u8Z {
7629         fn clone(&self) -> Self {
7630                 let mut res = Vec::new();
7631                 if self.datalen == 0 { return Self::from(res); }
7632                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7633                 Self::from(res)
7634         }
7635 }
7636 #[repr(C)]
7637 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7638 /// This corresponds to std::vector in C++
7639 pub struct CVec_CVec_u8ZZ {
7640         /// The elements in the array.
7641         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7642         pub data: *mut crate::c_types::derived::CVec_u8Z,
7643         /// The number of elements pointed to by `data`.
7644         pub datalen: usize
7645 }
7646 impl CVec_CVec_u8ZZ {
7647         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7648                 if self.datalen == 0 { return Vec::new(); }
7649                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7650                 self.data = core::ptr::null_mut();
7651                 self.datalen = 0;
7652                 ret
7653         }
7654         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7655                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7656         }
7657 }
7658 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7659         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7660                 let datalen = v.len();
7661                 let data = Box::into_raw(v.into_boxed_slice());
7662                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7663         }
7664 }
7665 #[no_mangle]
7666 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7667 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7668 impl Drop for CVec_CVec_u8ZZ {
7669         fn drop(&mut self) {
7670                 if self.datalen == 0 { return; }
7671                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7672         }
7673 }
7674 impl Clone for CVec_CVec_u8ZZ {
7675         fn clone(&self) -> Self {
7676                 let mut res = Vec::new();
7677                 if self.datalen == 0 { return Self::from(res); }
7678                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7679                 Self::from(res)
7680         }
7681 }
7682 #[repr(C)]
7683 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7684 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7685         /// A pointer to the contents in the success state.
7686         /// Reading from this pointer when `result_ok` is not set is undefined.
7687         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7688         /// Note that this value is always NULL, as there are no contents in the Err variant
7689         pub err: *mut core::ffi::c_void,
7690 }
7691 #[repr(C)]
7692 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7693 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7695 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7696         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7697         /// `err` or `result` depending on the state of `result_ok`.
7698         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7699         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7700         pub result_ok: bool,
7701 }
7702 #[no_mangle]
7703 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7704 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7705         CResult_CVec_CVec_u8ZZNoneZ {
7706                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7707                         result: Box::into_raw(Box::new(o)),
7708                 },
7709                 result_ok: true,
7710         }
7711 }
7712 #[no_mangle]
7713 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7714 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7715         CResult_CVec_CVec_u8ZZNoneZ {
7716                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7717                         err: core::ptr::null_mut(),
7718                 },
7719                 result_ok: false,
7720         }
7721 }
7722 /// Checks if the given object is currently in the success state
7723 #[no_mangle]
7724 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7725         o.result_ok
7726 }
7727 #[no_mangle]
7728 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7729 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7730 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7731         fn drop(&mut self) {
7732                 if self.result_ok {
7733                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7734                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7735                         }
7736                 } else {
7737                 }
7738         }
7739 }
7740 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7741         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7742                 let contents = if o.result_ok {
7743                         let result = unsafe { o.contents.result };
7744                         unsafe { o.contents.result = core::ptr::null_mut() };
7745                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
7746                 } else {
7747                         let _ = unsafe { Box::from_raw(o.contents.err) };
7748                         o.contents.err = core::ptr::null_mut();
7749                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7750                 };
7751                 Self {
7752                         contents,
7753                         result_ok: o.result_ok,
7754                 }
7755         }
7756 }
7757 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7758         fn clone(&self) -> Self {
7759                 if self.result_ok {
7760                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7761                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7762                         } }
7763                 } else {
7764                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7765                                 err: core::ptr::null_mut()
7766                         } }
7767                 }
7768         }
7769 }
7770 #[no_mangle]
7771 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7772 /// but with all dynamically-allocated buffers duplicated in new buffers.
7773 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7774 #[repr(C)]
7775 /// The contents of CResult_InMemorySignerDecodeErrorZ
7776 pub union CResult_InMemorySignerDecodeErrorZPtr {
7777         /// A pointer to the contents in the success state.
7778         /// Reading from this pointer when `result_ok` is not set is undefined.
7779         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7780         /// A pointer to the contents in the error state.
7781         /// Reading from this pointer when `result_ok` is set is undefined.
7782         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7783 }
7784 #[repr(C)]
7785 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7786 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7788 pub struct CResult_InMemorySignerDecodeErrorZ {
7789         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7790         /// `err` or `result` depending on the state of `result_ok`.
7791         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7792         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7793         pub result_ok: bool,
7794 }
7795 #[no_mangle]
7796 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7797 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7798         CResult_InMemorySignerDecodeErrorZ {
7799                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7800                         result: Box::into_raw(Box::new(o)),
7801                 },
7802                 result_ok: true,
7803         }
7804 }
7805 #[no_mangle]
7806 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7807 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7808         CResult_InMemorySignerDecodeErrorZ {
7809                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7810                         err: Box::into_raw(Box::new(e)),
7811                 },
7812                 result_ok: false,
7813         }
7814 }
7815 /// Checks if the given object is currently in the success state
7816 #[no_mangle]
7817 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7818         o.result_ok
7819 }
7820 #[no_mangle]
7821 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7822 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7823 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7824         fn drop(&mut self) {
7825                 if self.result_ok {
7826                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7827                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7828                         }
7829                 } else {
7830                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7831                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7832                         }
7833                 }
7834         }
7835 }
7836 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7837         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7838                 let contents = if o.result_ok {
7839                         let result = unsafe { o.contents.result };
7840                         unsafe { o.contents.result = core::ptr::null_mut() };
7841                         CResult_InMemorySignerDecodeErrorZPtr { result }
7842                 } else {
7843                         let err = unsafe { o.contents.err };
7844                         unsafe { o.contents.err = core::ptr::null_mut(); }
7845                         CResult_InMemorySignerDecodeErrorZPtr { err }
7846                 };
7847                 Self {
7848                         contents,
7849                         result_ok: o.result_ok,
7850                 }
7851         }
7852 }
7853 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7854         fn clone(&self) -> Self {
7855                 if self.result_ok {
7856                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7857                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7858                         } }
7859                 } else {
7860                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7861                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7862                         } }
7863                 }
7864         }
7865 }
7866 #[no_mangle]
7867 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7868 /// but with all dynamically-allocated buffers duplicated in new buffers.
7869 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7870 #[repr(C)]
7871 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7872 /// This corresponds to std::vector in C++
7873 pub struct CVec_TxOutZ {
7874         /// The elements in the array.
7875         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7876         pub data: *mut crate::c_types::TxOut,
7877         /// The number of elements pointed to by `data`.
7878         pub datalen: usize
7879 }
7880 impl CVec_TxOutZ {
7881         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7882                 if self.datalen == 0 { return Vec::new(); }
7883                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7884                 self.data = core::ptr::null_mut();
7885                 self.datalen = 0;
7886                 ret
7887         }
7888         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7889                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7890         }
7891 }
7892 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7893         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7894                 let datalen = v.len();
7895                 let data = Box::into_raw(v.into_boxed_slice());
7896                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7897         }
7898 }
7899 #[no_mangle]
7900 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7901 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7902 impl Drop for CVec_TxOutZ {
7903         fn drop(&mut self) {
7904                 if self.datalen == 0 { return; }
7905                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7906         }
7907 }
7908 impl Clone for CVec_TxOutZ {
7909         fn clone(&self) -> Self {
7910                 let mut res = Vec::new();
7911                 if self.datalen == 0 { return Self::from(res); }
7912                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7913                 Self::from(res)
7914         }
7915 }
7916 #[repr(C)]
7917 /// The contents of CResult_TransactionNoneZ
7918 pub union CResult_TransactionNoneZPtr {
7919         /// A pointer to the contents in the success state.
7920         /// Reading from this pointer when `result_ok` is not set is undefined.
7921         pub result: *mut crate::c_types::Transaction,
7922         /// Note that this value is always NULL, as there are no contents in the Err variant
7923         pub err: *mut core::ffi::c_void,
7924 }
7925 #[repr(C)]
7926 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7927 /// containing a crate::c_types::Transaction on success and a () on failure.
7928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929 pub struct CResult_TransactionNoneZ {
7930         /// The contents of this CResult_TransactionNoneZ, accessible via either
7931         /// `err` or `result` depending on the state of `result_ok`.
7932         pub contents: CResult_TransactionNoneZPtr,
7933         /// Whether this CResult_TransactionNoneZ represents a success state.
7934         pub result_ok: bool,
7935 }
7936 #[no_mangle]
7937 /// Creates a new CResult_TransactionNoneZ in the success state.
7938 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7939         CResult_TransactionNoneZ {
7940                 contents: CResult_TransactionNoneZPtr {
7941                         result: Box::into_raw(Box::new(o)),
7942                 },
7943                 result_ok: true,
7944         }
7945 }
7946 #[no_mangle]
7947 /// Creates a new CResult_TransactionNoneZ in the error state.
7948 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7949         CResult_TransactionNoneZ {
7950                 contents: CResult_TransactionNoneZPtr {
7951                         err: core::ptr::null_mut(),
7952                 },
7953                 result_ok: false,
7954         }
7955 }
7956 /// Checks if the given object is currently in the success state
7957 #[no_mangle]
7958 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7959         o.result_ok
7960 }
7961 #[no_mangle]
7962 /// Frees any resources used by the CResult_TransactionNoneZ.
7963 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7964 impl Drop for CResult_TransactionNoneZ {
7965         fn drop(&mut self) {
7966                 if self.result_ok {
7967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7969                         }
7970                 } else {
7971                 }
7972         }
7973 }
7974 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7975         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7976                 let contents = if o.result_ok {
7977                         let result = unsafe { o.contents.result };
7978                         unsafe { o.contents.result = core::ptr::null_mut() };
7979                         CResult_TransactionNoneZPtr { result }
7980                 } else {
7981                         let _ = unsafe { Box::from_raw(o.contents.err) };
7982                         o.contents.err = core::ptr::null_mut();
7983                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7984                 };
7985                 Self {
7986                         contents,
7987                         result_ok: o.result_ok,
7988                 }
7989         }
7990 }
7991 impl Clone for CResult_TransactionNoneZ {
7992         fn clone(&self) -> Self {
7993                 if self.result_ok {
7994                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7995                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7996                         } }
7997                 } else {
7998                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7999                                 err: core::ptr::null_mut()
8000                         } }
8001                 }
8002         }
8003 }
8004 #[no_mangle]
8005 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
8006 /// but with all dynamically-allocated buffers duplicated in new buffers.
8007 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
8008 #[repr(C)]
8009 /// A tuple of 2 elements. See the individual fields for the types contained.
8010 pub struct C2Tuple_BlockHashChannelMonitorZ {
8011         /// The element at position 0
8012         pub a: crate::c_types::ThirtyTwoBytes,
8013         /// The element at position 1
8014         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
8015 }
8016 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
8017         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
8018                 Self {
8019                         a: tup.0,
8020                         b: tup.1,
8021                 }
8022         }
8023 }
8024 impl C2Tuple_BlockHashChannelMonitorZ {
8025         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8026                 (self.a, self.b)
8027         }
8028 }
8029 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8030 #[no_mangle]
8031 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8032         C2Tuple_BlockHashChannelMonitorZ { a, b, }
8033 }
8034
8035 #[no_mangle]
8036 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8037 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8038 #[repr(C)]
8039 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8040 /// This corresponds to std::vector in C++
8041 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8042         /// The elements in the array.
8043         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8044         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8045         /// The number of elements pointed to by `data`.
8046         pub datalen: usize
8047 }
8048 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8049         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8050                 if self.datalen == 0 { return Vec::new(); }
8051                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8052                 self.data = core::ptr::null_mut();
8053                 self.datalen = 0;
8054                 ret
8055         }
8056         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8057                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8058         }
8059 }
8060 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8061         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8062                 let datalen = v.len();
8063                 let data = Box::into_raw(v.into_boxed_slice());
8064                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8065         }
8066 }
8067 #[no_mangle]
8068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8069 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8070 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8071         fn drop(&mut self) {
8072                 if self.datalen == 0 { return; }
8073                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8074         }
8075 }
8076 #[repr(C)]
8077 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8078 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8079         /// A pointer to the contents in the success state.
8080         /// Reading from this pointer when `result_ok` is not set is undefined.
8081         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8082         /// A pointer to the contents in the error state.
8083         /// Reading from this pointer when `result_ok` is set is undefined.
8084         pub err: *mut crate::c_types::IOError,
8085 }
8086 #[repr(C)]
8087 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8088 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8090 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8091         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8092         /// `err` or `result` depending on the state of `result_ok`.
8093         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8094         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8095         pub result_ok: bool,
8096 }
8097 #[no_mangle]
8098 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8099 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8100         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8101                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8102                         result: Box::into_raw(Box::new(o)),
8103                 },
8104                 result_ok: true,
8105         }
8106 }
8107 #[no_mangle]
8108 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8109 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8110         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8111                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8112                         err: Box::into_raw(Box::new(e)),
8113                 },
8114                 result_ok: false,
8115         }
8116 }
8117 /// Checks if the given object is currently in the success state
8118 #[no_mangle]
8119 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8120         o.result_ok
8121 }
8122 #[no_mangle]
8123 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8124 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8125 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8126         fn drop(&mut self) {
8127                 if self.result_ok {
8128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8130                         }
8131                 } else {
8132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8134                         }
8135                 }
8136         }
8137 }
8138 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8139         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8140                 let contents = if o.result_ok {
8141                         let result = unsafe { o.contents.result };
8142                         unsafe { o.contents.result = core::ptr::null_mut() };
8143                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8144                 } else {
8145                         let err = unsafe { o.contents.err };
8146                         unsafe { o.contents.err = core::ptr::null_mut(); }
8147                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8148                 };
8149                 Self {
8150                         contents,
8151                         result_ok: o.result_ok,
8152                 }
8153         }
8154 }
8155 #[repr(C)]
8156 #[derive(Clone)]
8157 /// An enum which can either contain a u16 or not
8158 pub enum COption_u16Z {
8159         /// When we're in this state, this COption_u16Z contains a u16
8160         Some(u16),
8161         /// When we're in this state, this COption_u16Z contains nothing
8162         None
8163 }
8164 impl COption_u16Z {
8165         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8166                 if let Self::None = self { false } else { true }
8167         }
8168         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8169                 !self.is_some()
8170         }
8171         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8172                 if let Self::Some(v) = self { v } else { unreachable!() }
8173         }
8174 }
8175 #[no_mangle]
8176 /// Constructs a new COption_u16Z containing a u16
8177 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8178         COption_u16Z::Some(o)
8179 }
8180 #[no_mangle]
8181 /// Constructs a new COption_u16Z containing nothing
8182 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8183         COption_u16Z::None
8184 }
8185 #[no_mangle]
8186 /// Frees any resources associated with the u16, if we are in the Some state
8187 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8188 #[no_mangle]
8189 /// Creates a new COption_u16Z which has the same data as `orig`
8190 /// but with all dynamically-allocated buffers duplicated in new buffers.
8191 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8192 #[repr(C)]
8193 /// The contents of CResult__u832APIErrorZ
8194 pub union CResult__u832APIErrorZPtr {
8195         /// A pointer to the contents in the success state.
8196         /// Reading from this pointer when `result_ok` is not set is undefined.
8197         pub result: *mut crate::c_types::ThirtyTwoBytes,
8198         /// A pointer to the contents in the error state.
8199         /// Reading from this pointer when `result_ok` is set is undefined.
8200         pub err: *mut crate::lightning::util::errors::APIError,
8201 }
8202 #[repr(C)]
8203 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8204 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8205 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8206 pub struct CResult__u832APIErrorZ {
8207         /// The contents of this CResult__u832APIErrorZ, accessible via either
8208         /// `err` or `result` depending on the state of `result_ok`.
8209         pub contents: CResult__u832APIErrorZPtr,
8210         /// Whether this CResult__u832APIErrorZ represents a success state.
8211         pub result_ok: bool,
8212 }
8213 #[no_mangle]
8214 /// Creates a new CResult__u832APIErrorZ in the success state.
8215 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8216         CResult__u832APIErrorZ {
8217                 contents: CResult__u832APIErrorZPtr {
8218                         result: Box::into_raw(Box::new(o)),
8219                 },
8220                 result_ok: true,
8221         }
8222 }
8223 #[no_mangle]
8224 /// Creates a new CResult__u832APIErrorZ in the error state.
8225 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8226         CResult__u832APIErrorZ {
8227                 contents: CResult__u832APIErrorZPtr {
8228                         err: Box::into_raw(Box::new(e)),
8229                 },
8230                 result_ok: false,
8231         }
8232 }
8233 /// Checks if the given object is currently in the success state
8234 #[no_mangle]
8235 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8236         o.result_ok
8237 }
8238 #[no_mangle]
8239 /// Frees any resources used by the CResult__u832APIErrorZ.
8240 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8241 impl Drop for CResult__u832APIErrorZ {
8242         fn drop(&mut self) {
8243                 if self.result_ok {
8244                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8245                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8246                         }
8247                 } else {
8248                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8249                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8250                         }
8251                 }
8252         }
8253 }
8254 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8255         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8256                 let contents = if o.result_ok {
8257                         let result = unsafe { o.contents.result };
8258                         unsafe { o.contents.result = core::ptr::null_mut() };
8259                         CResult__u832APIErrorZPtr { result }
8260                 } else {
8261                         let err = unsafe { o.contents.err };
8262                         unsafe { o.contents.err = core::ptr::null_mut(); }
8263                         CResult__u832APIErrorZPtr { err }
8264                 };
8265                 Self {
8266                         contents,
8267                         result_ok: o.result_ok,
8268                 }
8269         }
8270 }
8271 impl Clone for CResult__u832APIErrorZ {
8272         fn clone(&self) -> Self {
8273                 if self.result_ok {
8274                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8275                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8276                         } }
8277                 } else {
8278                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8279                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8280                         } }
8281                 }
8282         }
8283 }
8284 #[no_mangle]
8285 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8286 /// but with all dynamically-allocated buffers duplicated in new buffers.
8287 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8288 #[repr(C)]
8289 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
8290 /// This corresponds to std::vector in C++
8291 pub struct CVec_RecentPaymentDetailsZ {
8292         /// The elements in the array.
8293         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8294         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
8295         /// The number of elements pointed to by `data`.
8296         pub datalen: usize
8297 }
8298 impl CVec_RecentPaymentDetailsZ {
8299         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
8300                 if self.datalen == 0 { return Vec::new(); }
8301                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8302                 self.data = core::ptr::null_mut();
8303                 self.datalen = 0;
8304                 ret
8305         }
8306         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
8307                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8308         }
8309 }
8310 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
8311         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
8312                 let datalen = v.len();
8313                 let data = Box::into_raw(v.into_boxed_slice());
8314                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8315         }
8316 }
8317 #[no_mangle]
8318 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8319 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
8320 impl Drop for CVec_RecentPaymentDetailsZ {
8321         fn drop(&mut self) {
8322                 if self.datalen == 0 { return; }
8323                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8324         }
8325 }
8326 #[repr(C)]
8327 /// The contents of CResult_NonePaymentSendFailureZ
8328 pub union CResult_NonePaymentSendFailureZPtr {
8329         /// Note that this value is always NULL, as there are no contents in the OK variant
8330         pub result: *mut core::ffi::c_void,
8331         /// A pointer to the contents in the error state.
8332         /// Reading from this pointer when `result_ok` is set is undefined.
8333         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8334 }
8335 #[repr(C)]
8336 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8337 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8339 pub struct CResult_NonePaymentSendFailureZ {
8340         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8341         /// `err` or `result` depending on the state of `result_ok`.
8342         pub contents: CResult_NonePaymentSendFailureZPtr,
8343         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8344         pub result_ok: bool,
8345 }
8346 #[no_mangle]
8347 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8348 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8349         CResult_NonePaymentSendFailureZ {
8350                 contents: CResult_NonePaymentSendFailureZPtr {
8351                         result: core::ptr::null_mut(),
8352                 },
8353                 result_ok: true,
8354         }
8355 }
8356 #[no_mangle]
8357 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8358 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8359         CResult_NonePaymentSendFailureZ {
8360                 contents: CResult_NonePaymentSendFailureZPtr {
8361                         err: Box::into_raw(Box::new(e)),
8362                 },
8363                 result_ok: false,
8364         }
8365 }
8366 /// Checks if the given object is currently in the success state
8367 #[no_mangle]
8368 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8369         o.result_ok
8370 }
8371 #[no_mangle]
8372 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8373 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8374 impl Drop for CResult_NonePaymentSendFailureZ {
8375         fn drop(&mut self) {
8376                 if self.result_ok {
8377                 } else {
8378                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8379                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8380                         }
8381                 }
8382         }
8383 }
8384 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8385         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8386                 let contents = if o.result_ok {
8387                         let _ = unsafe { Box::from_raw(o.contents.result) };
8388                         o.contents.result = core::ptr::null_mut();
8389                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8390                 } else {
8391                         let err = unsafe { o.contents.err };
8392                         unsafe { o.contents.err = core::ptr::null_mut(); }
8393                         CResult_NonePaymentSendFailureZPtr { err }
8394                 };
8395                 Self {
8396                         contents,
8397                         result_ok: o.result_ok,
8398                 }
8399         }
8400 }
8401 impl Clone for CResult_NonePaymentSendFailureZ {
8402         fn clone(&self) -> Self {
8403                 if self.result_ok {
8404                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8405                                 result: core::ptr::null_mut()
8406                         } }
8407                 } else {
8408                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8409                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8410                         } }
8411                 }
8412         }
8413 }
8414 #[no_mangle]
8415 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8416 /// but with all dynamically-allocated buffers duplicated in new buffers.
8417 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8418 #[repr(C)]
8419 /// The contents of CResult_NoneRetryableSendFailureZ
8420 pub union CResult_NoneRetryableSendFailureZPtr {
8421         /// Note that this value is always NULL, as there are no contents in the OK variant
8422         pub result: *mut core::ffi::c_void,
8423         /// A pointer to the contents in the error state.
8424         /// Reading from this pointer when `result_ok` is set is undefined.
8425         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8426 }
8427 #[repr(C)]
8428 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
8429 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8431 pub struct CResult_NoneRetryableSendFailureZ {
8432         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
8433         /// `err` or `result` depending on the state of `result_ok`.
8434         pub contents: CResult_NoneRetryableSendFailureZPtr,
8435         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
8436         pub result_ok: bool,
8437 }
8438 #[no_mangle]
8439 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
8440 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
8441         CResult_NoneRetryableSendFailureZ {
8442                 contents: CResult_NoneRetryableSendFailureZPtr {
8443                         result: core::ptr::null_mut(),
8444                 },
8445                 result_ok: true,
8446         }
8447 }
8448 #[no_mangle]
8449 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
8450 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
8451         CResult_NoneRetryableSendFailureZ {
8452                 contents: CResult_NoneRetryableSendFailureZPtr {
8453                         err: Box::into_raw(Box::new(e)),
8454                 },
8455                 result_ok: false,
8456         }
8457 }
8458 /// Checks if the given object is currently in the success state
8459 #[no_mangle]
8460 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
8461         o.result_ok
8462 }
8463 #[no_mangle]
8464 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
8465 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
8466 impl Drop for CResult_NoneRetryableSendFailureZ {
8467         fn drop(&mut self) {
8468                 if self.result_ok {
8469                 } else {
8470                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8471                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8472                         }
8473                 }
8474         }
8475 }
8476 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
8477         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8478                 let contents = if o.result_ok {
8479                         let _ = unsafe { Box::from_raw(o.contents.result) };
8480                         o.contents.result = core::ptr::null_mut();
8481                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
8482                 } else {
8483                         let err = unsafe { o.contents.err };
8484                         unsafe { o.contents.err = core::ptr::null_mut(); }
8485                         CResult_NoneRetryableSendFailureZPtr { err }
8486                 };
8487                 Self {
8488                         contents,
8489                         result_ok: o.result_ok,
8490                 }
8491         }
8492 }
8493 impl Clone for CResult_NoneRetryableSendFailureZ {
8494         fn clone(&self) -> Self {
8495                 if self.result_ok {
8496                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
8497                                 result: core::ptr::null_mut()
8498                         } }
8499                 } else {
8500                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
8501                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8502                         } }
8503                 }
8504         }
8505 }
8506 #[no_mangle]
8507 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
8508 /// but with all dynamically-allocated buffers duplicated in new buffers.
8509 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
8510 #[repr(C)]
8511 /// The contents of CResult_PaymentHashPaymentSendFailureZ
8512 pub union CResult_PaymentHashPaymentSendFailureZPtr {
8513         /// A pointer to the contents in the success state.
8514         /// Reading from this pointer when `result_ok` is not set is undefined.
8515         pub result: *mut crate::c_types::ThirtyTwoBytes,
8516         /// A pointer to the contents in the error state.
8517         /// Reading from this pointer when `result_ok` is set is undefined.
8518         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8519 }
8520 #[repr(C)]
8521 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8522 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8524 pub struct CResult_PaymentHashPaymentSendFailureZ {
8525         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8526         /// `err` or `result` depending on the state of `result_ok`.
8527         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
8528         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8529         pub result_ok: bool,
8530 }
8531 #[no_mangle]
8532 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
8533 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
8534         CResult_PaymentHashPaymentSendFailureZ {
8535                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8536                         result: Box::into_raw(Box::new(o)),
8537                 },
8538                 result_ok: true,
8539         }
8540 }
8541 #[no_mangle]
8542 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
8543 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
8544         CResult_PaymentHashPaymentSendFailureZ {
8545                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8546                         err: Box::into_raw(Box::new(e)),
8547                 },
8548                 result_ok: false,
8549         }
8550 }
8551 /// Checks if the given object is currently in the success state
8552 #[no_mangle]
8553 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
8554         o.result_ok
8555 }
8556 #[no_mangle]
8557 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
8558 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
8559 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
8560         fn drop(&mut self) {
8561                 if self.result_ok {
8562                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8563                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8564                         }
8565                 } else {
8566                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8567                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8568                         }
8569                 }
8570         }
8571 }
8572 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
8573         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8574                 let contents = if o.result_ok {
8575                         let result = unsafe { o.contents.result };
8576                         unsafe { o.contents.result = core::ptr::null_mut() };
8577                         CResult_PaymentHashPaymentSendFailureZPtr { result }
8578                 } else {
8579                         let err = unsafe { o.contents.err };
8580                         unsafe { o.contents.err = core::ptr::null_mut(); }
8581                         CResult_PaymentHashPaymentSendFailureZPtr { err }
8582                 };
8583                 Self {
8584                         contents,
8585                         result_ok: o.result_ok,
8586                 }
8587         }
8588 }
8589 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
8590         fn clone(&self) -> Self {
8591                 if self.result_ok {
8592                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8593                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8594                         } }
8595                 } else {
8596                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8597                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8598                         } }
8599                 }
8600         }
8601 }
8602 #[no_mangle]
8603 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
8604 /// but with all dynamically-allocated buffers duplicated in new buffers.
8605 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
8606 #[repr(C)]
8607 /// The contents of CResult_PaymentHashRetryableSendFailureZ
8608 pub union CResult_PaymentHashRetryableSendFailureZPtr {
8609         /// A pointer to the contents in the success state.
8610         /// Reading from this pointer when `result_ok` is not set is undefined.
8611         pub result: *mut crate::c_types::ThirtyTwoBytes,
8612         /// A pointer to the contents in the error state.
8613         /// Reading from this pointer when `result_ok` is set is undefined.
8614         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
8615 }
8616 #[repr(C)]
8617 /// A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation,
8618 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
8619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8620 pub struct CResult_PaymentHashRetryableSendFailureZ {
8621         /// The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either
8622         /// `err` or `result` depending on the state of `result_ok`.
8623         pub contents: CResult_PaymentHashRetryableSendFailureZPtr,
8624         /// Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state.
8625         pub result_ok: bool,
8626 }
8627 #[no_mangle]
8628 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state.
8629 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashRetryableSendFailureZ {
8630         CResult_PaymentHashRetryableSendFailureZ {
8631                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8632                         result: Box::into_raw(Box::new(o)),
8633                 },
8634                 result_ok: true,
8635         }
8636 }
8637 #[no_mangle]
8638 /// Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state.
8639 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_PaymentHashRetryableSendFailureZ {
8640         CResult_PaymentHashRetryableSendFailureZ {
8641                 contents: CResult_PaymentHashRetryableSendFailureZPtr {
8642                         err: Box::into_raw(Box::new(e)),
8643                 },
8644                 result_ok: false,
8645         }
8646 }
8647 /// Checks if the given object is currently in the success state
8648 #[no_mangle]
8649 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_is_ok(o: &CResult_PaymentHashRetryableSendFailureZ) -> bool {
8650         o.result_ok
8651 }
8652 #[no_mangle]
8653 /// Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ.
8654 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_free(_res: CResult_PaymentHashRetryableSendFailureZ) { }
8655 impl Drop for CResult_PaymentHashRetryableSendFailureZ {
8656         fn drop(&mut self) {
8657                 if self.result_ok {
8658                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8659                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8660                         }
8661                 } else {
8662                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8663                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8664                         }
8665                 }
8666         }
8667 }
8668 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_PaymentHashRetryableSendFailureZ {
8669         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
8670                 let contents = if o.result_ok {
8671                         let result = unsafe { o.contents.result };
8672                         unsafe { o.contents.result = core::ptr::null_mut() };
8673                         CResult_PaymentHashRetryableSendFailureZPtr { result }
8674                 } else {
8675                         let err = unsafe { o.contents.err };
8676                         unsafe { o.contents.err = core::ptr::null_mut(); }
8677                         CResult_PaymentHashRetryableSendFailureZPtr { err }
8678                 };
8679                 Self {
8680                         contents,
8681                         result_ok: o.result_ok,
8682                 }
8683         }
8684 }
8685 impl Clone for CResult_PaymentHashRetryableSendFailureZ {
8686         fn clone(&self) -> Self {
8687                 if self.result_ok {
8688                         Self { result_ok: true, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8689                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8690                         } }
8691                 } else {
8692                         Self { result_ok: false, contents: CResult_PaymentHashRetryableSendFailureZPtr {
8693                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
8694                         } }
8695                 }
8696         }
8697 }
8698 #[no_mangle]
8699 /// Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig`
8700 /// but with all dynamically-allocated buffers duplicated in new buffers.
8701 pub extern "C" fn CResult_PaymentHashRetryableSendFailureZ_clone(orig: &CResult_PaymentHashRetryableSendFailureZ) -> CResult_PaymentHashRetryableSendFailureZ { Clone::clone(&orig) }
8702 #[repr(C)]
8703 /// A tuple of 2 elements. See the individual fields for the types contained.
8704 pub struct C2Tuple_PaymentHashPaymentIdZ {
8705         /// The element at position 0
8706         pub a: crate::c_types::ThirtyTwoBytes,
8707         /// The element at position 1
8708         pub b: crate::c_types::ThirtyTwoBytes,
8709 }
8710 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8711         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8712                 Self {
8713                         a: tup.0,
8714                         b: tup.1,
8715                 }
8716         }
8717 }
8718 impl C2Tuple_PaymentHashPaymentIdZ {
8719         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8720                 (self.a, self.b)
8721         }
8722 }
8723 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8724         fn clone(&self) -> Self {
8725                 Self {
8726                         a: Clone::clone(&self.a),
8727                         b: Clone::clone(&self.b),
8728                 }
8729         }
8730 }
8731 #[no_mangle]
8732 /// Creates a new tuple which has the same data as `orig`
8733 /// but with all dynamically-allocated buffers duplicated in new buffers.
8734 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8735 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8736 #[no_mangle]
8737 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8738         C2Tuple_PaymentHashPaymentIdZ { a, b, }
8739 }
8740
8741 #[no_mangle]
8742 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8743 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8744 #[repr(C)]
8745 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8746 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8747         /// A pointer to the contents in the success state.
8748         /// Reading from this pointer when `result_ok` is not set is undefined.
8749         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8750         /// A pointer to the contents in the error state.
8751         /// Reading from this pointer when `result_ok` is set is undefined.
8752         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
8753 }
8754 #[repr(C)]
8755 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8756 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
8757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8758 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8759         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8760         /// `err` or `result` depending on the state of `result_ok`.
8761         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8762         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8763         pub result_ok: bool,
8764 }
8765 #[no_mangle]
8766 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8767 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8768         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8769                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8770                         result: Box::into_raw(Box::new(o)),
8771                 },
8772                 result_ok: true,
8773         }
8774 }
8775 #[no_mangle]
8776 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8777 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8778         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8779                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8780                         err: Box::into_raw(Box::new(e)),
8781                 },
8782                 result_ok: false,
8783         }
8784 }
8785 /// Checks if the given object is currently in the success state
8786 #[no_mangle]
8787 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8788         o.result_ok
8789 }
8790 #[no_mangle]
8791 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8792 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8793 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8794         fn drop(&mut self) {
8795                 if self.result_ok {
8796                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8797                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8798                         }
8799                 } else {
8800                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8801                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8802                         }
8803                 }
8804         }
8805 }
8806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8807         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
8808                 let contents = if o.result_ok {
8809                         let result = unsafe { o.contents.result };
8810                         unsafe { o.contents.result = core::ptr::null_mut() };
8811                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8812                 } else {
8813                         let err = unsafe { o.contents.err };
8814                         unsafe { o.contents.err = core::ptr::null_mut(); }
8815                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8816                 };
8817                 Self {
8818                         contents,
8819                         result_ok: o.result_ok,
8820                 }
8821         }
8822 }
8823 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8824         fn clone(&self) -> Self {
8825                 if self.result_ok {
8826                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8827                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8828                         } }
8829                 } else {
8830                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8831                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8832                         } }
8833                 }
8834         }
8835 }
8836 #[no_mangle]
8837 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8838 /// but with all dynamically-allocated buffers duplicated in new buffers.
8839 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8840 #[repr(C)]
8841 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8842 /// This corresponds to std::vector in C++
8843 pub struct CVec_ThirtyTwoBytesZ {
8844         /// The elements in the array.
8845         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8846         pub data: *mut crate::c_types::ThirtyTwoBytes,
8847         /// The number of elements pointed to by `data`.
8848         pub datalen: usize
8849 }
8850 impl CVec_ThirtyTwoBytesZ {
8851         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8852                 if self.datalen == 0 { return Vec::new(); }
8853                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8854                 self.data = core::ptr::null_mut();
8855                 self.datalen = 0;
8856                 ret
8857         }
8858         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8859                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8860         }
8861 }
8862 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8863         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8864                 let datalen = v.len();
8865                 let data = Box::into_raw(v.into_boxed_slice());
8866                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8867         }
8868 }
8869 #[no_mangle]
8870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8871 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8872 impl Drop for CVec_ThirtyTwoBytesZ {
8873         fn drop(&mut self) {
8874                 if self.datalen == 0 { return; }
8875                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8876         }
8877 }
8878 impl Clone for CVec_ThirtyTwoBytesZ {
8879         fn clone(&self) -> Self {
8880                 let mut res = Vec::new();
8881                 if self.datalen == 0 { return Self::from(res); }
8882                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8883                 Self::from(res)
8884         }
8885 }
8886 #[repr(C)]
8887 /// A tuple of 2 elements. See the individual fields for the types contained.
8888 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8889         /// The element at position 0
8890         pub a: crate::c_types::ThirtyTwoBytes,
8891         /// The element at position 1
8892         pub b: crate::c_types::ThirtyTwoBytes,
8893 }
8894 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8895         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8896                 Self {
8897                         a: tup.0,
8898                         b: tup.1,
8899                 }
8900         }
8901 }
8902 impl C2Tuple_PaymentHashPaymentSecretZ {
8903         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8904                 (self.a, self.b)
8905         }
8906 }
8907 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8908         fn clone(&self) -> Self {
8909                 Self {
8910                         a: Clone::clone(&self.a),
8911                         b: Clone::clone(&self.b),
8912                 }
8913         }
8914 }
8915 #[no_mangle]
8916 /// Creates a new tuple which has the same data as `orig`
8917 /// but with all dynamically-allocated buffers duplicated in new buffers.
8918 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8919 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8920 #[no_mangle]
8921 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8922         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8923 }
8924
8925 #[no_mangle]
8926 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8927 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8928 #[repr(C)]
8929 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8930 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8931         /// A pointer to the contents in the success state.
8932         /// Reading from this pointer when `result_ok` is not set is undefined.
8933         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8934         /// Note that this value is always NULL, as there are no contents in the Err variant
8935         pub err: *mut core::ffi::c_void,
8936 }
8937 #[repr(C)]
8938 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8939 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8941 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8942         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8943         /// `err` or `result` depending on the state of `result_ok`.
8944         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8945         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8946         pub result_ok: bool,
8947 }
8948 #[no_mangle]
8949 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8950 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8951         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8952                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8953                         result: Box::into_raw(Box::new(o)),
8954                 },
8955                 result_ok: true,
8956         }
8957 }
8958 #[no_mangle]
8959 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8960 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8961         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8962                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8963                         err: core::ptr::null_mut(),
8964                 },
8965                 result_ok: false,
8966         }
8967 }
8968 /// Checks if the given object is currently in the success state
8969 #[no_mangle]
8970 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8971         o.result_ok
8972 }
8973 #[no_mangle]
8974 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8975 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8976 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8977         fn drop(&mut self) {
8978                 if self.result_ok {
8979                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8980                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8981                         }
8982                 } else {
8983                 }
8984         }
8985 }
8986 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8987         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8988                 let contents = if o.result_ok {
8989                         let result = unsafe { o.contents.result };
8990                         unsafe { o.contents.result = core::ptr::null_mut() };
8991                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8992                 } else {
8993                         let _ = unsafe { Box::from_raw(o.contents.err) };
8994                         o.contents.err = core::ptr::null_mut();
8995                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8996                 };
8997                 Self {
8998                         contents,
8999                         result_ok: o.result_ok,
9000                 }
9001         }
9002 }
9003 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
9004         fn clone(&self) -> Self {
9005                 if self.result_ok {
9006                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9007                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9008                         } }
9009                 } else {
9010                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
9011                                 err: core::ptr::null_mut()
9012                         } }
9013                 }
9014         }
9015 }
9016 #[no_mangle]
9017 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
9018 /// but with all dynamically-allocated buffers duplicated in new buffers.
9019 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
9020 #[repr(C)]
9021 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
9022 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9023         /// A pointer to the contents in the success state.
9024         /// Reading from this pointer when `result_ok` is not set is undefined.
9025         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
9026         /// A pointer to the contents in the error state.
9027         /// Reading from this pointer when `result_ok` is set is undefined.
9028         pub err: *mut crate::lightning::util::errors::APIError,
9029 }
9030 #[repr(C)]
9031 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
9032 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
9033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9034 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9035         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
9036         /// `err` or `result` depending on the state of `result_ok`.
9037         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
9038         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
9039         pub result_ok: bool,
9040 }
9041 #[no_mangle]
9042 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
9043 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9044         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9045                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9046                         result: Box::into_raw(Box::new(o)),
9047                 },
9048                 result_ok: true,
9049         }
9050 }
9051 #[no_mangle]
9052 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
9053 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9054         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9055                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9056                         err: Box::into_raw(Box::new(e)),
9057                 },
9058                 result_ok: false,
9059         }
9060 }
9061 /// Checks if the given object is currently in the success state
9062 #[no_mangle]
9063 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9064         o.result_ok
9065 }
9066 #[no_mangle]
9067 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9068 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9069 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9070         fn drop(&mut self) {
9071                 if self.result_ok {
9072                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9073                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9074                         }
9075                 } else {
9076                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9077                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9078                         }
9079                 }
9080         }
9081 }
9082 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9083         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9084                 let contents = if o.result_ok {
9085                         let result = unsafe { o.contents.result };
9086                         unsafe { o.contents.result = core::ptr::null_mut() };
9087                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9088                 } else {
9089                         let err = unsafe { o.contents.err };
9090                         unsafe { o.contents.err = core::ptr::null_mut(); }
9091                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9092                 };
9093                 Self {
9094                         contents,
9095                         result_ok: o.result_ok,
9096                 }
9097         }
9098 }
9099 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9100         fn clone(&self) -> Self {
9101                 if self.result_ok {
9102                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9103                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9104                         } }
9105                 } else {
9106                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9107                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9108                         } }
9109                 }
9110         }
9111 }
9112 #[no_mangle]
9113 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9114 /// but with all dynamically-allocated buffers duplicated in new buffers.
9115 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9116 #[repr(C)]
9117 /// The contents of CResult_PaymentSecretNoneZ
9118 pub union CResult_PaymentSecretNoneZPtr {
9119         /// A pointer to the contents in the success state.
9120         /// Reading from this pointer when `result_ok` is not set is undefined.
9121         pub result: *mut crate::c_types::ThirtyTwoBytes,
9122         /// Note that this value is always NULL, as there are no contents in the Err variant
9123         pub err: *mut core::ffi::c_void,
9124 }
9125 #[repr(C)]
9126 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9127 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9129 pub struct CResult_PaymentSecretNoneZ {
9130         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9131         /// `err` or `result` depending on the state of `result_ok`.
9132         pub contents: CResult_PaymentSecretNoneZPtr,
9133         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9134         pub result_ok: bool,
9135 }
9136 #[no_mangle]
9137 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9138 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9139         CResult_PaymentSecretNoneZ {
9140                 contents: CResult_PaymentSecretNoneZPtr {
9141                         result: Box::into_raw(Box::new(o)),
9142                 },
9143                 result_ok: true,
9144         }
9145 }
9146 #[no_mangle]
9147 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9148 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9149         CResult_PaymentSecretNoneZ {
9150                 contents: CResult_PaymentSecretNoneZPtr {
9151                         err: core::ptr::null_mut(),
9152                 },
9153                 result_ok: false,
9154         }
9155 }
9156 /// Checks if the given object is currently in the success state
9157 #[no_mangle]
9158 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9159         o.result_ok
9160 }
9161 #[no_mangle]
9162 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9163 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9164 impl Drop for CResult_PaymentSecretNoneZ {
9165         fn drop(&mut self) {
9166                 if self.result_ok {
9167                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9168                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9169                         }
9170                 } else {
9171                 }
9172         }
9173 }
9174 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9175         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9176                 let contents = if o.result_ok {
9177                         let result = unsafe { o.contents.result };
9178                         unsafe { o.contents.result = core::ptr::null_mut() };
9179                         CResult_PaymentSecretNoneZPtr { result }
9180                 } else {
9181                         let _ = unsafe { Box::from_raw(o.contents.err) };
9182                         o.contents.err = core::ptr::null_mut();
9183                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9184                 };
9185                 Self {
9186                         contents,
9187                         result_ok: o.result_ok,
9188                 }
9189         }
9190 }
9191 impl Clone for CResult_PaymentSecretNoneZ {
9192         fn clone(&self) -> Self {
9193                 if self.result_ok {
9194                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9195                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9196                         } }
9197                 } else {
9198                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9199                                 err: core::ptr::null_mut()
9200                         } }
9201                 }
9202         }
9203 }
9204 #[no_mangle]
9205 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9206 /// but with all dynamically-allocated buffers duplicated in new buffers.
9207 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9208 #[repr(C)]
9209 /// The contents of CResult_PaymentSecretAPIErrorZ
9210 pub union CResult_PaymentSecretAPIErrorZPtr {
9211         /// A pointer to the contents in the success state.
9212         /// Reading from this pointer when `result_ok` is not set is undefined.
9213         pub result: *mut crate::c_types::ThirtyTwoBytes,
9214         /// A pointer to the contents in the error state.
9215         /// Reading from this pointer when `result_ok` is set is undefined.
9216         pub err: *mut crate::lightning::util::errors::APIError,
9217 }
9218 #[repr(C)]
9219 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9220 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9222 pub struct CResult_PaymentSecretAPIErrorZ {
9223         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9224         /// `err` or `result` depending on the state of `result_ok`.
9225         pub contents: CResult_PaymentSecretAPIErrorZPtr,
9226         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9227         pub result_ok: bool,
9228 }
9229 #[no_mangle]
9230 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9231 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9232         CResult_PaymentSecretAPIErrorZ {
9233                 contents: CResult_PaymentSecretAPIErrorZPtr {
9234                         result: Box::into_raw(Box::new(o)),
9235                 },
9236                 result_ok: true,
9237         }
9238 }
9239 #[no_mangle]
9240 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9241 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9242         CResult_PaymentSecretAPIErrorZ {
9243                 contents: CResult_PaymentSecretAPIErrorZPtr {
9244                         err: Box::into_raw(Box::new(e)),
9245                 },
9246                 result_ok: false,
9247         }
9248 }
9249 /// Checks if the given object is currently in the success state
9250 #[no_mangle]
9251 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9252         o.result_ok
9253 }
9254 #[no_mangle]
9255 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9256 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9257 impl Drop for CResult_PaymentSecretAPIErrorZ {
9258         fn drop(&mut self) {
9259                 if self.result_ok {
9260                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9261                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9262                         }
9263                 } else {
9264                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9265                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9266                         }
9267                 }
9268         }
9269 }
9270 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9271         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9272                 let contents = if o.result_ok {
9273                         let result = unsafe { o.contents.result };
9274                         unsafe { o.contents.result = core::ptr::null_mut() };
9275                         CResult_PaymentSecretAPIErrorZPtr { result }
9276                 } else {
9277                         let err = unsafe { o.contents.err };
9278                         unsafe { o.contents.err = core::ptr::null_mut(); }
9279                         CResult_PaymentSecretAPIErrorZPtr { err }
9280                 };
9281                 Self {
9282                         contents,
9283                         result_ok: o.result_ok,
9284                 }
9285         }
9286 }
9287 impl Clone for CResult_PaymentSecretAPIErrorZ {
9288         fn clone(&self) -> Self {
9289                 if self.result_ok {
9290                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9291                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9292                         } }
9293                 } else {
9294                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9295                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9296                         } }
9297                 }
9298         }
9299 }
9300 #[no_mangle]
9301 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9302 /// but with all dynamically-allocated buffers duplicated in new buffers.
9303 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9304 #[repr(C)]
9305 /// The contents of CResult_PaymentPreimageAPIErrorZ
9306 pub union CResult_PaymentPreimageAPIErrorZPtr {
9307         /// A pointer to the contents in the success state.
9308         /// Reading from this pointer when `result_ok` is not set is undefined.
9309         pub result: *mut crate::c_types::ThirtyTwoBytes,
9310         /// A pointer to the contents in the error state.
9311         /// Reading from this pointer when `result_ok` is set is undefined.
9312         pub err: *mut crate::lightning::util::errors::APIError,
9313 }
9314 #[repr(C)]
9315 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9316 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9318 pub struct CResult_PaymentPreimageAPIErrorZ {
9319         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9320         /// `err` or `result` depending on the state of `result_ok`.
9321         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9322         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9323         pub result_ok: bool,
9324 }
9325 #[no_mangle]
9326 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9327 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9328         CResult_PaymentPreimageAPIErrorZ {
9329                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9330                         result: Box::into_raw(Box::new(o)),
9331                 },
9332                 result_ok: true,
9333         }
9334 }
9335 #[no_mangle]
9336 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9337 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9338         CResult_PaymentPreimageAPIErrorZ {
9339                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9340                         err: Box::into_raw(Box::new(e)),
9341                 },
9342                 result_ok: false,
9343         }
9344 }
9345 /// Checks if the given object is currently in the success state
9346 #[no_mangle]
9347 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9348         o.result_ok
9349 }
9350 #[no_mangle]
9351 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9352 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9353 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9354         fn drop(&mut self) {
9355                 if self.result_ok {
9356                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9357                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9358                         }
9359                 } else {
9360                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9361                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9362                         }
9363                 }
9364         }
9365 }
9366 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9367         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9368                 let contents = if o.result_ok {
9369                         let result = unsafe { o.contents.result };
9370                         unsafe { o.contents.result = core::ptr::null_mut() };
9371                         CResult_PaymentPreimageAPIErrorZPtr { result }
9372                 } else {
9373                         let err = unsafe { o.contents.err };
9374                         unsafe { o.contents.err = core::ptr::null_mut(); }
9375                         CResult_PaymentPreimageAPIErrorZPtr { err }
9376                 };
9377                 Self {
9378                         contents,
9379                         result_ok: o.result_ok,
9380                 }
9381         }
9382 }
9383 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9384         fn clone(&self) -> Self {
9385                 if self.result_ok {
9386                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9387                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9388                         } }
9389                 } else {
9390                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9391                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9392                         } }
9393                 }
9394         }
9395 }
9396 #[no_mangle]
9397 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9398 /// but with all dynamically-allocated buffers duplicated in new buffers.
9399 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9400 #[repr(C)]
9401 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9402 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9403         /// A pointer to the contents in the success state.
9404         /// Reading from this pointer when `result_ok` is not set is undefined.
9405         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9406         /// A pointer to the contents in the error state.
9407         /// Reading from this pointer when `result_ok` is set is undefined.
9408         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9409 }
9410 #[repr(C)]
9411 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9412 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9414 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9415         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9416         /// `err` or `result` depending on the state of `result_ok`.
9417         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9418         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9419         pub result_ok: bool,
9420 }
9421 #[no_mangle]
9422 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9423 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9424         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9425                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9426                         result: Box::into_raw(Box::new(o)),
9427                 },
9428                 result_ok: true,
9429         }
9430 }
9431 #[no_mangle]
9432 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9433 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9434         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9435                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9436                         err: Box::into_raw(Box::new(e)),
9437                 },
9438                 result_ok: false,
9439         }
9440 }
9441 /// Checks if the given object is currently in the success state
9442 #[no_mangle]
9443 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9444         o.result_ok
9445 }
9446 #[no_mangle]
9447 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9448 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9449 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9450         fn drop(&mut self) {
9451                 if self.result_ok {
9452                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9453                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9454                         }
9455                 } else {
9456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9458                         }
9459                 }
9460         }
9461 }
9462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9463         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9464                 let contents = if o.result_ok {
9465                         let result = unsafe { o.contents.result };
9466                         unsafe { o.contents.result = core::ptr::null_mut() };
9467                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9468                 } else {
9469                         let err = unsafe { o.contents.err };
9470                         unsafe { o.contents.err = core::ptr::null_mut(); }
9471                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9472                 };
9473                 Self {
9474                         contents,
9475                         result_ok: o.result_ok,
9476                 }
9477         }
9478 }
9479 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9480         fn clone(&self) -> Self {
9481                 if self.result_ok {
9482                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9483                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9484                         } }
9485                 } else {
9486                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9487                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9488                         } }
9489                 }
9490         }
9491 }
9492 #[no_mangle]
9493 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9494 /// but with all dynamically-allocated buffers duplicated in new buffers.
9495 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9496 #[repr(C)]
9497 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9498 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9499         /// A pointer to the contents in the success state.
9500         /// Reading from this pointer when `result_ok` is not set is undefined.
9501         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9502         /// A pointer to the contents in the error state.
9503         /// Reading from this pointer when `result_ok` is set is undefined.
9504         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9505 }
9506 #[repr(C)]
9507 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9508 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9510 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9511         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9512         /// `err` or `result` depending on the state of `result_ok`.
9513         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9514         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9515         pub result_ok: bool,
9516 }
9517 #[no_mangle]
9518 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9519 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9520         CResult_ChannelCounterpartyDecodeErrorZ {
9521                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9522                         result: Box::into_raw(Box::new(o)),
9523                 },
9524                 result_ok: true,
9525         }
9526 }
9527 #[no_mangle]
9528 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9529 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9530         CResult_ChannelCounterpartyDecodeErrorZ {
9531                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9532                         err: Box::into_raw(Box::new(e)),
9533                 },
9534                 result_ok: false,
9535         }
9536 }
9537 /// Checks if the given object is currently in the success state
9538 #[no_mangle]
9539 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9540         o.result_ok
9541 }
9542 #[no_mangle]
9543 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9544 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9545 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9546         fn drop(&mut self) {
9547                 if self.result_ok {
9548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9550                         }
9551                 } else {
9552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9554                         }
9555                 }
9556         }
9557 }
9558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9559         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9560                 let contents = if o.result_ok {
9561                         let result = unsafe { o.contents.result };
9562                         unsafe { o.contents.result = core::ptr::null_mut() };
9563                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9564                 } else {
9565                         let err = unsafe { o.contents.err };
9566                         unsafe { o.contents.err = core::ptr::null_mut(); }
9567                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9568                 };
9569                 Self {
9570                         contents,
9571                         result_ok: o.result_ok,
9572                 }
9573         }
9574 }
9575 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9576         fn clone(&self) -> Self {
9577                 if self.result_ok {
9578                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9579                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9580                         } }
9581                 } else {
9582                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9583                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9584                         } }
9585                 }
9586         }
9587 }
9588 #[no_mangle]
9589 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9590 /// but with all dynamically-allocated buffers duplicated in new buffers.
9591 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9592 #[repr(C)]
9593 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9594 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9595         /// A pointer to the contents in the success state.
9596         /// Reading from this pointer when `result_ok` is not set is undefined.
9597         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9598         /// A pointer to the contents in the error state.
9599         /// Reading from this pointer when `result_ok` is set is undefined.
9600         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9601 }
9602 #[repr(C)]
9603 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9604 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9606 pub struct CResult_ChannelDetailsDecodeErrorZ {
9607         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9608         /// `err` or `result` depending on the state of `result_ok`.
9609         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9610         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9611         pub result_ok: bool,
9612 }
9613 #[no_mangle]
9614 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9615 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9616         CResult_ChannelDetailsDecodeErrorZ {
9617                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9618                         result: Box::into_raw(Box::new(o)),
9619                 },
9620                 result_ok: true,
9621         }
9622 }
9623 #[no_mangle]
9624 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9625 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9626         CResult_ChannelDetailsDecodeErrorZ {
9627                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9628                         err: Box::into_raw(Box::new(e)),
9629                 },
9630                 result_ok: false,
9631         }
9632 }
9633 /// Checks if the given object is currently in the success state
9634 #[no_mangle]
9635 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9636         o.result_ok
9637 }
9638 #[no_mangle]
9639 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9640 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9641 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9642         fn drop(&mut self) {
9643                 if self.result_ok {
9644                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9645                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9646                         }
9647                 } else {
9648                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9649                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9650                         }
9651                 }
9652         }
9653 }
9654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9655         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9656                 let contents = if o.result_ok {
9657                         let result = unsafe { o.contents.result };
9658                         unsafe { o.contents.result = core::ptr::null_mut() };
9659                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9660                 } else {
9661                         let err = unsafe { o.contents.err };
9662                         unsafe { o.contents.err = core::ptr::null_mut(); }
9663                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9664                 };
9665                 Self {
9666                         contents,
9667                         result_ok: o.result_ok,
9668                 }
9669         }
9670 }
9671 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9672         fn clone(&self) -> Self {
9673                 if self.result_ok {
9674                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9675                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9676                         } }
9677                 } else {
9678                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9679                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9680                         } }
9681                 }
9682         }
9683 }
9684 #[no_mangle]
9685 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9686 /// but with all dynamically-allocated buffers duplicated in new buffers.
9687 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9688 #[repr(C)]
9689 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9690 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9691         /// A pointer to the contents in the success state.
9692         /// Reading from this pointer when `result_ok` is not set is undefined.
9693         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9694         /// A pointer to the contents in the error state.
9695         /// Reading from this pointer when `result_ok` is set is undefined.
9696         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9697 }
9698 #[repr(C)]
9699 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9700 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9702 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9703         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9704         /// `err` or `result` depending on the state of `result_ok`.
9705         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9706         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9707         pub result_ok: bool,
9708 }
9709 #[no_mangle]
9710 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9711 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9712         CResult_PhantomRouteHintsDecodeErrorZ {
9713                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9714                         result: Box::into_raw(Box::new(o)),
9715                 },
9716                 result_ok: true,
9717         }
9718 }
9719 #[no_mangle]
9720 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9721 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9722         CResult_PhantomRouteHintsDecodeErrorZ {
9723                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9724                         err: Box::into_raw(Box::new(e)),
9725                 },
9726                 result_ok: false,
9727         }
9728 }
9729 /// Checks if the given object is currently in the success state
9730 #[no_mangle]
9731 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9732         o.result_ok
9733 }
9734 #[no_mangle]
9735 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9736 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9737 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9738         fn drop(&mut self) {
9739                 if self.result_ok {
9740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9742                         }
9743                 } else {
9744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9746                         }
9747                 }
9748         }
9749 }
9750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9752                 let contents = if o.result_ok {
9753                         let result = unsafe { o.contents.result };
9754                         unsafe { o.contents.result = core::ptr::null_mut() };
9755                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9756                 } else {
9757                         let err = unsafe { o.contents.err };
9758                         unsafe { o.contents.err = core::ptr::null_mut(); }
9759                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9760                 };
9761                 Self {
9762                         contents,
9763                         result_ok: o.result_ok,
9764                 }
9765         }
9766 }
9767 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9768         fn clone(&self) -> Self {
9769                 if self.result_ok {
9770                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9771                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9772                         } }
9773                 } else {
9774                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9776                         } }
9777                 }
9778         }
9779 }
9780 #[no_mangle]
9781 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9782 /// but with all dynamically-allocated buffers duplicated in new buffers.
9783 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9784 #[repr(C)]
9785 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9786 /// This corresponds to std::vector in C++
9787 pub struct CVec_ChannelMonitorZ {
9788         /// The elements in the array.
9789         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9790         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9791         /// The number of elements pointed to by `data`.
9792         pub datalen: usize
9793 }
9794 impl CVec_ChannelMonitorZ {
9795         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9796                 if self.datalen == 0 { return Vec::new(); }
9797                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9798                 self.data = core::ptr::null_mut();
9799                 self.datalen = 0;
9800                 ret
9801         }
9802         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9803                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9804         }
9805 }
9806 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9807         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9808                 let datalen = v.len();
9809                 let data = Box::into_raw(v.into_boxed_slice());
9810                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9811         }
9812 }
9813 #[no_mangle]
9814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9815 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9816 impl Drop for CVec_ChannelMonitorZ {
9817         fn drop(&mut self) {
9818                 if self.datalen == 0 { return; }
9819                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9820         }
9821 }
9822 #[repr(C)]
9823 /// A tuple of 2 elements. See the individual fields for the types contained.
9824 pub struct C2Tuple_BlockHashChannelManagerZ {
9825         /// The element at position 0
9826         pub a: crate::c_types::ThirtyTwoBytes,
9827         /// The element at position 1
9828         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9829 }
9830 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9831         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9832                 Self {
9833                         a: tup.0,
9834                         b: tup.1,
9835                 }
9836         }
9837 }
9838 impl C2Tuple_BlockHashChannelManagerZ {
9839         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9840                 (self.a, self.b)
9841         }
9842 }
9843 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9844 #[no_mangle]
9845 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9846         C2Tuple_BlockHashChannelManagerZ { a, b, }
9847 }
9848
9849 #[no_mangle]
9850 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9851 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9852 #[repr(C)]
9853 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9854 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9855         /// A pointer to the contents in the success state.
9856         /// Reading from this pointer when `result_ok` is not set is undefined.
9857         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9858         /// A pointer to the contents in the error state.
9859         /// Reading from this pointer when `result_ok` is set is undefined.
9860         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9861 }
9862 #[repr(C)]
9863 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9864 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9865 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9866 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9867         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9868         /// `err` or `result` depending on the state of `result_ok`.
9869         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9870         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9871         pub result_ok: bool,
9872 }
9873 #[no_mangle]
9874 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9875 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9876         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9877                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9878                         result: Box::into_raw(Box::new(o)),
9879                 },
9880                 result_ok: true,
9881         }
9882 }
9883 #[no_mangle]
9884 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9885 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9886         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9887                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9888                         err: Box::into_raw(Box::new(e)),
9889                 },
9890                 result_ok: false,
9891         }
9892 }
9893 /// Checks if the given object is currently in the success state
9894 #[no_mangle]
9895 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9896         o.result_ok
9897 }
9898 #[no_mangle]
9899 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9900 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9901 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9902         fn drop(&mut self) {
9903                 if self.result_ok {
9904                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9905                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9906                         }
9907                 } else {
9908                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9909                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9910                         }
9911                 }
9912         }
9913 }
9914 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9915         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9916                 let contents = if o.result_ok {
9917                         let result = unsafe { o.contents.result };
9918                         unsafe { o.contents.result = core::ptr::null_mut() };
9919                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9920                 } else {
9921                         let err = unsafe { o.contents.err };
9922                         unsafe { o.contents.err = core::ptr::null_mut(); }
9923                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9924                 };
9925                 Self {
9926                         contents,
9927                         result_ok: o.result_ok,
9928                 }
9929         }
9930 }
9931 #[repr(C)]
9932 /// The contents of CResult_ChannelConfigDecodeErrorZ
9933 pub union CResult_ChannelConfigDecodeErrorZPtr {
9934         /// A pointer to the contents in the success state.
9935         /// Reading from this pointer when `result_ok` is not set is undefined.
9936         pub result: *mut crate::lightning::util::config::ChannelConfig,
9937         /// A pointer to the contents in the error state.
9938         /// Reading from this pointer when `result_ok` is set is undefined.
9939         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9940 }
9941 #[repr(C)]
9942 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9943 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9945 pub struct CResult_ChannelConfigDecodeErrorZ {
9946         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9947         /// `err` or `result` depending on the state of `result_ok`.
9948         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9949         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9950         pub result_ok: bool,
9951 }
9952 #[no_mangle]
9953 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9954 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9955         CResult_ChannelConfigDecodeErrorZ {
9956                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9957                         result: Box::into_raw(Box::new(o)),
9958                 },
9959                 result_ok: true,
9960         }
9961 }
9962 #[no_mangle]
9963 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9964 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9965         CResult_ChannelConfigDecodeErrorZ {
9966                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9967                         err: Box::into_raw(Box::new(e)),
9968                 },
9969                 result_ok: false,
9970         }
9971 }
9972 /// Checks if the given object is currently in the success state
9973 #[no_mangle]
9974 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9975         o.result_ok
9976 }
9977 #[no_mangle]
9978 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9979 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9980 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9981         fn drop(&mut self) {
9982                 if self.result_ok {
9983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9985                         }
9986                 } else {
9987                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9988                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9989                         }
9990                 }
9991         }
9992 }
9993 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9994         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9995                 let contents = if o.result_ok {
9996                         let result = unsafe { o.contents.result };
9997                         unsafe { o.contents.result = core::ptr::null_mut() };
9998                         CResult_ChannelConfigDecodeErrorZPtr { result }
9999                 } else {
10000                         let err = unsafe { o.contents.err };
10001                         unsafe { o.contents.err = core::ptr::null_mut(); }
10002                         CResult_ChannelConfigDecodeErrorZPtr { err }
10003                 };
10004                 Self {
10005                         contents,
10006                         result_ok: o.result_ok,
10007                 }
10008         }
10009 }
10010 impl Clone for CResult_ChannelConfigDecodeErrorZ {
10011         fn clone(&self) -> Self {
10012                 if self.result_ok {
10013                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
10014                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
10015                         } }
10016                 } else {
10017                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
10018                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10019                         } }
10020                 }
10021         }
10022 }
10023 #[no_mangle]
10024 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10025 /// but with all dynamically-allocated buffers duplicated in new buffers.
10026 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
10027 #[repr(C)]
10028 #[derive(Clone)]
10029 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
10030 pub enum COption_APIErrorZ {
10031         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
10032         Some(crate::lightning::util::errors::APIError),
10033         /// When we're in this state, this COption_APIErrorZ contains nothing
10034         None
10035 }
10036 impl COption_APIErrorZ {
10037         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10038                 if let Self::None = self { false } else { true }
10039         }
10040         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10041                 !self.is_some()
10042         }
10043         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
10044                 if let Self::Some(v) = self { v } else { unreachable!() }
10045         }
10046 }
10047 #[no_mangle]
10048 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
10049 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
10050         COption_APIErrorZ::Some(o)
10051 }
10052 #[no_mangle]
10053 /// Constructs a new COption_APIErrorZ containing nothing
10054 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
10055         COption_APIErrorZ::None
10056 }
10057 #[no_mangle]
10058 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
10059 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
10060 #[no_mangle]
10061 /// Creates a new COption_APIErrorZ which has the same data as `orig`
10062 /// but with all dynamically-allocated buffers duplicated in new buffers.
10063 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
10064 #[repr(C)]
10065 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
10066 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
10067         /// A pointer to the contents in the success state.
10068         /// Reading from this pointer when `result_ok` is not set is undefined.
10069         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
10070         /// A pointer to the contents in the error state.
10071         /// Reading from this pointer when `result_ok` is set is undefined.
10072         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10073 }
10074 #[repr(C)]
10075 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
10076 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10078 pub struct CResult_COption_APIErrorZDecodeErrorZ {
10079         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
10080         /// `err` or `result` depending on the state of `result_ok`.
10081         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
10082         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
10083         pub result_ok: bool,
10084 }
10085 #[no_mangle]
10086 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
10087 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
10088         CResult_COption_APIErrorZDecodeErrorZ {
10089                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10090                         result: Box::into_raw(Box::new(o)),
10091                 },
10092                 result_ok: true,
10093         }
10094 }
10095 #[no_mangle]
10096 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
10097 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
10098         CResult_COption_APIErrorZDecodeErrorZ {
10099                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10100                         err: Box::into_raw(Box::new(e)),
10101                 },
10102                 result_ok: false,
10103         }
10104 }
10105 /// Checks if the given object is currently in the success state
10106 #[no_mangle]
10107 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
10108         o.result_ok
10109 }
10110 #[no_mangle]
10111 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
10112 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
10113 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
10114         fn drop(&mut self) {
10115                 if self.result_ok {
10116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10118                         }
10119                 } else {
10120                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10121                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10122                         }
10123                 }
10124         }
10125 }
10126 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
10127         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10128                 let contents = if o.result_ok {
10129                         let result = unsafe { o.contents.result };
10130                         unsafe { o.contents.result = core::ptr::null_mut() };
10131                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
10132                 } else {
10133                         let err = unsafe { o.contents.err };
10134                         unsafe { o.contents.err = core::ptr::null_mut(); }
10135                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
10136                 };
10137                 Self {
10138                         contents,
10139                         result_ok: o.result_ok,
10140                 }
10141         }
10142 }
10143 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
10144         fn clone(&self) -> Self {
10145                 if self.result_ok {
10146                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10147                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
10148                         } }
10149                 } else {
10150                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
10151                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10152                         } }
10153                 }
10154         }
10155 }
10156 #[no_mangle]
10157 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
10158 /// but with all dynamically-allocated buffers duplicated in new buffers.
10159 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
10160 #[repr(C)]
10161 /// The contents of CResult_OutPointDecodeErrorZ
10162 pub union CResult_OutPointDecodeErrorZPtr {
10163         /// A pointer to the contents in the success state.
10164         /// Reading from this pointer when `result_ok` is not set is undefined.
10165         pub result: *mut crate::lightning::chain::transaction::OutPoint,
10166         /// A pointer to the contents in the error state.
10167         /// Reading from this pointer when `result_ok` is set is undefined.
10168         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10169 }
10170 #[repr(C)]
10171 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
10172 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
10173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174 pub struct CResult_OutPointDecodeErrorZ {
10175         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
10176         /// `err` or `result` depending on the state of `result_ok`.
10177         pub contents: CResult_OutPointDecodeErrorZPtr,
10178         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
10179         pub result_ok: bool,
10180 }
10181 #[no_mangle]
10182 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
10183 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
10184         CResult_OutPointDecodeErrorZ {
10185                 contents: CResult_OutPointDecodeErrorZPtr {
10186                         result: Box::into_raw(Box::new(o)),
10187                 },
10188                 result_ok: true,
10189         }
10190 }
10191 #[no_mangle]
10192 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
10193 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
10194         CResult_OutPointDecodeErrorZ {
10195                 contents: CResult_OutPointDecodeErrorZPtr {
10196                         err: Box::into_raw(Box::new(e)),
10197                 },
10198                 result_ok: false,
10199         }
10200 }
10201 /// Checks if the given object is currently in the success state
10202 #[no_mangle]
10203 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10204         o.result_ok
10205 }
10206 #[no_mangle]
10207 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10208 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10209 impl Drop for CResult_OutPointDecodeErrorZ {
10210         fn drop(&mut self) {
10211                 if self.result_ok {
10212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10214                         }
10215                 } else {
10216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10218                         }
10219                 }
10220         }
10221 }
10222 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10224                 let contents = if o.result_ok {
10225                         let result = unsafe { o.contents.result };
10226                         unsafe { o.contents.result = core::ptr::null_mut() };
10227                         CResult_OutPointDecodeErrorZPtr { result }
10228                 } else {
10229                         let err = unsafe { o.contents.err };
10230                         unsafe { o.contents.err = core::ptr::null_mut(); }
10231                         CResult_OutPointDecodeErrorZPtr { err }
10232                 };
10233                 Self {
10234                         contents,
10235                         result_ok: o.result_ok,
10236                 }
10237         }
10238 }
10239 impl Clone for CResult_OutPointDecodeErrorZ {
10240         fn clone(&self) -> Self {
10241                 if self.result_ok {
10242                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10243                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10244                         } }
10245                 } else {
10246                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10247                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10248                         } }
10249                 }
10250         }
10251 }
10252 #[no_mangle]
10253 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10254 /// but with all dynamically-allocated buffers duplicated in new buffers.
10255 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10256 #[repr(C)]
10257 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10258 pub enum COption_TypeZ {
10259         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10260         Some(crate::lightning::ln::wire::Type),
10261         /// When we're in this state, this COption_TypeZ contains nothing
10262         None
10263 }
10264 impl COption_TypeZ {
10265         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10266                 if let Self::None = self { false } else { true }
10267         }
10268         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10269                 !self.is_some()
10270         }
10271         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10272                 if let Self::Some(v) = self { v } else { unreachable!() }
10273         }
10274 }
10275 #[no_mangle]
10276 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10277 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10278         COption_TypeZ::Some(o)
10279 }
10280 #[no_mangle]
10281 /// Constructs a new COption_TypeZ containing nothing
10282 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10283         COption_TypeZ::None
10284 }
10285 #[no_mangle]
10286 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10287 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10288 #[repr(C)]
10289 /// The contents of CResult_COption_TypeZDecodeErrorZ
10290 pub union CResult_COption_TypeZDecodeErrorZPtr {
10291         /// A pointer to the contents in the success state.
10292         /// Reading from this pointer when `result_ok` is not set is undefined.
10293         pub result: *mut crate::c_types::derived::COption_TypeZ,
10294         /// A pointer to the contents in the error state.
10295         /// Reading from this pointer when `result_ok` is set is undefined.
10296         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10297 }
10298 #[repr(C)]
10299 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10300 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10302 pub struct CResult_COption_TypeZDecodeErrorZ {
10303         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10304         /// `err` or `result` depending on the state of `result_ok`.
10305         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10306         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10307         pub result_ok: bool,
10308 }
10309 #[no_mangle]
10310 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10311 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10312         CResult_COption_TypeZDecodeErrorZ {
10313                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10314                         result: Box::into_raw(Box::new(o)),
10315                 },
10316                 result_ok: true,
10317         }
10318 }
10319 #[no_mangle]
10320 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10321 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10322         CResult_COption_TypeZDecodeErrorZ {
10323                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10324                         err: Box::into_raw(Box::new(e)),
10325                 },
10326                 result_ok: false,
10327         }
10328 }
10329 /// Checks if the given object is currently in the success state
10330 #[no_mangle]
10331 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10332         o.result_ok
10333 }
10334 #[no_mangle]
10335 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10336 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10337 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10338         fn drop(&mut self) {
10339                 if self.result_ok {
10340                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10341                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10342                         }
10343                 } else {
10344                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10345                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10346                         }
10347                 }
10348         }
10349 }
10350 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10351         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10352                 let contents = if o.result_ok {
10353                         let result = unsafe { o.contents.result };
10354                         unsafe { o.contents.result = core::ptr::null_mut() };
10355                         CResult_COption_TypeZDecodeErrorZPtr { result }
10356                 } else {
10357                         let err = unsafe { o.contents.err };
10358                         unsafe { o.contents.err = core::ptr::null_mut(); }
10359                         CResult_COption_TypeZDecodeErrorZPtr { err }
10360                 };
10361                 Self {
10362                         contents,
10363                         result_ok: o.result_ok,
10364                 }
10365         }
10366 }
10367 #[repr(C)]
10368 /// The contents of CResult_PaymentIdPaymentErrorZ
10369 pub union CResult_PaymentIdPaymentErrorZPtr {
10370         /// A pointer to the contents in the success state.
10371         /// Reading from this pointer when `result_ok` is not set is undefined.
10372         pub result: *mut crate::c_types::ThirtyTwoBytes,
10373         /// A pointer to the contents in the error state.
10374         /// Reading from this pointer when `result_ok` is set is undefined.
10375         pub err: *mut crate::lightning_invoice::payment::PaymentError,
10376 }
10377 #[repr(C)]
10378 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10379 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10381 pub struct CResult_PaymentIdPaymentErrorZ {
10382         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10383         /// `err` or `result` depending on the state of `result_ok`.
10384         pub contents: CResult_PaymentIdPaymentErrorZPtr,
10385         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10386         pub result_ok: bool,
10387 }
10388 #[no_mangle]
10389 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
10390 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
10391         CResult_PaymentIdPaymentErrorZ {
10392                 contents: CResult_PaymentIdPaymentErrorZPtr {
10393                         result: Box::into_raw(Box::new(o)),
10394                 },
10395                 result_ok: true,
10396         }
10397 }
10398 #[no_mangle]
10399 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
10400 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
10401         CResult_PaymentIdPaymentErrorZ {
10402                 contents: CResult_PaymentIdPaymentErrorZPtr {
10403                         err: Box::into_raw(Box::new(e)),
10404                 },
10405                 result_ok: false,
10406         }
10407 }
10408 /// Checks if the given object is currently in the success state
10409 #[no_mangle]
10410 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
10411         o.result_ok
10412 }
10413 #[no_mangle]
10414 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
10415 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
10416 impl Drop for CResult_PaymentIdPaymentErrorZ {
10417         fn drop(&mut self) {
10418                 if self.result_ok {
10419                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10420                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10421                         }
10422                 } else {
10423                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10424                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10425                         }
10426                 }
10427         }
10428 }
10429 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
10430         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
10431                 let contents = if o.result_ok {
10432                         let result = unsafe { o.contents.result };
10433                         unsafe { o.contents.result = core::ptr::null_mut() };
10434                         CResult_PaymentIdPaymentErrorZPtr { result }
10435                 } else {
10436                         let err = unsafe { o.contents.err };
10437                         unsafe { o.contents.err = core::ptr::null_mut(); }
10438                         CResult_PaymentIdPaymentErrorZPtr { err }
10439                 };
10440                 Self {
10441                         contents,
10442                         result_ok: o.result_ok,
10443                 }
10444         }
10445 }
10446 impl Clone for CResult_PaymentIdPaymentErrorZ {
10447         fn clone(&self) -> Self {
10448                 if self.result_ok {
10449                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
10450                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10451                         } }
10452                 } else {
10453                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
10454                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10455                         } }
10456                 }
10457         }
10458 }
10459 #[no_mangle]
10460 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
10461 /// but with all dynamically-allocated buffers duplicated in new buffers.
10462 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
10463 #[repr(C)]
10464 /// The contents of CResult_NonePaymentErrorZ
10465 pub union CResult_NonePaymentErrorZPtr {
10466         /// Note that this value is always NULL, as there are no contents in the OK variant
10467         pub result: *mut core::ffi::c_void,
10468         /// A pointer to the contents in the error state.
10469         /// Reading from this pointer when `result_ok` is set is undefined.
10470         pub err: *mut crate::lightning_invoice::payment::PaymentError,
10471 }
10472 #[repr(C)]
10473 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
10474 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
10475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10476 pub struct CResult_NonePaymentErrorZ {
10477         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
10478         /// `err` or `result` depending on the state of `result_ok`.
10479         pub contents: CResult_NonePaymentErrorZPtr,
10480         /// Whether this CResult_NonePaymentErrorZ represents a success state.
10481         pub result_ok: bool,
10482 }
10483 #[no_mangle]
10484 /// Creates a new CResult_NonePaymentErrorZ in the success state.
10485 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
10486         CResult_NonePaymentErrorZ {
10487                 contents: CResult_NonePaymentErrorZPtr {
10488                         result: core::ptr::null_mut(),
10489                 },
10490                 result_ok: true,
10491         }
10492 }
10493 #[no_mangle]
10494 /// Creates a new CResult_NonePaymentErrorZ in the error state.
10495 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
10496         CResult_NonePaymentErrorZ {
10497                 contents: CResult_NonePaymentErrorZPtr {
10498                         err: Box::into_raw(Box::new(e)),
10499                 },
10500                 result_ok: false,
10501         }
10502 }
10503 /// Checks if the given object is currently in the success state
10504 #[no_mangle]
10505 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
10506         o.result_ok
10507 }
10508 #[no_mangle]
10509 /// Frees any resources used by the CResult_NonePaymentErrorZ.
10510 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
10511 impl Drop for CResult_NonePaymentErrorZ {
10512         fn drop(&mut self) {
10513                 if self.result_ok {
10514                 } else {
10515                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10516                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10517                         }
10518                 }
10519         }
10520 }
10521 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
10522         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
10523                 let contents = if o.result_ok {
10524                         let _ = unsafe { Box::from_raw(o.contents.result) };
10525                         o.contents.result = core::ptr::null_mut();
10526                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
10527                 } else {
10528                         let err = unsafe { o.contents.err };
10529                         unsafe { o.contents.err = core::ptr::null_mut(); }
10530                         CResult_NonePaymentErrorZPtr { err }
10531                 };
10532                 Self {
10533                         contents,
10534                         result_ok: o.result_ok,
10535                 }
10536         }
10537 }
10538 impl Clone for CResult_NonePaymentErrorZ {
10539         fn clone(&self) -> Self {
10540                 if self.result_ok {
10541                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
10542                                 result: core::ptr::null_mut()
10543                         } }
10544                 } else {
10545                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
10546                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10547                         } }
10548                 }
10549         }
10550 }
10551 #[no_mangle]
10552 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
10553 /// but with all dynamically-allocated buffers duplicated in new buffers.
10554 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
10555 #[repr(C)]
10556 /// The contents of CResult_StringErrorZ
10557 pub union CResult_StringErrorZPtr {
10558         /// A pointer to the contents in the success state.
10559         /// Reading from this pointer when `result_ok` is not set is undefined.
10560         pub result: *mut crate::c_types::Str,
10561         /// A pointer to the contents in the error state.
10562         /// Reading from this pointer when `result_ok` is set is undefined.
10563         pub err: *mut crate::c_types::Secp256k1Error,
10564 }
10565 #[repr(C)]
10566 /// A CResult_StringErrorZ represents the result of a fallible operation,
10567 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10569 pub struct CResult_StringErrorZ {
10570         /// The contents of this CResult_StringErrorZ, accessible via either
10571         /// `err` or `result` depending on the state of `result_ok`.
10572         pub contents: CResult_StringErrorZPtr,
10573         /// Whether this CResult_StringErrorZ represents a success state.
10574         pub result_ok: bool,
10575 }
10576 #[no_mangle]
10577 /// Creates a new CResult_StringErrorZ in the success state.
10578 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10579         CResult_StringErrorZ {
10580                 contents: CResult_StringErrorZPtr {
10581                         result: Box::into_raw(Box::new(o)),
10582                 },
10583                 result_ok: true,
10584         }
10585 }
10586 #[no_mangle]
10587 /// Creates a new CResult_StringErrorZ in the error state.
10588 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10589         CResult_StringErrorZ {
10590                 contents: CResult_StringErrorZPtr {
10591                         err: Box::into_raw(Box::new(e)),
10592                 },
10593                 result_ok: false,
10594         }
10595 }
10596 /// Checks if the given object is currently in the success state
10597 #[no_mangle]
10598 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10599         o.result_ok
10600 }
10601 #[no_mangle]
10602 /// Frees any resources used by the CResult_StringErrorZ.
10603 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10604 impl Drop for CResult_StringErrorZ {
10605         fn drop(&mut self) {
10606                 if self.result_ok {
10607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10609                         }
10610                 } else {
10611                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10612                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10613                         }
10614                 }
10615         }
10616 }
10617 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10618         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10619                 let contents = if o.result_ok {
10620                         let result = unsafe { o.contents.result };
10621                         unsafe { o.contents.result = core::ptr::null_mut() };
10622                         CResult_StringErrorZPtr { result }
10623                 } else {
10624                         let err = unsafe { o.contents.err };
10625                         unsafe { o.contents.err = core::ptr::null_mut(); }
10626                         CResult_StringErrorZPtr { err }
10627                 };
10628                 Self {
10629                         contents,
10630                         result_ok: o.result_ok,
10631                 }
10632         }
10633 }
10634 impl Clone for CResult_StringErrorZ {
10635         fn clone(&self) -> Self {
10636                 if self.result_ok {
10637                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
10638                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10639                         } }
10640                 } else {
10641                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
10642                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10643                         } }
10644                 }
10645         }
10646 }
10647 #[no_mangle]
10648 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10649 /// but with all dynamically-allocated buffers duplicated in new buffers.
10650 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10651 #[repr(C)]
10652 /// The contents of CResult_PublicKeyErrorZ
10653 pub union CResult_PublicKeyErrorZPtr {
10654         /// A pointer to the contents in the success state.
10655         /// Reading from this pointer when `result_ok` is not set is undefined.
10656         pub result: *mut crate::c_types::PublicKey,
10657         /// A pointer to the contents in the error state.
10658         /// Reading from this pointer when `result_ok` is set is undefined.
10659         pub err: *mut crate::c_types::Secp256k1Error,
10660 }
10661 #[repr(C)]
10662 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
10663 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
10664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10665 pub struct CResult_PublicKeyErrorZ {
10666         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
10667         /// `err` or `result` depending on the state of `result_ok`.
10668         pub contents: CResult_PublicKeyErrorZPtr,
10669         /// Whether this CResult_PublicKeyErrorZ represents a success state.
10670         pub result_ok: bool,
10671 }
10672 #[no_mangle]
10673 /// Creates a new CResult_PublicKeyErrorZ in the success state.
10674 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
10675         CResult_PublicKeyErrorZ {
10676                 contents: CResult_PublicKeyErrorZPtr {
10677                         result: Box::into_raw(Box::new(o)),
10678                 },
10679                 result_ok: true,
10680         }
10681 }
10682 #[no_mangle]
10683 /// Creates a new CResult_PublicKeyErrorZ in the error state.
10684 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
10685         CResult_PublicKeyErrorZ {
10686                 contents: CResult_PublicKeyErrorZPtr {
10687                         err: Box::into_raw(Box::new(e)),
10688                 },
10689                 result_ok: false,
10690         }
10691 }
10692 /// Checks if the given object is currently in the success state
10693 #[no_mangle]
10694 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
10695         o.result_ok
10696 }
10697 #[no_mangle]
10698 /// Frees any resources used by the CResult_PublicKeyErrorZ.
10699 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
10700 impl Drop for CResult_PublicKeyErrorZ {
10701         fn drop(&mut self) {
10702                 if self.result_ok {
10703                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10704                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10705                         }
10706                 } else {
10707                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10708                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10709                         }
10710                 }
10711         }
10712 }
10713 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
10714         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
10715                 let contents = if o.result_ok {
10716                         let result = unsafe { o.contents.result };
10717                         unsafe { o.contents.result = core::ptr::null_mut() };
10718                         CResult_PublicKeyErrorZPtr { result }
10719                 } else {
10720                         let err = unsafe { o.contents.err };
10721                         unsafe { o.contents.err = core::ptr::null_mut(); }
10722                         CResult_PublicKeyErrorZPtr { err }
10723                 };
10724                 Self {
10725                         contents,
10726                         result_ok: o.result_ok,
10727                 }
10728         }
10729 }
10730 impl Clone for CResult_PublicKeyErrorZ {
10731         fn clone(&self) -> Self {
10732                 if self.result_ok {
10733                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
10734                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
10735                         } }
10736                 } else {
10737                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
10738                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10739                         } }
10740                 }
10741         }
10742 }
10743 #[no_mangle]
10744 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10745 /// but with all dynamically-allocated buffers duplicated in new buffers.
10746 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
10747 #[repr(C)]
10748 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10749 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10750         /// A pointer to the contents in the success state.
10751         /// Reading from this pointer when `result_ok` is not set is undefined.
10752         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10753         /// A pointer to the contents in the error state.
10754         /// Reading from this pointer when `result_ok` is set is undefined.
10755         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10756 }
10757 #[repr(C)]
10758 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10759 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10761 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10762         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10763         /// `err` or `result` depending on the state of `result_ok`.
10764         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10765         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10766         pub result_ok: bool,
10767 }
10768 #[no_mangle]
10769 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10770 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10771         CResult_ChannelMonitorUpdateDecodeErrorZ {
10772                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10773                         result: Box::into_raw(Box::new(o)),
10774                 },
10775                 result_ok: true,
10776         }
10777 }
10778 #[no_mangle]
10779 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10780 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10781         CResult_ChannelMonitorUpdateDecodeErrorZ {
10782                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10783                         err: Box::into_raw(Box::new(e)),
10784                 },
10785                 result_ok: false,
10786         }
10787 }
10788 /// Checks if the given object is currently in the success state
10789 #[no_mangle]
10790 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10791         o.result_ok
10792 }
10793 #[no_mangle]
10794 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10795 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10796 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10797         fn drop(&mut self) {
10798                 if self.result_ok {
10799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10801                         }
10802                 } else {
10803                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10804                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10805                         }
10806                 }
10807         }
10808 }
10809 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10810         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10811                 let contents = if o.result_ok {
10812                         let result = unsafe { o.contents.result };
10813                         unsafe { o.contents.result = core::ptr::null_mut() };
10814                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10815                 } else {
10816                         let err = unsafe { o.contents.err };
10817                         unsafe { o.contents.err = core::ptr::null_mut(); }
10818                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10819                 };
10820                 Self {
10821                         contents,
10822                         result_ok: o.result_ok,
10823                 }
10824         }
10825 }
10826 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10827         fn clone(&self) -> Self {
10828                 if self.result_ok {
10829                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10830                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10831                         } }
10832                 } else {
10833                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10834                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10835                         } }
10836                 }
10837         }
10838 }
10839 #[no_mangle]
10840 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10841 /// but with all dynamically-allocated buffers duplicated in new buffers.
10842 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10843 #[repr(C)]
10844 #[derive(Clone)]
10845 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10846 pub enum COption_MonitorEventZ {
10847         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10848         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10849         /// When we're in this state, this COption_MonitorEventZ contains nothing
10850         None
10851 }
10852 impl COption_MonitorEventZ {
10853         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10854                 if let Self::None = self { false } else { true }
10855         }
10856         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10857                 !self.is_some()
10858         }
10859         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10860                 if let Self::Some(v) = self { v } else { unreachable!() }
10861         }
10862 }
10863 #[no_mangle]
10864 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10865 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10866         COption_MonitorEventZ::Some(o)
10867 }
10868 #[no_mangle]
10869 /// Constructs a new COption_MonitorEventZ containing nothing
10870 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10871         COption_MonitorEventZ::None
10872 }
10873 #[no_mangle]
10874 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10875 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10876 #[no_mangle]
10877 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10878 /// but with all dynamically-allocated buffers duplicated in new buffers.
10879 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10880 #[repr(C)]
10881 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10882 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10883         /// A pointer to the contents in the success state.
10884         /// Reading from this pointer when `result_ok` is not set is undefined.
10885         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10886         /// A pointer to the contents in the error state.
10887         /// Reading from this pointer when `result_ok` is set is undefined.
10888         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10889 }
10890 #[repr(C)]
10891 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10892 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10894 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10895         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10896         /// `err` or `result` depending on the state of `result_ok`.
10897         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10898         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10899         pub result_ok: bool,
10900 }
10901 #[no_mangle]
10902 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10903 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10904         CResult_COption_MonitorEventZDecodeErrorZ {
10905                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10906                         result: Box::into_raw(Box::new(o)),
10907                 },
10908                 result_ok: true,
10909         }
10910 }
10911 #[no_mangle]
10912 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10913 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10914         CResult_COption_MonitorEventZDecodeErrorZ {
10915                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10916                         err: Box::into_raw(Box::new(e)),
10917                 },
10918                 result_ok: false,
10919         }
10920 }
10921 /// Checks if the given object is currently in the success state
10922 #[no_mangle]
10923 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10924         o.result_ok
10925 }
10926 #[no_mangle]
10927 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10928 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10929 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10930         fn drop(&mut self) {
10931                 if self.result_ok {
10932                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10933                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10934                         }
10935                 } else {
10936                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10937                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10938                         }
10939                 }
10940         }
10941 }
10942 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10943         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10944                 let contents = if o.result_ok {
10945                         let result = unsafe { o.contents.result };
10946                         unsafe { o.contents.result = core::ptr::null_mut() };
10947                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10948                 } else {
10949                         let err = unsafe { o.contents.err };
10950                         unsafe { o.contents.err = core::ptr::null_mut(); }
10951                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10952                 };
10953                 Self {
10954                         contents,
10955                         result_ok: o.result_ok,
10956                 }
10957         }
10958 }
10959 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10960         fn clone(&self) -> Self {
10961                 if self.result_ok {
10962                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10963                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10964                         } }
10965                 } else {
10966                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10967                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10968                         } }
10969                 }
10970         }
10971 }
10972 #[no_mangle]
10973 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10974 /// but with all dynamically-allocated buffers duplicated in new buffers.
10975 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10976 #[repr(C)]
10977 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10978 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10979         /// A pointer to the contents in the success state.
10980         /// Reading from this pointer when `result_ok` is not set is undefined.
10981         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10982         /// A pointer to the contents in the error state.
10983         /// Reading from this pointer when `result_ok` is set is undefined.
10984         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10985 }
10986 #[repr(C)]
10987 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10988 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10990 pub struct CResult_HTLCUpdateDecodeErrorZ {
10991         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10992         /// `err` or `result` depending on the state of `result_ok`.
10993         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10994         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10995         pub result_ok: bool,
10996 }
10997 #[no_mangle]
10998 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10999 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11000         CResult_HTLCUpdateDecodeErrorZ {
11001                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11002                         result: Box::into_raw(Box::new(o)),
11003                 },
11004                 result_ok: true,
11005         }
11006 }
11007 #[no_mangle]
11008 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11009 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11010         CResult_HTLCUpdateDecodeErrorZ {
11011                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11012                         err: Box::into_raw(Box::new(e)),
11013                 },
11014                 result_ok: false,
11015         }
11016 }
11017 /// Checks if the given object is currently in the success state
11018 #[no_mangle]
11019 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11020         o.result_ok
11021 }
11022 #[no_mangle]
11023 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11024 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11025 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11026         fn drop(&mut self) {
11027                 if self.result_ok {
11028                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11029                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11030                         }
11031                 } else {
11032                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11033                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11034                         }
11035                 }
11036         }
11037 }
11038 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11039         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11040                 let contents = if o.result_ok {
11041                         let result = unsafe { o.contents.result };
11042                         unsafe { o.contents.result = core::ptr::null_mut() };
11043                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11044                 } else {
11045                         let err = unsafe { o.contents.err };
11046                         unsafe { o.contents.err = core::ptr::null_mut(); }
11047                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11048                 };
11049                 Self {
11050                         contents,
11051                         result_ok: o.result_ok,
11052                 }
11053         }
11054 }
11055 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11056         fn clone(&self) -> Self {
11057                 if self.result_ok {
11058                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11059                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11060                         } }
11061                 } else {
11062                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11063                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11064                         } }
11065                 }
11066         }
11067 }
11068 #[no_mangle]
11069 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11070 /// but with all dynamically-allocated buffers duplicated in new buffers.
11071 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11072 #[repr(C)]
11073 /// A tuple of 2 elements. See the individual fields for the types contained.
11074 pub struct C2Tuple_OutPointScriptZ {
11075         /// The element at position 0
11076         pub a: crate::lightning::chain::transaction::OutPoint,
11077         /// The element at position 1
11078         pub b: crate::c_types::derived::CVec_u8Z,
11079 }
11080 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11081         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11082                 Self {
11083                         a: tup.0,
11084                         b: tup.1,
11085                 }
11086         }
11087 }
11088 impl C2Tuple_OutPointScriptZ {
11089         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11090                 (self.a, self.b)
11091         }
11092 }
11093 impl Clone for C2Tuple_OutPointScriptZ {
11094         fn clone(&self) -> Self {
11095                 Self {
11096                         a: Clone::clone(&self.a),
11097                         b: Clone::clone(&self.b),
11098                 }
11099         }
11100 }
11101 #[no_mangle]
11102 /// Creates a new tuple which has the same data as `orig`
11103 /// but with all dynamically-allocated buffers duplicated in new buffers.
11104 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11105 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11106 #[no_mangle]
11107 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11108         C2Tuple_OutPointScriptZ { a, b, }
11109 }
11110
11111 #[no_mangle]
11112 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11113 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11114 #[repr(C)]
11115 /// A tuple of 2 elements. See the individual fields for the types contained.
11116 pub struct C2Tuple_u32ScriptZ {
11117         /// The element at position 0
11118         pub a: u32,
11119         /// The element at position 1
11120         pub b: crate::c_types::derived::CVec_u8Z,
11121 }
11122 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11123         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11124                 Self {
11125                         a: tup.0,
11126                         b: tup.1,
11127                 }
11128         }
11129 }
11130 impl C2Tuple_u32ScriptZ {
11131         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11132                 (self.a, self.b)
11133         }
11134 }
11135 impl Clone for C2Tuple_u32ScriptZ {
11136         fn clone(&self) -> Self {
11137                 Self {
11138                         a: Clone::clone(&self.a),
11139                         b: Clone::clone(&self.b),
11140                 }
11141         }
11142 }
11143 #[no_mangle]
11144 /// Creates a new tuple which has the same data as `orig`
11145 /// but with all dynamically-allocated buffers duplicated in new buffers.
11146 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11147 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11148 #[no_mangle]
11149 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11150         C2Tuple_u32ScriptZ { a, b, }
11151 }
11152
11153 #[no_mangle]
11154 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11155 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11156 #[repr(C)]
11157 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11158 /// This corresponds to std::vector in C++
11159 pub struct CVec_C2Tuple_u32ScriptZZ {
11160         /// The elements in the array.
11161         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11162         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11163         /// The number of elements pointed to by `data`.
11164         pub datalen: usize
11165 }
11166 impl CVec_C2Tuple_u32ScriptZZ {
11167         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11168                 if self.datalen == 0 { return Vec::new(); }
11169                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11170                 self.data = core::ptr::null_mut();
11171                 self.datalen = 0;
11172                 ret
11173         }
11174         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11175                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11176         }
11177 }
11178 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11179         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11180                 let datalen = v.len();
11181                 let data = Box::into_raw(v.into_boxed_slice());
11182                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11183         }
11184 }
11185 #[no_mangle]
11186 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11187 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11188 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11189         fn drop(&mut self) {
11190                 if self.datalen == 0 { return; }
11191                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11192         }
11193 }
11194 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11195         fn clone(&self) -> Self {
11196                 let mut res = Vec::new();
11197                 if self.datalen == 0 { return Self::from(res); }
11198                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11199                 Self::from(res)
11200         }
11201 }
11202 #[repr(C)]
11203 /// A tuple of 2 elements. See the individual fields for the types contained.
11204 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11205         /// The element at position 0
11206         pub a: crate::c_types::ThirtyTwoBytes,
11207         /// The element at position 1
11208         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11209 }
11210 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11211         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11212                 Self {
11213                         a: tup.0,
11214                         b: tup.1,
11215                 }
11216         }
11217 }
11218 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11219         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11220                 (self.a, self.b)
11221         }
11222 }
11223 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11224         fn clone(&self) -> Self {
11225                 Self {
11226                         a: Clone::clone(&self.a),
11227                         b: Clone::clone(&self.b),
11228                 }
11229         }
11230 }
11231 #[no_mangle]
11232 /// Creates a new tuple which has the same data as `orig`
11233 /// but with all dynamically-allocated buffers duplicated in new buffers.
11234 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11235 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11236 #[no_mangle]
11237 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 {
11238         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11239 }
11240
11241 #[no_mangle]
11242 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11243 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11244 #[repr(C)]
11245 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11246 /// This corresponds to std::vector in C++
11247 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11248         /// The elements in the array.
11249         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11250         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11251         /// The number of elements pointed to by `data`.
11252         pub datalen: usize
11253 }
11254 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11255         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11256                 if self.datalen == 0 { return Vec::new(); }
11257                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11258                 self.data = core::ptr::null_mut();
11259                 self.datalen = 0;
11260                 ret
11261         }
11262         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11263                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11264         }
11265 }
11266 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11267         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11268                 let datalen = v.len();
11269                 let data = Box::into_raw(v.into_boxed_slice());
11270                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11271         }
11272 }
11273 #[no_mangle]
11274 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11275 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11276 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11277         fn drop(&mut self) {
11278                 if self.datalen == 0 { return; }
11279                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11280         }
11281 }
11282 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11283         fn clone(&self) -> Self {
11284                 let mut res = Vec::new();
11285                 if self.datalen == 0 { return Self::from(res); }
11286                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11287                 Self::from(res)
11288         }
11289 }
11290 #[repr(C)]
11291 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11292 /// This corresponds to std::vector in C++
11293 pub struct CVec_EventZ {
11294         /// The elements in the array.
11295         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11296         pub data: *mut crate::lightning::util::events::Event,
11297         /// The number of elements pointed to by `data`.
11298         pub datalen: usize
11299 }
11300 impl CVec_EventZ {
11301         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11302                 if self.datalen == 0 { return Vec::new(); }
11303                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11304                 self.data = core::ptr::null_mut();
11305                 self.datalen = 0;
11306                 ret
11307         }
11308         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11309                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11310         }
11311 }
11312 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11313         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11314                 let datalen = v.len();
11315                 let data = Box::into_raw(v.into_boxed_slice());
11316                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11317         }
11318 }
11319 #[no_mangle]
11320 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11321 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11322 impl Drop for CVec_EventZ {
11323         fn drop(&mut self) {
11324                 if self.datalen == 0 { return; }
11325                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11326         }
11327 }
11328 impl Clone for CVec_EventZ {
11329         fn clone(&self) -> Self {
11330                 let mut res = Vec::new();
11331                 if self.datalen == 0 { return Self::from(res); }
11332                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11333                 Self::from(res)
11334         }
11335 }
11336 #[repr(C)]
11337 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11338 /// This corresponds to std::vector in C++
11339 pub struct CVec_TransactionZ {
11340         /// The elements in the array.
11341         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11342         pub data: *mut crate::c_types::Transaction,
11343         /// The number of elements pointed to by `data`.
11344         pub datalen: usize
11345 }
11346 impl CVec_TransactionZ {
11347         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11348                 if self.datalen == 0 { return Vec::new(); }
11349                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11350                 self.data = core::ptr::null_mut();
11351                 self.datalen = 0;
11352                 ret
11353         }
11354         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11355                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11356         }
11357 }
11358 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11359         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11360                 let datalen = v.len();
11361                 let data = Box::into_raw(v.into_boxed_slice());
11362                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11363         }
11364 }
11365 #[no_mangle]
11366 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11367 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11368 impl Drop for CVec_TransactionZ {
11369         fn drop(&mut self) {
11370                 if self.datalen == 0 { return; }
11371                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11372         }
11373 }
11374 impl Clone for CVec_TransactionZ {
11375         fn clone(&self) -> Self {
11376                 let mut res = Vec::new();
11377                 if self.datalen == 0 { return Self::from(res); }
11378                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11379                 Self::from(res)
11380         }
11381 }
11382 #[repr(C)]
11383 /// A tuple of 2 elements. See the individual fields for the types contained.
11384 pub struct C2Tuple_u32TxOutZ {
11385         /// The element at position 0
11386         pub a: u32,
11387         /// The element at position 1
11388         pub b: crate::c_types::TxOut,
11389 }
11390 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11391         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11392                 Self {
11393                         a: tup.0,
11394                         b: tup.1,
11395                 }
11396         }
11397 }
11398 impl C2Tuple_u32TxOutZ {
11399         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11400                 (self.a, self.b)
11401         }
11402 }
11403 impl Clone for C2Tuple_u32TxOutZ {
11404         fn clone(&self) -> Self {
11405                 Self {
11406                         a: Clone::clone(&self.a),
11407                         b: Clone::clone(&self.b),
11408                 }
11409         }
11410 }
11411 #[no_mangle]
11412 /// Creates a new tuple which has the same data as `orig`
11413 /// but with all dynamically-allocated buffers duplicated in new buffers.
11414 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11415 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11416 #[no_mangle]
11417 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11418         C2Tuple_u32TxOutZ { a, b, }
11419 }
11420
11421 #[no_mangle]
11422 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11423 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11424 #[repr(C)]
11425 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11426 /// This corresponds to std::vector in C++
11427 pub struct CVec_C2Tuple_u32TxOutZZ {
11428         /// The elements in the array.
11429         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11430         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11431         /// The number of elements pointed to by `data`.
11432         pub datalen: usize
11433 }
11434 impl CVec_C2Tuple_u32TxOutZZ {
11435         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11436                 if self.datalen == 0 { return Vec::new(); }
11437                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11438                 self.data = core::ptr::null_mut();
11439                 self.datalen = 0;
11440                 ret
11441         }
11442         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11443                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11444         }
11445 }
11446 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11447         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11448                 let datalen = v.len();
11449                 let data = Box::into_raw(v.into_boxed_slice());
11450                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11451         }
11452 }
11453 #[no_mangle]
11454 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11455 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11456 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11457         fn drop(&mut self) {
11458                 if self.datalen == 0 { return; }
11459                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11460         }
11461 }
11462 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11463         fn clone(&self) -> Self {
11464                 let mut res = Vec::new();
11465                 if self.datalen == 0 { return Self::from(res); }
11466                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11467                 Self::from(res)
11468         }
11469 }
11470 #[repr(C)]
11471 /// A tuple of 2 elements. See the individual fields for the types contained.
11472 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11473         /// The element at position 0
11474         pub a: crate::c_types::ThirtyTwoBytes,
11475         /// The element at position 1
11476         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11477 }
11478 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11479         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11480                 Self {
11481                         a: tup.0,
11482                         b: tup.1,
11483                 }
11484         }
11485 }
11486 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11487         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11488                 (self.a, self.b)
11489         }
11490 }
11491 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11492         fn clone(&self) -> Self {
11493                 Self {
11494                         a: Clone::clone(&self.a),
11495                         b: Clone::clone(&self.b),
11496                 }
11497         }
11498 }
11499 #[no_mangle]
11500 /// Creates a new tuple which has the same data as `orig`
11501 /// but with all dynamically-allocated buffers duplicated in new buffers.
11502 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11503 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11504 #[no_mangle]
11505 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 {
11506         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11507 }
11508
11509 #[no_mangle]
11510 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11511 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11512 #[repr(C)]
11513 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11514 /// This corresponds to std::vector in C++
11515 pub struct CVec_TransactionOutputsZ {
11516         /// The elements in the array.
11517         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11518         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11519         /// The number of elements pointed to by `data`.
11520         pub datalen: usize
11521 }
11522 impl CVec_TransactionOutputsZ {
11523         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11524                 if self.datalen == 0 { return Vec::new(); }
11525                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11526                 self.data = core::ptr::null_mut();
11527                 self.datalen = 0;
11528                 ret
11529         }
11530         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11531                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11532         }
11533 }
11534 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11535         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11536                 let datalen = v.len();
11537                 let data = Box::into_raw(v.into_boxed_slice());
11538                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11539         }
11540 }
11541 #[no_mangle]
11542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11543 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11544 impl Drop for CVec_TransactionOutputsZ {
11545         fn drop(&mut self) {
11546                 if self.datalen == 0 { return; }
11547                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11548         }
11549 }
11550 impl Clone for CVec_TransactionOutputsZ {
11551         fn clone(&self) -> Self {
11552                 let mut res = Vec::new();
11553                 if self.datalen == 0 { return Self::from(res); }
11554                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11555                 Self::from(res)
11556         }
11557 }
11558 #[repr(C)]
11559 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11560 /// This corresponds to std::vector in C++
11561 pub struct CVec_BalanceZ {
11562         /// The elements in the array.
11563         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11564         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11565         /// The number of elements pointed to by `data`.
11566         pub datalen: usize
11567 }
11568 impl CVec_BalanceZ {
11569         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11570                 if self.datalen == 0 { return Vec::new(); }
11571                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11572                 self.data = core::ptr::null_mut();
11573                 self.datalen = 0;
11574                 ret
11575         }
11576         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11577                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11578         }
11579 }
11580 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11581         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11582                 let datalen = v.len();
11583                 let data = Box::into_raw(v.into_boxed_slice());
11584                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11585         }
11586 }
11587 #[no_mangle]
11588 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11589 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11590 impl Drop for CVec_BalanceZ {
11591         fn drop(&mut self) {
11592                 if self.datalen == 0 { return; }
11593                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11594         }
11595 }
11596 impl Clone for CVec_BalanceZ {
11597         fn clone(&self) -> Self {
11598                 let mut res = Vec::new();
11599                 if self.datalen == 0 { return Self::from(res); }
11600                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11601                 Self::from(res)
11602         }
11603 }
11604 #[repr(C)]
11605 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11606 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11607         /// A pointer to the contents in the success state.
11608         /// Reading from this pointer when `result_ok` is not set is undefined.
11609         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11610         /// A pointer to the contents in the error state.
11611         /// Reading from this pointer when `result_ok` is set is undefined.
11612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11613 }
11614 #[repr(C)]
11615 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11616 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11618 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11619         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11620         /// `err` or `result` depending on the state of `result_ok`.
11621         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11622         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11623         pub result_ok: bool,
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11627 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11628         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11629                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11630                         result: Box::into_raw(Box::new(o)),
11631                 },
11632                 result_ok: true,
11633         }
11634 }
11635 #[no_mangle]
11636 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11637 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11638         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11639                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11640                         err: Box::into_raw(Box::new(e)),
11641                 },
11642                 result_ok: false,
11643         }
11644 }
11645 /// Checks if the given object is currently in the success state
11646 #[no_mangle]
11647 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11648         o.result_ok
11649 }
11650 #[no_mangle]
11651 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11652 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11653 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11654         fn drop(&mut self) {
11655                 if self.result_ok {
11656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11658                         }
11659                 } else {
11660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11662                         }
11663                 }
11664         }
11665 }
11666 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11667         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11668                 let contents = if o.result_ok {
11669                         let result = unsafe { o.contents.result };
11670                         unsafe { o.contents.result = core::ptr::null_mut() };
11671                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11672                 } else {
11673                         let err = unsafe { o.contents.err };
11674                         unsafe { o.contents.err = core::ptr::null_mut(); }
11675                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11676                 };
11677                 Self {
11678                         contents,
11679                         result_ok: o.result_ok,
11680                 }
11681         }
11682 }
11683 #[repr(C)]
11684 /// A tuple of 2 elements. See the individual fields for the types contained.
11685 pub struct C2Tuple_PublicKeyTypeZ {
11686         /// The element at position 0
11687         pub a: crate::c_types::PublicKey,
11688         /// The element at position 1
11689         pub b: crate::lightning::ln::wire::Type,
11690 }
11691 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11692         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11693                 Self {
11694                         a: tup.0,
11695                         b: tup.1,
11696                 }
11697         }
11698 }
11699 impl C2Tuple_PublicKeyTypeZ {
11700         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11701                 (self.a, self.b)
11702         }
11703 }
11704 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11705 #[no_mangle]
11706 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11707         C2Tuple_PublicKeyTypeZ { a, b, }
11708 }
11709
11710 #[no_mangle]
11711 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11712 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11713 #[repr(C)]
11714 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11715 /// This corresponds to std::vector in C++
11716 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11717         /// The elements in the array.
11718         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11719         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11720         /// The number of elements pointed to by `data`.
11721         pub datalen: usize
11722 }
11723 impl CVec_C2Tuple_PublicKeyTypeZZ {
11724         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11725                 if self.datalen == 0 { return Vec::new(); }
11726                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11727                 self.data = core::ptr::null_mut();
11728                 self.datalen = 0;
11729                 ret
11730         }
11731         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11732                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11733         }
11734 }
11735 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11736         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11737                 let datalen = v.len();
11738                 let data = Box::into_raw(v.into_boxed_slice());
11739                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11740         }
11741 }
11742 #[no_mangle]
11743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11744 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11745 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11746         fn drop(&mut self) {
11747                 if self.datalen == 0 { return; }
11748                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11749         }
11750 }
11751 #[repr(C)]
11752 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
11753 pub enum COption_CustomOnionMessageContentsZ {
11754         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
11755         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
11756         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
11757         None
11758 }
11759 impl COption_CustomOnionMessageContentsZ {
11760         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11761                 if let Self::None = self { false } else { true }
11762         }
11763         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11764                 !self.is_some()
11765         }
11766         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
11767                 if let Self::Some(v) = self { v } else { unreachable!() }
11768         }
11769 }
11770 #[no_mangle]
11771 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
11772 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
11773         COption_CustomOnionMessageContentsZ::Some(o)
11774 }
11775 #[no_mangle]
11776 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
11777 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
11778         COption_CustomOnionMessageContentsZ::None
11779 }
11780 #[no_mangle]
11781 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
11782 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
11783 #[repr(C)]
11784 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
11785 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11786         /// A pointer to the contents in the success state.
11787         /// Reading from this pointer when `result_ok` is not set is undefined.
11788         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
11789         /// A pointer to the contents in the error state.
11790         /// Reading from this pointer when `result_ok` is set is undefined.
11791         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11792 }
11793 #[repr(C)]
11794 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11795 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11797 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11798         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
11799         /// `err` or `result` depending on the state of `result_ok`.
11800         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
11801         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
11802         pub result_ok: bool,
11803 }
11804 #[no_mangle]
11805 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
11806 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11807         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11808                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11809                         result: Box::into_raw(Box::new(o)),
11810                 },
11811                 result_ok: true,
11812         }
11813 }
11814 #[no_mangle]
11815 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
11816 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11817         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11818                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11819                         err: Box::into_raw(Box::new(e)),
11820                 },
11821                 result_ok: false,
11822         }
11823 }
11824 /// Checks if the given object is currently in the success state
11825 #[no_mangle]
11826 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
11827         o.result_ok
11828 }
11829 #[no_mangle]
11830 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
11831 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
11832 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11833         fn drop(&mut self) {
11834                 if self.result_ok {
11835                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11836                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11837                         }
11838                 } else {
11839                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11840                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11841                         }
11842                 }
11843         }
11844 }
11845 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11846         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11847                 let contents = if o.result_ok {
11848                         let result = unsafe { o.contents.result };
11849                         unsafe { o.contents.result = core::ptr::null_mut() };
11850                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
11851                 } else {
11852                         let err = unsafe { o.contents.err };
11853                         unsafe { o.contents.err = core::ptr::null_mut(); }
11854                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
11855                 };
11856                 Self {
11857                         contents,
11858                         result_ok: o.result_ok,
11859                 }
11860         }
11861 }
11862 #[repr(C)]
11863 #[derive(Clone)]
11864 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11865 pub enum COption_NetAddressZ {
11866         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11867         Some(crate::lightning::ln::msgs::NetAddress),
11868         /// When we're in this state, this COption_NetAddressZ contains nothing
11869         None
11870 }
11871 impl COption_NetAddressZ {
11872         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11873                 if let Self::None = self { false } else { true }
11874         }
11875         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11876                 !self.is_some()
11877         }
11878         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11879                 if let Self::Some(v) = self { v } else { unreachable!() }
11880         }
11881 }
11882 #[no_mangle]
11883 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11884 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11885         COption_NetAddressZ::Some(o)
11886 }
11887 #[no_mangle]
11888 /// Constructs a new COption_NetAddressZ containing nothing
11889 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11890         COption_NetAddressZ::None
11891 }
11892 #[no_mangle]
11893 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11894 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11895 #[no_mangle]
11896 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11897 /// but with all dynamically-allocated buffers duplicated in new buffers.
11898 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11899 #[repr(C)]
11900 /// A tuple of 2 elements. See the individual fields for the types contained.
11901 pub struct C2Tuple_PublicKeyCOption_NetAddressZZ {
11902         /// The element at position 0
11903         pub a: crate::c_types::PublicKey,
11904         /// The element at position 1
11905         pub b: crate::c_types::derived::COption_NetAddressZ,
11906 }
11907 impl From<(crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)> for C2Tuple_PublicKeyCOption_NetAddressZZ {
11908         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ)) -> Self {
11909                 Self {
11910                         a: tup.0,
11911                         b: tup.1,
11912                 }
11913         }
11914 }
11915 impl C2Tuple_PublicKeyCOption_NetAddressZZ {
11916         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::COption_NetAddressZ) {
11917                 (self.a, self.b)
11918         }
11919 }
11920 impl Clone for C2Tuple_PublicKeyCOption_NetAddressZZ {
11921         fn clone(&self) -> Self {
11922                 Self {
11923                         a: Clone::clone(&self.a),
11924                         b: Clone::clone(&self.b),
11925                 }
11926         }
11927 }
11928 #[no_mangle]
11929 /// Creates a new tuple which has the same data as `orig`
11930 /// but with all dynamically-allocated buffers duplicated in new buffers.
11931 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig: &C2Tuple_PublicKeyCOption_NetAddressZZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ { Clone::clone(&orig) }
11932 /// Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements.
11933 #[no_mangle]
11934 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::COption_NetAddressZ) -> C2Tuple_PublicKeyCOption_NetAddressZZ {
11935         C2Tuple_PublicKeyCOption_NetAddressZZ { a, b, }
11936 }
11937
11938 #[no_mangle]
11939 /// Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ.
11940 pub extern "C" fn C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res: C2Tuple_PublicKeyCOption_NetAddressZZ) { }
11941 #[repr(C)]
11942 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size.
11943 /// This corresponds to std::vector in C++
11944 pub struct CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11945         /// The elements in the array.
11946         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11947         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ,
11948         /// The number of elements pointed to by `data`.
11949         pub datalen: usize
11950 }
11951 impl CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11952         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ> {
11953                 if self.datalen == 0 { return Vec::new(); }
11954                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11955                 self.data = core::ptr::null_mut();
11956                 self.datalen = 0;
11957                 ret
11958         }
11959         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ] {
11960                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11961         }
11962 }
11963 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>> for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11964         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZ>) -> Self {
11965                 let datalen = v.len();
11966                 let data = Box::into_raw(v.into_boxed_slice());
11967                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11968         }
11969 }
11970 #[no_mangle]
11971 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11972 pub extern "C" fn CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ) { }
11973 impl Drop for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11974         fn drop(&mut self) {
11975                 if self.datalen == 0 { return; }
11976                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11977         }
11978 }
11979 impl Clone for CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ {
11980         fn clone(&self) -> Self {
11981                 let mut res = Vec::new();
11982                 if self.datalen == 0 { return Self::from(res); }
11983                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11984                 Self::from(res)
11985         }
11986 }
11987 #[repr(C)]
11988 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11989 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11990         /// A pointer to the contents in the success state.
11991         /// Reading from this pointer when `result_ok` is not set is undefined.
11992         pub result: *mut crate::c_types::derived::CVec_u8Z,
11993         /// A pointer to the contents in the error state.
11994         /// Reading from this pointer when `result_ok` is set is undefined.
11995         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11996 }
11997 #[repr(C)]
11998 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11999 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12001 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
12002         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
12003         /// `err` or `result` depending on the state of `result_ok`.
12004         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
12005         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
12006         pub result_ok: bool,
12007 }
12008 #[no_mangle]
12009 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
12010 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
12011         CResult_CVec_u8ZPeerHandleErrorZ {
12012                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12013                         result: Box::into_raw(Box::new(o)),
12014                 },
12015                 result_ok: true,
12016         }
12017 }
12018 #[no_mangle]
12019 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
12020 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
12021         CResult_CVec_u8ZPeerHandleErrorZ {
12022                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12023                         err: Box::into_raw(Box::new(e)),
12024                 },
12025                 result_ok: false,
12026         }
12027 }
12028 /// Checks if the given object is currently in the success state
12029 #[no_mangle]
12030 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
12031         o.result_ok
12032 }
12033 #[no_mangle]
12034 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
12035 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
12036 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
12037         fn drop(&mut self) {
12038                 if self.result_ok {
12039                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12040                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12041                         }
12042                 } else {
12043                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12044                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12045                         }
12046                 }
12047         }
12048 }
12049 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
12050         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12051                 let contents = if o.result_ok {
12052                         let result = unsafe { o.contents.result };
12053                         unsafe { o.contents.result = core::ptr::null_mut() };
12054                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
12055                 } else {
12056                         let err = unsafe { o.contents.err };
12057                         unsafe { o.contents.err = core::ptr::null_mut(); }
12058                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
12059                 };
12060                 Self {
12061                         contents,
12062                         result_ok: o.result_ok,
12063                 }
12064         }
12065 }
12066 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
12067         fn clone(&self) -> Self {
12068                 if self.result_ok {
12069                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12070                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
12071                         } }
12072                 } else {
12073                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12074                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12075                         } }
12076                 }
12077         }
12078 }
12079 #[no_mangle]
12080 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12081 /// but with all dynamically-allocated buffers duplicated in new buffers.
12082 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12083 #[repr(C)]
12084 /// The contents of CResult_NonePeerHandleErrorZ
12085 pub union CResult_NonePeerHandleErrorZPtr {
12086         /// Note that this value is always NULL, as there are no contents in the OK variant
12087         pub result: *mut core::ffi::c_void,
12088         /// A pointer to the contents in the error state.
12089         /// Reading from this pointer when `result_ok` is set is undefined.
12090         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12091 }
12092 #[repr(C)]
12093 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12094 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12096 pub struct CResult_NonePeerHandleErrorZ {
12097         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12098         /// `err` or `result` depending on the state of `result_ok`.
12099         pub contents: CResult_NonePeerHandleErrorZPtr,
12100         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12101         pub result_ok: bool,
12102 }
12103 #[no_mangle]
12104 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12105 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12106         CResult_NonePeerHandleErrorZ {
12107                 contents: CResult_NonePeerHandleErrorZPtr {
12108                         result: core::ptr::null_mut(),
12109                 },
12110                 result_ok: true,
12111         }
12112 }
12113 #[no_mangle]
12114 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12115 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12116         CResult_NonePeerHandleErrorZ {
12117                 contents: CResult_NonePeerHandleErrorZPtr {
12118                         err: Box::into_raw(Box::new(e)),
12119                 },
12120                 result_ok: false,
12121         }
12122 }
12123 /// Checks if the given object is currently in the success state
12124 #[no_mangle]
12125 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12126         o.result_ok
12127 }
12128 #[no_mangle]
12129 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12130 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12131 impl Drop for CResult_NonePeerHandleErrorZ {
12132         fn drop(&mut self) {
12133                 if self.result_ok {
12134                 } else {
12135                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12136                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12137                         }
12138                 }
12139         }
12140 }
12141 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12142         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12143                 let contents = if o.result_ok {
12144                         let _ = unsafe { Box::from_raw(o.contents.result) };
12145                         o.contents.result = core::ptr::null_mut();
12146                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12147                 } else {
12148                         let err = unsafe { o.contents.err };
12149                         unsafe { o.contents.err = core::ptr::null_mut(); }
12150                         CResult_NonePeerHandleErrorZPtr { err }
12151                 };
12152                 Self {
12153                         contents,
12154                         result_ok: o.result_ok,
12155                 }
12156         }
12157 }
12158 impl Clone for CResult_NonePeerHandleErrorZ {
12159         fn clone(&self) -> Self {
12160                 if self.result_ok {
12161                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12162                                 result: core::ptr::null_mut()
12163                         } }
12164                 } else {
12165                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12166                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12167                         } }
12168                 }
12169         }
12170 }
12171 #[no_mangle]
12172 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12173 /// but with all dynamically-allocated buffers duplicated in new buffers.
12174 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12175 #[repr(C)]
12176 /// The contents of CResult_boolPeerHandleErrorZ
12177 pub union CResult_boolPeerHandleErrorZPtr {
12178         /// A pointer to the contents in the success state.
12179         /// Reading from this pointer when `result_ok` is not set is undefined.
12180         pub result: *mut bool,
12181         /// A pointer to the contents in the error state.
12182         /// Reading from this pointer when `result_ok` is set is undefined.
12183         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12184 }
12185 #[repr(C)]
12186 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12187 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12189 pub struct CResult_boolPeerHandleErrorZ {
12190         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12191         /// `err` or `result` depending on the state of `result_ok`.
12192         pub contents: CResult_boolPeerHandleErrorZPtr,
12193         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12194         pub result_ok: bool,
12195 }
12196 #[no_mangle]
12197 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12198 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12199         CResult_boolPeerHandleErrorZ {
12200                 contents: CResult_boolPeerHandleErrorZPtr {
12201                         result: Box::into_raw(Box::new(o)),
12202                 },
12203                 result_ok: true,
12204         }
12205 }
12206 #[no_mangle]
12207 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12208 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12209         CResult_boolPeerHandleErrorZ {
12210                 contents: CResult_boolPeerHandleErrorZPtr {
12211                         err: Box::into_raw(Box::new(e)),
12212                 },
12213                 result_ok: false,
12214         }
12215 }
12216 /// Checks if the given object is currently in the success state
12217 #[no_mangle]
12218 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12219         o.result_ok
12220 }
12221 #[no_mangle]
12222 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12223 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12224 impl Drop for CResult_boolPeerHandleErrorZ {
12225         fn drop(&mut self) {
12226                 if self.result_ok {
12227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12229                         }
12230                 } else {
12231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12233                         }
12234                 }
12235         }
12236 }
12237 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12238         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12239                 let contents = if o.result_ok {
12240                         let result = unsafe { o.contents.result };
12241                         unsafe { o.contents.result = core::ptr::null_mut() };
12242                         CResult_boolPeerHandleErrorZPtr { result }
12243                 } else {
12244                         let err = unsafe { o.contents.err };
12245                         unsafe { o.contents.err = core::ptr::null_mut(); }
12246                         CResult_boolPeerHandleErrorZPtr { err }
12247                 };
12248                 Self {
12249                         contents,
12250                         result_ok: o.result_ok,
12251                 }
12252         }
12253 }
12254 impl Clone for CResult_boolPeerHandleErrorZ {
12255         fn clone(&self) -> Self {
12256                 if self.result_ok {
12257                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12258                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12259                         } }
12260                 } else {
12261                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12262                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12263                         } }
12264                 }
12265         }
12266 }
12267 #[no_mangle]
12268 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12269 /// but with all dynamically-allocated buffers duplicated in new buffers.
12270 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12271 #[repr(C)]
12272 /// The contents of CResult_TxOutUtxoLookupErrorZ
12273 pub union CResult_TxOutUtxoLookupErrorZPtr {
12274         /// A pointer to the contents in the success state.
12275         /// Reading from this pointer when `result_ok` is not set is undefined.
12276         pub result: *mut crate::c_types::TxOut,
12277         /// A pointer to the contents in the error state.
12278         /// Reading from this pointer when `result_ok` is set is undefined.
12279         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
12280 }
12281 #[repr(C)]
12282 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
12283 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
12284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12285 pub struct CResult_TxOutUtxoLookupErrorZ {
12286         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
12287         /// `err` or `result` depending on the state of `result_ok`.
12288         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
12289         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
12290         pub result_ok: bool,
12291 }
12292 #[no_mangle]
12293 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
12294 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
12295         CResult_TxOutUtxoLookupErrorZ {
12296                 contents: CResult_TxOutUtxoLookupErrorZPtr {
12297                         result: Box::into_raw(Box::new(o)),
12298                 },
12299                 result_ok: true,
12300         }
12301 }
12302 #[no_mangle]
12303 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
12304 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
12305         CResult_TxOutUtxoLookupErrorZ {
12306                 contents: CResult_TxOutUtxoLookupErrorZPtr {
12307                         err: Box::into_raw(Box::new(e)),
12308                 },
12309                 result_ok: false,
12310         }
12311 }
12312 /// Checks if the given object is currently in the success state
12313 #[no_mangle]
12314 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
12315         o.result_ok
12316 }
12317 #[no_mangle]
12318 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
12319 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
12320 impl Drop for CResult_TxOutUtxoLookupErrorZ {
12321         fn drop(&mut self) {
12322                 if self.result_ok {
12323                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12324                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12325                         }
12326                 } else {
12327                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12328                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12329                         }
12330                 }
12331         }
12332 }
12333 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
12334         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
12335                 let contents = if o.result_ok {
12336                         let result = unsafe { o.contents.result };
12337                         unsafe { o.contents.result = core::ptr::null_mut() };
12338                         CResult_TxOutUtxoLookupErrorZPtr { result }
12339                 } else {
12340                         let err = unsafe { o.contents.err };
12341                         unsafe { o.contents.err = core::ptr::null_mut(); }
12342                         CResult_TxOutUtxoLookupErrorZPtr { err }
12343                 };
12344                 Self {
12345                         contents,
12346                         result_ok: o.result_ok,
12347                 }
12348         }
12349 }
12350 impl Clone for CResult_TxOutUtxoLookupErrorZ {
12351         fn clone(&self) -> Self {
12352                 if self.result_ok {
12353                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
12354                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
12355                         } }
12356                 } else {
12357                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
12358                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
12359                         } }
12360                 }
12361         }
12362 }
12363 #[no_mangle]
12364 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
12365 /// but with all dynamically-allocated buffers duplicated in new buffers.
12366 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
12367 #[repr(C)]
12368 /// The contents of CResult_NoneSendErrorZ
12369 pub union CResult_NoneSendErrorZPtr {
12370         /// Note that this value is always NULL, as there are no contents in the OK variant
12371         pub result: *mut core::ffi::c_void,
12372         /// A pointer to the contents in the error state.
12373         /// Reading from this pointer when `result_ok` is set is undefined.
12374         pub err: *mut crate::lightning::onion_message::messenger::SendError,
12375 }
12376 #[repr(C)]
12377 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
12378 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12380 pub struct CResult_NoneSendErrorZ {
12381         /// The contents of this CResult_NoneSendErrorZ, accessible via either
12382         /// `err` or `result` depending on the state of `result_ok`.
12383         pub contents: CResult_NoneSendErrorZPtr,
12384         /// Whether this CResult_NoneSendErrorZ represents a success state.
12385         pub result_ok: bool,
12386 }
12387 #[no_mangle]
12388 /// Creates a new CResult_NoneSendErrorZ in the success state.
12389 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12390         CResult_NoneSendErrorZ {
12391                 contents: CResult_NoneSendErrorZPtr {
12392                         result: core::ptr::null_mut(),
12393                 },
12394                 result_ok: true,
12395         }
12396 }
12397 #[no_mangle]
12398 /// Creates a new CResult_NoneSendErrorZ in the error state.
12399 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12400         CResult_NoneSendErrorZ {
12401                 contents: CResult_NoneSendErrorZPtr {
12402                         err: Box::into_raw(Box::new(e)),
12403                 },
12404                 result_ok: false,
12405         }
12406 }
12407 /// Checks if the given object is currently in the success state
12408 #[no_mangle]
12409 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12410         o.result_ok
12411 }
12412 #[no_mangle]
12413 /// Frees any resources used by the CResult_NoneSendErrorZ.
12414 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12415 impl Drop for CResult_NoneSendErrorZ {
12416         fn drop(&mut self) {
12417                 if self.result_ok {
12418                 } else {
12419                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12420                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12421                         }
12422                 }
12423         }
12424 }
12425 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12426         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12427                 let contents = if o.result_ok {
12428                         let _ = unsafe { Box::from_raw(o.contents.result) };
12429                         o.contents.result = core::ptr::null_mut();
12430                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12431                 } else {
12432                         let err = unsafe { o.contents.err };
12433                         unsafe { o.contents.err = core::ptr::null_mut(); }
12434                         CResult_NoneSendErrorZPtr { err }
12435                 };
12436                 Self {
12437                         contents,
12438                         result_ok: o.result_ok,
12439                 }
12440         }
12441 }
12442 #[repr(C)]
12443 /// The contents of CResult_SiPrefixParseErrorZ
12444 pub union CResult_SiPrefixParseErrorZPtr {
12445         /// A pointer to the contents in the success state.
12446         /// Reading from this pointer when `result_ok` is not set is undefined.
12447         pub result: *mut crate::lightning_invoice::SiPrefix,
12448         /// A pointer to the contents in the error state.
12449         /// Reading from this pointer when `result_ok` is set is undefined.
12450         pub err: *mut crate::lightning_invoice::ParseError,
12451 }
12452 #[repr(C)]
12453 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
12454 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
12455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12456 pub struct CResult_SiPrefixParseErrorZ {
12457         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
12458         /// `err` or `result` depending on the state of `result_ok`.
12459         pub contents: CResult_SiPrefixParseErrorZPtr,
12460         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
12461         pub result_ok: bool,
12462 }
12463 #[no_mangle]
12464 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
12465 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
12466         CResult_SiPrefixParseErrorZ {
12467                 contents: CResult_SiPrefixParseErrorZPtr {
12468                         result: Box::into_raw(Box::new(o)),
12469                 },
12470                 result_ok: true,
12471         }
12472 }
12473 #[no_mangle]
12474 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
12475 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
12476         CResult_SiPrefixParseErrorZ {
12477                 contents: CResult_SiPrefixParseErrorZPtr {
12478                         err: Box::into_raw(Box::new(e)),
12479                 },
12480                 result_ok: false,
12481         }
12482 }
12483 /// Checks if the given object is currently in the success state
12484 #[no_mangle]
12485 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
12486         o.result_ok
12487 }
12488 #[no_mangle]
12489 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
12490 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
12491 impl Drop for CResult_SiPrefixParseErrorZ {
12492         fn drop(&mut self) {
12493                 if self.result_ok {
12494                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12495                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12496                         }
12497                 } else {
12498                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12499                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12500                         }
12501                 }
12502         }
12503 }
12504 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
12505         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
12506                 let contents = if o.result_ok {
12507                         let result = unsafe { o.contents.result };
12508                         unsafe { o.contents.result = core::ptr::null_mut() };
12509                         CResult_SiPrefixParseErrorZPtr { result }
12510                 } else {
12511                         let err = unsafe { o.contents.err };
12512                         unsafe { o.contents.err = core::ptr::null_mut(); }
12513                         CResult_SiPrefixParseErrorZPtr { err }
12514                 };
12515                 Self {
12516                         contents,
12517                         result_ok: o.result_ok,
12518                 }
12519         }
12520 }
12521 impl Clone for CResult_SiPrefixParseErrorZ {
12522         fn clone(&self) -> Self {
12523                 if self.result_ok {
12524                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
12525                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
12526                         } }
12527                 } else {
12528                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
12529                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12530                         } }
12531                 }
12532         }
12533 }
12534 #[no_mangle]
12535 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
12536 /// but with all dynamically-allocated buffers duplicated in new buffers.
12537 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
12538 #[repr(C)]
12539 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
12540 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
12541         /// A pointer to the contents in the success state.
12542         /// Reading from this pointer when `result_ok` is not set is undefined.
12543         pub result: *mut crate::lightning_invoice::Invoice,
12544         /// A pointer to the contents in the error state.
12545         /// Reading from this pointer when `result_ok` is set is undefined.
12546         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
12547 }
12548 #[repr(C)]
12549 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
12550 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
12551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12552 pub struct CResult_InvoiceParseOrSemanticErrorZ {
12553         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
12554         /// `err` or `result` depending on the state of `result_ok`.
12555         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
12556         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
12557         pub result_ok: bool,
12558 }
12559 #[no_mangle]
12560 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
12561 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
12562         CResult_InvoiceParseOrSemanticErrorZ {
12563                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12564                         result: Box::into_raw(Box::new(o)),
12565                 },
12566                 result_ok: true,
12567         }
12568 }
12569 #[no_mangle]
12570 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
12571 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
12572         CResult_InvoiceParseOrSemanticErrorZ {
12573                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12574                         err: Box::into_raw(Box::new(e)),
12575                 },
12576                 result_ok: false,
12577         }
12578 }
12579 /// Checks if the given object is currently in the success state
12580 #[no_mangle]
12581 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
12582         o.result_ok
12583 }
12584 #[no_mangle]
12585 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
12586 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
12587 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
12588         fn drop(&mut self) {
12589                 if self.result_ok {
12590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12592                         }
12593                 } else {
12594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12596                         }
12597                 }
12598         }
12599 }
12600 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
12601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
12602                 let contents = if o.result_ok {
12603                         let result = unsafe { o.contents.result };
12604                         unsafe { o.contents.result = core::ptr::null_mut() };
12605                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
12606                 } else {
12607                         let err = unsafe { o.contents.err };
12608                         unsafe { o.contents.err = core::ptr::null_mut(); }
12609                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
12610                 };
12611                 Self {
12612                         contents,
12613                         result_ok: o.result_ok,
12614                 }
12615         }
12616 }
12617 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
12618         fn clone(&self) -> Self {
12619                 if self.result_ok {
12620                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12621                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12622                         } }
12623                 } else {
12624                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12625                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
12626                         } }
12627                 }
12628         }
12629 }
12630 #[no_mangle]
12631 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
12632 /// but with all dynamically-allocated buffers duplicated in new buffers.
12633 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
12634 #[repr(C)]
12635 /// The contents of CResult_SignedRawInvoiceParseErrorZ
12636 pub union CResult_SignedRawInvoiceParseErrorZPtr {
12637         /// A pointer to the contents in the success state.
12638         /// Reading from this pointer when `result_ok` is not set is undefined.
12639         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
12640         /// A pointer to the contents in the error state.
12641         /// Reading from this pointer when `result_ok` is set is undefined.
12642         pub err: *mut crate::lightning_invoice::ParseError,
12643 }
12644 #[repr(C)]
12645 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
12646 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
12647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12648 pub struct CResult_SignedRawInvoiceParseErrorZ {
12649         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
12650         /// `err` or `result` depending on the state of `result_ok`.
12651         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
12652         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
12653         pub result_ok: bool,
12654 }
12655 #[no_mangle]
12656 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
12657 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
12658         CResult_SignedRawInvoiceParseErrorZ {
12659                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12660                         result: Box::into_raw(Box::new(o)),
12661                 },
12662                 result_ok: true,
12663         }
12664 }
12665 #[no_mangle]
12666 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
12667 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
12668         CResult_SignedRawInvoiceParseErrorZ {
12669                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12670                         err: Box::into_raw(Box::new(e)),
12671                 },
12672                 result_ok: false,
12673         }
12674 }
12675 /// Checks if the given object is currently in the success state
12676 #[no_mangle]
12677 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
12678         o.result_ok
12679 }
12680 #[no_mangle]
12681 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
12682 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
12683 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
12684         fn drop(&mut self) {
12685                 if self.result_ok {
12686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12688                         }
12689                 } else {
12690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12692                         }
12693                 }
12694         }
12695 }
12696 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
12697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
12698                 let contents = if o.result_ok {
12699                         let result = unsafe { o.contents.result };
12700                         unsafe { o.contents.result = core::ptr::null_mut() };
12701                         CResult_SignedRawInvoiceParseErrorZPtr { result }
12702                 } else {
12703                         let err = unsafe { o.contents.err };
12704                         unsafe { o.contents.err = core::ptr::null_mut(); }
12705                         CResult_SignedRawInvoiceParseErrorZPtr { err }
12706                 };
12707                 Self {
12708                         contents,
12709                         result_ok: o.result_ok,
12710                 }
12711         }
12712 }
12713 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
12714         fn clone(&self) -> Self {
12715                 if self.result_ok {
12716                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12717                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
12718                         } }
12719                 } else {
12720                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12721                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12722                         } }
12723                 }
12724         }
12725 }
12726 #[no_mangle]
12727 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
12728 /// but with all dynamically-allocated buffers duplicated in new buffers.
12729 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
12730 #[repr(C)]
12731 /// A tuple of 3 elements. See the individual fields for the types contained.
12732 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12733         /// The element at position 0
12734         pub a: crate::lightning_invoice::RawInvoice,
12735         /// The element at position 1
12736         pub b: crate::c_types::ThirtyTwoBytes,
12737         /// The element at position 2
12738         pub c: crate::lightning_invoice::InvoiceSignature,
12739 }
12740 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12741         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
12742                 Self {
12743                         a: tup.0,
12744                         b: tup.1,
12745                         c: tup.2,
12746                 }
12747         }
12748 }
12749 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12750         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
12751                 (self.a, self.b, self.c)
12752         }
12753 }
12754 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12755         fn clone(&self) -> Self {
12756                 Self {
12757                         a: Clone::clone(&self.a),
12758                         b: Clone::clone(&self.b),
12759                         c: Clone::clone(&self.c),
12760                 }
12761         }
12762 }
12763 #[no_mangle]
12764 /// Creates a new tuple which has the same data as `orig`
12765 /// but with all dynamically-allocated buffers duplicated in new buffers.
12766 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
12767 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
12768 #[no_mangle]
12769 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 {
12770         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
12771 }
12772
12773 #[no_mangle]
12774 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
12775 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
12776 #[repr(C)]
12777 /// The contents of CResult_PayeePubKeyErrorZ
12778 pub union CResult_PayeePubKeyErrorZPtr {
12779         /// A pointer to the contents in the success state.
12780         /// Reading from this pointer when `result_ok` is not set is undefined.
12781         pub result: *mut crate::lightning_invoice::PayeePubKey,
12782         /// A pointer to the contents in the error state.
12783         /// Reading from this pointer when `result_ok` is set is undefined.
12784         pub err: *mut crate::c_types::Secp256k1Error,
12785 }
12786 #[repr(C)]
12787 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
12788 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
12789 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12790 pub struct CResult_PayeePubKeyErrorZ {
12791         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
12792         /// `err` or `result` depending on the state of `result_ok`.
12793         pub contents: CResult_PayeePubKeyErrorZPtr,
12794         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
12795         pub result_ok: bool,
12796 }
12797 #[no_mangle]
12798 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
12799 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
12800         CResult_PayeePubKeyErrorZ {
12801                 contents: CResult_PayeePubKeyErrorZPtr {
12802                         result: Box::into_raw(Box::new(o)),
12803                 },
12804                 result_ok: true,
12805         }
12806 }
12807 #[no_mangle]
12808 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
12809 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
12810         CResult_PayeePubKeyErrorZ {
12811                 contents: CResult_PayeePubKeyErrorZPtr {
12812                         err: Box::into_raw(Box::new(e)),
12813                 },
12814                 result_ok: false,
12815         }
12816 }
12817 /// Checks if the given object is currently in the success state
12818 #[no_mangle]
12819 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
12820         o.result_ok
12821 }
12822 #[no_mangle]
12823 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
12824 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
12825 impl Drop for CResult_PayeePubKeyErrorZ {
12826         fn drop(&mut self) {
12827                 if self.result_ok {
12828                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12829                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12830                         }
12831                 } else {
12832                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12833                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12834                         }
12835                 }
12836         }
12837 }
12838 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
12839         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
12840                 let contents = if o.result_ok {
12841                         let result = unsafe { o.contents.result };
12842                         unsafe { o.contents.result = core::ptr::null_mut() };
12843                         CResult_PayeePubKeyErrorZPtr { result }
12844                 } else {
12845                         let err = unsafe { o.contents.err };
12846                         unsafe { o.contents.err = core::ptr::null_mut(); }
12847                         CResult_PayeePubKeyErrorZPtr { err }
12848                 };
12849                 Self {
12850                         contents,
12851                         result_ok: o.result_ok,
12852                 }
12853         }
12854 }
12855 impl Clone for CResult_PayeePubKeyErrorZ {
12856         fn clone(&self) -> Self {
12857                 if self.result_ok {
12858                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
12859                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
12860                         } }
12861                 } else {
12862                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
12863                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
12864                         } }
12865                 }
12866         }
12867 }
12868 #[no_mangle]
12869 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
12870 /// but with all dynamically-allocated buffers duplicated in new buffers.
12871 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
12872 #[repr(C)]
12873 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
12874 /// This corresponds to std::vector in C++
12875 pub struct CVec_PrivateRouteZ {
12876         /// The elements in the array.
12877         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12878         pub data: *mut crate::lightning_invoice::PrivateRoute,
12879         /// The number of elements pointed to by `data`.
12880         pub datalen: usize
12881 }
12882 impl CVec_PrivateRouteZ {
12883         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
12884                 if self.datalen == 0 { return Vec::new(); }
12885                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12886                 self.data = core::ptr::null_mut();
12887                 self.datalen = 0;
12888                 ret
12889         }
12890         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
12891                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12892         }
12893 }
12894 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
12895         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
12896                 let datalen = v.len();
12897                 let data = Box::into_raw(v.into_boxed_slice());
12898                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12899         }
12900 }
12901 #[no_mangle]
12902 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12903 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
12904 impl Drop for CVec_PrivateRouteZ {
12905         fn drop(&mut self) {
12906                 if self.datalen == 0 { return; }
12907                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12908         }
12909 }
12910 impl Clone for CVec_PrivateRouteZ {
12911         fn clone(&self) -> Self {
12912                 let mut res = Vec::new();
12913                 if self.datalen == 0 { return Self::from(res); }
12914                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12915                 Self::from(res)
12916         }
12917 }
12918 #[repr(C)]
12919 /// The contents of CResult_PositiveTimestampCreationErrorZ
12920 pub union CResult_PositiveTimestampCreationErrorZPtr {
12921         /// A pointer to the contents in the success state.
12922         /// Reading from this pointer when `result_ok` is not set is undefined.
12923         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
12924         /// A pointer to the contents in the error state.
12925         /// Reading from this pointer when `result_ok` is set is undefined.
12926         pub err: *mut crate::lightning_invoice::CreationError,
12927 }
12928 #[repr(C)]
12929 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
12930 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
12931 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12932 pub struct CResult_PositiveTimestampCreationErrorZ {
12933         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
12934         /// `err` or `result` depending on the state of `result_ok`.
12935         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
12936         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
12937         pub result_ok: bool,
12938 }
12939 #[no_mangle]
12940 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
12941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
12942         CResult_PositiveTimestampCreationErrorZ {
12943                 contents: CResult_PositiveTimestampCreationErrorZPtr {
12944                         result: Box::into_raw(Box::new(o)),
12945                 },
12946                 result_ok: true,
12947         }
12948 }
12949 #[no_mangle]
12950 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
12951 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
12952         CResult_PositiveTimestampCreationErrorZ {
12953                 contents: CResult_PositiveTimestampCreationErrorZPtr {
12954                         err: Box::into_raw(Box::new(e)),
12955                 },
12956                 result_ok: false,
12957         }
12958 }
12959 /// Checks if the given object is currently in the success state
12960 #[no_mangle]
12961 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
12962         o.result_ok
12963 }
12964 #[no_mangle]
12965 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
12966 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
12967 impl Drop for CResult_PositiveTimestampCreationErrorZ {
12968         fn drop(&mut self) {
12969                 if self.result_ok {
12970                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12971                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12972                         }
12973                 } else {
12974                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12975                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12976                         }
12977                 }
12978         }
12979 }
12980 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
12981         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
12982                 let contents = if o.result_ok {
12983                         let result = unsafe { o.contents.result };
12984                         unsafe { o.contents.result = core::ptr::null_mut() };
12985                         CResult_PositiveTimestampCreationErrorZPtr { result }
12986                 } else {
12987                         let err = unsafe { o.contents.err };
12988                         unsafe { o.contents.err = core::ptr::null_mut(); }
12989                         CResult_PositiveTimestampCreationErrorZPtr { err }
12990                 };
12991                 Self {
12992                         contents,
12993                         result_ok: o.result_ok,
12994                 }
12995         }
12996 }
12997 impl Clone for CResult_PositiveTimestampCreationErrorZ {
12998         fn clone(&self) -> Self {
12999                 if self.result_ok {
13000                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
13001                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
13002                         } }
13003                 } else {
13004                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
13005                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13006                         } }
13007                 }
13008         }
13009 }
13010 #[no_mangle]
13011 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
13012 /// but with all dynamically-allocated buffers duplicated in new buffers.
13013 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
13014 #[repr(C)]
13015 /// The contents of CResult_NoneSemanticErrorZ
13016 pub union CResult_NoneSemanticErrorZPtr {
13017         /// Note that this value is always NULL, as there are no contents in the OK variant
13018         pub result: *mut core::ffi::c_void,
13019         /// A pointer to the contents in the error state.
13020         /// Reading from this pointer when `result_ok` is set is undefined.
13021         pub err: *mut crate::lightning_invoice::SemanticError,
13022 }
13023 #[repr(C)]
13024 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
13025 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
13026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13027 pub struct CResult_NoneSemanticErrorZ {
13028         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
13029         /// `err` or `result` depending on the state of `result_ok`.
13030         pub contents: CResult_NoneSemanticErrorZPtr,
13031         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
13032         pub result_ok: bool,
13033 }
13034 #[no_mangle]
13035 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
13036 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
13037         CResult_NoneSemanticErrorZ {
13038                 contents: CResult_NoneSemanticErrorZPtr {
13039                         result: core::ptr::null_mut(),
13040                 },
13041                 result_ok: true,
13042         }
13043 }
13044 #[no_mangle]
13045 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
13046 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
13047         CResult_NoneSemanticErrorZ {
13048                 contents: CResult_NoneSemanticErrorZPtr {
13049                         err: Box::into_raw(Box::new(e)),
13050                 },
13051                 result_ok: false,
13052         }
13053 }
13054 /// Checks if the given object is currently in the success state
13055 #[no_mangle]
13056 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
13057         o.result_ok
13058 }
13059 #[no_mangle]
13060 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
13061 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
13062 impl Drop for CResult_NoneSemanticErrorZ {
13063         fn drop(&mut self) {
13064                 if self.result_ok {
13065                 } else {
13066                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13067                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13068                         }
13069                 }
13070         }
13071 }
13072 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
13073         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
13074                 let contents = if o.result_ok {
13075                         let _ = unsafe { Box::from_raw(o.contents.result) };
13076                         o.contents.result = core::ptr::null_mut();
13077                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
13078                 } else {
13079                         let err = unsafe { o.contents.err };
13080                         unsafe { o.contents.err = core::ptr::null_mut(); }
13081                         CResult_NoneSemanticErrorZPtr { err }
13082                 };
13083                 Self {
13084                         contents,
13085                         result_ok: o.result_ok,
13086                 }
13087         }
13088 }
13089 impl Clone for CResult_NoneSemanticErrorZ {
13090         fn clone(&self) -> Self {
13091                 if self.result_ok {
13092                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
13093                                 result: core::ptr::null_mut()
13094                         } }
13095                 } else {
13096                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
13097                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13098                         } }
13099                 }
13100         }
13101 }
13102 #[no_mangle]
13103 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
13104 /// but with all dynamically-allocated buffers duplicated in new buffers.
13105 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
13106 #[repr(C)]
13107 /// The contents of CResult_InvoiceSemanticErrorZ
13108 pub union CResult_InvoiceSemanticErrorZPtr {
13109         /// A pointer to the contents in the success state.
13110         /// Reading from this pointer when `result_ok` is not set is undefined.
13111         pub result: *mut crate::lightning_invoice::Invoice,
13112         /// A pointer to the contents in the error state.
13113         /// Reading from this pointer when `result_ok` is set is undefined.
13114         pub err: *mut crate::lightning_invoice::SemanticError,
13115 }
13116 #[repr(C)]
13117 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
13118 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
13119 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13120 pub struct CResult_InvoiceSemanticErrorZ {
13121         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
13122         /// `err` or `result` depending on the state of `result_ok`.
13123         pub contents: CResult_InvoiceSemanticErrorZPtr,
13124         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
13125         pub result_ok: bool,
13126 }
13127 #[no_mangle]
13128 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
13129 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
13130         CResult_InvoiceSemanticErrorZ {
13131                 contents: CResult_InvoiceSemanticErrorZPtr {
13132                         result: Box::into_raw(Box::new(o)),
13133                 },
13134                 result_ok: true,
13135         }
13136 }
13137 #[no_mangle]
13138 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
13139 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
13140         CResult_InvoiceSemanticErrorZ {
13141                 contents: CResult_InvoiceSemanticErrorZPtr {
13142                         err: Box::into_raw(Box::new(e)),
13143                 },
13144                 result_ok: false,
13145         }
13146 }
13147 /// Checks if the given object is currently in the success state
13148 #[no_mangle]
13149 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
13150         o.result_ok
13151 }
13152 #[no_mangle]
13153 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
13154 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
13155 impl Drop for CResult_InvoiceSemanticErrorZ {
13156         fn drop(&mut self) {
13157                 if self.result_ok {
13158                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13159                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13160                         }
13161                 } else {
13162                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13163                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13164                         }
13165                 }
13166         }
13167 }
13168 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
13169         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
13170                 let contents = if o.result_ok {
13171                         let result = unsafe { o.contents.result };
13172                         unsafe { o.contents.result = core::ptr::null_mut() };
13173                         CResult_InvoiceSemanticErrorZPtr { result }
13174                 } else {
13175                         let err = unsafe { o.contents.err };
13176                         unsafe { o.contents.err = core::ptr::null_mut(); }
13177                         CResult_InvoiceSemanticErrorZPtr { err }
13178                 };
13179                 Self {
13180                         contents,
13181                         result_ok: o.result_ok,
13182                 }
13183         }
13184 }
13185 impl Clone for CResult_InvoiceSemanticErrorZ {
13186         fn clone(&self) -> Self {
13187                 if self.result_ok {
13188                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
13189                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
13190                         } }
13191                 } else {
13192                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
13193                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
13194                         } }
13195                 }
13196         }
13197 }
13198 #[no_mangle]
13199 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
13200 /// but with all dynamically-allocated buffers duplicated in new buffers.
13201 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
13202 #[repr(C)]
13203 /// The contents of CResult_DescriptionCreationErrorZ
13204 pub union CResult_DescriptionCreationErrorZPtr {
13205         /// A pointer to the contents in the success state.
13206         /// Reading from this pointer when `result_ok` is not set is undefined.
13207         pub result: *mut crate::lightning_invoice::Description,
13208         /// A pointer to the contents in the error state.
13209         /// Reading from this pointer when `result_ok` is set is undefined.
13210         pub err: *mut crate::lightning_invoice::CreationError,
13211 }
13212 #[repr(C)]
13213 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
13214 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
13215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13216 pub struct CResult_DescriptionCreationErrorZ {
13217         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
13218         /// `err` or `result` depending on the state of `result_ok`.
13219         pub contents: CResult_DescriptionCreationErrorZPtr,
13220         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
13221         pub result_ok: bool,
13222 }
13223 #[no_mangle]
13224 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
13225 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
13226         CResult_DescriptionCreationErrorZ {
13227                 contents: CResult_DescriptionCreationErrorZPtr {
13228                         result: Box::into_raw(Box::new(o)),
13229                 },
13230                 result_ok: true,
13231         }
13232 }
13233 #[no_mangle]
13234 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
13235 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
13236         CResult_DescriptionCreationErrorZ {
13237                 contents: CResult_DescriptionCreationErrorZPtr {
13238                         err: Box::into_raw(Box::new(e)),
13239                 },
13240                 result_ok: false,
13241         }
13242 }
13243 /// Checks if the given object is currently in the success state
13244 #[no_mangle]
13245 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
13246         o.result_ok
13247 }
13248 #[no_mangle]
13249 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
13250 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
13251 impl Drop for CResult_DescriptionCreationErrorZ {
13252         fn drop(&mut self) {
13253                 if self.result_ok {
13254                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13255                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13256                         }
13257                 } else {
13258                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13259                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13260                         }
13261                 }
13262         }
13263 }
13264 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
13265         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
13266                 let contents = if o.result_ok {
13267                         let result = unsafe { o.contents.result };
13268                         unsafe { o.contents.result = core::ptr::null_mut() };
13269                         CResult_DescriptionCreationErrorZPtr { result }
13270                 } else {
13271                         let err = unsafe { o.contents.err };
13272                         unsafe { o.contents.err = core::ptr::null_mut(); }
13273                         CResult_DescriptionCreationErrorZPtr { err }
13274                 };
13275                 Self {
13276                         contents,
13277                         result_ok: o.result_ok,
13278                 }
13279         }
13280 }
13281 impl Clone for CResult_DescriptionCreationErrorZ {
13282         fn clone(&self) -> Self {
13283                 if self.result_ok {
13284                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
13285                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
13286                         } }
13287                 } else {
13288                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
13289                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13290                         } }
13291                 }
13292         }
13293 }
13294 #[no_mangle]
13295 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
13296 /// but with all dynamically-allocated buffers duplicated in new buffers.
13297 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
13298 #[repr(C)]
13299 /// The contents of CResult_PrivateRouteCreationErrorZ
13300 pub union CResult_PrivateRouteCreationErrorZPtr {
13301         /// A pointer to the contents in the success state.
13302         /// Reading from this pointer when `result_ok` is not set is undefined.
13303         pub result: *mut crate::lightning_invoice::PrivateRoute,
13304         /// A pointer to the contents in the error state.
13305         /// Reading from this pointer when `result_ok` is set is undefined.
13306         pub err: *mut crate::lightning_invoice::CreationError,
13307 }
13308 #[repr(C)]
13309 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
13310 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
13311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13312 pub struct CResult_PrivateRouteCreationErrorZ {
13313         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
13314         /// `err` or `result` depending on the state of `result_ok`.
13315         pub contents: CResult_PrivateRouteCreationErrorZPtr,
13316         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
13317         pub result_ok: bool,
13318 }
13319 #[no_mangle]
13320 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
13321 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
13322         CResult_PrivateRouteCreationErrorZ {
13323                 contents: CResult_PrivateRouteCreationErrorZPtr {
13324                         result: Box::into_raw(Box::new(o)),
13325                 },
13326                 result_ok: true,
13327         }
13328 }
13329 #[no_mangle]
13330 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
13331 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
13332         CResult_PrivateRouteCreationErrorZ {
13333                 contents: CResult_PrivateRouteCreationErrorZPtr {
13334                         err: Box::into_raw(Box::new(e)),
13335                 },
13336                 result_ok: false,
13337         }
13338 }
13339 /// Checks if the given object is currently in the success state
13340 #[no_mangle]
13341 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
13342         o.result_ok
13343 }
13344 #[no_mangle]
13345 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
13346 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
13347 impl Drop for CResult_PrivateRouteCreationErrorZ {
13348         fn drop(&mut self) {
13349                 if self.result_ok {
13350                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13351                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13352                         }
13353                 } else {
13354                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13355                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13356                         }
13357                 }
13358         }
13359 }
13360 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
13361         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
13362                 let contents = if o.result_ok {
13363                         let result = unsafe { o.contents.result };
13364                         unsafe { o.contents.result = core::ptr::null_mut() };
13365                         CResult_PrivateRouteCreationErrorZPtr { result }
13366                 } else {
13367                         let err = unsafe { o.contents.err };
13368                         unsafe { o.contents.err = core::ptr::null_mut(); }
13369                         CResult_PrivateRouteCreationErrorZPtr { err }
13370                 };
13371                 Self {
13372                         contents,
13373                         result_ok: o.result_ok,
13374                 }
13375         }
13376 }
13377 impl Clone for CResult_PrivateRouteCreationErrorZ {
13378         fn clone(&self) -> Self {
13379                 if self.result_ok {
13380                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
13381                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
13382                         } }
13383                 } else {
13384                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
13385                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13386                         } }
13387                 }
13388         }
13389 }
13390 #[no_mangle]
13391 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
13392 /// but with all dynamically-allocated buffers duplicated in new buffers.
13393 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
13394 #[repr(C)]
13395 /// The contents of CResult_u32GraphSyncErrorZ
13396 pub union CResult_u32GraphSyncErrorZPtr {
13397         /// A pointer to the contents in the success state.
13398         /// Reading from this pointer when `result_ok` is not set is undefined.
13399         pub result: *mut u32,
13400         /// A pointer to the contents in the error state.
13401         /// Reading from this pointer when `result_ok` is set is undefined.
13402         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
13403 }
13404 #[repr(C)]
13405 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13406 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
13407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13408 pub struct CResult_u32GraphSyncErrorZ {
13409         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13410         /// `err` or `result` depending on the state of `result_ok`.
13411         pub contents: CResult_u32GraphSyncErrorZPtr,
13412         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13413         pub result_ok: bool,
13414 }
13415 #[no_mangle]
13416 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13417 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13418         CResult_u32GraphSyncErrorZ {
13419                 contents: CResult_u32GraphSyncErrorZPtr {
13420                         result: Box::into_raw(Box::new(o)),
13421                 },
13422                 result_ok: true,
13423         }
13424 }
13425 #[no_mangle]
13426 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13427 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13428         CResult_u32GraphSyncErrorZ {
13429                 contents: CResult_u32GraphSyncErrorZPtr {
13430                         err: Box::into_raw(Box::new(e)),
13431                 },
13432                 result_ok: false,
13433         }
13434 }
13435 /// Checks if the given object is currently in the success state
13436 #[no_mangle]
13437 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13438         o.result_ok
13439 }
13440 #[no_mangle]
13441 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13442 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13443 impl Drop for CResult_u32GraphSyncErrorZ {
13444         fn drop(&mut self) {
13445                 if self.result_ok {
13446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13448                         }
13449                 } else {
13450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13452                         }
13453                 }
13454         }
13455 }
13456 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13457         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
13458                 let contents = if o.result_ok {
13459                         let result = unsafe { o.contents.result };
13460                         unsafe { o.contents.result = core::ptr::null_mut() };
13461                         CResult_u32GraphSyncErrorZPtr { result }
13462                 } else {
13463                         let err = unsafe { o.contents.err };
13464                         unsafe { o.contents.err = core::ptr::null_mut(); }
13465                         CResult_u32GraphSyncErrorZPtr { err }
13466                 };
13467                 Self {
13468                         contents,
13469                         result_ok: o.result_ok,
13470                 }
13471         }
13472 }
13473 #[repr(C)]
13474 /// The contents of CResult_NetAddressDecodeErrorZ
13475 pub union CResult_NetAddressDecodeErrorZPtr {
13476         /// A pointer to the contents in the success state.
13477         /// Reading from this pointer when `result_ok` is not set is undefined.
13478         pub result: *mut crate::lightning::ln::msgs::NetAddress,
13479         /// A pointer to the contents in the error state.
13480         /// Reading from this pointer when `result_ok` is set is undefined.
13481         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13482 }
13483 #[repr(C)]
13484 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
13485 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13487 pub struct CResult_NetAddressDecodeErrorZ {
13488         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
13489         /// `err` or `result` depending on the state of `result_ok`.
13490         pub contents: CResult_NetAddressDecodeErrorZPtr,
13491         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
13492         pub result_ok: bool,
13493 }
13494 #[no_mangle]
13495 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13496 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
13497         CResult_NetAddressDecodeErrorZ {
13498                 contents: CResult_NetAddressDecodeErrorZPtr {
13499                         result: Box::into_raw(Box::new(o)),
13500                 },
13501                 result_ok: true,
13502         }
13503 }
13504 #[no_mangle]
13505 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13506 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
13507         CResult_NetAddressDecodeErrorZ {
13508                 contents: CResult_NetAddressDecodeErrorZPtr {
13509                         err: Box::into_raw(Box::new(e)),
13510                 },
13511                 result_ok: false,
13512         }
13513 }
13514 /// Checks if the given object is currently in the success state
13515 #[no_mangle]
13516 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
13517         o.result_ok
13518 }
13519 #[no_mangle]
13520 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13521 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
13522 impl Drop for CResult_NetAddressDecodeErrorZ {
13523         fn drop(&mut self) {
13524                 if self.result_ok {
13525                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13526                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13527                         }
13528                 } else {
13529                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13530                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13531                         }
13532                 }
13533         }
13534 }
13535 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
13536         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13537                 let contents = if o.result_ok {
13538                         let result = unsafe { o.contents.result };
13539                         unsafe { o.contents.result = core::ptr::null_mut() };
13540                         CResult_NetAddressDecodeErrorZPtr { result }
13541                 } else {
13542                         let err = unsafe { o.contents.err };
13543                         unsafe { o.contents.err = core::ptr::null_mut(); }
13544                         CResult_NetAddressDecodeErrorZPtr { err }
13545                 };
13546                 Self {
13547                         contents,
13548                         result_ok: o.result_ok,
13549                 }
13550         }
13551 }
13552 impl Clone for CResult_NetAddressDecodeErrorZ {
13553         fn clone(&self) -> Self {
13554                 if self.result_ok {
13555                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
13556                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
13557                         } }
13558                 } else {
13559                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
13560                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13561                         } }
13562                 }
13563         }
13564 }
13565 #[no_mangle]
13566 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
13567 /// but with all dynamically-allocated buffers duplicated in new buffers.
13568 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
13569 #[repr(C)]
13570 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13571 /// This corresponds to std::vector in C++
13572 pub struct CVec_UpdateAddHTLCZ {
13573         /// The elements in the array.
13574         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13575         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13576         /// The number of elements pointed to by `data`.
13577         pub datalen: usize
13578 }
13579 impl CVec_UpdateAddHTLCZ {
13580         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13581                 if self.datalen == 0 { return Vec::new(); }
13582                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13583                 self.data = core::ptr::null_mut();
13584                 self.datalen = 0;
13585                 ret
13586         }
13587         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13588                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13589         }
13590 }
13591 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13592         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13593                 let datalen = v.len();
13594                 let data = Box::into_raw(v.into_boxed_slice());
13595                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13596         }
13597 }
13598 #[no_mangle]
13599 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13600 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13601 impl Drop for CVec_UpdateAddHTLCZ {
13602         fn drop(&mut self) {
13603                 if self.datalen == 0 { return; }
13604                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13605         }
13606 }
13607 impl Clone for CVec_UpdateAddHTLCZ {
13608         fn clone(&self) -> Self {
13609                 let mut res = Vec::new();
13610                 if self.datalen == 0 { return Self::from(res); }
13611                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13612                 Self::from(res)
13613         }
13614 }
13615 #[repr(C)]
13616 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13617 /// This corresponds to std::vector in C++
13618 pub struct CVec_UpdateFulfillHTLCZ {
13619         /// The elements in the array.
13620         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13621         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13622         /// The number of elements pointed to by `data`.
13623         pub datalen: usize
13624 }
13625 impl CVec_UpdateFulfillHTLCZ {
13626         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13627                 if self.datalen == 0 { return Vec::new(); }
13628                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13629                 self.data = core::ptr::null_mut();
13630                 self.datalen = 0;
13631                 ret
13632         }
13633         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13634                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13635         }
13636 }
13637 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13638         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13639                 let datalen = v.len();
13640                 let data = Box::into_raw(v.into_boxed_slice());
13641                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13642         }
13643 }
13644 #[no_mangle]
13645 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13646 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13647 impl Drop for CVec_UpdateFulfillHTLCZ {
13648         fn drop(&mut self) {
13649                 if self.datalen == 0 { return; }
13650                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13651         }
13652 }
13653 impl Clone for CVec_UpdateFulfillHTLCZ {
13654         fn clone(&self) -> Self {
13655                 let mut res = Vec::new();
13656                 if self.datalen == 0 { return Self::from(res); }
13657                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13658                 Self::from(res)
13659         }
13660 }
13661 #[repr(C)]
13662 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13663 /// This corresponds to std::vector in C++
13664 pub struct CVec_UpdateFailHTLCZ {
13665         /// The elements in the array.
13666         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13667         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13668         /// The number of elements pointed to by `data`.
13669         pub datalen: usize
13670 }
13671 impl CVec_UpdateFailHTLCZ {
13672         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13673                 if self.datalen == 0 { return Vec::new(); }
13674                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13675                 self.data = core::ptr::null_mut();
13676                 self.datalen = 0;
13677                 ret
13678         }
13679         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13680                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13681         }
13682 }
13683 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13684         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13685                 let datalen = v.len();
13686                 let data = Box::into_raw(v.into_boxed_slice());
13687                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13688         }
13689 }
13690 #[no_mangle]
13691 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13692 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13693 impl Drop for CVec_UpdateFailHTLCZ {
13694         fn drop(&mut self) {
13695                 if self.datalen == 0 { return; }
13696                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13697         }
13698 }
13699 impl Clone for CVec_UpdateFailHTLCZ {
13700         fn clone(&self) -> Self {
13701                 let mut res = Vec::new();
13702                 if self.datalen == 0 { return Self::from(res); }
13703                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13704                 Self::from(res)
13705         }
13706 }
13707 #[repr(C)]
13708 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13709 /// This corresponds to std::vector in C++
13710 pub struct CVec_UpdateFailMalformedHTLCZ {
13711         /// The elements in the array.
13712         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13713         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13714         /// The number of elements pointed to by `data`.
13715         pub datalen: usize
13716 }
13717 impl CVec_UpdateFailMalformedHTLCZ {
13718         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13719                 if self.datalen == 0 { return Vec::new(); }
13720                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13721                 self.data = core::ptr::null_mut();
13722                 self.datalen = 0;
13723                 ret
13724         }
13725         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13726                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13727         }
13728 }
13729 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13730         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13731                 let datalen = v.len();
13732                 let data = Box::into_raw(v.into_boxed_slice());
13733                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13734         }
13735 }
13736 #[no_mangle]
13737 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13738 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13739 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13740         fn drop(&mut self) {
13741                 if self.datalen == 0 { return; }
13742                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13743         }
13744 }
13745 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13746         fn clone(&self) -> Self {
13747                 let mut res = Vec::new();
13748                 if self.datalen == 0 { return Self::from(res); }
13749                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13750                 Self::from(res)
13751         }
13752 }
13753 #[repr(C)]
13754 /// The contents of CResult_AcceptChannelDecodeErrorZ
13755 pub union CResult_AcceptChannelDecodeErrorZPtr {
13756         /// A pointer to the contents in the success state.
13757         /// Reading from this pointer when `result_ok` is not set is undefined.
13758         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13759         /// A pointer to the contents in the error state.
13760         /// Reading from this pointer when `result_ok` is set is undefined.
13761         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13762 }
13763 #[repr(C)]
13764 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13765 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13767 pub struct CResult_AcceptChannelDecodeErrorZ {
13768         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13769         /// `err` or `result` depending on the state of `result_ok`.
13770         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13771         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13772         pub result_ok: bool,
13773 }
13774 #[no_mangle]
13775 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13776 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13777         CResult_AcceptChannelDecodeErrorZ {
13778                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13779                         result: Box::into_raw(Box::new(o)),
13780                 },
13781                 result_ok: true,
13782         }
13783 }
13784 #[no_mangle]
13785 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13786 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13787         CResult_AcceptChannelDecodeErrorZ {
13788                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13789                         err: Box::into_raw(Box::new(e)),
13790                 },
13791                 result_ok: false,
13792         }
13793 }
13794 /// Checks if the given object is currently in the success state
13795 #[no_mangle]
13796 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13797         o.result_ok
13798 }
13799 #[no_mangle]
13800 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13801 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13802 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13803         fn drop(&mut self) {
13804                 if self.result_ok {
13805                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13806                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13807                         }
13808                 } else {
13809                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13810                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13811                         }
13812                 }
13813         }
13814 }
13815 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13816         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13817                 let contents = if o.result_ok {
13818                         let result = unsafe { o.contents.result };
13819                         unsafe { o.contents.result = core::ptr::null_mut() };
13820                         CResult_AcceptChannelDecodeErrorZPtr { result }
13821                 } else {
13822                         let err = unsafe { o.contents.err };
13823                         unsafe { o.contents.err = core::ptr::null_mut(); }
13824                         CResult_AcceptChannelDecodeErrorZPtr { err }
13825                 };
13826                 Self {
13827                         contents,
13828                         result_ok: o.result_ok,
13829                 }
13830         }
13831 }
13832 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13833         fn clone(&self) -> Self {
13834                 if self.result_ok {
13835                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13836                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13837                         } }
13838                 } else {
13839                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13840                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13841                         } }
13842                 }
13843         }
13844 }
13845 #[no_mangle]
13846 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13847 /// but with all dynamically-allocated buffers duplicated in new buffers.
13848 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13849 #[repr(C)]
13850 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13851 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13852         /// A pointer to the contents in the success state.
13853         /// Reading from this pointer when `result_ok` is not set is undefined.
13854         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13855         /// A pointer to the contents in the error state.
13856         /// Reading from this pointer when `result_ok` is set is undefined.
13857         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13858 }
13859 #[repr(C)]
13860 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13861 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13863 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13864         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13865         /// `err` or `result` depending on the state of `result_ok`.
13866         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13867         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13868         pub result_ok: bool,
13869 }
13870 #[no_mangle]
13871 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13872 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13873         CResult_AnnouncementSignaturesDecodeErrorZ {
13874                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13875                         result: Box::into_raw(Box::new(o)),
13876                 },
13877                 result_ok: true,
13878         }
13879 }
13880 #[no_mangle]
13881 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13882 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13883         CResult_AnnouncementSignaturesDecodeErrorZ {
13884                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13885                         err: Box::into_raw(Box::new(e)),
13886                 },
13887                 result_ok: false,
13888         }
13889 }
13890 /// Checks if the given object is currently in the success state
13891 #[no_mangle]
13892 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13893         o.result_ok
13894 }
13895 #[no_mangle]
13896 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13897 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13898 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13899         fn drop(&mut self) {
13900                 if self.result_ok {
13901                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13902                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13903                         }
13904                 } else {
13905                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13906                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13907                         }
13908                 }
13909         }
13910 }
13911 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13912         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13913                 let contents = if o.result_ok {
13914                         let result = unsafe { o.contents.result };
13915                         unsafe { o.contents.result = core::ptr::null_mut() };
13916                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13917                 } else {
13918                         let err = unsafe { o.contents.err };
13919                         unsafe { o.contents.err = core::ptr::null_mut(); }
13920                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13921                 };
13922                 Self {
13923                         contents,
13924                         result_ok: o.result_ok,
13925                 }
13926         }
13927 }
13928 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13929         fn clone(&self) -> Self {
13930                 if self.result_ok {
13931                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13932                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13933                         } }
13934                 } else {
13935                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13936                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13937                         } }
13938                 }
13939         }
13940 }
13941 #[no_mangle]
13942 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13943 /// but with all dynamically-allocated buffers duplicated in new buffers.
13944 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13945 #[repr(C)]
13946 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13947 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13948         /// A pointer to the contents in the success state.
13949         /// Reading from this pointer when `result_ok` is not set is undefined.
13950         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13951         /// A pointer to the contents in the error state.
13952         /// Reading from this pointer when `result_ok` is set is undefined.
13953         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13954 }
13955 #[repr(C)]
13956 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13957 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13959 pub struct CResult_ChannelReestablishDecodeErrorZ {
13960         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13961         /// `err` or `result` depending on the state of `result_ok`.
13962         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13963         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13964         pub result_ok: bool,
13965 }
13966 #[no_mangle]
13967 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13968 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13969         CResult_ChannelReestablishDecodeErrorZ {
13970                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13971                         result: Box::into_raw(Box::new(o)),
13972                 },
13973                 result_ok: true,
13974         }
13975 }
13976 #[no_mangle]
13977 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13978 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13979         CResult_ChannelReestablishDecodeErrorZ {
13980                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13981                         err: Box::into_raw(Box::new(e)),
13982                 },
13983                 result_ok: false,
13984         }
13985 }
13986 /// Checks if the given object is currently in the success state
13987 #[no_mangle]
13988 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13989         o.result_ok
13990 }
13991 #[no_mangle]
13992 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13993 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13994 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13995         fn drop(&mut self) {
13996                 if self.result_ok {
13997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13999                         }
14000                 } else {
14001                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14002                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14003                         }
14004                 }
14005         }
14006 }
14007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
14008         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
14009                 let contents = if o.result_ok {
14010                         let result = unsafe { o.contents.result };
14011                         unsafe { o.contents.result = core::ptr::null_mut() };
14012                         CResult_ChannelReestablishDecodeErrorZPtr { result }
14013                 } else {
14014                         let err = unsafe { o.contents.err };
14015                         unsafe { o.contents.err = core::ptr::null_mut(); }
14016                         CResult_ChannelReestablishDecodeErrorZPtr { err }
14017                 };
14018                 Self {
14019                         contents,
14020                         result_ok: o.result_ok,
14021                 }
14022         }
14023 }
14024 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
14025         fn clone(&self) -> Self {
14026                 if self.result_ok {
14027                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14028                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
14029                         } }
14030                 } else {
14031                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
14032                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14033                         } }
14034                 }
14035         }
14036 }
14037 #[no_mangle]
14038 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
14039 /// but with all dynamically-allocated buffers duplicated in new buffers.
14040 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
14041 #[repr(C)]
14042 /// The contents of CResult_ClosingSignedDecodeErrorZ
14043 pub union CResult_ClosingSignedDecodeErrorZPtr {
14044         /// A pointer to the contents in the success state.
14045         /// Reading from this pointer when `result_ok` is not set is undefined.
14046         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
14047         /// A pointer to the contents in the error state.
14048         /// Reading from this pointer when `result_ok` is set is undefined.
14049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14050 }
14051 #[repr(C)]
14052 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
14053 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14055 pub struct CResult_ClosingSignedDecodeErrorZ {
14056         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
14057         /// `err` or `result` depending on the state of `result_ok`.
14058         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
14059         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
14060         pub result_ok: bool,
14061 }
14062 #[no_mangle]
14063 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
14064 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
14065         CResult_ClosingSignedDecodeErrorZ {
14066                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14067                         result: Box::into_raw(Box::new(o)),
14068                 },
14069                 result_ok: true,
14070         }
14071 }
14072 #[no_mangle]
14073 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
14074 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
14075         CResult_ClosingSignedDecodeErrorZ {
14076                 contents: CResult_ClosingSignedDecodeErrorZPtr {
14077                         err: Box::into_raw(Box::new(e)),
14078                 },
14079                 result_ok: false,
14080         }
14081 }
14082 /// Checks if the given object is currently in the success state
14083 #[no_mangle]
14084 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
14085         o.result_ok
14086 }
14087 #[no_mangle]
14088 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
14089 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
14090 impl Drop for CResult_ClosingSignedDecodeErrorZ {
14091         fn drop(&mut self) {
14092                 if self.result_ok {
14093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14095                         }
14096                 } else {
14097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14099                         }
14100                 }
14101         }
14102 }
14103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
14104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14105                 let contents = if o.result_ok {
14106                         let result = unsafe { o.contents.result };
14107                         unsafe { o.contents.result = core::ptr::null_mut() };
14108                         CResult_ClosingSignedDecodeErrorZPtr { result }
14109                 } else {
14110                         let err = unsafe { o.contents.err };
14111                         unsafe { o.contents.err = core::ptr::null_mut(); }
14112                         CResult_ClosingSignedDecodeErrorZPtr { err }
14113                 };
14114                 Self {
14115                         contents,
14116                         result_ok: o.result_ok,
14117                 }
14118         }
14119 }
14120 impl Clone for CResult_ClosingSignedDecodeErrorZ {
14121         fn clone(&self) -> Self {
14122                 if self.result_ok {
14123                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
14124                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
14125                         } }
14126                 } else {
14127                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
14128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14129                         } }
14130                 }
14131         }
14132 }
14133 #[no_mangle]
14134 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
14135 /// but with all dynamically-allocated buffers duplicated in new buffers.
14136 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
14137 #[repr(C)]
14138 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
14139 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14140         /// A pointer to the contents in the success state.
14141         /// Reading from this pointer when `result_ok` is not set is undefined.
14142         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
14143         /// A pointer to the contents in the error state.
14144         /// Reading from this pointer when `result_ok` is set is undefined.
14145         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14146 }
14147 #[repr(C)]
14148 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
14149 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14151 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
14152         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
14153         /// `err` or `result` depending on the state of `result_ok`.
14154         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
14155         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
14156         pub result_ok: bool,
14157 }
14158 #[no_mangle]
14159 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
14160 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14161         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14162                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14163                         result: Box::into_raw(Box::new(o)),
14164                 },
14165                 result_ok: true,
14166         }
14167 }
14168 #[no_mangle]
14169 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
14170 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
14171         CResult_ClosingSignedFeeRangeDecodeErrorZ {
14172                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14173                         err: Box::into_raw(Box::new(e)),
14174                 },
14175                 result_ok: false,
14176         }
14177 }
14178 /// Checks if the given object is currently in the success state
14179 #[no_mangle]
14180 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
14181         o.result_ok
14182 }
14183 #[no_mangle]
14184 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
14185 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
14186 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14187         fn drop(&mut self) {
14188                 if self.result_ok {
14189                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14190                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14191                         }
14192                 } else {
14193                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14194                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14195                         }
14196                 }
14197         }
14198 }
14199 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14200         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14201                 let contents = if o.result_ok {
14202                         let result = unsafe { o.contents.result };
14203                         unsafe { o.contents.result = core::ptr::null_mut() };
14204                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
14205                 } else {
14206                         let err = unsafe { o.contents.err };
14207                         unsafe { o.contents.err = core::ptr::null_mut(); }
14208                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
14209                 };
14210                 Self {
14211                         contents,
14212                         result_ok: o.result_ok,
14213                 }
14214         }
14215 }
14216 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
14217         fn clone(&self) -> Self {
14218                 if self.result_ok {
14219                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14220                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
14221                         } }
14222                 } else {
14223                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
14224                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14225                         } }
14226                 }
14227         }
14228 }
14229 #[no_mangle]
14230 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
14231 /// but with all dynamically-allocated buffers duplicated in new buffers.
14232 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
14233 #[repr(C)]
14234 /// The contents of CResult_CommitmentSignedDecodeErrorZ
14235 pub union CResult_CommitmentSignedDecodeErrorZPtr {
14236         /// A pointer to the contents in the success state.
14237         /// Reading from this pointer when `result_ok` is not set is undefined.
14238         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
14239         /// A pointer to the contents in the error state.
14240         /// Reading from this pointer when `result_ok` is set is undefined.
14241         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14242 }
14243 #[repr(C)]
14244 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
14245 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14247 pub struct CResult_CommitmentSignedDecodeErrorZ {
14248         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
14249         /// `err` or `result` depending on the state of `result_ok`.
14250         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
14251         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
14252         pub result_ok: bool,
14253 }
14254 #[no_mangle]
14255 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
14256 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
14257         CResult_CommitmentSignedDecodeErrorZ {
14258                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14259                         result: Box::into_raw(Box::new(o)),
14260                 },
14261                 result_ok: true,
14262         }
14263 }
14264 #[no_mangle]
14265 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
14266 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
14267         CResult_CommitmentSignedDecodeErrorZ {
14268                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
14269                         err: Box::into_raw(Box::new(e)),
14270                 },
14271                 result_ok: false,
14272         }
14273 }
14274 /// Checks if the given object is currently in the success state
14275 #[no_mangle]
14276 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
14277         o.result_ok
14278 }
14279 #[no_mangle]
14280 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
14281 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
14282 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
14283         fn drop(&mut self) {
14284                 if self.result_ok {
14285                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14286                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14287                         }
14288                 } else {
14289                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14290                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14291                         }
14292                 }
14293         }
14294 }
14295 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
14296         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14297                 let contents = if o.result_ok {
14298                         let result = unsafe { o.contents.result };
14299                         unsafe { o.contents.result = core::ptr::null_mut() };
14300                         CResult_CommitmentSignedDecodeErrorZPtr { result }
14301                 } else {
14302                         let err = unsafe { o.contents.err };
14303                         unsafe { o.contents.err = core::ptr::null_mut(); }
14304                         CResult_CommitmentSignedDecodeErrorZPtr { err }
14305                 };
14306                 Self {
14307                         contents,
14308                         result_ok: o.result_ok,
14309                 }
14310         }
14311 }
14312 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
14313         fn clone(&self) -> Self {
14314                 if self.result_ok {
14315                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14316                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
14317                         } }
14318                 } else {
14319                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
14320                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14321                         } }
14322                 }
14323         }
14324 }
14325 #[no_mangle]
14326 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
14327 /// but with all dynamically-allocated buffers duplicated in new buffers.
14328 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
14329 #[repr(C)]
14330 /// The contents of CResult_FundingCreatedDecodeErrorZ
14331 pub union CResult_FundingCreatedDecodeErrorZPtr {
14332         /// A pointer to the contents in the success state.
14333         /// Reading from this pointer when `result_ok` is not set is undefined.
14334         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
14335         /// A pointer to the contents in the error state.
14336         /// Reading from this pointer when `result_ok` is set is undefined.
14337         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14338 }
14339 #[repr(C)]
14340 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
14341 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
14342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14343 pub struct CResult_FundingCreatedDecodeErrorZ {
14344         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
14345         /// `err` or `result` depending on the state of `result_ok`.
14346         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
14347         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
14348         pub result_ok: bool,
14349 }
14350 #[no_mangle]
14351 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
14352 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
14353         CResult_FundingCreatedDecodeErrorZ {
14354                 contents: CResult_FundingCreatedDecodeErrorZPtr {
14355                         result: Box::into_raw(Box::new(o)),
14356                 },
14357                 result_ok: true,
14358         }
14359 }
14360 #[no_mangle]
14361 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
14362 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
14363         CResult_FundingCreatedDecodeErrorZ {
14364                 contents: CResult_FundingCreatedDecodeErrorZPtr {
14365                         err: Box::into_raw(Box::new(e)),
14366                 },
14367                 result_ok: false,
14368         }
14369 }
14370 /// Checks if the given object is currently in the success state
14371 #[no_mangle]
14372 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
14373         o.result_ok
14374 }
14375 #[no_mangle]
14376 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
14377 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
14378 impl Drop for CResult_FundingCreatedDecodeErrorZ {
14379         fn drop(&mut self) {
14380                 if self.result_ok {
14381                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14382                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14383                         }
14384                 } else {
14385                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14386                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14387                         }
14388                 }
14389         }
14390 }
14391 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
14392         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
14393                 let contents = if o.result_ok {
14394                         let result = unsafe { o.contents.result };
14395                         unsafe { o.contents.result = core::ptr::null_mut() };
14396                         CResult_FundingCreatedDecodeErrorZPtr { result }
14397                 } else {
14398                         let err = unsafe { o.contents.err };
14399                         unsafe { o.contents.err = core::ptr::null_mut(); }
14400                         CResult_FundingCreatedDecodeErrorZPtr { err }
14401                 };
14402                 Self {
14403                         contents,
14404                         result_ok: o.result_ok,
14405                 }
14406         }
14407 }
14408 impl Clone for CResult_FundingCreatedDecodeErrorZ {
14409         fn clone(&self) -> Self {
14410                 if self.result_ok {
14411                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
14412                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
14413                         } }
14414                 } else {
14415                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
14416                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14417                         } }
14418                 }
14419         }
14420 }
14421 #[no_mangle]
14422 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14423 /// but with all dynamically-allocated buffers duplicated in new buffers.
14424 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
14425 #[repr(C)]
14426 /// The contents of CResult_FundingSignedDecodeErrorZ
14427 pub union CResult_FundingSignedDecodeErrorZPtr {
14428         /// A pointer to the contents in the success state.
14429         /// Reading from this pointer when `result_ok` is not set is undefined.
14430         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
14431         /// A pointer to the contents in the error state.
14432         /// Reading from this pointer when `result_ok` is set is undefined.
14433         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14434 }
14435 #[repr(C)]
14436 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
14437 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14438 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14439 pub struct CResult_FundingSignedDecodeErrorZ {
14440         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
14441         /// `err` or `result` depending on the state of `result_ok`.
14442         pub contents: CResult_FundingSignedDecodeErrorZPtr,
14443         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
14444         pub result_ok: bool,
14445 }
14446 #[no_mangle]
14447 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14448 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
14449         CResult_FundingSignedDecodeErrorZ {
14450                 contents: CResult_FundingSignedDecodeErrorZPtr {
14451                         result: Box::into_raw(Box::new(o)),
14452                 },
14453                 result_ok: true,
14454         }
14455 }
14456 #[no_mangle]
14457 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14458 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
14459         CResult_FundingSignedDecodeErrorZ {
14460                 contents: CResult_FundingSignedDecodeErrorZPtr {
14461                         err: Box::into_raw(Box::new(e)),
14462                 },
14463                 result_ok: false,
14464         }
14465 }
14466 /// Checks if the given object is currently in the success state
14467 #[no_mangle]
14468 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
14469         o.result_ok
14470 }
14471 #[no_mangle]
14472 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14473 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
14474 impl Drop for CResult_FundingSignedDecodeErrorZ {
14475         fn drop(&mut self) {
14476                 if self.result_ok {
14477                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14478                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14479                         }
14480                 } else {
14481                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14482                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14483                         }
14484                 }
14485         }
14486 }
14487 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
14488         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14489                 let contents = if o.result_ok {
14490                         let result = unsafe { o.contents.result };
14491                         unsafe { o.contents.result = core::ptr::null_mut() };
14492                         CResult_FundingSignedDecodeErrorZPtr { result }
14493                 } else {
14494                         let err = unsafe { o.contents.err };
14495                         unsafe { o.contents.err = core::ptr::null_mut(); }
14496                         CResult_FundingSignedDecodeErrorZPtr { err }
14497                 };
14498                 Self {
14499                         contents,
14500                         result_ok: o.result_ok,
14501                 }
14502         }
14503 }
14504 impl Clone for CResult_FundingSignedDecodeErrorZ {
14505         fn clone(&self) -> Self {
14506                 if self.result_ok {
14507                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
14508                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
14509                         } }
14510                 } else {
14511                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
14512                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14513                         } }
14514                 }
14515         }
14516 }
14517 #[no_mangle]
14518 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14519 /// but with all dynamically-allocated buffers duplicated in new buffers.
14520 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
14521 #[repr(C)]
14522 /// The contents of CResult_ChannelReadyDecodeErrorZ
14523 pub union CResult_ChannelReadyDecodeErrorZPtr {
14524         /// A pointer to the contents in the success state.
14525         /// Reading from this pointer when `result_ok` is not set is undefined.
14526         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
14527         /// A pointer to the contents in the error state.
14528         /// Reading from this pointer when `result_ok` is set is undefined.
14529         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14530 }
14531 #[repr(C)]
14532 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
14533 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
14534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14535 pub struct CResult_ChannelReadyDecodeErrorZ {
14536         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
14537         /// `err` or `result` depending on the state of `result_ok`.
14538         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
14539         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
14540         pub result_ok: bool,
14541 }
14542 #[no_mangle]
14543 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
14544 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
14545         CResult_ChannelReadyDecodeErrorZ {
14546                 contents: CResult_ChannelReadyDecodeErrorZPtr {
14547                         result: Box::into_raw(Box::new(o)),
14548                 },
14549                 result_ok: true,
14550         }
14551 }
14552 #[no_mangle]
14553 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
14554 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
14555         CResult_ChannelReadyDecodeErrorZ {
14556                 contents: CResult_ChannelReadyDecodeErrorZPtr {
14557                         err: Box::into_raw(Box::new(e)),
14558                 },
14559                 result_ok: false,
14560         }
14561 }
14562 /// Checks if the given object is currently in the success state
14563 #[no_mangle]
14564 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
14565         o.result_ok
14566 }
14567 #[no_mangle]
14568 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
14569 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
14570 impl Drop for CResult_ChannelReadyDecodeErrorZ {
14571         fn drop(&mut self) {
14572                 if self.result_ok {
14573                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14574                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14575                         }
14576                 } else {
14577                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14578                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14579                         }
14580                 }
14581         }
14582 }
14583 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
14584         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
14585                 let contents = if o.result_ok {
14586                         let result = unsafe { o.contents.result };
14587                         unsafe { o.contents.result = core::ptr::null_mut() };
14588                         CResult_ChannelReadyDecodeErrorZPtr { result }
14589                 } else {
14590                         let err = unsafe { o.contents.err };
14591                         unsafe { o.contents.err = core::ptr::null_mut(); }
14592                         CResult_ChannelReadyDecodeErrorZPtr { err }
14593                 };
14594                 Self {
14595                         contents,
14596                         result_ok: o.result_ok,
14597                 }
14598         }
14599 }
14600 impl Clone for CResult_ChannelReadyDecodeErrorZ {
14601         fn clone(&self) -> Self {
14602                 if self.result_ok {
14603                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
14604                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
14605                         } }
14606                 } else {
14607                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
14608                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14609                         } }
14610                 }
14611         }
14612 }
14613 #[no_mangle]
14614 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
14615 /// but with all dynamically-allocated buffers duplicated in new buffers.
14616 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
14617 #[repr(C)]
14618 /// The contents of CResult_InitDecodeErrorZ
14619 pub union CResult_InitDecodeErrorZPtr {
14620         /// A pointer to the contents in the success state.
14621         /// Reading from this pointer when `result_ok` is not set is undefined.
14622         pub result: *mut crate::lightning::ln::msgs::Init,
14623         /// A pointer to the contents in the error state.
14624         /// Reading from this pointer when `result_ok` is set is undefined.
14625         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14626 }
14627 #[repr(C)]
14628 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
14629 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
14630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14631 pub struct CResult_InitDecodeErrorZ {
14632         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
14633         /// `err` or `result` depending on the state of `result_ok`.
14634         pub contents: CResult_InitDecodeErrorZPtr,
14635         /// Whether this CResult_InitDecodeErrorZ represents a success state.
14636         pub result_ok: bool,
14637 }
14638 #[no_mangle]
14639 /// Creates a new CResult_InitDecodeErrorZ in the success state.
14640 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
14641         CResult_InitDecodeErrorZ {
14642                 contents: CResult_InitDecodeErrorZPtr {
14643                         result: Box::into_raw(Box::new(o)),
14644                 },
14645                 result_ok: true,
14646         }
14647 }
14648 #[no_mangle]
14649 /// Creates a new CResult_InitDecodeErrorZ in the error state.
14650 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
14651         CResult_InitDecodeErrorZ {
14652                 contents: CResult_InitDecodeErrorZPtr {
14653                         err: Box::into_raw(Box::new(e)),
14654                 },
14655                 result_ok: false,
14656         }
14657 }
14658 /// Checks if the given object is currently in the success state
14659 #[no_mangle]
14660 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
14661         o.result_ok
14662 }
14663 #[no_mangle]
14664 /// Frees any resources used by the CResult_InitDecodeErrorZ.
14665 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
14666 impl Drop for CResult_InitDecodeErrorZ {
14667         fn drop(&mut self) {
14668                 if self.result_ok {
14669                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14670                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14671                         }
14672                 } else {
14673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14675                         }
14676                 }
14677         }
14678 }
14679 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14680         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14681                 let contents = if o.result_ok {
14682                         let result = unsafe { o.contents.result };
14683                         unsafe { o.contents.result = core::ptr::null_mut() };
14684                         CResult_InitDecodeErrorZPtr { result }
14685                 } else {
14686                         let err = unsafe { o.contents.err };
14687                         unsafe { o.contents.err = core::ptr::null_mut(); }
14688                         CResult_InitDecodeErrorZPtr { err }
14689                 };
14690                 Self {
14691                         contents,
14692                         result_ok: o.result_ok,
14693                 }
14694         }
14695 }
14696 impl Clone for CResult_InitDecodeErrorZ {
14697         fn clone(&self) -> Self {
14698                 if self.result_ok {
14699                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14700                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14701                         } }
14702                 } else {
14703                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14704                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14705                         } }
14706                 }
14707         }
14708 }
14709 #[no_mangle]
14710 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14711 /// but with all dynamically-allocated buffers duplicated in new buffers.
14712 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14713 #[repr(C)]
14714 /// The contents of CResult_OpenChannelDecodeErrorZ
14715 pub union CResult_OpenChannelDecodeErrorZPtr {
14716         /// A pointer to the contents in the success state.
14717         /// Reading from this pointer when `result_ok` is not set is undefined.
14718         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14719         /// A pointer to the contents in the error state.
14720         /// Reading from this pointer when `result_ok` is set is undefined.
14721         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14722 }
14723 #[repr(C)]
14724 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14725 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14727 pub struct CResult_OpenChannelDecodeErrorZ {
14728         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14729         /// `err` or `result` depending on the state of `result_ok`.
14730         pub contents: CResult_OpenChannelDecodeErrorZPtr,
14731         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14732         pub result_ok: bool,
14733 }
14734 #[no_mangle]
14735 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14736 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14737         CResult_OpenChannelDecodeErrorZ {
14738                 contents: CResult_OpenChannelDecodeErrorZPtr {
14739                         result: Box::into_raw(Box::new(o)),
14740                 },
14741                 result_ok: true,
14742         }
14743 }
14744 #[no_mangle]
14745 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14746 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14747         CResult_OpenChannelDecodeErrorZ {
14748                 contents: CResult_OpenChannelDecodeErrorZPtr {
14749                         err: Box::into_raw(Box::new(e)),
14750                 },
14751                 result_ok: false,
14752         }
14753 }
14754 /// Checks if the given object is currently in the success state
14755 #[no_mangle]
14756 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14757         o.result_ok
14758 }
14759 #[no_mangle]
14760 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14761 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14762 impl Drop for CResult_OpenChannelDecodeErrorZ {
14763         fn drop(&mut self) {
14764                 if self.result_ok {
14765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14767                         }
14768                 } else {
14769                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14770                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14771                         }
14772                 }
14773         }
14774 }
14775 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14776         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14777                 let contents = if o.result_ok {
14778                         let result = unsafe { o.contents.result };
14779                         unsafe { o.contents.result = core::ptr::null_mut() };
14780                         CResult_OpenChannelDecodeErrorZPtr { result }
14781                 } else {
14782                         let err = unsafe { o.contents.err };
14783                         unsafe { o.contents.err = core::ptr::null_mut(); }
14784                         CResult_OpenChannelDecodeErrorZPtr { err }
14785                 };
14786                 Self {
14787                         contents,
14788                         result_ok: o.result_ok,
14789                 }
14790         }
14791 }
14792 impl Clone for CResult_OpenChannelDecodeErrorZ {
14793         fn clone(&self) -> Self {
14794                 if self.result_ok {
14795                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14796                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14797                         } }
14798                 } else {
14799                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14800                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14801                         } }
14802                 }
14803         }
14804 }
14805 #[no_mangle]
14806 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14807 /// but with all dynamically-allocated buffers duplicated in new buffers.
14808 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14809 #[repr(C)]
14810 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14811 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14812         /// A pointer to the contents in the success state.
14813         /// Reading from this pointer when `result_ok` is not set is undefined.
14814         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14815         /// A pointer to the contents in the error state.
14816         /// Reading from this pointer when `result_ok` is set is undefined.
14817         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14818 }
14819 #[repr(C)]
14820 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14821 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14823 pub struct CResult_RevokeAndACKDecodeErrorZ {
14824         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14825         /// `err` or `result` depending on the state of `result_ok`.
14826         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14827         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14828         pub result_ok: bool,
14829 }
14830 #[no_mangle]
14831 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14832 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14833         CResult_RevokeAndACKDecodeErrorZ {
14834                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14835                         result: Box::into_raw(Box::new(o)),
14836                 },
14837                 result_ok: true,
14838         }
14839 }
14840 #[no_mangle]
14841 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14842 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14843         CResult_RevokeAndACKDecodeErrorZ {
14844                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14845                         err: Box::into_raw(Box::new(e)),
14846                 },
14847                 result_ok: false,
14848         }
14849 }
14850 /// Checks if the given object is currently in the success state
14851 #[no_mangle]
14852 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14853         o.result_ok
14854 }
14855 #[no_mangle]
14856 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14857 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14858 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14859         fn drop(&mut self) {
14860                 if self.result_ok {
14861                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14862                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14863                         }
14864                 } else {
14865                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14866                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14867                         }
14868                 }
14869         }
14870 }
14871 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14872         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14873                 let contents = if o.result_ok {
14874                         let result = unsafe { o.contents.result };
14875                         unsafe { o.contents.result = core::ptr::null_mut() };
14876                         CResult_RevokeAndACKDecodeErrorZPtr { result }
14877                 } else {
14878                         let err = unsafe { o.contents.err };
14879                         unsafe { o.contents.err = core::ptr::null_mut(); }
14880                         CResult_RevokeAndACKDecodeErrorZPtr { err }
14881                 };
14882                 Self {
14883                         contents,
14884                         result_ok: o.result_ok,
14885                 }
14886         }
14887 }
14888 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14889         fn clone(&self) -> Self {
14890                 if self.result_ok {
14891                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14892                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14893                         } }
14894                 } else {
14895                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14896                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14897                         } }
14898                 }
14899         }
14900 }
14901 #[no_mangle]
14902 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14903 /// but with all dynamically-allocated buffers duplicated in new buffers.
14904 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14905 #[repr(C)]
14906 /// The contents of CResult_ShutdownDecodeErrorZ
14907 pub union CResult_ShutdownDecodeErrorZPtr {
14908         /// A pointer to the contents in the success state.
14909         /// Reading from this pointer when `result_ok` is not set is undefined.
14910         pub result: *mut crate::lightning::ln::msgs::Shutdown,
14911         /// A pointer to the contents in the error state.
14912         /// Reading from this pointer when `result_ok` is set is undefined.
14913         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14914 }
14915 #[repr(C)]
14916 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14917 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14918 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14919 pub struct CResult_ShutdownDecodeErrorZ {
14920         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14921         /// `err` or `result` depending on the state of `result_ok`.
14922         pub contents: CResult_ShutdownDecodeErrorZPtr,
14923         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14924         pub result_ok: bool,
14925 }
14926 #[no_mangle]
14927 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14928 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14929         CResult_ShutdownDecodeErrorZ {
14930                 contents: CResult_ShutdownDecodeErrorZPtr {
14931                         result: Box::into_raw(Box::new(o)),
14932                 },
14933                 result_ok: true,
14934         }
14935 }
14936 #[no_mangle]
14937 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14938 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14939         CResult_ShutdownDecodeErrorZ {
14940                 contents: CResult_ShutdownDecodeErrorZPtr {
14941                         err: Box::into_raw(Box::new(e)),
14942                 },
14943                 result_ok: false,
14944         }
14945 }
14946 /// Checks if the given object is currently in the success state
14947 #[no_mangle]
14948 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14949         o.result_ok
14950 }
14951 #[no_mangle]
14952 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14953 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14954 impl Drop for CResult_ShutdownDecodeErrorZ {
14955         fn drop(&mut self) {
14956                 if self.result_ok {
14957                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14958                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14959                         }
14960                 } else {
14961                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14962                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14963                         }
14964                 }
14965         }
14966 }
14967 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14968         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14969                 let contents = if o.result_ok {
14970                         let result = unsafe { o.contents.result };
14971                         unsafe { o.contents.result = core::ptr::null_mut() };
14972                         CResult_ShutdownDecodeErrorZPtr { result }
14973                 } else {
14974                         let err = unsafe { o.contents.err };
14975                         unsafe { o.contents.err = core::ptr::null_mut(); }
14976                         CResult_ShutdownDecodeErrorZPtr { err }
14977                 };
14978                 Self {
14979                         contents,
14980                         result_ok: o.result_ok,
14981                 }
14982         }
14983 }
14984 impl Clone for CResult_ShutdownDecodeErrorZ {
14985         fn clone(&self) -> Self {
14986                 if self.result_ok {
14987                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14988                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14989                         } }
14990                 } else {
14991                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14992                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14993                         } }
14994                 }
14995         }
14996 }
14997 #[no_mangle]
14998 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14999 /// but with all dynamically-allocated buffers duplicated in new buffers.
15000 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
15001 #[repr(C)]
15002 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
15003 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
15004         /// A pointer to the contents in the success state.
15005         /// Reading from this pointer when `result_ok` is not set is undefined.
15006         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15007         /// A pointer to the contents in the error state.
15008         /// Reading from this pointer when `result_ok` is set is undefined.
15009         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15010 }
15011 #[repr(C)]
15012 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
15013 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15015 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
15016         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
15017         /// `err` or `result` depending on the state of `result_ok`.
15018         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
15019         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
15020         pub result_ok: bool,
15021 }
15022 #[no_mangle]
15023 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15024 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
15025         CResult_UpdateFailHTLCDecodeErrorZ {
15026                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15027                         result: Box::into_raw(Box::new(o)),
15028                 },
15029                 result_ok: true,
15030         }
15031 }
15032 #[no_mangle]
15033 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15034 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
15035         CResult_UpdateFailHTLCDecodeErrorZ {
15036                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15037                         err: Box::into_raw(Box::new(e)),
15038                 },
15039                 result_ok: false,
15040         }
15041 }
15042 /// Checks if the given object is currently in the success state
15043 #[no_mangle]
15044 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
15045         o.result_ok
15046 }
15047 #[no_mangle]
15048 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15049 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
15050 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
15051         fn drop(&mut self) {
15052                 if self.result_ok {
15053                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15054                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15055                         }
15056                 } else {
15057                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15058                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15059                         }
15060                 }
15061         }
15062 }
15063 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
15064         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15065                 let contents = if o.result_ok {
15066                         let result = unsafe { o.contents.result };
15067                         unsafe { o.contents.result = core::ptr::null_mut() };
15068                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
15069                 } else {
15070                         let err = unsafe { o.contents.err };
15071                         unsafe { o.contents.err = core::ptr::null_mut(); }
15072                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
15073                 };
15074                 Self {
15075                         contents,
15076                         result_ok: o.result_ok,
15077                 }
15078         }
15079 }
15080 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
15081         fn clone(&self) -> Self {
15082                 if self.result_ok {
15083                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15084                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
15085                         } }
15086                 } else {
15087                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
15088                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15089                         } }
15090                 }
15091         }
15092 }
15093 #[no_mangle]
15094 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15095 /// but with all dynamically-allocated buffers duplicated in new buffers.
15096 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
15097 #[repr(C)]
15098 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
15099 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15100         /// A pointer to the contents in the success state.
15101         /// Reading from this pointer when `result_ok` is not set is undefined.
15102         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15103         /// A pointer to the contents in the error state.
15104         /// Reading from this pointer when `result_ok` is set is undefined.
15105         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15106 }
15107 #[repr(C)]
15108 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
15109 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15111 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15112         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
15113         /// `err` or `result` depending on the state of `result_ok`.
15114         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
15115         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
15116         pub result_ok: bool,
15117 }
15118 #[no_mangle]
15119 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15120 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15121         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15122                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15123                         result: Box::into_raw(Box::new(o)),
15124                 },
15125                 result_ok: true,
15126         }
15127 }
15128 #[no_mangle]
15129 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15130 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15131         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15132                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15133                         err: Box::into_raw(Box::new(e)),
15134                 },
15135                 result_ok: false,
15136         }
15137 }
15138 /// Checks if the given object is currently in the success state
15139 #[no_mangle]
15140 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
15141         o.result_ok
15142 }
15143 #[no_mangle]
15144 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15145 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
15146 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15147         fn drop(&mut self) {
15148                 if self.result_ok {
15149                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15150                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15151                         }
15152                 } else {
15153                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15154                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15155                         }
15156                 }
15157         }
15158 }
15159 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15160         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15161                 let contents = if o.result_ok {
15162                         let result = unsafe { o.contents.result };
15163                         unsafe { o.contents.result = core::ptr::null_mut() };
15164                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
15165                 } else {
15166                         let err = unsafe { o.contents.err };
15167                         unsafe { o.contents.err = core::ptr::null_mut(); }
15168                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
15169                 };
15170                 Self {
15171                         contents,
15172                         result_ok: o.result_ok,
15173                 }
15174         }
15175 }
15176 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
15177         fn clone(&self) -> Self {
15178                 if self.result_ok {
15179                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15180                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
15181                         } }
15182                 } else {
15183                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
15184                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15185                         } }
15186                 }
15187         }
15188 }
15189 #[no_mangle]
15190 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15191 /// but with all dynamically-allocated buffers duplicated in new buffers.
15192 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
15193 #[repr(C)]
15194 /// The contents of CResult_UpdateFeeDecodeErrorZ
15195 pub union CResult_UpdateFeeDecodeErrorZPtr {
15196         /// A pointer to the contents in the success state.
15197         /// Reading from this pointer when `result_ok` is not set is undefined.
15198         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
15199         /// A pointer to the contents in the error state.
15200         /// Reading from this pointer when `result_ok` is set is undefined.
15201         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15202 }
15203 #[repr(C)]
15204 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
15205 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
15206 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15207 pub struct CResult_UpdateFeeDecodeErrorZ {
15208         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
15209         /// `err` or `result` depending on the state of `result_ok`.
15210         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
15211         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
15212         pub result_ok: bool,
15213 }
15214 #[no_mangle]
15215 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15216 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
15217         CResult_UpdateFeeDecodeErrorZ {
15218                 contents: CResult_UpdateFeeDecodeErrorZPtr {
15219                         result: Box::into_raw(Box::new(o)),
15220                 },
15221                 result_ok: true,
15222         }
15223 }
15224 #[no_mangle]
15225 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15226 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
15227         CResult_UpdateFeeDecodeErrorZ {
15228                 contents: CResult_UpdateFeeDecodeErrorZPtr {
15229                         err: Box::into_raw(Box::new(e)),
15230                 },
15231                 result_ok: false,
15232         }
15233 }
15234 /// Checks if the given object is currently in the success state
15235 #[no_mangle]
15236 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
15237         o.result_ok
15238 }
15239 #[no_mangle]
15240 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15241 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
15242 impl Drop for CResult_UpdateFeeDecodeErrorZ {
15243         fn drop(&mut self) {
15244                 if self.result_ok {
15245                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15246                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15247                         }
15248                 } else {
15249                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15250                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15251                         }
15252                 }
15253         }
15254 }
15255 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
15256         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
15257                 let contents = if o.result_ok {
15258                         let result = unsafe { o.contents.result };
15259                         unsafe { o.contents.result = core::ptr::null_mut() };
15260                         CResult_UpdateFeeDecodeErrorZPtr { result }
15261                 } else {
15262                         let err = unsafe { o.contents.err };
15263                         unsafe { o.contents.err = core::ptr::null_mut(); }
15264                         CResult_UpdateFeeDecodeErrorZPtr { err }
15265                 };
15266                 Self {
15267                         contents,
15268                         result_ok: o.result_ok,
15269                 }
15270         }
15271 }
15272 impl Clone for CResult_UpdateFeeDecodeErrorZ {
15273         fn clone(&self) -> Self {
15274                 if self.result_ok {
15275                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
15276                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
15277                         } }
15278                 } else {
15279                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
15280                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15281                         } }
15282                 }
15283         }
15284 }
15285 #[no_mangle]
15286 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15287 /// but with all dynamically-allocated buffers duplicated in new buffers.
15288 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
15289 #[repr(C)]
15290 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
15291 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15292         /// A pointer to the contents in the success state.
15293         /// Reading from this pointer when `result_ok` is not set is undefined.
15294         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15295         /// A pointer to the contents in the error state.
15296         /// Reading from this pointer when `result_ok` is set is undefined.
15297         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15298 }
15299 #[repr(C)]
15300 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
15301 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15302 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15303 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
15304         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
15305         /// `err` or `result` depending on the state of `result_ok`.
15306         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
15307         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
15308         pub result_ok: bool,
15309 }
15310 #[no_mangle]
15311 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15312 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15313         CResult_UpdateFulfillHTLCDecodeErrorZ {
15314                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15315                         result: Box::into_raw(Box::new(o)),
15316                 },
15317                 result_ok: true,
15318         }
15319 }
15320 #[no_mangle]
15321 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15322 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
15323         CResult_UpdateFulfillHTLCDecodeErrorZ {
15324                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15325                         err: Box::into_raw(Box::new(e)),
15326                 },
15327                 result_ok: false,
15328         }
15329 }
15330 /// Checks if the given object is currently in the success state
15331 #[no_mangle]
15332 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
15333         o.result_ok
15334 }
15335 #[no_mangle]
15336 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15337 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
15338 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
15339         fn drop(&mut self) {
15340                 if self.result_ok {
15341                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15342                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15343                         }
15344                 } else {
15345                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15346                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15347                         }
15348                 }
15349         }
15350 }
15351 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
15352         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15353                 let contents = if o.result_ok {
15354                         let result = unsafe { o.contents.result };
15355                         unsafe { o.contents.result = core::ptr::null_mut() };
15356                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
15357                 } else {
15358                         let err = unsafe { o.contents.err };
15359                         unsafe { o.contents.err = core::ptr::null_mut(); }
15360                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
15361                 };
15362                 Self {
15363                         contents,
15364                         result_ok: o.result_ok,
15365                 }
15366         }
15367 }
15368 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
15369         fn clone(&self) -> Self {
15370                 if self.result_ok {
15371                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15372                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
15373                         } }
15374                 } else {
15375                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
15376                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15377                         } }
15378                 }
15379         }
15380 }
15381 #[no_mangle]
15382 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15383 /// but with all dynamically-allocated buffers duplicated in new buffers.
15384 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
15385 #[repr(C)]
15386 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
15387 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
15388         /// A pointer to the contents in the success state.
15389         /// Reading from this pointer when `result_ok` is not set is undefined.
15390         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15391         /// A pointer to the contents in the error state.
15392         /// Reading from this pointer when `result_ok` is set is undefined.
15393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15394 }
15395 #[repr(C)]
15396 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15397 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15399 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
15400         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15401         /// `err` or `result` depending on the state of `result_ok`.
15402         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
15403         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15404         pub result_ok: bool,
15405 }
15406 #[no_mangle]
15407 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15408 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
15409         CResult_UpdateAddHTLCDecodeErrorZ {
15410                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15411                         result: Box::into_raw(Box::new(o)),
15412                 },
15413                 result_ok: true,
15414         }
15415 }
15416 #[no_mangle]
15417 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15418 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
15419         CResult_UpdateAddHTLCDecodeErrorZ {
15420                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15421                         err: Box::into_raw(Box::new(e)),
15422                 },
15423                 result_ok: false,
15424         }
15425 }
15426 /// Checks if the given object is currently in the success state
15427 #[no_mangle]
15428 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
15429         o.result_ok
15430 }
15431 #[no_mangle]
15432 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15433 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
15434 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
15435         fn drop(&mut self) {
15436                 if self.result_ok {
15437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15439                         }
15440                 } else {
15441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15443                         }
15444                 }
15445         }
15446 }
15447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
15448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15449                 let contents = if o.result_ok {
15450                         let result = unsafe { o.contents.result };
15451                         unsafe { o.contents.result = core::ptr::null_mut() };
15452                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
15453                 } else {
15454                         let err = unsafe { o.contents.err };
15455                         unsafe { o.contents.err = core::ptr::null_mut(); }
15456                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
15457                 };
15458                 Self {
15459                         contents,
15460                         result_ok: o.result_ok,
15461                 }
15462         }
15463 }
15464 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
15465         fn clone(&self) -> Self {
15466                 if self.result_ok {
15467                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15468                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
15469                         } }
15470                 } else {
15471                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15472                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15473                         } }
15474                 }
15475         }
15476 }
15477 #[no_mangle]
15478 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15479 /// but with all dynamically-allocated buffers duplicated in new buffers.
15480 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
15481 #[repr(C)]
15482 /// The contents of CResult_OnionMessageDecodeErrorZ
15483 pub union CResult_OnionMessageDecodeErrorZPtr {
15484         /// A pointer to the contents in the success state.
15485         /// Reading from this pointer when `result_ok` is not set is undefined.
15486         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
15487         /// A pointer to the contents in the error state.
15488         /// Reading from this pointer when `result_ok` is set is undefined.
15489         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15490 }
15491 #[repr(C)]
15492 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15493 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15495 pub struct CResult_OnionMessageDecodeErrorZ {
15496         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15497         /// `err` or `result` depending on the state of `result_ok`.
15498         pub contents: CResult_OnionMessageDecodeErrorZPtr,
15499         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15500         pub result_ok: bool,
15501 }
15502 #[no_mangle]
15503 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
15504 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
15505         CResult_OnionMessageDecodeErrorZ {
15506                 contents: CResult_OnionMessageDecodeErrorZPtr {
15507                         result: Box::into_raw(Box::new(o)),
15508                 },
15509                 result_ok: true,
15510         }
15511 }
15512 #[no_mangle]
15513 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
15514 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
15515         CResult_OnionMessageDecodeErrorZ {
15516                 contents: CResult_OnionMessageDecodeErrorZPtr {
15517                         err: Box::into_raw(Box::new(e)),
15518                 },
15519                 result_ok: false,
15520         }
15521 }
15522 /// Checks if the given object is currently in the success state
15523 #[no_mangle]
15524 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
15525         o.result_ok
15526 }
15527 #[no_mangle]
15528 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
15529 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
15530 impl Drop for CResult_OnionMessageDecodeErrorZ {
15531         fn drop(&mut self) {
15532                 if self.result_ok {
15533                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15534                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15535                         }
15536                 } else {
15537                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15538                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15539                         }
15540                 }
15541         }
15542 }
15543 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
15544         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15545                 let contents = if o.result_ok {
15546                         let result = unsafe { o.contents.result };
15547                         unsafe { o.contents.result = core::ptr::null_mut() };
15548                         CResult_OnionMessageDecodeErrorZPtr { result }
15549                 } else {
15550                         let err = unsafe { o.contents.err };
15551                         unsafe { o.contents.err = core::ptr::null_mut(); }
15552                         CResult_OnionMessageDecodeErrorZPtr { err }
15553                 };
15554                 Self {
15555                         contents,
15556                         result_ok: o.result_ok,
15557                 }
15558         }
15559 }
15560 impl Clone for CResult_OnionMessageDecodeErrorZ {
15561         fn clone(&self) -> Self {
15562                 if self.result_ok {
15563                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
15564                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
15565                         } }
15566                 } else {
15567                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
15568                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15569                         } }
15570                 }
15571         }
15572 }
15573 #[no_mangle]
15574 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
15575 /// but with all dynamically-allocated buffers duplicated in new buffers.
15576 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
15577 #[repr(C)]
15578 /// The contents of CResult_PingDecodeErrorZ
15579 pub union CResult_PingDecodeErrorZPtr {
15580         /// A pointer to the contents in the success state.
15581         /// Reading from this pointer when `result_ok` is not set is undefined.
15582         pub result: *mut crate::lightning::ln::msgs::Ping,
15583         /// A pointer to the contents in the error state.
15584         /// Reading from this pointer when `result_ok` is set is undefined.
15585         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15586 }
15587 #[repr(C)]
15588 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15589 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15591 pub struct CResult_PingDecodeErrorZ {
15592         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
15593         /// `err` or `result` depending on the state of `result_ok`.
15594         pub contents: CResult_PingDecodeErrorZPtr,
15595         /// Whether this CResult_PingDecodeErrorZ represents a success state.
15596         pub result_ok: bool,
15597 }
15598 #[no_mangle]
15599 /// Creates a new CResult_PingDecodeErrorZ in the success state.
15600 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
15601         CResult_PingDecodeErrorZ {
15602                 contents: CResult_PingDecodeErrorZPtr {
15603                         result: Box::into_raw(Box::new(o)),
15604                 },
15605                 result_ok: true,
15606         }
15607 }
15608 #[no_mangle]
15609 /// Creates a new CResult_PingDecodeErrorZ in the error state.
15610 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
15611         CResult_PingDecodeErrorZ {
15612                 contents: CResult_PingDecodeErrorZPtr {
15613                         err: Box::into_raw(Box::new(e)),
15614                 },
15615                 result_ok: false,
15616         }
15617 }
15618 /// Checks if the given object is currently in the success state
15619 #[no_mangle]
15620 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
15621         o.result_ok
15622 }
15623 #[no_mangle]
15624 /// Frees any resources used by the CResult_PingDecodeErrorZ.
15625 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
15626 impl Drop for CResult_PingDecodeErrorZ {
15627         fn drop(&mut self) {
15628                 if self.result_ok {
15629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15631                         }
15632                 } else {
15633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15635                         }
15636                 }
15637         }
15638 }
15639 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15640         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15641                 let contents = if o.result_ok {
15642                         let result = unsafe { o.contents.result };
15643                         unsafe { o.contents.result = core::ptr::null_mut() };
15644                         CResult_PingDecodeErrorZPtr { result }
15645                 } else {
15646                         let err = unsafe { o.contents.err };
15647                         unsafe { o.contents.err = core::ptr::null_mut(); }
15648                         CResult_PingDecodeErrorZPtr { err }
15649                 };
15650                 Self {
15651                         contents,
15652                         result_ok: o.result_ok,
15653                 }
15654         }
15655 }
15656 impl Clone for CResult_PingDecodeErrorZ {
15657         fn clone(&self) -> Self {
15658                 if self.result_ok {
15659                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15660                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15661                         } }
15662                 } else {
15663                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15664                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15665                         } }
15666                 }
15667         }
15668 }
15669 #[no_mangle]
15670 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15671 /// but with all dynamically-allocated buffers duplicated in new buffers.
15672 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15673 #[repr(C)]
15674 /// The contents of CResult_PongDecodeErrorZ
15675 pub union CResult_PongDecodeErrorZPtr {
15676         /// A pointer to the contents in the success state.
15677         /// Reading from this pointer when `result_ok` is not set is undefined.
15678         pub result: *mut crate::lightning::ln::msgs::Pong,
15679         /// A pointer to the contents in the error state.
15680         /// Reading from this pointer when `result_ok` is set is undefined.
15681         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15682 }
15683 #[repr(C)]
15684 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15685 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15687 pub struct CResult_PongDecodeErrorZ {
15688         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15689         /// `err` or `result` depending on the state of `result_ok`.
15690         pub contents: CResult_PongDecodeErrorZPtr,
15691         /// Whether this CResult_PongDecodeErrorZ represents a success state.
15692         pub result_ok: bool,
15693 }
15694 #[no_mangle]
15695 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15696 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15697         CResult_PongDecodeErrorZ {
15698                 contents: CResult_PongDecodeErrorZPtr {
15699                         result: Box::into_raw(Box::new(o)),
15700                 },
15701                 result_ok: true,
15702         }
15703 }
15704 #[no_mangle]
15705 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15706 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15707         CResult_PongDecodeErrorZ {
15708                 contents: CResult_PongDecodeErrorZPtr {
15709                         err: Box::into_raw(Box::new(e)),
15710                 },
15711                 result_ok: false,
15712         }
15713 }
15714 /// Checks if the given object is currently in the success state
15715 #[no_mangle]
15716 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15717         o.result_ok
15718 }
15719 #[no_mangle]
15720 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15721 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15722 impl Drop for CResult_PongDecodeErrorZ {
15723         fn drop(&mut self) {
15724                 if self.result_ok {
15725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15727                         }
15728                 } else {
15729                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15730                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15731                         }
15732                 }
15733         }
15734 }
15735 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15736         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15737                 let contents = if o.result_ok {
15738                         let result = unsafe { o.contents.result };
15739                         unsafe { o.contents.result = core::ptr::null_mut() };
15740                         CResult_PongDecodeErrorZPtr { result }
15741                 } else {
15742                         let err = unsafe { o.contents.err };
15743                         unsafe { o.contents.err = core::ptr::null_mut(); }
15744                         CResult_PongDecodeErrorZPtr { err }
15745                 };
15746                 Self {
15747                         contents,
15748                         result_ok: o.result_ok,
15749                 }
15750         }
15751 }
15752 impl Clone for CResult_PongDecodeErrorZ {
15753         fn clone(&self) -> Self {
15754                 if self.result_ok {
15755                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15756                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15757                         } }
15758                 } else {
15759                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15760                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15761                         } }
15762                 }
15763         }
15764 }
15765 #[no_mangle]
15766 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15767 /// but with all dynamically-allocated buffers duplicated in new buffers.
15768 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15769 #[repr(C)]
15770 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15771 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15772         /// A pointer to the contents in the success state.
15773         /// Reading from this pointer when `result_ok` is not set is undefined.
15774         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15775         /// A pointer to the contents in the error state.
15776         /// Reading from this pointer when `result_ok` is set is undefined.
15777         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15778 }
15779 #[repr(C)]
15780 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15781 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15782 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15783 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15784         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15785         /// `err` or `result` depending on the state of `result_ok`.
15786         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15787         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15788         pub result_ok: bool,
15789 }
15790 #[no_mangle]
15791 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15792 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15793         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15794                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15795                         result: Box::into_raw(Box::new(o)),
15796                 },
15797                 result_ok: true,
15798         }
15799 }
15800 #[no_mangle]
15801 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15802 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15803         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15804                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15805                         err: Box::into_raw(Box::new(e)),
15806                 },
15807                 result_ok: false,
15808         }
15809 }
15810 /// Checks if the given object is currently in the success state
15811 #[no_mangle]
15812 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15813         o.result_ok
15814 }
15815 #[no_mangle]
15816 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15817 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15818 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15819         fn drop(&mut self) {
15820                 if self.result_ok {
15821                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15822                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15823                         }
15824                 } else {
15825                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15826                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15827                         }
15828                 }
15829         }
15830 }
15831 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15832         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15833                 let contents = if o.result_ok {
15834                         let result = unsafe { o.contents.result };
15835                         unsafe { o.contents.result = core::ptr::null_mut() };
15836                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15837                 } else {
15838                         let err = unsafe { o.contents.err };
15839                         unsafe { o.contents.err = core::ptr::null_mut(); }
15840                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15841                 };
15842                 Self {
15843                         contents,
15844                         result_ok: o.result_ok,
15845                 }
15846         }
15847 }
15848 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15849         fn clone(&self) -> Self {
15850                 if self.result_ok {
15851                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15852                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15853                         } }
15854                 } else {
15855                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15856                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15857                         } }
15858                 }
15859         }
15860 }
15861 #[no_mangle]
15862 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15863 /// but with all dynamically-allocated buffers duplicated in new buffers.
15864 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15865 #[repr(C)]
15866 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15867 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15868         /// A pointer to the contents in the success state.
15869         /// Reading from this pointer when `result_ok` is not set is undefined.
15870         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15871         /// A pointer to the contents in the error state.
15872         /// Reading from this pointer when `result_ok` is set is undefined.
15873         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15874 }
15875 #[repr(C)]
15876 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15877 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15879 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15880         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15881         /// `err` or `result` depending on the state of `result_ok`.
15882         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15883         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15884         pub result_ok: bool,
15885 }
15886 #[no_mangle]
15887 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15888 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15889         CResult_ChannelAnnouncementDecodeErrorZ {
15890                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15891                         result: Box::into_raw(Box::new(o)),
15892                 },
15893                 result_ok: true,
15894         }
15895 }
15896 #[no_mangle]
15897 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15898 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15899         CResult_ChannelAnnouncementDecodeErrorZ {
15900                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15901                         err: Box::into_raw(Box::new(e)),
15902                 },
15903                 result_ok: false,
15904         }
15905 }
15906 /// Checks if the given object is currently in the success state
15907 #[no_mangle]
15908 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15909         o.result_ok
15910 }
15911 #[no_mangle]
15912 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15913 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15914 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15915         fn drop(&mut self) {
15916                 if self.result_ok {
15917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15919                         }
15920                 } else {
15921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15923                         }
15924                 }
15925         }
15926 }
15927 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15928         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15929                 let contents = if o.result_ok {
15930                         let result = unsafe { o.contents.result };
15931                         unsafe { o.contents.result = core::ptr::null_mut() };
15932                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15933                 } else {
15934                         let err = unsafe { o.contents.err };
15935                         unsafe { o.contents.err = core::ptr::null_mut(); }
15936                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15937                 };
15938                 Self {
15939                         contents,
15940                         result_ok: o.result_ok,
15941                 }
15942         }
15943 }
15944 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15945         fn clone(&self) -> Self {
15946                 if self.result_ok {
15947                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15948                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15949                         } }
15950                 } else {
15951                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15952                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15953                         } }
15954                 }
15955         }
15956 }
15957 #[no_mangle]
15958 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15959 /// but with all dynamically-allocated buffers duplicated in new buffers.
15960 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15961 #[repr(C)]
15962 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15963 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15964         /// A pointer to the contents in the success state.
15965         /// Reading from this pointer when `result_ok` is not set is undefined.
15966         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15967         /// A pointer to the contents in the error state.
15968         /// Reading from this pointer when `result_ok` is set is undefined.
15969         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15970 }
15971 #[repr(C)]
15972 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15973 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15974 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15975 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15976         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15977         /// `err` or `result` depending on the state of `result_ok`.
15978         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15979         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15980         pub result_ok: bool,
15981 }
15982 #[no_mangle]
15983 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15984 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15985         CResult_UnsignedChannelUpdateDecodeErrorZ {
15986                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15987                         result: Box::into_raw(Box::new(o)),
15988                 },
15989                 result_ok: true,
15990         }
15991 }
15992 #[no_mangle]
15993 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15994 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15995         CResult_UnsignedChannelUpdateDecodeErrorZ {
15996                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15997                         err: Box::into_raw(Box::new(e)),
15998                 },
15999                 result_ok: false,
16000         }
16001 }
16002 /// Checks if the given object is currently in the success state
16003 #[no_mangle]
16004 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
16005         o.result_ok
16006 }
16007 #[no_mangle]
16008 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16009 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
16010 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
16011         fn drop(&mut self) {
16012                 if self.result_ok {
16013                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16014                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16015                         }
16016                 } else {
16017                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16018                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16019                         }
16020                 }
16021         }
16022 }
16023 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
16024         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16025                 let contents = if o.result_ok {
16026                         let result = unsafe { o.contents.result };
16027                         unsafe { o.contents.result = core::ptr::null_mut() };
16028                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
16029                 } else {
16030                         let err = unsafe { o.contents.err };
16031                         unsafe { o.contents.err = core::ptr::null_mut(); }
16032                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
16033                 };
16034                 Self {
16035                         contents,
16036                         result_ok: o.result_ok,
16037                 }
16038         }
16039 }
16040 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
16041         fn clone(&self) -> Self {
16042                 if self.result_ok {
16043                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16044                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
16045                         } }
16046                 } else {
16047                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
16048                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16049                         } }
16050                 }
16051         }
16052 }
16053 #[no_mangle]
16054 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16055 /// but with all dynamically-allocated buffers duplicated in new buffers.
16056 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16057 #[repr(C)]
16058 /// The contents of CResult_ChannelUpdateDecodeErrorZ
16059 pub union CResult_ChannelUpdateDecodeErrorZPtr {
16060         /// A pointer to the contents in the success state.
16061         /// Reading from this pointer when `result_ok` is not set is undefined.
16062         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
16063         /// A pointer to the contents in the error state.
16064         /// Reading from this pointer when `result_ok` is set is undefined.
16065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16066 }
16067 #[repr(C)]
16068 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
16069 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
16070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16071 pub struct CResult_ChannelUpdateDecodeErrorZ {
16072         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
16073         /// `err` or `result` depending on the state of `result_ok`.
16074         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
16075         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
16076         pub result_ok: bool,
16077 }
16078 #[no_mangle]
16079 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16080 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
16081         CResult_ChannelUpdateDecodeErrorZ {
16082                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16083                         result: Box::into_raw(Box::new(o)),
16084                 },
16085                 result_ok: true,
16086         }
16087 }
16088 #[no_mangle]
16089 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16090 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
16091         CResult_ChannelUpdateDecodeErrorZ {
16092                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
16093                         err: Box::into_raw(Box::new(e)),
16094                 },
16095                 result_ok: false,
16096         }
16097 }
16098 /// Checks if the given object is currently in the success state
16099 #[no_mangle]
16100 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
16101         o.result_ok
16102 }
16103 #[no_mangle]
16104 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16105 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
16106 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
16107         fn drop(&mut self) {
16108                 if self.result_ok {
16109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16111                         }
16112                 } else {
16113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16115                         }
16116                 }
16117         }
16118 }
16119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
16120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
16121                 let contents = if o.result_ok {
16122                         let result = unsafe { o.contents.result };
16123                         unsafe { o.contents.result = core::ptr::null_mut() };
16124                         CResult_ChannelUpdateDecodeErrorZPtr { result }
16125                 } else {
16126                         let err = unsafe { o.contents.err };
16127                         unsafe { o.contents.err = core::ptr::null_mut(); }
16128                         CResult_ChannelUpdateDecodeErrorZPtr { err }
16129                 };
16130                 Self {
16131                         contents,
16132                         result_ok: o.result_ok,
16133                 }
16134         }
16135 }
16136 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
16137         fn clone(&self) -> Self {
16138                 if self.result_ok {
16139                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16140                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
16141                         } }
16142                 } else {
16143                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
16144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16145                         } }
16146                 }
16147         }
16148 }
16149 #[no_mangle]
16150 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16151 /// but with all dynamically-allocated buffers duplicated in new buffers.
16152 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
16153 #[repr(C)]
16154 /// The contents of CResult_ErrorMessageDecodeErrorZ
16155 pub union CResult_ErrorMessageDecodeErrorZPtr {
16156         /// A pointer to the contents in the success state.
16157         /// Reading from this pointer when `result_ok` is not set is undefined.
16158         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
16159         /// A pointer to the contents in the error state.
16160         /// Reading from this pointer when `result_ok` is set is undefined.
16161         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16162 }
16163 #[repr(C)]
16164 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
16165 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16167 pub struct CResult_ErrorMessageDecodeErrorZ {
16168         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
16169         /// `err` or `result` depending on the state of `result_ok`.
16170         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
16171         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
16172         pub result_ok: bool,
16173 }
16174 #[no_mangle]
16175 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16176 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
16177         CResult_ErrorMessageDecodeErrorZ {
16178                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16179                         result: Box::into_raw(Box::new(o)),
16180                 },
16181                 result_ok: true,
16182         }
16183 }
16184 #[no_mangle]
16185 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16186 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
16187         CResult_ErrorMessageDecodeErrorZ {
16188                 contents: CResult_ErrorMessageDecodeErrorZPtr {
16189                         err: Box::into_raw(Box::new(e)),
16190                 },
16191                 result_ok: false,
16192         }
16193 }
16194 /// Checks if the given object is currently in the success state
16195 #[no_mangle]
16196 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
16197         o.result_ok
16198 }
16199 #[no_mangle]
16200 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16201 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
16202 impl Drop for CResult_ErrorMessageDecodeErrorZ {
16203         fn drop(&mut self) {
16204                 if self.result_ok {
16205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16207                         }
16208                 } else {
16209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16211                         }
16212                 }
16213         }
16214 }
16215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
16216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16217                 let contents = if o.result_ok {
16218                         let result = unsafe { o.contents.result };
16219                         unsafe { o.contents.result = core::ptr::null_mut() };
16220                         CResult_ErrorMessageDecodeErrorZPtr { result }
16221                 } else {
16222                         let err = unsafe { o.contents.err };
16223                         unsafe { o.contents.err = core::ptr::null_mut(); }
16224                         CResult_ErrorMessageDecodeErrorZPtr { err }
16225                 };
16226                 Self {
16227                         contents,
16228                         result_ok: o.result_ok,
16229                 }
16230         }
16231 }
16232 impl Clone for CResult_ErrorMessageDecodeErrorZ {
16233         fn clone(&self) -> Self {
16234                 if self.result_ok {
16235                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
16236                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
16237                         } }
16238                 } else {
16239                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
16240                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16241                         } }
16242                 }
16243         }
16244 }
16245 #[no_mangle]
16246 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16247 /// but with all dynamically-allocated buffers duplicated in new buffers.
16248 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
16249 #[repr(C)]
16250 /// The contents of CResult_WarningMessageDecodeErrorZ
16251 pub union CResult_WarningMessageDecodeErrorZPtr {
16252         /// A pointer to the contents in the success state.
16253         /// Reading from this pointer when `result_ok` is not set is undefined.
16254         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
16255         /// A pointer to the contents in the error state.
16256         /// Reading from this pointer when `result_ok` is set is undefined.
16257         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16258 }
16259 #[repr(C)]
16260 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
16261 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
16262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16263 pub struct CResult_WarningMessageDecodeErrorZ {
16264         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
16265         /// `err` or `result` depending on the state of `result_ok`.
16266         pub contents: CResult_WarningMessageDecodeErrorZPtr,
16267         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
16268         pub result_ok: bool,
16269 }
16270 #[no_mangle]
16271 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16272 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
16273         CResult_WarningMessageDecodeErrorZ {
16274                 contents: CResult_WarningMessageDecodeErrorZPtr {
16275                         result: Box::into_raw(Box::new(o)),
16276                 },
16277                 result_ok: true,
16278         }
16279 }
16280 #[no_mangle]
16281 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16282 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
16283         CResult_WarningMessageDecodeErrorZ {
16284                 contents: CResult_WarningMessageDecodeErrorZPtr {
16285                         err: Box::into_raw(Box::new(e)),
16286                 },
16287                 result_ok: false,
16288         }
16289 }
16290 /// Checks if the given object is currently in the success state
16291 #[no_mangle]
16292 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
16293         o.result_ok
16294 }
16295 #[no_mangle]
16296 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16297 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
16298 impl Drop for CResult_WarningMessageDecodeErrorZ {
16299         fn drop(&mut self) {
16300                 if self.result_ok {
16301                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16302                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16303                         }
16304                 } else {
16305                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16306                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16307                         }
16308                 }
16309         }
16310 }
16311 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
16312         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
16313                 let contents = if o.result_ok {
16314                         let result = unsafe { o.contents.result };
16315                         unsafe { o.contents.result = core::ptr::null_mut() };
16316                         CResult_WarningMessageDecodeErrorZPtr { result }
16317                 } else {
16318                         let err = unsafe { o.contents.err };
16319                         unsafe { o.contents.err = core::ptr::null_mut(); }
16320                         CResult_WarningMessageDecodeErrorZPtr { err }
16321                 };
16322                 Self {
16323                         contents,
16324                         result_ok: o.result_ok,
16325                 }
16326         }
16327 }
16328 impl Clone for CResult_WarningMessageDecodeErrorZ {
16329         fn clone(&self) -> Self {
16330                 if self.result_ok {
16331                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
16332                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
16333                         } }
16334                 } else {
16335                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
16336                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16337                         } }
16338                 }
16339         }
16340 }
16341 #[no_mangle]
16342 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16343 /// but with all dynamically-allocated buffers duplicated in new buffers.
16344 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
16345 #[repr(C)]
16346 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
16347 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16348         /// A pointer to the contents in the success state.
16349         /// Reading from this pointer when `result_ok` is not set is undefined.
16350         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
16351         /// A pointer to the contents in the error state.
16352         /// Reading from this pointer when `result_ok` is set is undefined.
16353         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16354 }
16355 #[repr(C)]
16356 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16357 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16359 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16360         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
16361         /// `err` or `result` depending on the state of `result_ok`.
16362         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
16363         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
16364         pub result_ok: bool,
16365 }
16366 #[no_mangle]
16367 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16368 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16369         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16370                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16371                         result: Box::into_raw(Box::new(o)),
16372                 },
16373                 result_ok: true,
16374         }
16375 }
16376 #[no_mangle]
16377 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16378 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16379         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16380                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16381                         err: Box::into_raw(Box::new(e)),
16382                 },
16383                 result_ok: false,
16384         }
16385 }
16386 /// Checks if the given object is currently in the success state
16387 #[no_mangle]
16388 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
16389         o.result_ok
16390 }
16391 #[no_mangle]
16392 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16393 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
16394 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16395         fn drop(&mut self) {
16396                 if self.result_ok {
16397                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16398                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16399                         }
16400                 } else {
16401                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16402                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16403                         }
16404                 }
16405         }
16406 }
16407 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16408         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16409                 let contents = if o.result_ok {
16410                         let result = unsafe { o.contents.result };
16411                         unsafe { o.contents.result = core::ptr::null_mut() };
16412                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
16413                 } else {
16414                         let err = unsafe { o.contents.err };
16415                         unsafe { o.contents.err = core::ptr::null_mut(); }
16416                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
16417                 };
16418                 Self {
16419                         contents,
16420                         result_ok: o.result_ok,
16421                 }
16422         }
16423 }
16424 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16425         fn clone(&self) -> Self {
16426                 if self.result_ok {
16427                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16428                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16429                         } }
16430                 } else {
16431                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16432                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16433                         } }
16434                 }
16435         }
16436 }
16437 #[no_mangle]
16438 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16439 /// but with all dynamically-allocated buffers duplicated in new buffers.
16440 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16441 #[repr(C)]
16442 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
16443 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
16444         /// A pointer to the contents in the success state.
16445         /// Reading from this pointer when `result_ok` is not set is undefined.
16446         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
16447         /// A pointer to the contents in the error state.
16448         /// Reading from this pointer when `result_ok` is set is undefined.
16449         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16450 }
16451 #[repr(C)]
16452 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16453 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16455 pub struct CResult_NodeAnnouncementDecodeErrorZ {
16456         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16457         /// `err` or `result` depending on the state of `result_ok`.
16458         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
16459         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16460         pub result_ok: bool,
16461 }
16462 #[no_mangle]
16463 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16464 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
16465         CResult_NodeAnnouncementDecodeErrorZ {
16466                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16467                         result: Box::into_raw(Box::new(o)),
16468                 },
16469                 result_ok: true,
16470         }
16471 }
16472 #[no_mangle]
16473 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16474 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
16475         CResult_NodeAnnouncementDecodeErrorZ {
16476                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16477                         err: Box::into_raw(Box::new(e)),
16478                 },
16479                 result_ok: false,
16480         }
16481 }
16482 /// Checks if the given object is currently in the success state
16483 #[no_mangle]
16484 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
16485         o.result_ok
16486 }
16487 #[no_mangle]
16488 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16489 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
16490 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
16491         fn drop(&mut self) {
16492                 if self.result_ok {
16493                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16494                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16495                         }
16496                 } else {
16497                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16498                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16499                         }
16500                 }
16501         }
16502 }
16503 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
16504         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16505                 let contents = if o.result_ok {
16506                         let result = unsafe { o.contents.result };
16507                         unsafe { o.contents.result = core::ptr::null_mut() };
16508                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
16509                 } else {
16510                         let err = unsafe { o.contents.err };
16511                         unsafe { o.contents.err = core::ptr::null_mut(); }
16512                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
16513                 };
16514                 Self {
16515                         contents,
16516                         result_ok: o.result_ok,
16517                 }
16518         }
16519 }
16520 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
16521         fn clone(&self) -> Self {
16522                 if self.result_ok {
16523                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16524                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16525                         } }
16526                 } else {
16527                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16528                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16529                         } }
16530                 }
16531         }
16532 }
16533 #[no_mangle]
16534 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16535 /// but with all dynamically-allocated buffers duplicated in new buffers.
16536 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16537 #[repr(C)]
16538 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
16539 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
16540         /// A pointer to the contents in the success state.
16541         /// Reading from this pointer when `result_ok` is not set is undefined.
16542         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
16543         /// A pointer to the contents in the error state.
16544         /// Reading from this pointer when `result_ok` is set is undefined.
16545         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16546 }
16547 #[repr(C)]
16548 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
16549 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
16550 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16551 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
16552         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
16553         /// `err` or `result` depending on the state of `result_ok`.
16554         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
16555         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
16556         pub result_ok: bool,
16557 }
16558 #[no_mangle]
16559 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16560 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16561         CResult_QueryShortChannelIdsDecodeErrorZ {
16562                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16563                         result: Box::into_raw(Box::new(o)),
16564                 },
16565                 result_ok: true,
16566         }
16567 }
16568 #[no_mangle]
16569 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16570 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16571         CResult_QueryShortChannelIdsDecodeErrorZ {
16572                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16573                         err: Box::into_raw(Box::new(e)),
16574                 },
16575                 result_ok: false,
16576         }
16577 }
16578 /// Checks if the given object is currently in the success state
16579 #[no_mangle]
16580 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
16581         o.result_ok
16582 }
16583 #[no_mangle]
16584 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16585 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
16586 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
16587         fn drop(&mut self) {
16588                 if self.result_ok {
16589                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16590                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16591                         }
16592                 } else {
16593                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16594                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16595                         }
16596                 }
16597         }
16598 }
16599 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
16600         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
16601                 let contents = if o.result_ok {
16602                         let result = unsafe { o.contents.result };
16603                         unsafe { o.contents.result = core::ptr::null_mut() };
16604                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
16605                 } else {
16606                         let err = unsafe { o.contents.err };
16607                         unsafe { o.contents.err = core::ptr::null_mut(); }
16608                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
16609                 };
16610                 Self {
16611                         contents,
16612                         result_ok: o.result_ok,
16613                 }
16614         }
16615 }
16616 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
16617         fn clone(&self) -> Self {
16618                 if self.result_ok {
16619                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16620                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
16621                         } }
16622                 } else {
16623                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16624                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16625                         } }
16626                 }
16627         }
16628 }
16629 #[no_mangle]
16630 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16631 /// but with all dynamically-allocated buffers duplicated in new buffers.
16632 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16633 #[repr(C)]
16634 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16635 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16636         /// A pointer to the contents in the success state.
16637         /// Reading from this pointer when `result_ok` is not set is undefined.
16638         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16639         /// A pointer to the contents in the error state.
16640         /// Reading from this pointer when `result_ok` is set is undefined.
16641         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16642 }
16643 #[repr(C)]
16644 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16645 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16646 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16647 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16648         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16649         /// `err` or `result` depending on the state of `result_ok`.
16650         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16651         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16652         pub result_ok: bool,
16653 }
16654 #[no_mangle]
16655 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16656 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16657         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16658                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16659                         result: Box::into_raw(Box::new(o)),
16660                 },
16661                 result_ok: true,
16662         }
16663 }
16664 #[no_mangle]
16665 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16666 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16667         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16668                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16669                         err: Box::into_raw(Box::new(e)),
16670                 },
16671                 result_ok: false,
16672         }
16673 }
16674 /// Checks if the given object is currently in the success state
16675 #[no_mangle]
16676 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16677         o.result_ok
16678 }
16679 #[no_mangle]
16680 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16681 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16682 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16683         fn drop(&mut self) {
16684                 if self.result_ok {
16685                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16686                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16687                         }
16688                 } else {
16689                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16690                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16691                         }
16692                 }
16693         }
16694 }
16695 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16696         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16697                 let contents = if o.result_ok {
16698                         let result = unsafe { o.contents.result };
16699                         unsafe { o.contents.result = core::ptr::null_mut() };
16700                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16701                 } else {
16702                         let err = unsafe { o.contents.err };
16703                         unsafe { o.contents.err = core::ptr::null_mut(); }
16704                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16705                 };
16706                 Self {
16707                         contents,
16708                         result_ok: o.result_ok,
16709                 }
16710         }
16711 }
16712 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16713         fn clone(&self) -> Self {
16714                 if self.result_ok {
16715                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16716                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16717                         } }
16718                 } else {
16719                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16720                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16721                         } }
16722                 }
16723         }
16724 }
16725 #[no_mangle]
16726 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16727 /// but with all dynamically-allocated buffers duplicated in new buffers.
16728 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16729 #[repr(C)]
16730 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16731 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16732         /// A pointer to the contents in the success state.
16733         /// Reading from this pointer when `result_ok` is not set is undefined.
16734         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16735         /// A pointer to the contents in the error state.
16736         /// Reading from this pointer when `result_ok` is set is undefined.
16737         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16738 }
16739 #[repr(C)]
16740 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16741 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16743 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16744         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16745         /// `err` or `result` depending on the state of `result_ok`.
16746         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16747         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16748         pub result_ok: bool,
16749 }
16750 #[no_mangle]
16751 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16752 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16753         CResult_QueryChannelRangeDecodeErrorZ {
16754                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16755                         result: Box::into_raw(Box::new(o)),
16756                 },
16757                 result_ok: true,
16758         }
16759 }
16760 #[no_mangle]
16761 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16762 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16763         CResult_QueryChannelRangeDecodeErrorZ {
16764                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16765                         err: Box::into_raw(Box::new(e)),
16766                 },
16767                 result_ok: false,
16768         }
16769 }
16770 /// Checks if the given object is currently in the success state
16771 #[no_mangle]
16772 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16773         o.result_ok
16774 }
16775 #[no_mangle]
16776 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16777 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16778 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16779         fn drop(&mut self) {
16780                 if self.result_ok {
16781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16783                         }
16784                 } else {
16785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16787                         }
16788                 }
16789         }
16790 }
16791 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16792         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16793                 let contents = if o.result_ok {
16794                         let result = unsafe { o.contents.result };
16795                         unsafe { o.contents.result = core::ptr::null_mut() };
16796                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
16797                 } else {
16798                         let err = unsafe { o.contents.err };
16799                         unsafe { o.contents.err = core::ptr::null_mut(); }
16800                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
16801                 };
16802                 Self {
16803                         contents,
16804                         result_ok: o.result_ok,
16805                 }
16806         }
16807 }
16808 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16809         fn clone(&self) -> Self {
16810                 if self.result_ok {
16811                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16812                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16813                         } }
16814                 } else {
16815                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16816                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16817                         } }
16818                 }
16819         }
16820 }
16821 #[no_mangle]
16822 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16823 /// but with all dynamically-allocated buffers duplicated in new buffers.
16824 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16825 #[repr(C)]
16826 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16827 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16828         /// A pointer to the contents in the success state.
16829         /// Reading from this pointer when `result_ok` is not set is undefined.
16830         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16831         /// A pointer to the contents in the error state.
16832         /// Reading from this pointer when `result_ok` is set is undefined.
16833         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16834 }
16835 #[repr(C)]
16836 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16837 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16838 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16839 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16840         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16841         /// `err` or `result` depending on the state of `result_ok`.
16842         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16843         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16844         pub result_ok: bool,
16845 }
16846 #[no_mangle]
16847 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16848 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16849         CResult_ReplyChannelRangeDecodeErrorZ {
16850                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16851                         result: Box::into_raw(Box::new(o)),
16852                 },
16853                 result_ok: true,
16854         }
16855 }
16856 #[no_mangle]
16857 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16858 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16859         CResult_ReplyChannelRangeDecodeErrorZ {
16860                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16861                         err: Box::into_raw(Box::new(e)),
16862                 },
16863                 result_ok: false,
16864         }
16865 }
16866 /// Checks if the given object is currently in the success state
16867 #[no_mangle]
16868 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16869         o.result_ok
16870 }
16871 #[no_mangle]
16872 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16873 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16874 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16875         fn drop(&mut self) {
16876                 if self.result_ok {
16877                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16878                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16879                         }
16880                 } else {
16881                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16882                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16883                         }
16884                 }
16885         }
16886 }
16887 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16888         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16889                 let contents = if o.result_ok {
16890                         let result = unsafe { o.contents.result };
16891                         unsafe { o.contents.result = core::ptr::null_mut() };
16892                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16893                 } else {
16894                         let err = unsafe { o.contents.err };
16895                         unsafe { o.contents.err = core::ptr::null_mut(); }
16896                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16897                 };
16898                 Self {
16899                         contents,
16900                         result_ok: o.result_ok,
16901                 }
16902         }
16903 }
16904 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16905         fn clone(&self) -> Self {
16906                 if self.result_ok {
16907                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16908                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16909                         } }
16910                 } else {
16911                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16912                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16913                         } }
16914                 }
16915         }
16916 }
16917 #[no_mangle]
16918 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16919 /// but with all dynamically-allocated buffers duplicated in new buffers.
16920 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16921 #[repr(C)]
16922 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16923 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16924         /// A pointer to the contents in the success state.
16925         /// Reading from this pointer when `result_ok` is not set is undefined.
16926         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16927         /// A pointer to the contents in the error state.
16928         /// Reading from this pointer when `result_ok` is set is undefined.
16929         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16930 }
16931 #[repr(C)]
16932 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16933 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16934 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16935 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16936         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16937         /// `err` or `result` depending on the state of `result_ok`.
16938         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16939         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16940         pub result_ok: bool,
16941 }
16942 #[no_mangle]
16943 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16944 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16945         CResult_GossipTimestampFilterDecodeErrorZ {
16946                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16947                         result: Box::into_raw(Box::new(o)),
16948                 },
16949                 result_ok: true,
16950         }
16951 }
16952 #[no_mangle]
16953 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16954 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16955         CResult_GossipTimestampFilterDecodeErrorZ {
16956                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16957                         err: Box::into_raw(Box::new(e)),
16958                 },
16959                 result_ok: false,
16960         }
16961 }
16962 /// Checks if the given object is currently in the success state
16963 #[no_mangle]
16964 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16965         o.result_ok
16966 }
16967 #[no_mangle]
16968 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16969 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16970 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16971         fn drop(&mut self) {
16972                 if self.result_ok {
16973                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16974                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16975                         }
16976                 } else {
16977                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16978                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16979                         }
16980                 }
16981         }
16982 }
16983 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16984         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16985                 let contents = if o.result_ok {
16986                         let result = unsafe { o.contents.result };
16987                         unsafe { o.contents.result = core::ptr::null_mut() };
16988                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16989                 } else {
16990                         let err = unsafe { o.contents.err };
16991                         unsafe { o.contents.err = core::ptr::null_mut(); }
16992                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16993                 };
16994                 Self {
16995                         contents,
16996                         result_ok: o.result_ok,
16997                 }
16998         }
16999 }
17000 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
17001         fn clone(&self) -> Self {
17002                 if self.result_ok {
17003                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17004                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
17005                         } }
17006                 } else {
17007                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
17008                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17009                         } }
17010                 }
17011         }
17012 }
17013 #[no_mangle]
17014 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17015 /// but with all dynamically-allocated buffers duplicated in new buffers.
17016 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
17017 #[repr(C)]
17018 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
17019 /// This corresponds to std::vector in C++
17020 pub struct CVec_PhantomRouteHintsZ {
17021         /// The elements in the array.
17022         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17023         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
17024         /// The number of elements pointed to by `data`.
17025         pub datalen: usize
17026 }
17027 impl CVec_PhantomRouteHintsZ {
17028         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
17029                 if self.datalen == 0 { return Vec::new(); }
17030                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17031                 self.data = core::ptr::null_mut();
17032                 self.datalen = 0;
17033                 ret
17034         }
17035         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
17036                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17037         }
17038 }
17039 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
17040         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
17041                 let datalen = v.len();
17042                 let data = Box::into_raw(v.into_boxed_slice());
17043                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17044         }
17045 }
17046 #[no_mangle]
17047 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17048 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
17049 impl Drop for CVec_PhantomRouteHintsZ {
17050         fn drop(&mut self) {
17051                 if self.datalen == 0 { return; }
17052                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17053         }
17054 }
17055 impl Clone for CVec_PhantomRouteHintsZ {
17056         fn clone(&self) -> Self {
17057                 let mut res = Vec::new();
17058                 if self.datalen == 0 { return Self::from(res); }
17059                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17060                 Self::from(res)
17061         }
17062 }
17063 #[repr(C)]
17064 /// The contents of CResult_InvoiceSignOrCreationErrorZ
17065 pub union CResult_InvoiceSignOrCreationErrorZPtr {
17066         /// A pointer to the contents in the success state.
17067         /// Reading from this pointer when `result_ok` is not set is undefined.
17068         pub result: *mut crate::lightning_invoice::Invoice,
17069         /// A pointer to the contents in the error state.
17070         /// Reading from this pointer when `result_ok` is set is undefined.
17071         pub err: *mut crate::lightning_invoice::SignOrCreationError,
17072 }
17073 #[repr(C)]
17074 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
17075 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
17076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17077 pub struct CResult_InvoiceSignOrCreationErrorZ {
17078         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
17079         /// `err` or `result` depending on the state of `result_ok`.
17080         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
17081         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
17082         pub result_ok: bool,
17083 }
17084 #[no_mangle]
17085 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17086 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
17087         CResult_InvoiceSignOrCreationErrorZ {
17088                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17089                         result: Box::into_raw(Box::new(o)),
17090                 },
17091                 result_ok: true,
17092         }
17093 }
17094 #[no_mangle]
17095 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17096 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
17097         CResult_InvoiceSignOrCreationErrorZ {
17098                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
17099                         err: Box::into_raw(Box::new(e)),
17100                 },
17101                 result_ok: false,
17102         }
17103 }
17104 /// Checks if the given object is currently in the success state
17105 #[no_mangle]
17106 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
17107         o.result_ok
17108 }
17109 #[no_mangle]
17110 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17111 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
17112 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
17113         fn drop(&mut self) {
17114                 if self.result_ok {
17115                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17116                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17117                         }
17118                 } else {
17119                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17120                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17121                         }
17122                 }
17123         }
17124 }
17125 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
17126         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
17127                 let contents = if o.result_ok {
17128                         let result = unsafe { o.contents.result };
17129                         unsafe { o.contents.result = core::ptr::null_mut() };
17130                         CResult_InvoiceSignOrCreationErrorZPtr { result }
17131                 } else {
17132                         let err = unsafe { o.contents.err };
17133                         unsafe { o.contents.err = core::ptr::null_mut(); }
17134                         CResult_InvoiceSignOrCreationErrorZPtr { err }
17135                 };
17136                 Self {
17137                         contents,
17138                         result_ok: o.result_ok,
17139                 }
17140         }
17141 }
17142 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
17143         fn clone(&self) -> Self {
17144                 if self.result_ok {
17145                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17146                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
17147                         } }
17148                 } else {
17149                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
17150                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
17151                         } }
17152                 }
17153         }
17154 }
17155 #[no_mangle]
17156 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17157 /// but with all dynamically-allocated buffers duplicated in new buffers.
17158 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
17159 #[repr(C)]
17160 /// An enum which can either contain a crate::lightning::chain::Filter or not
17161 pub enum COption_FilterZ {
17162         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
17163         Some(crate::lightning::chain::Filter),
17164         /// When we're in this state, this COption_FilterZ contains nothing
17165         None
17166 }
17167 impl COption_FilterZ {
17168         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
17169                 if let Self::None = self { false } else { true }
17170         }
17171         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
17172                 !self.is_some()
17173         }
17174         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
17175                 if let Self::Some(v) = self { v } else { unreachable!() }
17176         }
17177 }
17178 #[no_mangle]
17179 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
17180 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
17181         COption_FilterZ::Some(o)
17182 }
17183 #[no_mangle]
17184 /// Constructs a new COption_FilterZ containing nothing
17185 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
17186         COption_FilterZ::None
17187 }
17188 #[no_mangle]
17189 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
17190 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
17191 #[repr(C)]
17192 /// The contents of CResult_LockedChannelMonitorNoneZ
17193 pub union CResult_LockedChannelMonitorNoneZPtr {
17194         /// A pointer to the contents in the success state.
17195         /// Reading from this pointer when `result_ok` is not set is undefined.
17196         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
17197         /// Note that this value is always NULL, as there are no contents in the Err variant
17198         pub err: *mut core::ffi::c_void,
17199 }
17200 #[repr(C)]
17201 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
17202 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
17203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17204 pub struct CResult_LockedChannelMonitorNoneZ {
17205         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
17206         /// `err` or `result` depending on the state of `result_ok`.
17207         pub contents: CResult_LockedChannelMonitorNoneZPtr,
17208         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
17209         pub result_ok: bool,
17210 }
17211 #[no_mangle]
17212 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
17213 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
17214         CResult_LockedChannelMonitorNoneZ {
17215                 contents: CResult_LockedChannelMonitorNoneZPtr {
17216                         result: Box::into_raw(Box::new(o)),
17217                 },
17218                 result_ok: true,
17219         }
17220 }
17221 #[no_mangle]
17222 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
17223 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
17224         CResult_LockedChannelMonitorNoneZ {
17225                 contents: CResult_LockedChannelMonitorNoneZPtr {
17226                         err: core::ptr::null_mut(),
17227                 },
17228                 result_ok: false,
17229         }
17230 }
17231 /// Checks if the given object is currently in the success state
17232 #[no_mangle]
17233 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
17234         o.result_ok
17235 }
17236 #[no_mangle]
17237 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
17238 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
17239 impl Drop for CResult_LockedChannelMonitorNoneZ {
17240         fn drop(&mut self) {
17241                 if self.result_ok {
17242                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17243                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17244                         }
17245                 } else {
17246                 }
17247         }
17248 }
17249 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
17250         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
17251                 let contents = if o.result_ok {
17252                         let result = unsafe { o.contents.result };
17253                         unsafe { o.contents.result = core::ptr::null_mut() };
17254                         CResult_LockedChannelMonitorNoneZPtr { result }
17255                 } else {
17256                         let _ = unsafe { Box::from_raw(o.contents.err) };
17257                         o.contents.err = core::ptr::null_mut();
17258                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
17259                 };
17260                 Self {
17261                         contents,
17262                         result_ok: o.result_ok,
17263                 }
17264         }
17265 }
17266 #[repr(C)]
17267 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
17268 /// This corresponds to std::vector in C++
17269 pub struct CVec_OutPointZ {
17270         /// The elements in the array.
17271         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17272         pub data: *mut crate::lightning::chain::transaction::OutPoint,
17273         /// The number of elements pointed to by `data`.
17274         pub datalen: usize
17275 }
17276 impl CVec_OutPointZ {
17277         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
17278                 if self.datalen == 0 { return Vec::new(); }
17279                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17280                 self.data = core::ptr::null_mut();
17281                 self.datalen = 0;
17282                 ret
17283         }
17284         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
17285                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17286         }
17287 }
17288 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
17289         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
17290                 let datalen = v.len();
17291                 let data = Box::into_raw(v.into_boxed_slice());
17292                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17293         }
17294 }
17295 #[no_mangle]
17296 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17297 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
17298 impl Drop for CVec_OutPointZ {
17299         fn drop(&mut self) {
17300                 if self.datalen == 0 { return; }
17301                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17302         }
17303 }
17304 impl Clone for CVec_OutPointZ {
17305         fn clone(&self) -> Self {
17306                 let mut res = Vec::new();
17307                 if self.datalen == 0 { return Self::from(res); }
17308                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17309                 Self::from(res)
17310         }
17311 }
17312 #[repr(C)]
17313 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
17314 /// This corresponds to std::vector in C++
17315 pub struct CVec_MonitorUpdateIdZ {
17316         /// The elements in the array.
17317         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17318         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
17319         /// The number of elements pointed to by `data`.
17320         pub datalen: usize
17321 }
17322 impl CVec_MonitorUpdateIdZ {
17323         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
17324                 if self.datalen == 0 { return Vec::new(); }
17325                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17326                 self.data = core::ptr::null_mut();
17327                 self.datalen = 0;
17328                 ret
17329         }
17330         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
17331                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17332         }
17333 }
17334 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
17335         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
17336                 let datalen = v.len();
17337                 let data = Box::into_raw(v.into_boxed_slice());
17338                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17339         }
17340 }
17341 #[no_mangle]
17342 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17343 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
17344 impl Drop for CVec_MonitorUpdateIdZ {
17345         fn drop(&mut self) {
17346                 if self.datalen == 0 { return; }
17347                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17348         }
17349 }
17350 impl Clone for CVec_MonitorUpdateIdZ {
17351         fn clone(&self) -> Self {
17352                 let mut res = Vec::new();
17353                 if self.datalen == 0 { return Self::from(res); }
17354                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17355                 Self::from(res)
17356         }
17357 }
17358 #[repr(C)]
17359 /// A tuple of 2 elements. See the individual fields for the types contained.
17360 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17361         /// The element at position 0
17362         pub a: crate::lightning::chain::transaction::OutPoint,
17363         /// The element at position 1
17364         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
17365 }
17366 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17367         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
17368                 Self {
17369                         a: tup.0,
17370                         b: tup.1,
17371                 }
17372         }
17373 }
17374 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17375         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
17376                 (self.a, self.b)
17377         }
17378 }
17379 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17380         fn clone(&self) -> Self {
17381                 Self {
17382                         a: Clone::clone(&self.a),
17383                         b: Clone::clone(&self.b),
17384                 }
17385         }
17386 }
17387 #[no_mangle]
17388 /// Creates a new tuple which has the same data as `orig`
17389 /// but with all dynamically-allocated buffers duplicated in new buffers.
17390 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
17391 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
17392 #[no_mangle]
17393 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17394         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
17395 }
17396
17397 #[no_mangle]
17398 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
17399 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
17400 #[repr(C)]
17401 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
17402 /// This corresponds to std::vector in C++
17403 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17404         /// The elements in the array.
17405         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17406         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
17407         /// The number of elements pointed to by `data`.
17408         pub datalen: usize
17409 }
17410 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17411         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
17412                 if self.datalen == 0 { return Vec::new(); }
17413                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17414                 self.data = core::ptr::null_mut();
17415                 self.datalen = 0;
17416                 ret
17417         }
17418         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
17419                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17420         }
17421 }
17422 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17423         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
17424                 let datalen = v.len();
17425                 let data = Box::into_raw(v.into_boxed_slice());
17426                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17427         }
17428 }
17429 #[no_mangle]
17430 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17431 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
17432 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17433         fn drop(&mut self) {
17434                 if self.datalen == 0 { return; }
17435                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17436         }
17437 }
17438 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17439         fn clone(&self) -> Self {
17440                 let mut res = Vec::new();
17441                 if self.datalen == 0 { return Self::from(res); }
17442                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17443                 Self::from(res)
17444         }
17445 }