Update auto-generated bindings to LDK 0.0.123
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use alloc::string::String;
4 use core::ffi::c_void;
5 use core::convert::Infallible;
6 use bitcoin::hashes::Hash;
7 use crate::c_types::*;
8 #[cfg(feature="no-std")]
9 use alloc::{vec::Vec, boxed::Box};
10
11 #[repr(C)]
12 /// A dynamically-allocated array of u8s of arbitrary size.
13 /// This corresponds to std::vector in C++
14 pub struct CVec_u8Z {
15         /// The elements in the array.
16         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17         pub data: *mut u8,
18         /// The number of elements pointed to by `data`.
19         pub datalen: usize
20 }
21 impl CVec_u8Z {
22         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
23                 if self.datalen == 0 { return Vec::new(); }
24                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
25                 self.data = core::ptr::null_mut();
26                 self.datalen = 0;
27                 ret
28         }
29         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
30                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
31         }
32 }
33 impl From<Vec<u8>> for CVec_u8Z {
34         fn from(v: Vec<u8>) -> Self {
35                 let datalen = v.len();
36                 let data = Box::into_raw(v.into_boxed_slice());
37                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
38         }
39 }
40 #[no_mangle]
41 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
42 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
43 impl Drop for CVec_u8Z {
44         fn drop(&mut self) {
45                 if self.datalen == 0 { return; }
46                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
47         }
48 }
49 impl Clone for CVec_u8Z {
50         fn clone(&self) -> Self {
51                 let mut res = Vec::new();
52                 if self.datalen == 0 { return Self::from(res); }
53                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
54                 Self::from(res)
55         }
56 }
57 #[repr(C)]
58 /// The contents of CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ
59 pub union CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
60         /// A pointer to the contents in the success state.
61         /// Reading from this pointer when `result_ok` is not set is undefined.
62         pub result: *mut crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder,
63         /// A pointer to the contents in the error state.
64         /// Reading from this pointer when `result_ok` is set is undefined.
65         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
66 }
67 #[repr(C)]
68 /// A CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
69 /// containing a crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
70 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
71 pub struct CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
72         /// The contents of this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
73         /// `err` or `result` depending on the state of `result_ok`.
74         pub contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
75         /// Whether this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
76         pub result_ok: bool,
77 }
78 #[no_mangle]
79 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
80 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
81         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
82                 contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
83                         result: Box::into_raw(Box::new(o)),
84                 },
85                 result_ok: true,
86         }
87 }
88 #[no_mangle]
89 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
90 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
91         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
92                 contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
93                         err: Box::into_raw(Box::new(e)),
94                 },
95                 result_ok: false,
96         }
97 }
98 /// Checks if the given object is currently in the success state
99 #[no_mangle]
100 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
101         o.result_ok
102 }
103 #[no_mangle]
104 /// Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ.
105 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
106 impl Drop for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
107         fn drop(&mut self) {
108                 if self.result_ok {
109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
111                         }
112                 } else {
113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
115                         }
116                 }
117         }
118 }
119 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
121                 let contents = if o.result_ok {
122                         let result = unsafe { o.contents.result };
123                         unsafe { o.contents.result = core::ptr::null_mut() };
124                         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
125                 } else {
126                         let err = unsafe { o.contents.err };
127                         unsafe { o.contents.err = core::ptr::null_mut(); }
128                         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
129                 };
130                 Self {
131                         contents,
132                         result_ok: o.result_ok,
133                 }
134         }
135 }
136 impl Clone for CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ {
137         fn clone(&self) -> Self {
138                 if self.result_ok {
139                         Self { result_ok: true, contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
140                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder>::clone(unsafe { &*self.contents.result })))
141                         } }
142                 } else {
143                         Self { result_ok: false, contents: CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
144                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
145                         } }
146                 }
147         }
148 }
149 #[no_mangle]
150 /// Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
151 /// but with all dynamically-allocated buffers duplicated in new buffers.
152 pub extern "C" fn CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) }
153 #[repr(C)]
154 /// The contents of CResult_RefundBolt12SemanticErrorZ
155 pub union CResult_RefundBolt12SemanticErrorZPtr {
156         /// A pointer to the contents in the success state.
157         /// Reading from this pointer when `result_ok` is not set is undefined.
158         pub result: *mut crate::lightning::offers::refund::Refund,
159         /// A pointer to the contents in the error state.
160         /// Reading from this pointer when `result_ok` is set is undefined.
161         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
162 }
163 #[repr(C)]
164 /// A CResult_RefundBolt12SemanticErrorZ represents the result of a fallible operation,
165 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
167 pub struct CResult_RefundBolt12SemanticErrorZ {
168         /// The contents of this CResult_RefundBolt12SemanticErrorZ, accessible via either
169         /// `err` or `result` depending on the state of `result_ok`.
170         pub contents: CResult_RefundBolt12SemanticErrorZPtr,
171         /// Whether this CResult_RefundBolt12SemanticErrorZ represents a success state.
172         pub result_ok: bool,
173 }
174 #[no_mangle]
175 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the success state.
176 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12SemanticErrorZ {
177         CResult_RefundBolt12SemanticErrorZ {
178                 contents: CResult_RefundBolt12SemanticErrorZPtr {
179                         result: Box::into_raw(Box::new(o)),
180                 },
181                 result_ok: true,
182         }
183 }
184 #[no_mangle]
185 /// Creates a new CResult_RefundBolt12SemanticErrorZ in the error state.
186 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_RefundBolt12SemanticErrorZ {
187         CResult_RefundBolt12SemanticErrorZ {
188                 contents: CResult_RefundBolt12SemanticErrorZPtr {
189                         err: Box::into_raw(Box::new(e)),
190                 },
191                 result_ok: false,
192         }
193 }
194 /// Checks if the given object is currently in the success state
195 #[no_mangle]
196 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_is_ok(o: &CResult_RefundBolt12SemanticErrorZ) -> bool {
197         o.result_ok
198 }
199 #[no_mangle]
200 /// Frees any resources used by the CResult_RefundBolt12SemanticErrorZ.
201 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_free(_res: CResult_RefundBolt12SemanticErrorZ) { }
202 impl Drop for CResult_RefundBolt12SemanticErrorZ {
203         fn drop(&mut self) {
204                 if self.result_ok {
205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
207                         }
208                 } else {
209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
211                         }
212                 }
213         }
214 }
215 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_RefundBolt12SemanticErrorZ {
216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
217                 let contents = if o.result_ok {
218                         let result = unsafe { o.contents.result };
219                         unsafe { o.contents.result = core::ptr::null_mut() };
220                         CResult_RefundBolt12SemanticErrorZPtr { result }
221                 } else {
222                         let err = unsafe { o.contents.err };
223                         unsafe { o.contents.err = core::ptr::null_mut(); }
224                         CResult_RefundBolt12SemanticErrorZPtr { err }
225                 };
226                 Self {
227                         contents,
228                         result_ok: o.result_ok,
229                 }
230         }
231 }
232 impl Clone for CResult_RefundBolt12SemanticErrorZ {
233         fn clone(&self) -> Self {
234                 if self.result_ok {
235                         Self { result_ok: true, contents: CResult_RefundBolt12SemanticErrorZPtr {
236                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
237                         } }
238                 } else {
239                         Self { result_ok: false, contents: CResult_RefundBolt12SemanticErrorZPtr {
240                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
241                         } }
242                 }
243         }
244 }
245 #[no_mangle]
246 /// Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig`
247 /// but with all dynamically-allocated buffers duplicated in new buffers.
248 pub extern "C" fn CResult_RefundBolt12SemanticErrorZ_clone(orig: &CResult_RefundBolt12SemanticErrorZ) -> CResult_RefundBolt12SemanticErrorZ { Clone::clone(&orig) }
249 #[repr(C)]
250 #[derive(Clone)]
251 /// An enum which can either contain a u64 or not
252 pub enum COption_u64Z {
253         /// When we're in this state, this COption_u64Z contains a u64
254         Some(u64),
255         /// When we're in this state, this COption_u64Z contains nothing
256         None
257 }
258 impl COption_u64Z {
259         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
260                 if let Self::None = self { false } else { true }
261         }
262         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
263                 !self.is_some()
264         }
265         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
266                 if let Self::Some(v) = self { v } else { unreachable!() }
267         }
268 }
269 #[no_mangle]
270 /// Constructs a new COption_u64Z containing a u64
271 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
272         COption_u64Z::Some(o)
273 }
274 #[no_mangle]
275 /// Constructs a new COption_u64Z containing nothing
276 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
277         COption_u64Z::None
278 }
279 #[no_mangle]
280 /// Frees any resources associated with the u64, if we are in the Some state
281 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
282 #[no_mangle]
283 /// Creates a new COption_u64Z which has the same data as `orig`
284 /// but with all dynamically-allocated buffers duplicated in new buffers.
285 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
286 #[repr(C)]
287 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
288 /// This corresponds to std::vector in C++
289 pub struct CVec_BlindedPathZ {
290         /// The elements in the array.
291         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
292         pub data: *mut crate::lightning::blinded_path::BlindedPath,
293         /// The number of elements pointed to by `data`.
294         pub datalen: usize
295 }
296 impl CVec_BlindedPathZ {
297         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedPath> {
298                 if self.datalen == 0 { return Vec::new(); }
299                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
300                 self.data = core::ptr::null_mut();
301                 self.datalen = 0;
302                 ret
303         }
304         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedPath] {
305                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
306         }
307 }
308 impl From<Vec<crate::lightning::blinded_path::BlindedPath>> for CVec_BlindedPathZ {
309         fn from(v: Vec<crate::lightning::blinded_path::BlindedPath>) -> Self {
310                 let datalen = v.len();
311                 let data = Box::into_raw(v.into_boxed_slice());
312                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
313         }
314 }
315 #[no_mangle]
316 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
317 pub extern "C" fn CVec_BlindedPathZ_free(_res: CVec_BlindedPathZ) { }
318 impl Drop for CVec_BlindedPathZ {
319         fn drop(&mut self) {
320                 if self.datalen == 0 { return; }
321                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
322         }
323 }
324 impl Clone for CVec_BlindedPathZ {
325         fn clone(&self) -> Self {
326                 let mut res = Vec::new();
327                 if self.datalen == 0 { return Self::from(res); }
328                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
329                 Self::from(res)
330         }
331 }
332 #[repr(C)]
333 /// The contents of CResult_RefundBolt12ParseErrorZ
334 pub union CResult_RefundBolt12ParseErrorZPtr {
335         /// A pointer to the contents in the success state.
336         /// Reading from this pointer when `result_ok` is not set is undefined.
337         pub result: *mut crate::lightning::offers::refund::Refund,
338         /// A pointer to the contents in the error state.
339         /// Reading from this pointer when `result_ok` is set is undefined.
340         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
341 }
342 #[repr(C)]
343 /// A CResult_RefundBolt12ParseErrorZ represents the result of a fallible operation,
344 /// containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
346 pub struct CResult_RefundBolt12ParseErrorZ {
347         /// The contents of this CResult_RefundBolt12ParseErrorZ, accessible via either
348         /// `err` or `result` depending on the state of `result_ok`.
349         pub contents: CResult_RefundBolt12ParseErrorZPtr,
350         /// Whether this CResult_RefundBolt12ParseErrorZ represents a success state.
351         pub result_ok: bool,
352 }
353 #[no_mangle]
354 /// Creates a new CResult_RefundBolt12ParseErrorZ in the success state.
355 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_ok(o: crate::lightning::offers::refund::Refund) -> CResult_RefundBolt12ParseErrorZ {
356         CResult_RefundBolt12ParseErrorZ {
357                 contents: CResult_RefundBolt12ParseErrorZPtr {
358                         result: Box::into_raw(Box::new(o)),
359                 },
360                 result_ok: true,
361         }
362 }
363 #[no_mangle]
364 /// Creates a new CResult_RefundBolt12ParseErrorZ in the error state.
365 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_RefundBolt12ParseErrorZ {
366         CResult_RefundBolt12ParseErrorZ {
367                 contents: CResult_RefundBolt12ParseErrorZPtr {
368                         err: Box::into_raw(Box::new(e)),
369                 },
370                 result_ok: false,
371         }
372 }
373 /// Checks if the given object is currently in the success state
374 #[no_mangle]
375 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_is_ok(o: &CResult_RefundBolt12ParseErrorZ) -> bool {
376         o.result_ok
377 }
378 #[no_mangle]
379 /// Frees any resources used by the CResult_RefundBolt12ParseErrorZ.
380 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_free(_res: CResult_RefundBolt12ParseErrorZ) { }
381 impl Drop for CResult_RefundBolt12ParseErrorZ {
382         fn drop(&mut self) {
383                 if self.result_ok {
384                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
385                                 let _ = unsafe { Box::from_raw(self.contents.result) };
386                         }
387                 } else {
388                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
389                                 let _ = unsafe { Box::from_raw(self.contents.err) };
390                         }
391                 }
392         }
393 }
394 impl From<crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_RefundBolt12ParseErrorZ {
395         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::refund::Refund, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
396                 let contents = if o.result_ok {
397                         let result = unsafe { o.contents.result };
398                         unsafe { o.contents.result = core::ptr::null_mut() };
399                         CResult_RefundBolt12ParseErrorZPtr { result }
400                 } else {
401                         let err = unsafe { o.contents.err };
402                         unsafe { o.contents.err = core::ptr::null_mut(); }
403                         CResult_RefundBolt12ParseErrorZPtr { err }
404                 };
405                 Self {
406                         contents,
407                         result_ok: o.result_ok,
408                 }
409         }
410 }
411 impl Clone for CResult_RefundBolt12ParseErrorZ {
412         fn clone(&self) -> Self {
413                 if self.result_ok {
414                         Self { result_ok: true, contents: CResult_RefundBolt12ParseErrorZPtr {
415                                 result: Box::into_raw(Box::new(<crate::lightning::offers::refund::Refund>::clone(unsafe { &*self.contents.result })))
416                         } }
417                 } else {
418                         Self { result_ok: false, contents: CResult_RefundBolt12ParseErrorZPtr {
419                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
420                         } }
421                 }
422         }
423 }
424 #[no_mangle]
425 /// Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig`
426 /// but with all dynamically-allocated buffers duplicated in new buffers.
427 pub extern "C" fn CResult_RefundBolt12ParseErrorZ_clone(orig: &CResult_RefundBolt12ParseErrorZ) -> CResult_RefundBolt12ParseErrorZ { Clone::clone(&orig) }
428 #[repr(C)]
429 /// The contents of CResult_RetryDecodeErrorZ
430 pub union CResult_RetryDecodeErrorZPtr {
431         /// A pointer to the contents in the success state.
432         /// Reading from this pointer when `result_ok` is not set is undefined.
433         pub result: *mut crate::lightning::ln::outbound_payment::Retry,
434         /// A pointer to the contents in the error state.
435         /// Reading from this pointer when `result_ok` is set is undefined.
436         pub err: *mut crate::lightning::ln::msgs::DecodeError,
437 }
438 #[repr(C)]
439 /// A CResult_RetryDecodeErrorZ represents the result of a fallible operation,
440 /// containing a crate::lightning::ln::outbound_payment::Retry on success and a crate::lightning::ln::msgs::DecodeError on failure.
441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
442 pub struct CResult_RetryDecodeErrorZ {
443         /// The contents of this CResult_RetryDecodeErrorZ, accessible via either
444         /// `err` or `result` depending on the state of `result_ok`.
445         pub contents: CResult_RetryDecodeErrorZPtr,
446         /// Whether this CResult_RetryDecodeErrorZ represents a success state.
447         pub result_ok: bool,
448 }
449 #[no_mangle]
450 /// Creates a new CResult_RetryDecodeErrorZ in the success state.
451 pub extern "C" fn CResult_RetryDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::Retry) -> CResult_RetryDecodeErrorZ {
452         CResult_RetryDecodeErrorZ {
453                 contents: CResult_RetryDecodeErrorZPtr {
454                         result: Box::into_raw(Box::new(o)),
455                 },
456                 result_ok: true,
457         }
458 }
459 #[no_mangle]
460 /// Creates a new CResult_RetryDecodeErrorZ in the error state.
461 pub extern "C" fn CResult_RetryDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RetryDecodeErrorZ {
462         CResult_RetryDecodeErrorZ {
463                 contents: CResult_RetryDecodeErrorZPtr {
464                         err: Box::into_raw(Box::new(e)),
465                 },
466                 result_ok: false,
467         }
468 }
469 /// Checks if the given object is currently in the success state
470 #[no_mangle]
471 pub extern "C" fn CResult_RetryDecodeErrorZ_is_ok(o: &CResult_RetryDecodeErrorZ) -> bool {
472         o.result_ok
473 }
474 #[no_mangle]
475 /// Frees any resources used by the CResult_RetryDecodeErrorZ.
476 pub extern "C" fn CResult_RetryDecodeErrorZ_free(_res: CResult_RetryDecodeErrorZ) { }
477 impl Drop for CResult_RetryDecodeErrorZ {
478         fn drop(&mut self) {
479                 if self.result_ok {
480                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
481                                 let _ = unsafe { Box::from_raw(self.contents.result) };
482                         }
483                 } else {
484                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
485                                 let _ = unsafe { Box::from_raw(self.contents.err) };
486                         }
487                 }
488         }
489 }
490 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>> for CResult_RetryDecodeErrorZ {
491         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::Retry, crate::lightning::ln::msgs::DecodeError>) -> Self {
492                 let contents = if o.result_ok {
493                         let result = unsafe { o.contents.result };
494                         unsafe { o.contents.result = core::ptr::null_mut() };
495                         CResult_RetryDecodeErrorZPtr { result }
496                 } else {
497                         let err = unsafe { o.contents.err };
498                         unsafe { o.contents.err = core::ptr::null_mut(); }
499                         CResult_RetryDecodeErrorZPtr { err }
500                 };
501                 Self {
502                         contents,
503                         result_ok: o.result_ok,
504                 }
505         }
506 }
507 impl Clone for CResult_RetryDecodeErrorZ {
508         fn clone(&self) -> Self {
509                 if self.result_ok {
510                         Self { result_ok: true, contents: CResult_RetryDecodeErrorZPtr {
511                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::Retry>::clone(unsafe { &*self.contents.result })))
512                         } }
513                 } else {
514                         Self { result_ok: false, contents: CResult_RetryDecodeErrorZPtr {
515                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
516                         } }
517                 }
518         }
519 }
520 #[no_mangle]
521 /// Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig`
522 /// but with all dynamically-allocated buffers duplicated in new buffers.
523 pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) }
524 #[repr(C)]
525 /// The contents of CResult_NoneAPIErrorZ
526 pub union CResult_NoneAPIErrorZPtr {
527         /// Note that this value is always NULL, as there are no contents in the OK variant
528         pub result: *mut core::ffi::c_void,
529         /// A pointer to the contents in the error state.
530         /// Reading from this pointer when `result_ok` is set is undefined.
531         pub err: *mut crate::lightning::util::errors::APIError,
532 }
533 #[repr(C)]
534 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
535 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
537 pub struct CResult_NoneAPIErrorZ {
538         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
539         /// `err` or `result` depending on the state of `result_ok`.
540         pub contents: CResult_NoneAPIErrorZPtr,
541         /// Whether this CResult_NoneAPIErrorZ represents a success state.
542         pub result_ok: bool,
543 }
544 #[no_mangle]
545 /// Creates a new CResult_NoneAPIErrorZ in the success state.
546 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
547         CResult_NoneAPIErrorZ {
548                 contents: CResult_NoneAPIErrorZPtr {
549                         result: core::ptr::null_mut(),
550                 },
551                 result_ok: true,
552         }
553 }
554 #[no_mangle]
555 /// Creates a new CResult_NoneAPIErrorZ in the error state.
556 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
557         CResult_NoneAPIErrorZ {
558                 contents: CResult_NoneAPIErrorZPtr {
559                         err: Box::into_raw(Box::new(e)),
560                 },
561                 result_ok: false,
562         }
563 }
564 /// Checks if the given object is currently in the success state
565 #[no_mangle]
566 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
567         o.result_ok
568 }
569 #[no_mangle]
570 /// Frees any resources used by the CResult_NoneAPIErrorZ.
571 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
572 impl Drop for CResult_NoneAPIErrorZ {
573         fn drop(&mut self) {
574                 if self.result_ok {
575                 } else {
576                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
577                                 let _ = unsafe { Box::from_raw(self.contents.err) };
578                         }
579                 }
580         }
581 }
582 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
583         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
584                 let contents = if o.result_ok {
585                         let _ = unsafe { Box::from_raw(o.contents.result) };
586                         o.contents.result = core::ptr::null_mut();
587                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
588                 } else {
589                         let err = unsafe { o.contents.err };
590                         unsafe { o.contents.err = core::ptr::null_mut(); }
591                         CResult_NoneAPIErrorZPtr { err }
592                 };
593                 Self {
594                         contents,
595                         result_ok: o.result_ok,
596                 }
597         }
598 }
599 impl Clone for CResult_NoneAPIErrorZ {
600         fn clone(&self) -> Self {
601                 if self.result_ok {
602                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
603                                 result: core::ptr::null_mut()
604                         } }
605                 } else {
606                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
607                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
608                         } }
609                 }
610         }
611 }
612 #[no_mangle]
613 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
614 /// but with all dynamically-allocated buffers duplicated in new buffers.
615 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
616 #[repr(C)]
617 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
618 /// This corresponds to std::vector in C++
619 pub struct CVec_CResult_NoneAPIErrorZZ {
620         /// The elements in the array.
621         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
622         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
623         /// The number of elements pointed to by `data`.
624         pub datalen: usize
625 }
626 impl CVec_CResult_NoneAPIErrorZZ {
627         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
628                 if self.datalen == 0 { return Vec::new(); }
629                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
630                 self.data = core::ptr::null_mut();
631                 self.datalen = 0;
632                 ret
633         }
634         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
635                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
636         }
637 }
638 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
639         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
640                 let datalen = v.len();
641                 let data = Box::into_raw(v.into_boxed_slice());
642                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
643         }
644 }
645 #[no_mangle]
646 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
647 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
648 impl Drop for CVec_CResult_NoneAPIErrorZZ {
649         fn drop(&mut self) {
650                 if self.datalen == 0 { return; }
651                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
652         }
653 }
654 impl Clone for CVec_CResult_NoneAPIErrorZZ {
655         fn clone(&self) -> Self {
656                 let mut res = Vec::new();
657                 if self.datalen == 0 { return Self::from(res); }
658                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
659                 Self::from(res)
660         }
661 }
662 #[repr(C)]
663 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
664 /// This corresponds to std::vector in C++
665 pub struct CVec_APIErrorZ {
666         /// The elements in the array.
667         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
668         pub data: *mut crate::lightning::util::errors::APIError,
669         /// The number of elements pointed to by `data`.
670         pub datalen: usize
671 }
672 impl CVec_APIErrorZ {
673         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
674                 if self.datalen == 0 { return Vec::new(); }
675                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
676                 self.data = core::ptr::null_mut();
677                 self.datalen = 0;
678                 ret
679         }
680         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
681                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
682         }
683 }
684 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
685         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
686                 let datalen = v.len();
687                 let data = Box::into_raw(v.into_boxed_slice());
688                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
689         }
690 }
691 #[no_mangle]
692 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
693 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
694 impl Drop for CVec_APIErrorZ {
695         fn drop(&mut self) {
696                 if self.datalen == 0 { return; }
697                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
698         }
699 }
700 impl Clone for CVec_APIErrorZ {
701         fn clone(&self) -> Self {
702                 let mut res = Vec::new();
703                 if self.datalen == 0 { return Self::from(res); }
704                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
705                 Self::from(res)
706         }
707 }
708 #[repr(C)]
709 #[derive(Clone)]
710 /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
711 pub enum COption_ThirtyTwoBytesZ {
712         /// When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes
713         Some(crate::c_types::ThirtyTwoBytes),
714         /// When we're in this state, this COption_ThirtyTwoBytesZ contains nothing
715         None
716 }
717 impl COption_ThirtyTwoBytesZ {
718         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
719                 if let Self::None = self { false } else { true }
720         }
721         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
722                 !self.is_some()
723         }
724         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ThirtyTwoBytes {
725                 if let Self::Some(v) = self { v } else { unreachable!() }
726         }
727 }
728 #[no_mangle]
729 /// Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
730 pub extern "C" fn COption_ThirtyTwoBytesZ_some(o: crate::c_types::ThirtyTwoBytes) -> COption_ThirtyTwoBytesZ {
731         COption_ThirtyTwoBytesZ::Some(o)
732 }
733 #[no_mangle]
734 /// Constructs a new COption_ThirtyTwoBytesZ containing nothing
735 pub extern "C" fn COption_ThirtyTwoBytesZ_none() -> COption_ThirtyTwoBytesZ {
736         COption_ThirtyTwoBytesZ::None
737 }
738 #[no_mangle]
739 /// Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state
740 pub extern "C" fn COption_ThirtyTwoBytesZ_free(_res: COption_ThirtyTwoBytesZ) { }
741 #[no_mangle]
742 /// Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
743 /// but with all dynamically-allocated buffers duplicated in new buffers.
744 pub extern "C" fn COption_ThirtyTwoBytesZ_clone(orig: &COption_ThirtyTwoBytesZ) -> COption_ThirtyTwoBytesZ { Clone::clone(&orig) }
745 #[repr(C)]
746 #[derive(Clone)]
747 /// An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
748 pub enum COption_CVec_u8ZZ {
749         /// When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
750         Some(crate::c_types::derived::CVec_u8Z),
751         /// When we're in this state, this COption_CVec_u8ZZ contains nothing
752         None
753 }
754 impl COption_CVec_u8ZZ {
755         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
756                 if let Self::None = self { false } else { true }
757         }
758         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
759                 !self.is_some()
760         }
761         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_u8Z {
762                 if let Self::Some(v) = self { v } else { unreachable!() }
763         }
764 }
765 #[no_mangle]
766 /// Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
767 pub extern "C" fn COption_CVec_u8ZZ_some(o: crate::c_types::derived::CVec_u8Z) -> COption_CVec_u8ZZ {
768         COption_CVec_u8ZZ::Some(o)
769 }
770 #[no_mangle]
771 /// Constructs a new COption_CVec_u8ZZ containing nothing
772 pub extern "C" fn COption_CVec_u8ZZ_none() -> COption_CVec_u8ZZ {
773         COption_CVec_u8ZZ::None
774 }
775 #[no_mangle]
776 /// Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
777 pub extern "C" fn COption_CVec_u8ZZ_free(_res: COption_CVec_u8ZZ) { }
778 #[no_mangle]
779 /// Creates a new COption_CVec_u8ZZ which has the same data as `orig`
780 /// but with all dynamically-allocated buffers duplicated in new buffers.
781 pub extern "C" fn COption_CVec_u8ZZ_clone(orig: &COption_CVec_u8ZZ) -> COption_CVec_u8ZZ { Clone::clone(&orig) }
782 #[repr(C)]
783 /// The contents of CResult_RecipientOnionFieldsDecodeErrorZ
784 pub union CResult_RecipientOnionFieldsDecodeErrorZPtr {
785         /// A pointer to the contents in the success state.
786         /// Reading from this pointer when `result_ok` is not set is undefined.
787         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
788         /// A pointer to the contents in the error state.
789         /// Reading from this pointer when `result_ok` is set is undefined.
790         pub err: *mut crate::lightning::ln::msgs::DecodeError,
791 }
792 #[repr(C)]
793 /// A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
794 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
795 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
796 pub struct CResult_RecipientOnionFieldsDecodeErrorZ {
797         /// The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
798         /// `err` or `result` depending on the state of `result_ok`.
799         pub contents: CResult_RecipientOnionFieldsDecodeErrorZPtr,
800         /// Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
801         pub result_ok: bool,
802 }
803 #[no_mangle]
804 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
805 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsDecodeErrorZ {
806         CResult_RecipientOnionFieldsDecodeErrorZ {
807                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
808                         result: Box::into_raw(Box::new(o)),
809                 },
810                 result_ok: true,
811         }
812 }
813 #[no_mangle]
814 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
815 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RecipientOnionFieldsDecodeErrorZ {
816         CResult_RecipientOnionFieldsDecodeErrorZ {
817                 contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
818                         err: Box::into_raw(Box::new(e)),
819                 },
820                 result_ok: false,
821         }
822 }
823 /// Checks if the given object is currently in the success state
824 #[no_mangle]
825 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o: &CResult_RecipientOnionFieldsDecodeErrorZ) -> bool {
826         o.result_ok
827 }
828 #[no_mangle]
829 /// Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
830 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_free(_res: CResult_RecipientOnionFieldsDecodeErrorZ) { }
831 impl Drop for CResult_RecipientOnionFieldsDecodeErrorZ {
832         fn drop(&mut self) {
833                 if self.result_ok {
834                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
835                                 let _ = unsafe { Box::from_raw(self.contents.result) };
836                         }
837                 } else {
838                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
839                                 let _ = unsafe { Box::from_raw(self.contents.err) };
840                         }
841                 }
842         }
843 }
844 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>> for CResult_RecipientOnionFieldsDecodeErrorZ {
845         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
846                 let contents = if o.result_ok {
847                         let result = unsafe { o.contents.result };
848                         unsafe { o.contents.result = core::ptr::null_mut() };
849                         CResult_RecipientOnionFieldsDecodeErrorZPtr { result }
850                 } else {
851                         let err = unsafe { o.contents.err };
852                         unsafe { o.contents.err = core::ptr::null_mut(); }
853                         CResult_RecipientOnionFieldsDecodeErrorZPtr { err }
854                 };
855                 Self {
856                         contents,
857                         result_ok: o.result_ok,
858                 }
859         }
860 }
861 impl Clone for CResult_RecipientOnionFieldsDecodeErrorZ {
862         fn clone(&self) -> Self {
863                 if self.result_ok {
864                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
865                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
866                         } }
867                 } else {
868                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsDecodeErrorZPtr {
869                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
870                         } }
871                 }
872         }
873 }
874 #[no_mangle]
875 /// Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
876 /// but with all dynamically-allocated buffers duplicated in new buffers.
877 pub extern "C" fn CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig: &CResult_RecipientOnionFieldsDecodeErrorZ) -> CResult_RecipientOnionFieldsDecodeErrorZ { Clone::clone(&orig) }
878 #[repr(C)]
879 /// A tuple of 2 elements. See the individual fields for the types contained.
880 pub struct C2Tuple_u64CVec_u8ZZ {
881         /// The element at position 0
882         pub a: u64,
883         /// The element at position 1
884         pub b: crate::c_types::derived::CVec_u8Z,
885 }
886 impl From<(u64, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u64CVec_u8ZZ {
887         fn from (tup: (u64, crate::c_types::derived::CVec_u8Z)) -> Self {
888                 Self {
889                         a: tup.0,
890                         b: tup.1,
891                 }
892         }
893 }
894 impl C2Tuple_u64CVec_u8ZZ {
895         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::c_types::derived::CVec_u8Z) {
896                 (self.a, self.b)
897         }
898 }
899 impl Clone for C2Tuple_u64CVec_u8ZZ {
900         fn clone(&self) -> Self {
901                 Self {
902                         a: Clone::clone(&self.a),
903                         b: Clone::clone(&self.b),
904                 }
905         }
906 }
907 #[no_mangle]
908 /// Creates a new tuple which has the same data as `orig`
909 /// but with all dynamically-allocated buffers duplicated in new buffers.
910 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_clone(orig: &C2Tuple_u64CVec_u8ZZ) -> C2Tuple_u64CVec_u8ZZ { Clone::clone(&orig) }
911 /// Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements.
912 #[no_mangle]
913 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_new(a: u64, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u64CVec_u8ZZ {
914         C2Tuple_u64CVec_u8ZZ { a, b, }
915 }
916
917 #[no_mangle]
918 /// Frees any resources used by the C2Tuple_u64CVec_u8ZZ.
919 pub extern "C" fn C2Tuple_u64CVec_u8ZZ_free(_res: C2Tuple_u64CVec_u8ZZ) { }
920 #[repr(C)]
921 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size.
922 /// This corresponds to std::vector in C++
923 pub struct CVec_C2Tuple_u64CVec_u8ZZZ {
924         /// The elements in the array.
925         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
926         pub data: *mut crate::c_types::derived::C2Tuple_u64CVec_u8ZZ,
927         /// The number of elements pointed to by `data`.
928         pub datalen: usize
929 }
930 impl CVec_C2Tuple_u64CVec_u8ZZZ {
931         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ> {
932                 if self.datalen == 0 { return Vec::new(); }
933                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
934                 self.data = core::ptr::null_mut();
935                 self.datalen = 0;
936                 ret
937         }
938         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64CVec_u8ZZ] {
939                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
940         }
941 }
942 impl From<Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>> for CVec_C2Tuple_u64CVec_u8ZZZ {
943         fn from(v: Vec<crate::c_types::derived::C2Tuple_u64CVec_u8ZZ>) -> Self {
944                 let datalen = v.len();
945                 let data = Box::into_raw(v.into_boxed_slice());
946                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
947         }
948 }
949 #[no_mangle]
950 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
951 pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8ZZZ) { }
952 impl Drop for CVec_C2Tuple_u64CVec_u8ZZZ {
953         fn drop(&mut self) {
954                 if self.datalen == 0 { return; }
955                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
956         }
957 }
958 impl Clone for CVec_C2Tuple_u64CVec_u8ZZZ {
959         fn clone(&self) -> Self {
960                 let mut res = Vec::new();
961                 if self.datalen == 0 { return Self::from(res); }
962                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
963                 Self::from(res)
964         }
965 }
966 #[repr(C)]
967 /// The contents of CResult_RecipientOnionFieldsNoneZ
968 pub union CResult_RecipientOnionFieldsNoneZPtr {
969         /// A pointer to the contents in the success state.
970         /// Reading from this pointer when `result_ok` is not set is undefined.
971         pub result: *mut crate::lightning::ln::outbound_payment::RecipientOnionFields,
972         /// Note that this value is always NULL, as there are no contents in the Err variant
973         pub err: *mut core::ffi::c_void,
974 }
975 #[repr(C)]
976 /// A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation,
977 /// containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure.
978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
979 pub struct CResult_RecipientOnionFieldsNoneZ {
980         /// The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either
981         /// `err` or `result` depending on the state of `result_ok`.
982         pub contents: CResult_RecipientOnionFieldsNoneZPtr,
983         /// Whether this CResult_RecipientOnionFieldsNoneZ represents a success state.
984         pub result_ok: bool,
985 }
986 #[no_mangle]
987 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the success state.
988 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_ok(o: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> CResult_RecipientOnionFieldsNoneZ {
989         CResult_RecipientOnionFieldsNoneZ {
990                 contents: CResult_RecipientOnionFieldsNoneZPtr {
991                         result: Box::into_raw(Box::new(o)),
992                 },
993                 result_ok: true,
994         }
995 }
996 #[no_mangle]
997 /// Creates a new CResult_RecipientOnionFieldsNoneZ in the error state.
998 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_err() -> CResult_RecipientOnionFieldsNoneZ {
999         CResult_RecipientOnionFieldsNoneZ {
1000                 contents: CResult_RecipientOnionFieldsNoneZPtr {
1001                         err: core::ptr::null_mut(),
1002                 },
1003                 result_ok: false,
1004         }
1005 }
1006 /// Checks if the given object is currently in the success state
1007 #[no_mangle]
1008 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_is_ok(o: &CResult_RecipientOnionFieldsNoneZ) -> bool {
1009         o.result_ok
1010 }
1011 #[no_mangle]
1012 /// Frees any resources used by the CResult_RecipientOnionFieldsNoneZ.
1013 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_free(_res: CResult_RecipientOnionFieldsNoneZ) { }
1014 impl Drop for CResult_RecipientOnionFieldsNoneZ {
1015         fn drop(&mut self) {
1016                 if self.result_ok {
1017                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1018                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1019                         }
1020                 } else {
1021                 }
1022         }
1023 }
1024 impl From<crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>> for CResult_RecipientOnionFieldsNoneZ {
1025         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::outbound_payment::RecipientOnionFields, ()>) -> Self {
1026                 let contents = if o.result_ok {
1027                         let result = unsafe { o.contents.result };
1028                         unsafe { o.contents.result = core::ptr::null_mut() };
1029                         CResult_RecipientOnionFieldsNoneZPtr { result }
1030                 } else {
1031                         let _ = unsafe { Box::from_raw(o.contents.err) };
1032                         o.contents.err = core::ptr::null_mut();
1033                         CResult_RecipientOnionFieldsNoneZPtr { err: core::ptr::null_mut() }
1034                 };
1035                 Self {
1036                         contents,
1037                         result_ok: o.result_ok,
1038                 }
1039         }
1040 }
1041 impl Clone for CResult_RecipientOnionFieldsNoneZ {
1042         fn clone(&self) -> Self {
1043                 if self.result_ok {
1044                         Self { result_ok: true, contents: CResult_RecipientOnionFieldsNoneZPtr {
1045                                 result: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RecipientOnionFields>::clone(unsafe { &*self.contents.result })))
1046                         } }
1047                 } else {
1048                         Self { result_ok: false, contents: CResult_RecipientOnionFieldsNoneZPtr {
1049                                 err: core::ptr::null_mut()
1050                         } }
1051                 }
1052         }
1053 }
1054 #[no_mangle]
1055 /// Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig`
1056 /// but with all dynamically-allocated buffers duplicated in new buffers.
1057 pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) }
1058 #[repr(C)]
1059 /// The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ
1060 pub union CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1061         /// A pointer to the contents in the success state.
1062         /// Reading from this pointer when `result_ok` is not set is undefined.
1063         pub result: *mut crate::lightning::offers::invoice::UnsignedBolt12Invoice,
1064         /// A pointer to the contents in the error state.
1065         /// Reading from this pointer when `result_ok` is set is undefined.
1066         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1067 }
1068 #[repr(C)]
1069 /// A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1070 /// containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1072 pub struct CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1073         /// The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either
1074         /// `err` or `result` depending on the state of `result_ok`.
1075         pub contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr,
1076         /// Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state.
1077         pub result_ok: bool,
1078 }
1079 #[no_mangle]
1080 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state.
1081 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1082         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1083                 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1084                         result: Box::into_raw(Box::new(o)),
1085                 },
1086                 result_ok: true,
1087         }
1088 }
1089 #[no_mangle]
1090 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state.
1091 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1092         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1093                 contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1094                         err: Box::into_raw(Box::new(e)),
1095                 },
1096                 result_ok: false,
1097         }
1098 }
1099 /// Checks if the given object is currently in the success state
1100 #[no_mangle]
1101 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> bool {
1102         o.result_ok
1103 }
1104 #[no_mangle]
1105 /// Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ.
1106 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) { }
1107 impl Drop for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1108         fn drop(&mut self) {
1109                 if self.result_ok {
1110                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1111                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1112                         }
1113                 } else {
1114                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1115                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1116                         }
1117                 }
1118         }
1119 }
1120 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1121         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::UnsignedBolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1122                 let contents = if o.result_ok {
1123                         let result = unsafe { o.contents.result };
1124                         unsafe { o.contents.result = core::ptr::null_mut() };
1125                         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result }
1126                 } else {
1127                         let err = unsafe { o.contents.err };
1128                         unsafe { o.contents.err = core::ptr::null_mut(); }
1129                         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err }
1130                 };
1131                 Self {
1132                         contents,
1133                         result_ok: o.result_ok,
1134                 }
1135         }
1136 }
1137 impl Clone for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ {
1138         fn clone(&self) -> Self {
1139                 if self.result_ok {
1140                         Self { result_ok: true, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1141                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::UnsignedBolt12Invoice>::clone(unsafe { &*self.contents.result })))
1142                         } }
1143                 } else {
1144                         Self { result_ok: false, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr {
1145                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
1146                         } }
1147                 }
1148         }
1149 }
1150 #[no_mangle]
1151 /// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
1152 /// but with all dynamically-allocated buffers duplicated in new buffers.
1153 pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) }
1154 #[repr(C)]
1155 /// The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ
1156 pub union CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1157         /// A pointer to the contents in the success state.
1158         /// Reading from this pointer when `result_ok` is not set is undefined.
1159         pub result: *mut crate::lightning::offers::invoice::Bolt12Invoice,
1160         /// A pointer to the contents in the error state.
1161         /// Reading from this pointer when `result_ok` is set is undefined.
1162         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
1163 }
1164 #[repr(C)]
1165 /// A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation,
1166 /// containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
1167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1168 pub struct CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1169         /// The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either
1170         /// `err` or `result` depending on the state of `result_ok`.
1171         pub contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr,
1172         /// Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state.
1173         pub result_ok: bool,
1174 }
1175 #[no_mangle]
1176 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state.
1177 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1178         CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1179                 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1180                         result: Box::into_raw(Box::new(o)),
1181                 },
1182                 result_ok: true,
1183         }
1184 }
1185 #[no_mangle]
1186 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state.
1187 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1188         CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1189                 contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1190                         err: Box::into_raw(Box::new(e)),
1191                 },
1192                 result_ok: false,
1193         }
1194 }
1195 /// Checks if the given object is currently in the success state
1196 #[no_mangle]
1197 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> bool {
1198         o.result_ok
1199 }
1200 #[no_mangle]
1201 /// Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ.
1202 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_Bolt12InvoiceBolt12SemanticErrorZ) { }
1203 impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1204         fn drop(&mut self) {
1205                 if self.result_ok {
1206                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1207                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1208                         }
1209                 } else {
1210                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1211                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1212                         }
1213                 }
1214         }
1215 }
1216 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1217         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::Bolt12Invoice, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
1218                 let contents = if o.result_ok {
1219                         let result = unsafe { o.contents.result };
1220                         unsafe { o.contents.result = core::ptr::null_mut() };
1221                         CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { result }
1222                 } else {
1223                         let err = unsafe { o.contents.err };
1224                         unsafe { o.contents.err = core::ptr::null_mut(); }
1225                         CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err }
1226                 };
1227                 Self {
1228                         contents,
1229                         result_ok: o.result_ok,
1230                 }
1231         }
1232 }
1233 impl Clone for CResult_Bolt12InvoiceBolt12SemanticErrorZ {
1234         fn clone(&self) -> Self {
1235                 if self.result_ok {
1236                         Self { result_ok: true, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1237                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::Bolt12Invoice>::clone(unsafe { &*self.contents.result })))
1238                         } }
1239                 } else {
1240                         Self { result_ok: false, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr {
1241                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
1242                         } }
1243                 }
1244         }
1245 }
1246 #[no_mangle]
1247 /// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig`
1248 /// but with all dynamically-allocated buffers duplicated in new buffers.
1249 pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) }
1250 #[repr(C)]
1251 /// The contents of CResult_SchnorrSignatureNoneZ
1252 pub union CResult_SchnorrSignatureNoneZPtr {
1253         /// A pointer to the contents in the success state.
1254         /// Reading from this pointer when `result_ok` is not set is undefined.
1255         pub result: *mut crate::c_types::SchnorrSignature,
1256         /// Note that this value is always NULL, as there are no contents in the Err variant
1257         pub err: *mut core::ffi::c_void,
1258 }
1259 #[repr(C)]
1260 /// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation,
1261 /// containing a crate::c_types::SchnorrSignature on success and a () on failure.
1262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1263 pub struct CResult_SchnorrSignatureNoneZ {
1264         /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either
1265         /// `err` or `result` depending on the state of `result_ok`.
1266         pub contents: CResult_SchnorrSignatureNoneZPtr,
1267         /// Whether this CResult_SchnorrSignatureNoneZ represents a success state.
1268         pub result_ok: bool,
1269 }
1270 #[no_mangle]
1271 /// Creates a new CResult_SchnorrSignatureNoneZ in the success state.
1272 pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ {
1273         CResult_SchnorrSignatureNoneZ {
1274                 contents: CResult_SchnorrSignatureNoneZPtr {
1275                         result: Box::into_raw(Box::new(o)),
1276                 },
1277                 result_ok: true,
1278         }
1279 }
1280 #[no_mangle]
1281 /// Creates a new CResult_SchnorrSignatureNoneZ in the error state.
1282 pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ {
1283         CResult_SchnorrSignatureNoneZ {
1284                 contents: CResult_SchnorrSignatureNoneZPtr {
1285                         err: core::ptr::null_mut(),
1286                 },
1287                 result_ok: false,
1288         }
1289 }
1290 /// Checks if the given object is currently in the success state
1291 #[no_mangle]
1292 pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool {
1293         o.result_ok
1294 }
1295 #[no_mangle]
1296 /// Frees any resources used by the CResult_SchnorrSignatureNoneZ.
1297 pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { }
1298 impl Drop for CResult_SchnorrSignatureNoneZ {
1299         fn drop(&mut self) {
1300                 if self.result_ok {
1301                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1302                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1303                         }
1304                 } else {
1305                 }
1306         }
1307 }
1308 impl From<crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>> for CResult_SchnorrSignatureNoneZ {
1309         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SchnorrSignature, ()>) -> Self {
1310                 let contents = if o.result_ok {
1311                         let result = unsafe { o.contents.result };
1312                         unsafe { o.contents.result = core::ptr::null_mut() };
1313                         CResult_SchnorrSignatureNoneZPtr { result }
1314                 } else {
1315                         let _ = unsafe { Box::from_raw(o.contents.err) };
1316                         o.contents.err = core::ptr::null_mut();
1317                         CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() }
1318                 };
1319                 Self {
1320                         contents,
1321                         result_ok: o.result_ok,
1322                 }
1323         }
1324 }
1325 impl Clone for CResult_SchnorrSignatureNoneZ {
1326         fn clone(&self) -> Self {
1327                 if self.result_ok {
1328                         Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr {
1329                                 result: Box::into_raw(Box::new(<crate::c_types::SchnorrSignature>::clone(unsafe { &*self.contents.result })))
1330                         } }
1331                 } else {
1332                         Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr {
1333                                 err: core::ptr::null_mut()
1334                         } }
1335                 }
1336         }
1337 }
1338 #[no_mangle]
1339 /// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig`
1340 /// but with all dynamically-allocated buffers duplicated in new buffers.
1341 pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) }
1342 #[repr(C)]
1343 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1344 /// This corresponds to std::vector in C++
1345 pub struct CVec_ThirtyTwoBytesZ {
1346         /// The elements in the array.
1347         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1348         pub data: *mut crate::c_types::ThirtyTwoBytes,
1349         /// The number of elements pointed to by `data`.
1350         pub datalen: usize
1351 }
1352 impl CVec_ThirtyTwoBytesZ {
1353         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
1354                 if self.datalen == 0 { return Vec::new(); }
1355                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1356                 self.data = core::ptr::null_mut();
1357                 self.datalen = 0;
1358                 ret
1359         }
1360         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
1361                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1362         }
1363 }
1364 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
1365         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
1366                 let datalen = v.len();
1367                 let data = Box::into_raw(v.into_boxed_slice());
1368                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1369         }
1370 }
1371 #[no_mangle]
1372 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1373 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
1374 impl Drop for CVec_ThirtyTwoBytesZ {
1375         fn drop(&mut self) {
1376                 if self.datalen == 0 { return; }
1377                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1378         }
1379 }
1380 impl Clone for CVec_ThirtyTwoBytesZ {
1381         fn clone(&self) -> Self {
1382                 let mut res = Vec::new();
1383                 if self.datalen == 0 { return Self::from(res); }
1384                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1385                 Self::from(res)
1386         }
1387 }
1388 #[repr(C)]
1389 #[derive(Clone)]
1390 /// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not
1391 pub enum COption_CVec_ThirtyTwoBytesZZ {
1392         /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1393         Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ),
1394         /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing
1395         None
1396 }
1397 impl COption_CVec_ThirtyTwoBytesZZ {
1398         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1399                 if let Self::None = self { false } else { true }
1400         }
1401         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1402                 !self.is_some()
1403         }
1404         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
1405                 if let Self::Some(v) = self { v } else { unreachable!() }
1406         }
1407 }
1408 #[no_mangle]
1409 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ
1410 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ {
1411         COption_CVec_ThirtyTwoBytesZZ::Some(o)
1412 }
1413 #[no_mangle]
1414 /// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing
1415 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ {
1416         COption_CVec_ThirtyTwoBytesZZ::None
1417 }
1418 #[no_mangle]
1419 /// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state
1420 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { }
1421 #[no_mangle]
1422 /// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig`
1423 /// but with all dynamically-allocated buffers duplicated in new buffers.
1424 pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) }
1425 #[repr(C)]
1426 #[derive(Clone)]
1427 /// An enum which can either contain a crate::lightning::offers::offer::Amount or not
1428 pub enum COption_AmountZ {
1429         /// When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount
1430         Some(crate::lightning::offers::offer::Amount),
1431         /// When we're in this state, this COption_AmountZ contains nothing
1432         None
1433 }
1434 impl COption_AmountZ {
1435         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1436                 if let Self::None = self { false } else { true }
1437         }
1438         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1439                 !self.is_some()
1440         }
1441         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Amount {
1442                 if let Self::Some(v) = self { v } else { unreachable!() }
1443         }
1444 }
1445 #[no_mangle]
1446 /// Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount
1447 pub extern "C" fn COption_AmountZ_some(o: crate::lightning::offers::offer::Amount) -> COption_AmountZ {
1448         COption_AmountZ::Some(o)
1449 }
1450 #[no_mangle]
1451 /// Constructs a new COption_AmountZ containing nothing
1452 pub extern "C" fn COption_AmountZ_none() -> COption_AmountZ {
1453         COption_AmountZ::None
1454 }
1455 #[no_mangle]
1456 /// Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state
1457 pub extern "C" fn COption_AmountZ_free(_res: COption_AmountZ) { }
1458 #[no_mangle]
1459 /// Creates a new COption_AmountZ which has the same data as `orig`
1460 /// but with all dynamically-allocated buffers duplicated in new buffers.
1461 pub extern "C" fn COption_AmountZ_clone(orig: &COption_AmountZ) -> COption_AmountZ { Clone::clone(&orig) }
1462 #[repr(C)]
1463 #[derive(Clone)]
1464 /// An enum which can either contain a crate::lightning::offers::offer::Quantity or not
1465 pub enum COption_QuantityZ {
1466         /// When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity
1467         Some(crate::lightning::offers::offer::Quantity),
1468         /// When we're in this state, this COption_QuantityZ contains nothing
1469         None
1470 }
1471 impl COption_QuantityZ {
1472         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1473                 if let Self::None = self { false } else { true }
1474         }
1475         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1476                 !self.is_some()
1477         }
1478         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Quantity {
1479                 if let Self::Some(v) = self { v } else { unreachable!() }
1480         }
1481 }
1482 #[no_mangle]
1483 /// Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity
1484 pub extern "C" fn COption_QuantityZ_some(o: crate::lightning::offers::offer::Quantity) -> COption_QuantityZ {
1485         COption_QuantityZ::Some(o)
1486 }
1487 #[no_mangle]
1488 /// Constructs a new COption_QuantityZ containing nothing
1489 pub extern "C" fn COption_QuantityZ_none() -> COption_QuantityZ {
1490         COption_QuantityZ::None
1491 }
1492 #[no_mangle]
1493 /// Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state
1494 pub extern "C" fn COption_QuantityZ_free(_res: COption_QuantityZ) { }
1495 #[no_mangle]
1496 /// Creates a new COption_QuantityZ which has the same data as `orig`
1497 /// but with all dynamically-allocated buffers duplicated in new buffers.
1498 pub extern "C" fn COption_QuantityZ_clone(orig: &COption_QuantityZ) -> COption_QuantityZ { Clone::clone(&orig) }
1499 #[repr(C)]
1500 /// The contents of CResult_ThirtyTwoBytesNoneZ
1501 pub union CResult_ThirtyTwoBytesNoneZPtr {
1502         /// A pointer to the contents in the success state.
1503         /// Reading from this pointer when `result_ok` is not set is undefined.
1504         pub result: *mut crate::c_types::ThirtyTwoBytes,
1505         /// Note that this value is always NULL, as there are no contents in the Err variant
1506         pub err: *mut core::ffi::c_void,
1507 }
1508 #[repr(C)]
1509 /// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation,
1510 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
1511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1512 pub struct CResult_ThirtyTwoBytesNoneZ {
1513         /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either
1514         /// `err` or `result` depending on the state of `result_ok`.
1515         pub contents: CResult_ThirtyTwoBytesNoneZPtr,
1516         /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state.
1517         pub result_ok: bool,
1518 }
1519 #[no_mangle]
1520 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state.
1521 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ {
1522         CResult_ThirtyTwoBytesNoneZ {
1523                 contents: CResult_ThirtyTwoBytesNoneZPtr {
1524                         result: Box::into_raw(Box::new(o)),
1525                 },
1526                 result_ok: true,
1527         }
1528 }
1529 #[no_mangle]
1530 /// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state.
1531 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ {
1532         CResult_ThirtyTwoBytesNoneZ {
1533                 contents: CResult_ThirtyTwoBytesNoneZPtr {
1534                         err: core::ptr::null_mut(),
1535                 },
1536                 result_ok: false,
1537         }
1538 }
1539 /// Checks if the given object is currently in the success state
1540 #[no_mangle]
1541 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool {
1542         o.result_ok
1543 }
1544 #[no_mangle]
1545 /// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ.
1546 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { }
1547 impl Drop for CResult_ThirtyTwoBytesNoneZ {
1548         fn drop(&mut self) {
1549                 if self.result_ok {
1550                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1551                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1552                         }
1553                 } else {
1554                 }
1555         }
1556 }
1557 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_ThirtyTwoBytesNoneZ {
1558         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
1559                 let contents = if o.result_ok {
1560                         let result = unsafe { o.contents.result };
1561                         unsafe { o.contents.result = core::ptr::null_mut() };
1562                         CResult_ThirtyTwoBytesNoneZPtr { result }
1563                 } else {
1564                         let _ = unsafe { Box::from_raw(o.contents.err) };
1565                         o.contents.err = core::ptr::null_mut();
1566                         CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() }
1567                 };
1568                 Self {
1569                         contents,
1570                         result_ok: o.result_ok,
1571                 }
1572         }
1573 }
1574 impl Clone for CResult_ThirtyTwoBytesNoneZ {
1575         fn clone(&self) -> Self {
1576                 if self.result_ok {
1577                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr {
1578                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
1579                         } }
1580                 } else {
1581                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr {
1582                                 err: core::ptr::null_mut()
1583                         } }
1584                 }
1585         }
1586 }
1587 #[no_mangle]
1588 /// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig`
1589 /// but with all dynamically-allocated buffers duplicated in new buffers.
1590 pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) }
1591 #[repr(C)]
1592 /// The contents of CResult_BlindedPayInfoDecodeErrorZ
1593 pub union CResult_BlindedPayInfoDecodeErrorZPtr {
1594         /// A pointer to the contents in the success state.
1595         /// Reading from this pointer when `result_ok` is not set is undefined.
1596         pub result: *mut crate::lightning::offers::invoice::BlindedPayInfo,
1597         /// A pointer to the contents in the error state.
1598         /// Reading from this pointer when `result_ok` is set is undefined.
1599         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1600 }
1601 #[repr(C)]
1602 /// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
1603 /// containing a crate::lightning::offers::invoice::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
1604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1605 pub struct CResult_BlindedPayInfoDecodeErrorZ {
1606         /// The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
1607         /// `err` or `result` depending on the state of `result_ok`.
1608         pub contents: CResult_BlindedPayInfoDecodeErrorZPtr,
1609         /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
1610         pub result_ok: bool,
1611 }
1612 #[no_mangle]
1613 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
1614 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::offers::invoice::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ {
1615         CResult_BlindedPayInfoDecodeErrorZ {
1616                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1617                         result: Box::into_raw(Box::new(o)),
1618                 },
1619                 result_ok: true,
1620         }
1621 }
1622 #[no_mangle]
1623 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
1624 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPayInfoDecodeErrorZ {
1625         CResult_BlindedPayInfoDecodeErrorZ {
1626                 contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1627                         err: Box::into_raw(Box::new(e)),
1628                 },
1629                 result_ok: false,
1630         }
1631 }
1632 /// Checks if the given object is currently in the success state
1633 #[no_mangle]
1634 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool {
1635         o.result_ok
1636 }
1637 #[no_mangle]
1638 /// Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
1639 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_free(_res: CResult_BlindedPayInfoDecodeErrorZ) { }
1640 impl Drop for CResult_BlindedPayInfoDecodeErrorZ {
1641         fn drop(&mut self) {
1642                 if self.result_ok {
1643                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1644                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1645                         }
1646                 } else {
1647                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1648                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1649                         }
1650                 }
1651         }
1652 }
1653 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPayInfoDecodeErrorZ {
1654         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
1655                 let contents = if o.result_ok {
1656                         let result = unsafe { o.contents.result };
1657                         unsafe { o.contents.result = core::ptr::null_mut() };
1658                         CResult_BlindedPayInfoDecodeErrorZPtr { result }
1659                 } else {
1660                         let err = unsafe { o.contents.err };
1661                         unsafe { o.contents.err = core::ptr::null_mut(); }
1662                         CResult_BlindedPayInfoDecodeErrorZPtr { err }
1663                 };
1664                 Self {
1665                         contents,
1666                         result_ok: o.result_ok,
1667                 }
1668         }
1669 }
1670 impl Clone for CResult_BlindedPayInfoDecodeErrorZ {
1671         fn clone(&self) -> Self {
1672                 if self.result_ok {
1673                         Self { result_ok: true, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1674                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice::BlindedPayInfo>::clone(unsafe { &*self.contents.result })))
1675                         } }
1676                 } else {
1677                         Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr {
1678                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1679                         } }
1680                 }
1681         }
1682 }
1683 #[no_mangle]
1684 /// Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
1685 /// but with all dynamically-allocated buffers duplicated in new buffers.
1686 pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) }
1687 #[repr(C)]
1688 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
1689 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1690         /// A pointer to the contents in the success state.
1691         /// Reading from this pointer when `result_ok` is not set is undefined.
1692         pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor,
1693         /// A pointer to the contents in the error state.
1694         /// Reading from this pointer when `result_ok` is set is undefined.
1695         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1696 }
1697 #[repr(C)]
1698 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1699 /// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1701 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1702         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
1703         /// `err` or `result` depending on the state of `result_ok`.
1704         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
1705         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
1706         pub result_ok: bool,
1707 }
1708 #[no_mangle]
1709 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
1710 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1711         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1712                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1713                         result: Box::into_raw(Box::new(o)),
1714                 },
1715                 result_ok: true,
1716         }
1717 }
1718 #[no_mangle]
1719 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
1720 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1721         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1722                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1723                         err: Box::into_raw(Box::new(e)),
1724                 },
1725                 result_ok: false,
1726         }
1727 }
1728 /// Checks if the given object is currently in the success state
1729 #[no_mangle]
1730 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
1731         o.result_ok
1732 }
1733 #[no_mangle]
1734 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
1735 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
1736 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1737         fn drop(&mut self) {
1738                 if self.result_ok {
1739                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1740                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1741                         }
1742                 } else {
1743                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1744                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1745                         }
1746                 }
1747         }
1748 }
1749 impl From<crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1750         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1751                 let contents = if o.result_ok {
1752                         let result = unsafe { o.contents.result };
1753                         unsafe { o.contents.result = core::ptr::null_mut() };
1754                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
1755                 } else {
1756                         let err = unsafe { o.contents.err };
1757                         unsafe { o.contents.err = core::ptr::null_mut(); }
1758                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
1759                 };
1760                 Self {
1761                         contents,
1762                         result_ok: o.result_ok,
1763                 }
1764         }
1765 }
1766 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
1767         fn clone(&self) -> Self {
1768                 if self.result_ok {
1769                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1770                                 result: Box::into_raw(Box::new(<crate::lightning::sign::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1771                         } }
1772                 } else {
1773                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
1774                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1775                         } }
1776                 }
1777         }
1778 }
1779 #[no_mangle]
1780 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1781 /// but with all dynamically-allocated buffers duplicated in new buffers.
1782 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1783 #[repr(C)]
1784 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
1785 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1786         /// A pointer to the contents in the success state.
1787         /// Reading from this pointer when `result_ok` is not set is undefined.
1788         pub result: *mut crate::lightning::sign::StaticPaymentOutputDescriptor,
1789         /// A pointer to the contents in the error state.
1790         /// Reading from this pointer when `result_ok` is set is undefined.
1791         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1792 }
1793 #[repr(C)]
1794 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1795 /// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1797 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1798         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
1799         /// `err` or `result` depending on the state of `result_ok`.
1800         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
1801         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
1802         pub result_ok: bool,
1803 }
1804 #[no_mangle]
1805 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
1806 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1807         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1808                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1809                         result: Box::into_raw(Box::new(o)),
1810                 },
1811                 result_ok: true,
1812         }
1813 }
1814 #[no_mangle]
1815 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
1816 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1817         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1818                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1819                         err: Box::into_raw(Box::new(e)),
1820                 },
1821                 result_ok: false,
1822         }
1823 }
1824 /// Checks if the given object is currently in the success state
1825 #[no_mangle]
1826 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
1827         o.result_ok
1828 }
1829 #[no_mangle]
1830 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
1831 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
1832 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1833         fn drop(&mut self) {
1834                 if self.result_ok {
1835                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1836                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1837                         }
1838                 } else {
1839                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1840                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1841                         }
1842                 }
1843         }
1844 }
1845 impl From<crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1846         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1847                 let contents = if o.result_ok {
1848                         let result = unsafe { o.contents.result };
1849                         unsafe { o.contents.result = core::ptr::null_mut() };
1850                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
1851                 } else {
1852                         let err = unsafe { o.contents.err };
1853                         unsafe { o.contents.err = core::ptr::null_mut(); }
1854                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
1855                 };
1856                 Self {
1857                         contents,
1858                         result_ok: o.result_ok,
1859                 }
1860         }
1861 }
1862 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
1863         fn clone(&self) -> Self {
1864                 if self.result_ok {
1865                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1866                                 result: Box::into_raw(Box::new(<crate::lightning::sign::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1867                         } }
1868                 } else {
1869                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
1870                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1871                         } }
1872                 }
1873         }
1874 }
1875 #[no_mangle]
1876 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
1877 /// but with all dynamically-allocated buffers duplicated in new buffers.
1878 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1879 #[repr(C)]
1880 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
1881 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1882         /// A pointer to the contents in the success state.
1883         /// Reading from this pointer when `result_ok` is not set is undefined.
1884         pub result: *mut crate::lightning::sign::SpendableOutputDescriptor,
1885         /// A pointer to the contents in the error state.
1886         /// Reading from this pointer when `result_ok` is set is undefined.
1887         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1888 }
1889 #[repr(C)]
1890 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
1891 /// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
1892 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1893 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
1894         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
1895         /// `err` or `result` depending on the state of `result_ok`.
1896         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
1897         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
1898         pub result_ok: bool,
1899 }
1900 #[no_mangle]
1901 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
1902 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1903         CResult_SpendableOutputDescriptorDecodeErrorZ {
1904                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1905                         result: Box::into_raw(Box::new(o)),
1906                 },
1907                 result_ok: true,
1908         }
1909 }
1910 #[no_mangle]
1911 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
1912 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
1913         CResult_SpendableOutputDescriptorDecodeErrorZ {
1914                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1915                         err: Box::into_raw(Box::new(e)),
1916                 },
1917                 result_ok: false,
1918         }
1919 }
1920 /// Checks if the given object is currently in the success state
1921 #[no_mangle]
1922 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
1923         o.result_ok
1924 }
1925 #[no_mangle]
1926 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
1927 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
1928 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
1929         fn drop(&mut self) {
1930                 if self.result_ok {
1931                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1932                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1933                         }
1934                 } else {
1935                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1936                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1937                         }
1938                 }
1939         }
1940 }
1941 impl From<crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
1942         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
1943                 let contents = if o.result_ok {
1944                         let result = unsafe { o.contents.result };
1945                         unsafe { o.contents.result = core::ptr::null_mut() };
1946                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
1947                 } else {
1948                         let err = unsafe { o.contents.err };
1949                         unsafe { o.contents.err = core::ptr::null_mut(); }
1950                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
1951                 };
1952                 Self {
1953                         contents,
1954                         result_ok: o.result_ok,
1955                 }
1956         }
1957 }
1958 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
1959         fn clone(&self) -> Self {
1960                 if self.result_ok {
1961                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1962                                 result: Box::into_raw(Box::new(<crate::lightning::sign::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
1963                         } }
1964                 } else {
1965                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
1966                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1967                         } }
1968                 }
1969         }
1970 }
1971 #[no_mangle]
1972 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
1973 /// but with all dynamically-allocated buffers duplicated in new buffers.
1974 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
1975 #[repr(C)]
1976 /// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size.
1977 /// This corresponds to std::vector in C++
1978 pub struct CVec_SpendableOutputDescriptorZ {
1979         /// The elements in the array.
1980         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1981         pub data: *mut crate::lightning::sign::SpendableOutputDescriptor,
1982         /// The number of elements pointed to by `data`.
1983         pub datalen: usize
1984 }
1985 impl CVec_SpendableOutputDescriptorZ {
1986         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::SpendableOutputDescriptor> {
1987                 if self.datalen == 0 { return Vec::new(); }
1988                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1989                 self.data = core::ptr::null_mut();
1990                 self.datalen = 0;
1991                 ret
1992         }
1993         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] {
1994                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1995         }
1996 }
1997 impl From<Vec<crate::lightning::sign::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
1998         fn from(v: Vec<crate::lightning::sign::SpendableOutputDescriptor>) -> Self {
1999                 let datalen = v.len();
2000                 let data = Box::into_raw(v.into_boxed_slice());
2001                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2002         }
2003 }
2004 #[no_mangle]
2005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2006 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2007 impl Drop for CVec_SpendableOutputDescriptorZ {
2008         fn drop(&mut self) {
2009                 if self.datalen == 0 { return; }
2010                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2011         }
2012 }
2013 impl Clone for CVec_SpendableOutputDescriptorZ {
2014         fn clone(&self) -> Self {
2015                 let mut res = Vec::new();
2016                 if self.datalen == 0 { return Self::from(res); }
2017                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2018                 Self::from(res)
2019         }
2020 }
2021 #[repr(C)]
2022 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
2023 /// This corresponds to std::vector in C++
2024 pub struct CVec_TxOutZ {
2025         /// The elements in the array.
2026         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2027         pub data: *mut crate::c_types::TxOut,
2028         /// The number of elements pointed to by `data`.
2029         pub datalen: usize
2030 }
2031 impl CVec_TxOutZ {
2032         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
2033                 if self.datalen == 0 { return Vec::new(); }
2034                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2035                 self.data = core::ptr::null_mut();
2036                 self.datalen = 0;
2037                 ret
2038         }
2039         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
2040                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2041         }
2042 }
2043 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
2044         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
2045                 let datalen = v.len();
2046                 let data = Box::into_raw(v.into_boxed_slice());
2047                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2048         }
2049 }
2050 #[no_mangle]
2051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2052 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
2053 impl Drop for CVec_TxOutZ {
2054         fn drop(&mut self) {
2055                 if self.datalen == 0 { return; }
2056                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2057         }
2058 }
2059 impl Clone for CVec_TxOutZ {
2060         fn clone(&self) -> Self {
2061                 let mut res = Vec::new();
2062                 if self.datalen == 0 { return Self::from(res); }
2063                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2064                 Self::from(res)
2065         }
2066 }
2067 #[repr(C)]
2068 #[derive(Clone)]
2069 /// An enum which can either contain a u32 or not
2070 pub enum COption_u32Z {
2071         /// When we're in this state, this COption_u32Z contains a u32
2072         Some(u32),
2073         /// When we're in this state, this COption_u32Z contains nothing
2074         None
2075 }
2076 impl COption_u32Z {
2077         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2078                 if let Self::None = self { false } else { true }
2079         }
2080         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2081                 !self.is_some()
2082         }
2083         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
2084                 if let Self::Some(v) = self { v } else { unreachable!() }
2085         }
2086 }
2087 #[no_mangle]
2088 /// Constructs a new COption_u32Z containing a u32
2089 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
2090         COption_u32Z::Some(o)
2091 }
2092 #[no_mangle]
2093 /// Constructs a new COption_u32Z containing nothing
2094 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
2095         COption_u32Z::None
2096 }
2097 #[no_mangle]
2098 /// Frees any resources associated with the u32, if we are in the Some state
2099 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
2100 #[no_mangle]
2101 /// Creates a new COption_u32Z which has the same data as `orig`
2102 /// but with all dynamically-allocated buffers duplicated in new buffers.
2103 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
2104 #[repr(C)]
2105 /// A tuple of 2 elements. See the individual fields for the types contained.
2106 pub struct C2Tuple_CVec_u8Zu64Z {
2107         /// The element at position 0
2108         pub a: crate::c_types::derived::CVec_u8Z,
2109         /// The element at position 1
2110         pub b: u64,
2111 }
2112 impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z {
2113         fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self {
2114                 Self {
2115                         a: tup.0,
2116                         b: tup.1,
2117                 }
2118         }
2119 }
2120 impl C2Tuple_CVec_u8Zu64Z {
2121         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) {
2122                 (self.a, self.b)
2123         }
2124 }
2125 impl Clone for C2Tuple_CVec_u8Zu64Z {
2126         fn clone(&self) -> Self {
2127                 Self {
2128                         a: Clone::clone(&self.a),
2129                         b: Clone::clone(&self.b),
2130                 }
2131         }
2132 }
2133 #[no_mangle]
2134 /// Creates a new tuple which has the same data as `orig`
2135 /// but with all dynamically-allocated buffers duplicated in new buffers.
2136 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) }
2137 /// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements.
2138 #[no_mangle]
2139 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z {
2140         C2Tuple_CVec_u8Zu64Z { a, b, }
2141 }
2142
2143 #[no_mangle]
2144 /// Frees any resources used by the C2Tuple_CVec_u8Zu64Z.
2145 pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { }
2146 #[repr(C)]
2147 /// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ
2148 pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2149         /// A pointer to the contents in the success state.
2150         /// Reading from this pointer when `result_ok` is not set is undefined.
2151         pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8Zu64Z,
2152         /// Note that this value is always NULL, as there are no contents in the Err variant
2153         pub err: *mut core::ffi::c_void,
2154 }
2155 #[repr(C)]
2156 /// A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation,
2157 /// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure.
2158 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2159 pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2160         /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either
2161         /// `err` or `result` depending on the state of `result_ok`.
2162         pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr,
2163         /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state.
2164         pub result_ok: bool,
2165 }
2166 #[no_mangle]
2167 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state.
2168 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2169         CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2170                 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2171                         result: Box::into_raw(Box::new(o)),
2172                 },
2173                 result_ok: true,
2174         }
2175 }
2176 #[no_mangle]
2177 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state.
2178 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2179         CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2180                 contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2181                         err: core::ptr::null_mut(),
2182                 },
2183                 result_ok: false,
2184         }
2185 }
2186 /// Checks if the given object is currently in the success state
2187 #[no_mangle]
2188 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool {
2189         o.result_ok
2190 }
2191 #[no_mangle]
2192 /// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ.
2193 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { }
2194 impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2195         fn drop(&mut self) {
2196                 if self.result_ok {
2197                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2198                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2199                         }
2200                 } else {
2201                 }
2202         }
2203 }
2204 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2205         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, ()>) -> Self {
2206                 let contents = if o.result_ok {
2207                         let result = unsafe { o.contents.result };
2208                         unsafe { o.contents.result = core::ptr::null_mut() };
2209                         CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result }
2210                 } else {
2211                         let _ = unsafe { Box::from_raw(o.contents.err) };
2212                         o.contents.err = core::ptr::null_mut();
2213                         CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() }
2214                 };
2215                 Self {
2216                         contents,
2217                         result_ok: o.result_ok,
2218                 }
2219         }
2220 }
2221 impl Clone for CResult_C2Tuple_CVec_u8Zu64ZNoneZ {
2222         fn clone(&self) -> Self {
2223                 if self.result_ok {
2224                         Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2225                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_CVec_u8Zu64Z>::clone(unsafe { &*self.contents.result })))
2226                         } }
2227                 } else {
2228                         Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr {
2229                                 err: core::ptr::null_mut()
2230                         } }
2231                 }
2232         }
2233 }
2234 #[no_mangle]
2235 /// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig`
2236 /// but with all dynamically-allocated buffers duplicated in new buffers.
2237 pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) }
2238 #[repr(C)]
2239 /// The contents of CResult_ChannelDerivationParametersDecodeErrorZ
2240 pub union CResult_ChannelDerivationParametersDecodeErrorZPtr {
2241         /// A pointer to the contents in the success state.
2242         /// Reading from this pointer when `result_ok` is not set is undefined.
2243         pub result: *mut crate::lightning::sign::ChannelDerivationParameters,
2244         /// A pointer to the contents in the error state.
2245         /// Reading from this pointer when `result_ok` is set is undefined.
2246         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2247 }
2248 #[repr(C)]
2249 /// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation,
2250 /// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2252 pub struct CResult_ChannelDerivationParametersDecodeErrorZ {
2253         /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either
2254         /// `err` or `result` depending on the state of `result_ok`.
2255         pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr,
2256         /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state.
2257         pub result_ok: bool,
2258 }
2259 #[no_mangle]
2260 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state.
2261 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2262         CResult_ChannelDerivationParametersDecodeErrorZ {
2263                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2264                         result: Box::into_raw(Box::new(o)),
2265                 },
2266                 result_ok: true,
2267         }
2268 }
2269 #[no_mangle]
2270 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state.
2271 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ {
2272         CResult_ChannelDerivationParametersDecodeErrorZ {
2273                 contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2274                         err: Box::into_raw(Box::new(e)),
2275                 },
2276                 result_ok: false,
2277         }
2278 }
2279 /// Checks if the given object is currently in the success state
2280 #[no_mangle]
2281 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool {
2282         o.result_ok
2283 }
2284 #[no_mangle]
2285 /// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ.
2286 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { }
2287 impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ {
2288         fn drop(&mut self) {
2289                 if self.result_ok {
2290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2292                         }
2293                 } else {
2294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2296                         }
2297                 }
2298         }
2299 }
2300 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDerivationParametersDecodeErrorZ {
2301         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ChannelDerivationParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2302                 let contents = if o.result_ok {
2303                         let result = unsafe { o.contents.result };
2304                         unsafe { o.contents.result = core::ptr::null_mut() };
2305                         CResult_ChannelDerivationParametersDecodeErrorZPtr { result }
2306                 } else {
2307                         let err = unsafe { o.contents.err };
2308                         unsafe { o.contents.err = core::ptr::null_mut(); }
2309                         CResult_ChannelDerivationParametersDecodeErrorZPtr { err }
2310                 };
2311                 Self {
2312                         contents,
2313                         result_ok: o.result_ok,
2314                 }
2315         }
2316 }
2317 impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ {
2318         fn clone(&self) -> Self {
2319                 if self.result_ok {
2320                         Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2321                                 result: Box::into_raw(Box::new(<crate::lightning::sign::ChannelDerivationParameters>::clone(unsafe { &*self.contents.result })))
2322                         } }
2323                 } else {
2324                         Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr {
2325                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2326                         } }
2327                 }
2328         }
2329 }
2330 #[no_mangle]
2331 /// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig`
2332 /// but with all dynamically-allocated buffers duplicated in new buffers.
2333 pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) }
2334 #[repr(C)]
2335 /// The contents of CResult_HTLCDescriptorDecodeErrorZ
2336 pub union CResult_HTLCDescriptorDecodeErrorZPtr {
2337         /// A pointer to the contents in the success state.
2338         /// Reading from this pointer when `result_ok` is not set is undefined.
2339         pub result: *mut crate::lightning::sign::HTLCDescriptor,
2340         /// A pointer to the contents in the error state.
2341         /// Reading from this pointer when `result_ok` is set is undefined.
2342         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2343 }
2344 #[repr(C)]
2345 /// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation,
2346 /// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2348 pub struct CResult_HTLCDescriptorDecodeErrorZ {
2349         /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either
2350         /// `err` or `result` depending on the state of `result_ok`.
2351         pub contents: CResult_HTLCDescriptorDecodeErrorZPtr,
2352         /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state.
2353         pub result_ok: bool,
2354 }
2355 #[no_mangle]
2356 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state.
2357 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ {
2358         CResult_HTLCDescriptorDecodeErrorZ {
2359                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2360                         result: Box::into_raw(Box::new(o)),
2361                 },
2362                 result_ok: true,
2363         }
2364 }
2365 #[no_mangle]
2366 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state.
2367 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ {
2368         CResult_HTLCDescriptorDecodeErrorZ {
2369                 contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2370                         err: Box::into_raw(Box::new(e)),
2371                 },
2372                 result_ok: false,
2373         }
2374 }
2375 /// Checks if the given object is currently in the success state
2376 #[no_mangle]
2377 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool {
2378         o.result_ok
2379 }
2380 #[no_mangle]
2381 /// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ.
2382 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { }
2383 impl Drop for CResult_HTLCDescriptorDecodeErrorZ {
2384         fn drop(&mut self) {
2385                 if self.result_ok {
2386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2388                         }
2389                 } else {
2390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2392                         }
2393                 }
2394         }
2395 }
2396 impl From<crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCDescriptorDecodeErrorZ {
2397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::HTLCDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
2398                 let contents = if o.result_ok {
2399                         let result = unsafe { o.contents.result };
2400                         unsafe { o.contents.result = core::ptr::null_mut() };
2401                         CResult_HTLCDescriptorDecodeErrorZPtr { result }
2402                 } else {
2403                         let err = unsafe { o.contents.err };
2404                         unsafe { o.contents.err = core::ptr::null_mut(); }
2405                         CResult_HTLCDescriptorDecodeErrorZPtr { err }
2406                 };
2407                 Self {
2408                         contents,
2409                         result_ok: o.result_ok,
2410                 }
2411         }
2412 }
2413 impl Clone for CResult_HTLCDescriptorDecodeErrorZ {
2414         fn clone(&self) -> Self {
2415                 if self.result_ok {
2416                         Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2417                                 result: Box::into_raw(Box::new(<crate::lightning::sign::HTLCDescriptor>::clone(unsafe { &*self.contents.result })))
2418                         } }
2419                 } else {
2420                         Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr {
2421                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2422                         } }
2423                 }
2424         }
2425 }
2426 #[no_mangle]
2427 /// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig`
2428 /// but with all dynamically-allocated buffers duplicated in new buffers.
2429 pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) }
2430 #[repr(C)]
2431 /// The contents of CResult_NoneNoneZ
2432 pub union CResult_NoneNoneZPtr {
2433         /// Note that this value is always NULL, as there are no contents in the OK variant
2434         pub result: *mut core::ffi::c_void,
2435         /// Note that this value is always NULL, as there are no contents in the Err variant
2436         pub err: *mut core::ffi::c_void,
2437 }
2438 #[repr(C)]
2439 /// A CResult_NoneNoneZ represents the result of a fallible operation,
2440 /// containing a () on success and a () on failure.
2441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2442 pub struct CResult_NoneNoneZ {
2443         /// The contents of this CResult_NoneNoneZ, accessible via either
2444         /// `err` or `result` depending on the state of `result_ok`.
2445         pub contents: CResult_NoneNoneZPtr,
2446         /// Whether this CResult_NoneNoneZ represents a success state.
2447         pub result_ok: bool,
2448 }
2449 #[no_mangle]
2450 /// Creates a new CResult_NoneNoneZ in the success state.
2451 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
2452         CResult_NoneNoneZ {
2453                 contents: CResult_NoneNoneZPtr {
2454                         result: core::ptr::null_mut(),
2455                 },
2456                 result_ok: true,
2457         }
2458 }
2459 #[no_mangle]
2460 /// Creates a new CResult_NoneNoneZ in the error state.
2461 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
2462         CResult_NoneNoneZ {
2463                 contents: CResult_NoneNoneZPtr {
2464                         err: core::ptr::null_mut(),
2465                 },
2466                 result_ok: false,
2467         }
2468 }
2469 /// Checks if the given object is currently in the success state
2470 #[no_mangle]
2471 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
2472         o.result_ok
2473 }
2474 #[no_mangle]
2475 /// Frees any resources used by the CResult_NoneNoneZ.
2476 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
2477 impl Drop for CResult_NoneNoneZ {
2478         fn drop(&mut self) {
2479                 if self.result_ok {
2480                 } else {
2481                 }
2482         }
2483 }
2484 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
2485         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
2486                 let contents = if o.result_ok {
2487                         let _ = unsafe { Box::from_raw(o.contents.result) };
2488                         o.contents.result = core::ptr::null_mut();
2489                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
2490                 } else {
2491                         let _ = unsafe { Box::from_raw(o.contents.err) };
2492                         o.contents.err = core::ptr::null_mut();
2493                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
2494                 };
2495                 Self {
2496                         contents,
2497                         result_ok: o.result_ok,
2498                 }
2499         }
2500 }
2501 impl Clone for CResult_NoneNoneZ {
2502         fn clone(&self) -> Self {
2503                 if self.result_ok {
2504                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
2505                                 result: core::ptr::null_mut()
2506                         } }
2507                 } else {
2508                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
2509                                 err: core::ptr::null_mut()
2510                         } }
2511                 }
2512         }
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
2516 /// but with all dynamically-allocated buffers duplicated in new buffers.
2517 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
2518 #[repr(C)]
2519 /// The contents of CResult_PublicKeyNoneZ
2520 pub union CResult_PublicKeyNoneZPtr {
2521         /// A pointer to the contents in the success state.
2522         /// Reading from this pointer when `result_ok` is not set is undefined.
2523         pub result: *mut crate::c_types::PublicKey,
2524         /// Note that this value is always NULL, as there are no contents in the Err variant
2525         pub err: *mut core::ffi::c_void,
2526 }
2527 #[repr(C)]
2528 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
2529 /// containing a crate::c_types::PublicKey on success and a () on failure.
2530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2531 pub struct CResult_PublicKeyNoneZ {
2532         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
2533         /// `err` or `result` depending on the state of `result_ok`.
2534         pub contents: CResult_PublicKeyNoneZPtr,
2535         /// Whether this CResult_PublicKeyNoneZ represents a success state.
2536         pub result_ok: bool,
2537 }
2538 #[no_mangle]
2539 /// Creates a new CResult_PublicKeyNoneZ in the success state.
2540 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
2541         CResult_PublicKeyNoneZ {
2542                 contents: CResult_PublicKeyNoneZPtr {
2543                         result: Box::into_raw(Box::new(o)),
2544                 },
2545                 result_ok: true,
2546         }
2547 }
2548 #[no_mangle]
2549 /// Creates a new CResult_PublicKeyNoneZ in the error state.
2550 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
2551         CResult_PublicKeyNoneZ {
2552                 contents: CResult_PublicKeyNoneZPtr {
2553                         err: core::ptr::null_mut(),
2554                 },
2555                 result_ok: false,
2556         }
2557 }
2558 /// Checks if the given object is currently in the success state
2559 #[no_mangle]
2560 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
2561         o.result_ok
2562 }
2563 #[no_mangle]
2564 /// Frees any resources used by the CResult_PublicKeyNoneZ.
2565 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
2566 impl Drop for CResult_PublicKeyNoneZ {
2567         fn drop(&mut self) {
2568                 if self.result_ok {
2569                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2570                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2571                         }
2572                 } else {
2573                 }
2574         }
2575 }
2576 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
2577         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
2578                 let contents = if o.result_ok {
2579                         let result = unsafe { o.contents.result };
2580                         unsafe { o.contents.result = core::ptr::null_mut() };
2581                         CResult_PublicKeyNoneZPtr { result }
2582                 } else {
2583                         let _ = unsafe { Box::from_raw(o.contents.err) };
2584                         o.contents.err = core::ptr::null_mut();
2585                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
2586                 };
2587                 Self {
2588                         contents,
2589                         result_ok: o.result_ok,
2590                 }
2591         }
2592 }
2593 impl Clone for CResult_PublicKeyNoneZ {
2594         fn clone(&self) -> Self {
2595                 if self.result_ok {
2596                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
2597                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
2598                         } }
2599                 } else {
2600                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
2601                                 err: core::ptr::null_mut()
2602                         } }
2603                 }
2604         }
2605 }
2606 #[no_mangle]
2607 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
2608 /// but with all dynamically-allocated buffers duplicated in new buffers.
2609 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
2610 #[repr(C)]
2611 #[derive(Clone)]
2612 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
2613 pub enum COption_BigEndianScalarZ {
2614         /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar
2615         Some(crate::c_types::BigEndianScalar),
2616         /// When we're in this state, this COption_BigEndianScalarZ contains nothing
2617         None
2618 }
2619 impl COption_BigEndianScalarZ {
2620         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2621                 if let Self::None = self { false } else { true }
2622         }
2623         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2624                 !self.is_some()
2625         }
2626         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
2627                 if let Self::Some(v) = self { v } else { unreachable!() }
2628         }
2629 }
2630 #[no_mangle]
2631 /// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar
2632 pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ {
2633         COption_BigEndianScalarZ::Some(o)
2634 }
2635 #[no_mangle]
2636 /// Constructs a new COption_BigEndianScalarZ containing nothing
2637 pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ {
2638         COption_BigEndianScalarZ::None
2639 }
2640 #[no_mangle]
2641 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
2642 pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { }
2643 #[no_mangle]
2644 /// Creates a new COption_BigEndianScalarZ which has the same data as `orig`
2645 /// but with all dynamically-allocated buffers duplicated in new buffers.
2646 pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) }
2647 #[repr(C)]
2648 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
2649 /// This corresponds to std::vector in C++
2650 pub struct CVec_U5Z {
2651         /// The elements in the array.
2652         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2653         pub data: *mut crate::c_types::U5,
2654         /// The number of elements pointed to by `data`.
2655         pub datalen: usize
2656 }
2657 impl CVec_U5Z {
2658         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
2659                 if self.datalen == 0 { return Vec::new(); }
2660                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2661                 self.data = core::ptr::null_mut();
2662                 self.datalen = 0;
2663                 ret
2664         }
2665         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
2666                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2667         }
2668 }
2669 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
2670         fn from(v: Vec<crate::c_types::U5>) -> Self {
2671                 let datalen = v.len();
2672                 let data = Box::into_raw(v.into_boxed_slice());
2673                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2674         }
2675 }
2676 #[no_mangle]
2677 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2678 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
2679 impl Drop for CVec_U5Z {
2680         fn drop(&mut self) {
2681                 if self.datalen == 0 { return; }
2682                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2683         }
2684 }
2685 impl Clone for CVec_U5Z {
2686         fn clone(&self) -> Self {
2687                 let mut res = Vec::new();
2688                 if self.datalen == 0 { return Self::from(res); }
2689                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2690                 Self::from(res)
2691         }
2692 }
2693 #[repr(C)]
2694 /// The contents of CResult_RecoverableSignatureNoneZ
2695 pub union CResult_RecoverableSignatureNoneZPtr {
2696         /// A pointer to the contents in the success state.
2697         /// Reading from this pointer when `result_ok` is not set is undefined.
2698         pub result: *mut crate::c_types::RecoverableSignature,
2699         /// Note that this value is always NULL, as there are no contents in the Err variant
2700         pub err: *mut core::ffi::c_void,
2701 }
2702 #[repr(C)]
2703 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
2704 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
2705 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2706 pub struct CResult_RecoverableSignatureNoneZ {
2707         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
2708         /// `err` or `result` depending on the state of `result_ok`.
2709         pub contents: CResult_RecoverableSignatureNoneZPtr,
2710         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
2711         pub result_ok: bool,
2712 }
2713 #[no_mangle]
2714 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
2715 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
2716         CResult_RecoverableSignatureNoneZ {
2717                 contents: CResult_RecoverableSignatureNoneZPtr {
2718                         result: Box::into_raw(Box::new(o)),
2719                 },
2720                 result_ok: true,
2721         }
2722 }
2723 #[no_mangle]
2724 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
2725 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
2726         CResult_RecoverableSignatureNoneZ {
2727                 contents: CResult_RecoverableSignatureNoneZPtr {
2728                         err: core::ptr::null_mut(),
2729                 },
2730                 result_ok: false,
2731         }
2732 }
2733 /// Checks if the given object is currently in the success state
2734 #[no_mangle]
2735 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
2736         o.result_ok
2737 }
2738 #[no_mangle]
2739 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
2740 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
2741 impl Drop for CResult_RecoverableSignatureNoneZ {
2742         fn drop(&mut self) {
2743                 if self.result_ok {
2744                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2745                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2746                         }
2747                 } else {
2748                 }
2749         }
2750 }
2751 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
2752         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
2753                 let contents = if o.result_ok {
2754                         let result = unsafe { o.contents.result };
2755                         unsafe { o.contents.result = core::ptr::null_mut() };
2756                         CResult_RecoverableSignatureNoneZPtr { result }
2757                 } else {
2758                         let _ = unsafe { Box::from_raw(o.contents.err) };
2759                         o.contents.err = core::ptr::null_mut();
2760                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
2761                 };
2762                 Self {
2763                         contents,
2764                         result_ok: o.result_ok,
2765                 }
2766         }
2767 }
2768 impl Clone for CResult_RecoverableSignatureNoneZ {
2769         fn clone(&self) -> Self {
2770                 if self.result_ok {
2771                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
2772                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
2773                         } }
2774                 } else {
2775                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
2776                                 err: core::ptr::null_mut()
2777                         } }
2778                 }
2779         }
2780 }
2781 #[no_mangle]
2782 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
2783 /// but with all dynamically-allocated buffers duplicated in new buffers.
2784 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
2785 #[repr(C)]
2786 /// The contents of CResult_ECDSASignatureNoneZ
2787 pub union CResult_ECDSASignatureNoneZPtr {
2788         /// A pointer to the contents in the success state.
2789         /// Reading from this pointer when `result_ok` is not set is undefined.
2790         pub result: *mut crate::c_types::ECDSASignature,
2791         /// Note that this value is always NULL, as there are no contents in the Err variant
2792         pub err: *mut core::ffi::c_void,
2793 }
2794 #[repr(C)]
2795 /// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation,
2796 /// containing a crate::c_types::ECDSASignature on success and a () on failure.
2797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2798 pub struct CResult_ECDSASignatureNoneZ {
2799         /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either
2800         /// `err` or `result` depending on the state of `result_ok`.
2801         pub contents: CResult_ECDSASignatureNoneZPtr,
2802         /// Whether this CResult_ECDSASignatureNoneZ represents a success state.
2803         pub result_ok: bool,
2804 }
2805 #[no_mangle]
2806 /// Creates a new CResult_ECDSASignatureNoneZ in the success state.
2807 pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ {
2808         CResult_ECDSASignatureNoneZ {
2809                 contents: CResult_ECDSASignatureNoneZPtr {
2810                         result: Box::into_raw(Box::new(o)),
2811                 },
2812                 result_ok: true,
2813         }
2814 }
2815 #[no_mangle]
2816 /// Creates a new CResult_ECDSASignatureNoneZ in the error state.
2817 pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ {
2818         CResult_ECDSASignatureNoneZ {
2819                 contents: CResult_ECDSASignatureNoneZPtr {
2820                         err: core::ptr::null_mut(),
2821                 },
2822                 result_ok: false,
2823         }
2824 }
2825 /// Checks if the given object is currently in the success state
2826 #[no_mangle]
2827 pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool {
2828         o.result_ok
2829 }
2830 #[no_mangle]
2831 /// Frees any resources used by the CResult_ECDSASignatureNoneZ.
2832 pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { }
2833 impl Drop for CResult_ECDSASignatureNoneZ {
2834         fn drop(&mut self) {
2835                 if self.result_ok {
2836                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2837                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2838                         }
2839                 } else {
2840                 }
2841         }
2842 }
2843 impl From<crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>> for CResult_ECDSASignatureNoneZ {
2844         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ECDSASignature, ()>) -> Self {
2845                 let contents = if o.result_ok {
2846                         let result = unsafe { o.contents.result };
2847                         unsafe { o.contents.result = core::ptr::null_mut() };
2848                         CResult_ECDSASignatureNoneZPtr { result }
2849                 } else {
2850                         let _ = unsafe { Box::from_raw(o.contents.err) };
2851                         o.contents.err = core::ptr::null_mut();
2852                         CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() }
2853                 };
2854                 Self {
2855                         contents,
2856                         result_ok: o.result_ok,
2857                 }
2858         }
2859 }
2860 impl Clone for CResult_ECDSASignatureNoneZ {
2861         fn clone(&self) -> Self {
2862                 if self.result_ok {
2863                         Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr {
2864                                 result: Box::into_raw(Box::new(<crate::c_types::ECDSASignature>::clone(unsafe { &*self.contents.result })))
2865                         } }
2866                 } else {
2867                         Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr {
2868                                 err: core::ptr::null_mut()
2869                         } }
2870                 }
2871         }
2872 }
2873 #[no_mangle]
2874 /// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig`
2875 /// but with all dynamically-allocated buffers duplicated in new buffers.
2876 pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) }
2877 #[repr(C)]
2878 /// The contents of CResult_TransactionNoneZ
2879 pub union CResult_TransactionNoneZPtr {
2880         /// A pointer to the contents in the success state.
2881         /// Reading from this pointer when `result_ok` is not set is undefined.
2882         pub result: *mut crate::c_types::Transaction,
2883         /// Note that this value is always NULL, as there are no contents in the Err variant
2884         pub err: *mut core::ffi::c_void,
2885 }
2886 #[repr(C)]
2887 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
2888 /// containing a crate::c_types::Transaction on success and a () on failure.
2889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2890 pub struct CResult_TransactionNoneZ {
2891         /// The contents of this CResult_TransactionNoneZ, accessible via either
2892         /// `err` or `result` depending on the state of `result_ok`.
2893         pub contents: CResult_TransactionNoneZPtr,
2894         /// Whether this CResult_TransactionNoneZ represents a success state.
2895         pub result_ok: bool,
2896 }
2897 #[no_mangle]
2898 /// Creates a new CResult_TransactionNoneZ in the success state.
2899 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
2900         CResult_TransactionNoneZ {
2901                 contents: CResult_TransactionNoneZPtr {
2902                         result: Box::into_raw(Box::new(o)),
2903                 },
2904                 result_ok: true,
2905         }
2906 }
2907 #[no_mangle]
2908 /// Creates a new CResult_TransactionNoneZ in the error state.
2909 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
2910         CResult_TransactionNoneZ {
2911                 contents: CResult_TransactionNoneZPtr {
2912                         err: core::ptr::null_mut(),
2913                 },
2914                 result_ok: false,
2915         }
2916 }
2917 /// Checks if the given object is currently in the success state
2918 #[no_mangle]
2919 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
2920         o.result_ok
2921 }
2922 #[no_mangle]
2923 /// Frees any resources used by the CResult_TransactionNoneZ.
2924 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
2925 impl Drop for CResult_TransactionNoneZ {
2926         fn drop(&mut self) {
2927                 if self.result_ok {
2928                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2929                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2930                         }
2931                 } else {
2932                 }
2933         }
2934 }
2935 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
2936         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
2937                 let contents = if o.result_ok {
2938                         let result = unsafe { o.contents.result };
2939                         unsafe { o.contents.result = core::ptr::null_mut() };
2940                         CResult_TransactionNoneZPtr { result }
2941                 } else {
2942                         let _ = unsafe { Box::from_raw(o.contents.err) };
2943                         o.contents.err = core::ptr::null_mut();
2944                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
2945                 };
2946                 Self {
2947                         contents,
2948                         result_ok: o.result_ok,
2949                 }
2950         }
2951 }
2952 impl Clone for CResult_TransactionNoneZ {
2953         fn clone(&self) -> Self {
2954                 if self.result_ok {
2955                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
2956                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
2957                         } }
2958                 } else {
2959                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
2960                                 err: core::ptr::null_mut()
2961                         } }
2962                 }
2963         }
2964 }
2965 #[no_mangle]
2966 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
2967 /// but with all dynamically-allocated buffers duplicated in new buffers.
2968 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
2969 #[repr(C)]
2970 /// The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ
2971 pub union CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2972         /// A pointer to the contents in the success state.
2973         /// Reading from this pointer when `result_ok` is not set is undefined.
2974         pub result: *mut crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner,
2975         /// A pointer to the contents in the error state.
2976         /// Reading from this pointer when `result_ok` is set is undefined.
2977         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2978 }
2979 #[repr(C)]
2980 /// A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation,
2981 /// containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
2982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2983 pub struct CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2984         /// The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either
2985         /// `err` or `result` depending on the state of `result_ok`.
2986         pub contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr,
2987         /// Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state.
2988         pub result_ok: bool,
2989 }
2990 #[no_mangle]
2991 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state.
2992 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2993         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
2994                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
2995                         result: Box::into_raw(Box::new(o)),
2996                 },
2997                 result_ok: true,
2998         }
2999 }
3000 #[no_mangle]
3001 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state.
3002 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3003         CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3004                 contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3005                         err: Box::into_raw(Box::new(e)),
3006                 },
3007                 result_ok: false,
3008         }
3009 }
3010 /// Checks if the given object is currently in the success state
3011 #[no_mangle]
3012 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> bool {
3013         o.result_ok
3014 }
3015 #[no_mangle]
3016 /// Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ.
3017 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res: CResult_WriteableEcdsaChannelSignerDecodeErrorZ) { }
3018 impl Drop for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3019         fn drop(&mut self) {
3020                 if self.result_ok {
3021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3023                         }
3024                 } else {
3025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3027                         }
3028                 }
3029         }
3030 }
3031 impl From<crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>> for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3032         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3033                 let contents = if o.result_ok {
3034                         let result = unsafe { o.contents.result };
3035                         unsafe { o.contents.result = core::ptr::null_mut() };
3036                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { result }
3037                 } else {
3038                         let err = unsafe { o.contents.err };
3039                         unsafe { o.contents.err = core::ptr::null_mut(); }
3040                         CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { err }
3041                 };
3042                 Self {
3043                         contents,
3044                         result_ok: o.result_ok,
3045                 }
3046         }
3047 }
3048 impl Clone for CResult_WriteableEcdsaChannelSignerDecodeErrorZ {
3049         fn clone(&self) -> Self {
3050                 if self.result_ok {
3051                         Self { result_ok: true, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3052                                 result: Box::into_raw(Box::new(<crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner>::clone(unsafe { &*self.contents.result })))
3053                         } }
3054                 } else {
3055                         Self { result_ok: false, contents: CResult_WriteableEcdsaChannelSignerDecodeErrorZPtr {
3056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3057                         } }
3058                 }
3059         }
3060 }
3061 #[no_mangle]
3062 /// Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig`
3063 /// but with all dynamically-allocated buffers duplicated in new buffers.
3064 pub extern "C" fn CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_WriteableEcdsaChannelSignerDecodeErrorZ) -> CResult_WriteableEcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) }
3065 #[repr(C)]
3066 /// The contents of CResult_CVec_u8ZNoneZ
3067 pub union CResult_CVec_u8ZNoneZPtr {
3068         /// A pointer to the contents in the success state.
3069         /// Reading from this pointer when `result_ok` is not set is undefined.
3070         pub result: *mut crate::c_types::derived::CVec_u8Z,
3071         /// Note that this value is always NULL, as there are no contents in the Err variant
3072         pub err: *mut core::ffi::c_void,
3073 }
3074 #[repr(C)]
3075 /// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation,
3076 /// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure.
3077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3078 pub struct CResult_CVec_u8ZNoneZ {
3079         /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either
3080         /// `err` or `result` depending on the state of `result_ok`.
3081         pub contents: CResult_CVec_u8ZNoneZPtr,
3082         /// Whether this CResult_CVec_u8ZNoneZ represents a success state.
3083         pub result_ok: bool,
3084 }
3085 #[no_mangle]
3086 /// Creates a new CResult_CVec_u8ZNoneZ in the success state.
3087 pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ {
3088         CResult_CVec_u8ZNoneZ {
3089                 contents: CResult_CVec_u8ZNoneZPtr {
3090                         result: Box::into_raw(Box::new(o)),
3091                 },
3092                 result_ok: true,
3093         }
3094 }
3095 #[no_mangle]
3096 /// Creates a new CResult_CVec_u8ZNoneZ in the error state.
3097 pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ {
3098         CResult_CVec_u8ZNoneZ {
3099                 contents: CResult_CVec_u8ZNoneZPtr {
3100                         err: core::ptr::null_mut(),
3101                 },
3102                 result_ok: false,
3103         }
3104 }
3105 /// Checks if the given object is currently in the success state
3106 #[no_mangle]
3107 pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool {
3108         o.result_ok
3109 }
3110 #[no_mangle]
3111 /// Frees any resources used by the CResult_CVec_u8ZNoneZ.
3112 pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { }
3113 impl Drop for CResult_CVec_u8ZNoneZ {
3114         fn drop(&mut self) {
3115                 if self.result_ok {
3116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3118                         }
3119                 } else {
3120                 }
3121         }
3122 }
3123 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>> for CResult_CVec_u8ZNoneZ {
3124         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, ()>) -> Self {
3125                 let contents = if o.result_ok {
3126                         let result = unsafe { o.contents.result };
3127                         unsafe { o.contents.result = core::ptr::null_mut() };
3128                         CResult_CVec_u8ZNoneZPtr { result }
3129                 } else {
3130                         let _ = unsafe { Box::from_raw(o.contents.err) };
3131                         o.contents.err = core::ptr::null_mut();
3132                         CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() }
3133                 };
3134                 Self {
3135                         contents,
3136                         result_ok: o.result_ok,
3137                 }
3138         }
3139 }
3140 impl Clone for CResult_CVec_u8ZNoneZ {
3141         fn clone(&self) -> Self {
3142                 if self.result_ok {
3143                         Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr {
3144                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3145                         } }
3146                 } else {
3147                         Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr {
3148                                 err: core::ptr::null_mut()
3149                         } }
3150                 }
3151         }
3152 }
3153 #[no_mangle]
3154 /// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig`
3155 /// but with all dynamically-allocated buffers duplicated in new buffers.
3156 pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) }
3157 #[repr(C)]
3158 /// The contents of CResult_ShutdownScriptNoneZ
3159 pub union CResult_ShutdownScriptNoneZPtr {
3160         /// A pointer to the contents in the success state.
3161         /// Reading from this pointer when `result_ok` is not set is undefined.
3162         pub result: *mut crate::lightning::ln::script::ShutdownScript,
3163         /// Note that this value is always NULL, as there are no contents in the Err variant
3164         pub err: *mut core::ffi::c_void,
3165 }
3166 #[repr(C)]
3167 /// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation,
3168 /// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure.
3169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3170 pub struct CResult_ShutdownScriptNoneZ {
3171         /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either
3172         /// `err` or `result` depending on the state of `result_ok`.
3173         pub contents: CResult_ShutdownScriptNoneZPtr,
3174         /// Whether this CResult_ShutdownScriptNoneZ represents a success state.
3175         pub result_ok: bool,
3176 }
3177 #[no_mangle]
3178 /// Creates a new CResult_ShutdownScriptNoneZ in the success state.
3179 pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ {
3180         CResult_ShutdownScriptNoneZ {
3181                 contents: CResult_ShutdownScriptNoneZPtr {
3182                         result: Box::into_raw(Box::new(o)),
3183                 },
3184                 result_ok: true,
3185         }
3186 }
3187 #[no_mangle]
3188 /// Creates a new CResult_ShutdownScriptNoneZ in the error state.
3189 pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ {
3190         CResult_ShutdownScriptNoneZ {
3191                 contents: CResult_ShutdownScriptNoneZPtr {
3192                         err: core::ptr::null_mut(),
3193                 },
3194                 result_ok: false,
3195         }
3196 }
3197 /// Checks if the given object is currently in the success state
3198 #[no_mangle]
3199 pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool {
3200         o.result_ok
3201 }
3202 #[no_mangle]
3203 /// Frees any resources used by the CResult_ShutdownScriptNoneZ.
3204 pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { }
3205 impl Drop for CResult_ShutdownScriptNoneZ {
3206         fn drop(&mut self) {
3207                 if self.result_ok {
3208                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3209                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3210                         }
3211                 } else {
3212                 }
3213         }
3214 }
3215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>> for CResult_ShutdownScriptNoneZ {
3216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, ()>) -> Self {
3217                 let contents = if o.result_ok {
3218                         let result = unsafe { o.contents.result };
3219                         unsafe { o.contents.result = core::ptr::null_mut() };
3220                         CResult_ShutdownScriptNoneZPtr { result }
3221                 } else {
3222                         let _ = unsafe { Box::from_raw(o.contents.err) };
3223                         o.contents.err = core::ptr::null_mut();
3224                         CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() }
3225                 };
3226                 Self {
3227                         contents,
3228                         result_ok: o.result_ok,
3229                 }
3230         }
3231 }
3232 impl Clone for CResult_ShutdownScriptNoneZ {
3233         fn clone(&self) -> Self {
3234                 if self.result_ok {
3235                         Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr {
3236                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
3237                         } }
3238                 } else {
3239                         Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr {
3240                                 err: core::ptr::null_mut()
3241                         } }
3242                 }
3243         }
3244 }
3245 #[no_mangle]
3246 /// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig`
3247 /// but with all dynamically-allocated buffers duplicated in new buffers.
3248 pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) }
3249 #[repr(C)]
3250 #[derive(Clone)]
3251 /// An enum which can either contain a u16 or not
3252 pub enum COption_u16Z {
3253         /// When we're in this state, this COption_u16Z contains a u16
3254         Some(u16),
3255         /// When we're in this state, this COption_u16Z contains nothing
3256         None
3257 }
3258 impl COption_u16Z {
3259         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3260                 if let Self::None = self { false } else { true }
3261         }
3262         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3263                 !self.is_some()
3264         }
3265         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
3266                 if let Self::Some(v) = self { v } else { unreachable!() }
3267         }
3268 }
3269 #[no_mangle]
3270 /// Constructs a new COption_u16Z containing a u16
3271 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
3272         COption_u16Z::Some(o)
3273 }
3274 #[no_mangle]
3275 /// Constructs a new COption_u16Z containing nothing
3276 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
3277         COption_u16Z::None
3278 }
3279 #[no_mangle]
3280 /// Frees any resources associated with the u16, if we are in the Some state
3281 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
3282 #[no_mangle]
3283 /// Creates a new COption_u16Z which has the same data as `orig`
3284 /// but with all dynamically-allocated buffers duplicated in new buffers.
3285 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
3286 #[repr(C)]
3287 #[derive(Clone)]
3288 /// An enum which can either contain a bool or not
3289 pub enum COption_boolZ {
3290         /// When we're in this state, this COption_boolZ contains a bool
3291         Some(bool),
3292         /// When we're in this state, this COption_boolZ contains nothing
3293         None
3294 }
3295 impl COption_boolZ {
3296         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3297                 if let Self::None = self { false } else { true }
3298         }
3299         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3300                 !self.is_some()
3301         }
3302         #[allow(unused)] pub(crate) fn take(mut self) -> bool {
3303                 if let Self::Some(v) = self { v } else { unreachable!() }
3304         }
3305 }
3306 #[no_mangle]
3307 /// Constructs a new COption_boolZ containing a bool
3308 pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ {
3309         COption_boolZ::Some(o)
3310 }
3311 #[no_mangle]
3312 /// Constructs a new COption_boolZ containing nothing
3313 pub extern "C" fn COption_boolZ_none() -> COption_boolZ {
3314         COption_boolZ::None
3315 }
3316 #[no_mangle]
3317 /// Frees any resources associated with the bool, if we are in the Some state
3318 pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { }
3319 #[no_mangle]
3320 /// Creates a new COption_boolZ which has the same data as `orig`
3321 /// but with all dynamically-allocated buffers duplicated in new buffers.
3322 pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) }
3323 #[repr(C)]
3324 /// The contents of CResult_WitnessNoneZ
3325 pub union CResult_WitnessNoneZPtr {
3326         /// A pointer to the contents in the success state.
3327         /// Reading from this pointer when `result_ok` is not set is undefined.
3328         pub result: *mut crate::c_types::Witness,
3329         /// Note that this value is always NULL, as there are no contents in the Err variant
3330         pub err: *mut core::ffi::c_void,
3331 }
3332 #[repr(C)]
3333 /// A CResult_WitnessNoneZ represents the result of a fallible operation,
3334 /// containing a crate::c_types::Witness on success and a () on failure.
3335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3336 pub struct CResult_WitnessNoneZ {
3337         /// The contents of this CResult_WitnessNoneZ, accessible via either
3338         /// `err` or `result` depending on the state of `result_ok`.
3339         pub contents: CResult_WitnessNoneZPtr,
3340         /// Whether this CResult_WitnessNoneZ represents a success state.
3341         pub result_ok: bool,
3342 }
3343 #[no_mangle]
3344 /// Creates a new CResult_WitnessNoneZ in the success state.
3345 pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ {
3346         CResult_WitnessNoneZ {
3347                 contents: CResult_WitnessNoneZPtr {
3348                         result: Box::into_raw(Box::new(o)),
3349                 },
3350                 result_ok: true,
3351         }
3352 }
3353 #[no_mangle]
3354 /// Creates a new CResult_WitnessNoneZ in the error state.
3355 pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ {
3356         CResult_WitnessNoneZ {
3357                 contents: CResult_WitnessNoneZPtr {
3358                         err: core::ptr::null_mut(),
3359                 },
3360                 result_ok: false,
3361         }
3362 }
3363 /// Checks if the given object is currently in the success state
3364 #[no_mangle]
3365 pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool {
3366         o.result_ok
3367 }
3368 #[no_mangle]
3369 /// Frees any resources used by the CResult_WitnessNoneZ.
3370 pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { }
3371 impl Drop for CResult_WitnessNoneZ {
3372         fn drop(&mut self) {
3373                 if self.result_ok {
3374                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3375                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3376                         }
3377                 } else {
3378                 }
3379         }
3380 }
3381 impl From<crate::c_types::CResultTempl<crate::c_types::Witness, ()>> for CResult_WitnessNoneZ {
3382         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Witness, ()>) -> Self {
3383                 let contents = if o.result_ok {
3384                         let result = unsafe { o.contents.result };
3385                         unsafe { o.contents.result = core::ptr::null_mut() };
3386                         CResult_WitnessNoneZPtr { result }
3387                 } else {
3388                         let _ = unsafe { Box::from_raw(o.contents.err) };
3389                         o.contents.err = core::ptr::null_mut();
3390                         CResult_WitnessNoneZPtr { err: core::ptr::null_mut() }
3391                 };
3392                 Self {
3393                         contents,
3394                         result_ok: o.result_ok,
3395                 }
3396         }
3397 }
3398 impl Clone for CResult_WitnessNoneZ {
3399         fn clone(&self) -> Self {
3400                 if self.result_ok {
3401                         Self { result_ok: true, contents: CResult_WitnessNoneZPtr {
3402                                 result: Box::into_raw(Box::new(<crate::c_types::Witness>::clone(unsafe { &*self.contents.result })))
3403                         } }
3404                 } else {
3405                         Self { result_ok: false, contents: CResult_WitnessNoneZPtr {
3406                                 err: core::ptr::null_mut()
3407                         } }
3408                 }
3409         }
3410 }
3411 #[no_mangle]
3412 /// Creates a new CResult_WitnessNoneZ which has the same data as `orig`
3413 /// but with all dynamically-allocated buffers duplicated in new buffers.
3414 pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) }
3415 #[repr(C)]
3416 /// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size.
3417 /// This corresponds to std::vector in C++
3418 pub struct CVec_ECDSASignatureZ {
3419         /// The elements in the array.
3420         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3421         pub data: *mut crate::c_types::ECDSASignature,
3422         /// The number of elements pointed to by `data`.
3423         pub datalen: usize
3424 }
3425 impl CVec_ECDSASignatureZ {
3426         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ECDSASignature> {
3427                 if self.datalen == 0 { return Vec::new(); }
3428                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3429                 self.data = core::ptr::null_mut();
3430                 self.datalen = 0;
3431                 ret
3432         }
3433         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] {
3434                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3435         }
3436 }
3437 impl From<Vec<crate::c_types::ECDSASignature>> for CVec_ECDSASignatureZ {
3438         fn from(v: Vec<crate::c_types::ECDSASignature>) -> Self {
3439                 let datalen = v.len();
3440                 let data = Box::into_raw(v.into_boxed_slice());
3441                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3442         }
3443 }
3444 #[no_mangle]
3445 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3446 pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { }
3447 impl Drop for CVec_ECDSASignatureZ {
3448         fn drop(&mut self) {
3449                 if self.datalen == 0 { return; }
3450                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3451         }
3452 }
3453 impl Clone for CVec_ECDSASignatureZ {
3454         fn clone(&self) -> Self {
3455                 let mut res = Vec::new();
3456                 if self.datalen == 0 { return Self::from(res); }
3457                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3458                 Self::from(res)
3459         }
3460 }
3461 #[repr(C)]
3462 /// A tuple of 2 elements. See the individual fields for the types contained.
3463 pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3464         /// The element at position 0
3465         pub a: crate::c_types::ECDSASignature,
3466         /// The element at position 1
3467         pub b: crate::c_types::derived::CVec_ECDSASignatureZ,
3468 }
3469 impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3470         fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self {
3471                 Self {
3472                         a: tup.0,
3473                         b: tup.1,
3474                 }
3475         }
3476 }
3477 impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3478         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) {
3479                 (self.a, self.b)
3480         }
3481 }
3482 impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3483         fn clone(&self) -> Self {
3484                 Self {
3485                         a: Clone::clone(&self.a),
3486                         b: Clone::clone(&self.b),
3487                 }
3488         }
3489 }
3490 #[no_mangle]
3491 /// Creates a new tuple which has the same data as `orig`
3492 /// but with all dynamically-allocated buffers duplicated in new buffers.
3493 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) }
3494 /// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements.
3495 #[no_mangle]
3496 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ {
3497         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, }
3498 }
3499
3500 #[no_mangle]
3501 /// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ.
3502 pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { }
3503 #[repr(C)]
3504 /// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ
3505 pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3506         /// A pointer to the contents in the success state.
3507         /// Reading from this pointer when `result_ok` is not set is undefined.
3508         pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ,
3509         /// Note that this value is always NULL, as there are no contents in the Err variant
3510         pub err: *mut core::ffi::c_void,
3511 }
3512 #[repr(C)]
3513 /// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation,
3514 /// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure.
3515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3516 pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3517         /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either
3518         /// `err` or `result` depending on the state of `result_ok`.
3519         pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr,
3520         /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state.
3521         pub result_ok: bool,
3522 }
3523 #[no_mangle]
3524 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state.
3525 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3526         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3527                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3528                         result: Box::into_raw(Box::new(o)),
3529                 },
3530                 result_ok: true,
3531         }
3532 }
3533 #[no_mangle]
3534 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state.
3535 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3536         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3537                 contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3538                         err: core::ptr::null_mut(),
3539                 },
3540                 result_ok: false,
3541         }
3542 }
3543 /// Checks if the given object is currently in the success state
3544 #[no_mangle]
3545 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool {
3546         o.result_ok
3547 }
3548 #[no_mangle]
3549 /// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.
3550 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { }
3551 impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3552         fn drop(&mut self) {
3553                 if self.result_ok {
3554                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3555                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3556                         }
3557                 } else {
3558                 }
3559         }
3560 }
3561 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3562         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, ()>) -> Self {
3563                 let contents = if o.result_ok {
3564                         let result = unsafe { o.contents.result };
3565                         unsafe { o.contents.result = core::ptr::null_mut() };
3566                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result }
3567                 } else {
3568                         let _ = unsafe { Box::from_raw(o.contents.err) };
3569                         o.contents.err = core::ptr::null_mut();
3570                         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() }
3571                 };
3572                 Self {
3573                         contents,
3574                         result_ok: o.result_ok,
3575                 }
3576         }
3577 }
3578 impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ {
3579         fn clone(&self) -> Self {
3580                 if self.result_ok {
3581                         Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3582                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ>::clone(unsafe { &*self.contents.result })))
3583                         } }
3584                 } else {
3585                         Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr {
3586                                 err: core::ptr::null_mut()
3587                         } }
3588                 }
3589         }
3590 }
3591 #[no_mangle]
3592 /// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig`
3593 /// but with all dynamically-allocated buffers duplicated in new buffers.
3594 pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) }
3595 #[repr(C)]
3596 /// The contents of CResult_InMemorySignerDecodeErrorZ
3597 pub union CResult_InMemorySignerDecodeErrorZPtr {
3598         /// A pointer to the contents in the success state.
3599         /// Reading from this pointer when `result_ok` is not set is undefined.
3600         pub result: *mut crate::lightning::sign::InMemorySigner,
3601         /// A pointer to the contents in the error state.
3602         /// Reading from this pointer when `result_ok` is set is undefined.
3603         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3604 }
3605 #[repr(C)]
3606 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3607 /// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3608 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3609 pub struct CResult_InMemorySignerDecodeErrorZ {
3610         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3611         /// `err` or `result` depending on the state of `result_ok`.
3612         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
3613         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3614         pub result_ok: bool,
3615 }
3616 #[no_mangle]
3617 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
3618 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
3619         CResult_InMemorySignerDecodeErrorZ {
3620                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3621                         result: Box::into_raw(Box::new(o)),
3622                 },
3623                 result_ok: true,
3624         }
3625 }
3626 #[no_mangle]
3627 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
3628 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
3629         CResult_InMemorySignerDecodeErrorZ {
3630                 contents: CResult_InMemorySignerDecodeErrorZPtr {
3631                         err: Box::into_raw(Box::new(e)),
3632                 },
3633                 result_ok: false,
3634         }
3635 }
3636 /// Checks if the given object is currently in the success state
3637 #[no_mangle]
3638 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
3639         o.result_ok
3640 }
3641 #[no_mangle]
3642 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
3643 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
3644 impl Drop for CResult_InMemorySignerDecodeErrorZ {
3645         fn drop(&mut self) {
3646                 if self.result_ok {
3647                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3648                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3649                         }
3650                 } else {
3651                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3652                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3653                         }
3654                 }
3655         }
3656 }
3657 impl From<crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
3658         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::sign::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
3659                 let contents = if o.result_ok {
3660                         let result = unsafe { o.contents.result };
3661                         unsafe { o.contents.result = core::ptr::null_mut() };
3662                         CResult_InMemorySignerDecodeErrorZPtr { result }
3663                 } else {
3664                         let err = unsafe { o.contents.err };
3665                         unsafe { o.contents.err = core::ptr::null_mut(); }
3666                         CResult_InMemorySignerDecodeErrorZPtr { err }
3667                 };
3668                 Self {
3669                         contents,
3670                         result_ok: o.result_ok,
3671                 }
3672         }
3673 }
3674 impl Clone for CResult_InMemorySignerDecodeErrorZ {
3675         fn clone(&self) -> Self {
3676                 if self.result_ok {
3677                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
3678                                 result: Box::into_raw(Box::new(<crate::lightning::sign::InMemorySigner>::clone(unsafe { &*self.contents.result })))
3679                         } }
3680                 } else {
3681                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
3682                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3683                         } }
3684                 }
3685         }
3686 }
3687 #[no_mangle]
3688 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
3689 /// but with all dynamically-allocated buffers duplicated in new buffers.
3690 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
3691 #[repr(C)]
3692 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
3693 pub enum COption_WriteableScoreZ {
3694         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
3695         Some(crate::lightning::routing::scoring::WriteableScore),
3696         /// When we're in this state, this COption_WriteableScoreZ contains nothing
3697         None
3698 }
3699 impl COption_WriteableScoreZ {
3700         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3701                 if let Self::None = self { false } else { true }
3702         }
3703         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3704                 !self.is_some()
3705         }
3706         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
3707                 if let Self::Some(v) = self { v } else { unreachable!() }
3708         }
3709 }
3710 #[no_mangle]
3711 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
3712 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
3713         COption_WriteableScoreZ::Some(o)
3714 }
3715 #[no_mangle]
3716 /// Constructs a new COption_WriteableScoreZ containing nothing
3717 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
3718         COption_WriteableScoreZ::None
3719 }
3720 #[no_mangle]
3721 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
3722 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
3723 #[repr(C)]
3724 /// The contents of CResult_NoneIOErrorZ
3725 pub union CResult_NoneIOErrorZPtr {
3726         /// Note that this value is always NULL, as there are no contents in the OK variant
3727         pub result: *mut core::ffi::c_void,
3728         /// A pointer to the contents in the error state.
3729         /// Reading from this pointer when `result_ok` is set is undefined.
3730         pub err: *mut crate::c_types::IOError,
3731 }
3732 #[repr(C)]
3733 /// A CResult_NoneIOErrorZ represents the result of a fallible operation,
3734 /// containing a () on success and a crate::c_types::IOError on failure.
3735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3736 pub struct CResult_NoneIOErrorZ {
3737         /// The contents of this CResult_NoneIOErrorZ, accessible via either
3738         /// `err` or `result` depending on the state of `result_ok`.
3739         pub contents: CResult_NoneIOErrorZPtr,
3740         /// Whether this CResult_NoneIOErrorZ represents a success state.
3741         pub result_ok: bool,
3742 }
3743 #[no_mangle]
3744 /// Creates a new CResult_NoneIOErrorZ in the success state.
3745 pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ {
3746         CResult_NoneIOErrorZ {
3747                 contents: CResult_NoneIOErrorZPtr {
3748                         result: core::ptr::null_mut(),
3749                 },
3750                 result_ok: true,
3751         }
3752 }
3753 #[no_mangle]
3754 /// Creates a new CResult_NoneIOErrorZ in the error state.
3755 pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ {
3756         CResult_NoneIOErrorZ {
3757                 contents: CResult_NoneIOErrorZPtr {
3758                         err: Box::into_raw(Box::new(e)),
3759                 },
3760                 result_ok: false,
3761         }
3762 }
3763 /// Checks if the given object is currently in the success state
3764 #[no_mangle]
3765 pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool {
3766         o.result_ok
3767 }
3768 #[no_mangle]
3769 /// Frees any resources used by the CResult_NoneIOErrorZ.
3770 pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { }
3771 impl Drop for CResult_NoneIOErrorZ {
3772         fn drop(&mut self) {
3773                 if self.result_ok {
3774                 } else {
3775                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3776                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3777                         }
3778                 }
3779         }
3780 }
3781 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneIOErrorZ {
3782         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
3783                 let contents = if o.result_ok {
3784                         let _ = unsafe { Box::from_raw(o.contents.result) };
3785                         o.contents.result = core::ptr::null_mut();
3786                         CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() }
3787                 } else {
3788                         let err = unsafe { o.contents.err };
3789                         unsafe { o.contents.err = core::ptr::null_mut(); }
3790                         CResult_NoneIOErrorZPtr { err }
3791                 };
3792                 Self {
3793                         contents,
3794                         result_ok: o.result_ok,
3795                 }
3796         }
3797 }
3798 impl Clone for CResult_NoneIOErrorZ {
3799         fn clone(&self) -> Self {
3800                 if self.result_ok {
3801                         Self { result_ok: true, contents: CResult_NoneIOErrorZPtr {
3802                                 result: core::ptr::null_mut()
3803                         } }
3804                 } else {
3805                         Self { result_ok: false, contents: CResult_NoneIOErrorZPtr {
3806                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
3807                         } }
3808                 }
3809         }
3810 }
3811 #[no_mangle]
3812 /// Creates a new CResult_NoneIOErrorZ which has the same data as `orig`
3813 /// but with all dynamically-allocated buffers duplicated in new buffers.
3814 pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) }
3815 #[repr(C)]
3816 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
3817 /// This corresponds to std::vector in C++
3818 pub struct CVec_ChannelDetailsZ {
3819         /// The elements in the array.
3820         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3821         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
3822         /// The number of elements pointed to by `data`.
3823         pub datalen: usize
3824 }
3825 impl CVec_ChannelDetailsZ {
3826         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
3827                 if self.datalen == 0 { return Vec::new(); }
3828                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3829                 self.data = core::ptr::null_mut();
3830                 self.datalen = 0;
3831                 ret
3832         }
3833         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
3834                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3835         }
3836 }
3837 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3838         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
3839                 let datalen = v.len();
3840                 let data = Box::into_raw(v.into_boxed_slice());
3841                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3842         }
3843 }
3844 #[no_mangle]
3845 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3846 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3847 impl Drop for CVec_ChannelDetailsZ {
3848         fn drop(&mut self) {
3849                 if self.datalen == 0 { return; }
3850                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3851         }
3852 }
3853 impl Clone for CVec_ChannelDetailsZ {
3854         fn clone(&self) -> Self {
3855                 let mut res = Vec::new();
3856                 if self.datalen == 0 { return Self::from(res); }
3857                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3858                 Self::from(res)
3859         }
3860 }
3861 #[repr(C)]
3862 /// The contents of CResult_RouteLightningErrorZ
3863 pub union CResult_RouteLightningErrorZPtr {
3864         /// A pointer to the contents in the success state.
3865         /// Reading from this pointer when `result_ok` is not set is undefined.
3866         pub result: *mut crate::lightning::routing::router::Route,
3867         /// A pointer to the contents in the error state.
3868         /// Reading from this pointer when `result_ok` is set is undefined.
3869         pub err: *mut crate::lightning::ln::msgs::LightningError,
3870 }
3871 #[repr(C)]
3872 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
3873 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
3874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3875 pub struct CResult_RouteLightningErrorZ {
3876         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
3877         /// `err` or `result` depending on the state of `result_ok`.
3878         pub contents: CResult_RouteLightningErrorZPtr,
3879         /// Whether this CResult_RouteLightningErrorZ represents a success state.
3880         pub result_ok: bool,
3881 }
3882 #[no_mangle]
3883 /// Creates a new CResult_RouteLightningErrorZ in the success state.
3884 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
3885         CResult_RouteLightningErrorZ {
3886                 contents: CResult_RouteLightningErrorZPtr {
3887                         result: Box::into_raw(Box::new(o)),
3888                 },
3889                 result_ok: true,
3890         }
3891 }
3892 #[no_mangle]
3893 /// Creates a new CResult_RouteLightningErrorZ in the error state.
3894 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3895         CResult_RouteLightningErrorZ {
3896                 contents: CResult_RouteLightningErrorZPtr {
3897                         err: Box::into_raw(Box::new(e)),
3898                 },
3899                 result_ok: false,
3900         }
3901 }
3902 /// Checks if the given object is currently in the success state
3903 #[no_mangle]
3904 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
3905         o.result_ok
3906 }
3907 #[no_mangle]
3908 /// Frees any resources used by the CResult_RouteLightningErrorZ.
3909 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
3910 impl Drop for CResult_RouteLightningErrorZ {
3911         fn drop(&mut self) {
3912                 if self.result_ok {
3913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3915                         }
3916                 } else {
3917                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3918                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3919                         }
3920                 }
3921         }
3922 }
3923 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
3924         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
3925                 let contents = if o.result_ok {
3926                         let result = unsafe { o.contents.result };
3927                         unsafe { o.contents.result = core::ptr::null_mut() };
3928                         CResult_RouteLightningErrorZPtr { result }
3929                 } else {
3930                         let err = unsafe { o.contents.err };
3931                         unsafe { o.contents.err = core::ptr::null_mut(); }
3932                         CResult_RouteLightningErrorZPtr { err }
3933                 };
3934                 Self {
3935                         contents,
3936                         result_ok: o.result_ok,
3937                 }
3938         }
3939 }
3940 impl Clone for CResult_RouteLightningErrorZ {
3941         fn clone(&self) -> Self {
3942                 if self.result_ok {
3943                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
3944                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3945                         } }
3946                 } else {
3947                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
3948                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3949                         } }
3950                 }
3951         }
3952 }
3953 #[no_mangle]
3954 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
3955 /// but with all dynamically-allocated buffers duplicated in new buffers.
3956 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
3957 #[repr(C)]
3958 /// A tuple of 2 elements. See the individual fields for the types contained.
3959 pub struct C2Tuple_BlindedPayInfoBlindedPathZ {
3960         /// The element at position 0
3961         pub a: crate::lightning::offers::invoice::BlindedPayInfo,
3962         /// The element at position 1
3963         pub b: crate::lightning::blinded_path::BlindedPath,
3964 }
3965 impl From<(crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)> for C2Tuple_BlindedPayInfoBlindedPathZ {
3966         fn from (tup: (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath)) -> Self {
3967                 Self {
3968                         a: tup.0,
3969                         b: tup.1,
3970                 }
3971         }
3972 }
3973 impl C2Tuple_BlindedPayInfoBlindedPathZ {
3974         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::invoice::BlindedPayInfo, crate::lightning::blinded_path::BlindedPath) {
3975                 (self.a, self.b)
3976         }
3977 }
3978 impl Clone for C2Tuple_BlindedPayInfoBlindedPathZ {
3979         fn clone(&self) -> Self {
3980                 Self {
3981                         a: Clone::clone(&self.a),
3982                         b: Clone::clone(&self.b),
3983                 }
3984         }
3985 }
3986 #[no_mangle]
3987 /// Creates a new tuple which has the same data as `orig`
3988 /// but with all dynamically-allocated buffers duplicated in new buffers.
3989 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig: &C2Tuple_BlindedPayInfoBlindedPathZ) -> C2Tuple_BlindedPayInfoBlindedPathZ { Clone::clone(&orig) }
3990 /// Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
3991 #[no_mangle]
3992 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_new(a: crate::lightning::offers::invoice::BlindedPayInfo, b: crate::lightning::blinded_path::BlindedPath) -> C2Tuple_BlindedPayInfoBlindedPathZ {
3993         C2Tuple_BlindedPayInfoBlindedPathZ { a, b, }
3994 }
3995
3996 #[no_mangle]
3997 /// Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
3998 pub extern "C" fn C2Tuple_BlindedPayInfoBlindedPathZ_free(_res: C2Tuple_BlindedPayInfoBlindedPathZ) { }
3999 #[repr(C)]
4000 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
4001 /// This corresponds to std::vector in C++
4002 pub struct CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4003         /// The elements in the array.
4004         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4005         pub data: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
4006         /// The number of elements pointed to by `data`.
4007         pub datalen: usize
4008 }
4009 impl CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4010         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ> {
4011                 if self.datalen == 0 { return Vec::new(); }
4012                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4013                 self.data = core::ptr::null_mut();
4014                 self.datalen = 0;
4015                 ret
4016         }
4017         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ] {
4018                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4019         }
4020 }
4021 impl From<Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>> for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4022         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>) -> Self {
4023                 let datalen = v.len();
4024                 let data = Box::into_raw(v.into_boxed_slice());
4025                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4026         }
4027 }
4028 #[no_mangle]
4029 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4030 pub extern "C" fn CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res: CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) { }
4031 impl Drop for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4032         fn drop(&mut self) {
4033                 if self.datalen == 0 { return; }
4034                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4035         }
4036 }
4037 impl Clone for CVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
4038         fn clone(&self) -> Self {
4039                 let mut res = Vec::new();
4040                 if self.datalen == 0 { return Self::from(res); }
4041                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4042                 Self::from(res)
4043         }
4044 }
4045 #[repr(C)]
4046 /// The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ
4047 pub union CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4048         /// A pointer to the contents in the success state.
4049         /// Reading from this pointer when `result_ok` is not set is undefined.
4050         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ,
4051         /// Note that this value is always NULL, as there are no contents in the Err variant
4052         pub err: *mut core::ffi::c_void,
4053 }
4054 #[repr(C)]
4055 /// A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation,
4056 /// containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure.
4057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4058 pub struct CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4059         /// The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either
4060         /// `err` or `result` depending on the state of `result_ok`.
4061         pub contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr,
4062         /// Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state.
4063         pub result_ok: bool,
4064 }
4065 #[no_mangle]
4066 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state.
4067 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4068         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4069                 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4070                         result: Box::into_raw(Box::new(o)),
4071                 },
4072                 result_ok: true,
4073         }
4074 }
4075 #[no_mangle]
4076 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state.
4077 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4078         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4079                 contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4080                         err: core::ptr::null_mut(),
4081                 },
4082                 result_ok: false,
4083         }
4084 }
4085 /// Checks if the given object is currently in the success state
4086 #[no_mangle]
4087 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> bool {
4088         o.result_ok
4089 }
4090 #[no_mangle]
4091 /// Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ.
4092 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) { }
4093 impl Drop for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4094         fn drop(&mut self) {
4095                 if self.result_ok {
4096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4098                         }
4099                 } else {
4100                 }
4101         }
4102 }
4103 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>> for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4104         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ, ()>) -> Self {
4105                 let contents = if o.result_ok {
4106                         let result = unsafe { o.contents.result };
4107                         unsafe { o.contents.result = core::ptr::null_mut() };
4108                         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { result }
4109                 } else {
4110                         let _ = unsafe { Box::from_raw(o.contents.err) };
4111                         o.contents.err = core::ptr::null_mut();
4112                         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { err: core::ptr::null_mut() }
4113                 };
4114                 Self {
4115                         contents,
4116                         result_ok: o.result_ok,
4117                 }
4118         }
4119 }
4120 impl Clone for CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ {
4121         fn clone(&self) -> Self {
4122                 if self.result_ok {
4123                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4124                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ>::clone(unsafe { &*self.contents.result })))
4125                         } }
4126                 } else {
4127                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr {
4128                                 err: core::ptr::null_mut()
4129                         } }
4130                 }
4131         }
4132 }
4133 #[no_mangle]
4134 /// Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig`
4135 /// but with all dynamically-allocated buffers duplicated in new buffers.
4136 pub extern "C" fn CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig: &CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ) -> CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { Clone::clone(&orig) }
4137 #[repr(C)]
4138 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
4139 /// This corresponds to std::vector in C++
4140 pub struct CVec_PublicKeyZ {
4141         /// The elements in the array.
4142         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4143         pub data: *mut crate::c_types::PublicKey,
4144         /// The number of elements pointed to by `data`.
4145         pub datalen: usize
4146 }
4147 impl CVec_PublicKeyZ {
4148         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
4149                 if self.datalen == 0 { return Vec::new(); }
4150                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4151                 self.data = core::ptr::null_mut();
4152                 self.datalen = 0;
4153                 ret
4154         }
4155         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
4156                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4157         }
4158 }
4159 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
4160         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
4161                 let datalen = v.len();
4162                 let data = Box::into_raw(v.into_boxed_slice());
4163                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4164         }
4165 }
4166 #[no_mangle]
4167 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4168 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
4169 impl Drop for CVec_PublicKeyZ {
4170         fn drop(&mut self) {
4171                 if self.datalen == 0 { return; }
4172                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4173         }
4174 }
4175 impl Clone for CVec_PublicKeyZ {
4176         fn clone(&self) -> Self {
4177                 let mut res = Vec::new();
4178                 if self.datalen == 0 { return Self::from(res); }
4179                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4180                 Self::from(res)
4181         }
4182 }
4183 #[repr(C)]
4184 /// The contents of CResult_OnionMessagePathNoneZ
4185 pub union CResult_OnionMessagePathNoneZPtr {
4186         /// A pointer to the contents in the success state.
4187         /// Reading from this pointer when `result_ok` is not set is undefined.
4188         pub result: *mut crate::lightning::onion_message::messenger::OnionMessagePath,
4189         /// Note that this value is always NULL, as there are no contents in the Err variant
4190         pub err: *mut core::ffi::c_void,
4191 }
4192 #[repr(C)]
4193 /// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation,
4194 /// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure.
4195 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4196 pub struct CResult_OnionMessagePathNoneZ {
4197         /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either
4198         /// `err` or `result` depending on the state of `result_ok`.
4199         pub contents: CResult_OnionMessagePathNoneZPtr,
4200         /// Whether this CResult_OnionMessagePathNoneZ represents a success state.
4201         pub result_ok: bool,
4202 }
4203 #[no_mangle]
4204 /// Creates a new CResult_OnionMessagePathNoneZ in the success state.
4205 pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ {
4206         CResult_OnionMessagePathNoneZ {
4207                 contents: CResult_OnionMessagePathNoneZPtr {
4208                         result: Box::into_raw(Box::new(o)),
4209                 },
4210                 result_ok: true,
4211         }
4212 }
4213 #[no_mangle]
4214 /// Creates a new CResult_OnionMessagePathNoneZ in the error state.
4215 pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ {
4216         CResult_OnionMessagePathNoneZ {
4217                 contents: CResult_OnionMessagePathNoneZPtr {
4218                         err: core::ptr::null_mut(),
4219                 },
4220                 result_ok: false,
4221         }
4222 }
4223 /// Checks if the given object is currently in the success state
4224 #[no_mangle]
4225 pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool {
4226         o.result_ok
4227 }
4228 #[no_mangle]
4229 /// Frees any resources used by the CResult_OnionMessagePathNoneZ.
4230 pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { }
4231 impl Drop for CResult_OnionMessagePathNoneZ {
4232         fn drop(&mut self) {
4233                 if self.result_ok {
4234                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4235                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4236                         }
4237                 } else {
4238                 }
4239         }
4240 }
4241 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>> for CResult_OnionMessagePathNoneZ {
4242         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::OnionMessagePath, ()>) -> Self {
4243                 let contents = if o.result_ok {
4244                         let result = unsafe { o.contents.result };
4245                         unsafe { o.contents.result = core::ptr::null_mut() };
4246                         CResult_OnionMessagePathNoneZPtr { result }
4247                 } else {
4248                         let _ = unsafe { Box::from_raw(o.contents.err) };
4249                         o.contents.err = core::ptr::null_mut();
4250                         CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() }
4251                 };
4252                 Self {
4253                         contents,
4254                         result_ok: o.result_ok,
4255                 }
4256         }
4257 }
4258 impl Clone for CResult_OnionMessagePathNoneZ {
4259         fn clone(&self) -> Self {
4260                 if self.result_ok {
4261                         Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr {
4262                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::OnionMessagePath>::clone(unsafe { &*self.contents.result })))
4263                         } }
4264                 } else {
4265                         Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr {
4266                                 err: core::ptr::null_mut()
4267                         } }
4268                 }
4269         }
4270 }
4271 #[no_mangle]
4272 /// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig`
4273 /// but with all dynamically-allocated buffers duplicated in new buffers.
4274 pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) }
4275 #[repr(C)]
4276 /// The contents of CResult_CVec_BlindedPathZNoneZ
4277 pub union CResult_CVec_BlindedPathZNoneZPtr {
4278         /// A pointer to the contents in the success state.
4279         /// Reading from this pointer when `result_ok` is not set is undefined.
4280         pub result: *mut crate::c_types::derived::CVec_BlindedPathZ,
4281         /// Note that this value is always NULL, as there are no contents in the Err variant
4282         pub err: *mut core::ffi::c_void,
4283 }
4284 #[repr(C)]
4285 /// A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation,
4286 /// containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure.
4287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4288 pub struct CResult_CVec_BlindedPathZNoneZ {
4289         /// The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either
4290         /// `err` or `result` depending on the state of `result_ok`.
4291         pub contents: CResult_CVec_BlindedPathZNoneZPtr,
4292         /// Whether this CResult_CVec_BlindedPathZNoneZ represents a success state.
4293         pub result_ok: bool,
4294 }
4295 #[no_mangle]
4296 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the success state.
4297 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPathZ) -> CResult_CVec_BlindedPathZNoneZ {
4298         CResult_CVec_BlindedPathZNoneZ {
4299                 contents: CResult_CVec_BlindedPathZNoneZPtr {
4300                         result: Box::into_raw(Box::new(o)),
4301                 },
4302                 result_ok: true,
4303         }
4304 }
4305 #[no_mangle]
4306 /// Creates a new CResult_CVec_BlindedPathZNoneZ in the error state.
4307 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_err() -> CResult_CVec_BlindedPathZNoneZ {
4308         CResult_CVec_BlindedPathZNoneZ {
4309                 contents: CResult_CVec_BlindedPathZNoneZPtr {
4310                         err: core::ptr::null_mut(),
4311                 },
4312                 result_ok: false,
4313         }
4314 }
4315 /// Checks if the given object is currently in the success state
4316 #[no_mangle]
4317 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPathZNoneZ) -> bool {
4318         o.result_ok
4319 }
4320 #[no_mangle]
4321 /// Frees any resources used by the CResult_CVec_BlindedPathZNoneZ.
4322 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_free(_res: CResult_CVec_BlindedPathZNoneZ) { }
4323 impl Drop for CResult_CVec_BlindedPathZNoneZ {
4324         fn drop(&mut self) {
4325                 if self.result_ok {
4326                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4327                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4328                         }
4329                 } else {
4330                 }
4331         }
4332 }
4333 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>> for CResult_CVec_BlindedPathZNoneZ {
4334         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_BlindedPathZ, ()>) -> Self {
4335                 let contents = if o.result_ok {
4336                         let result = unsafe { o.contents.result };
4337                         unsafe { o.contents.result = core::ptr::null_mut() };
4338                         CResult_CVec_BlindedPathZNoneZPtr { result }
4339                 } else {
4340                         let _ = unsafe { Box::from_raw(o.contents.err) };
4341                         o.contents.err = core::ptr::null_mut();
4342                         CResult_CVec_BlindedPathZNoneZPtr { err: core::ptr::null_mut() }
4343                 };
4344                 Self {
4345                         contents,
4346                         result_ok: o.result_ok,
4347                 }
4348         }
4349 }
4350 impl Clone for CResult_CVec_BlindedPathZNoneZ {
4351         fn clone(&self) -> Self {
4352                 if self.result_ok {
4353                         Self { result_ok: true, contents: CResult_CVec_BlindedPathZNoneZPtr {
4354                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_BlindedPathZ>::clone(unsafe { &*self.contents.result })))
4355                         } }
4356                 } else {
4357                         Self { result_ok: false, contents: CResult_CVec_BlindedPathZNoneZPtr {
4358                                 err: core::ptr::null_mut()
4359                         } }
4360                 }
4361         }
4362 }
4363 #[no_mangle]
4364 /// Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig`
4365 /// but with all dynamically-allocated buffers duplicated in new buffers.
4366 pub extern "C" fn CResult_CVec_BlindedPathZNoneZ_clone(orig: &CResult_CVec_BlindedPathZNoneZ) -> CResult_CVec_BlindedPathZNoneZ { Clone::clone(&orig) }
4367 #[repr(C)]
4368 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
4369 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
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::router::InFlightHtlcs,
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_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
4379 /// containing a crate::lightning::routing::router::InFlightHtlcs 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_InFlightHtlcsDecodeErrorZ {
4382         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
4383         /// `err` or `result` depending on the state of `result_ok`.
4384         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
4385         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
4386         pub result_ok: bool,
4387 }
4388 #[no_mangle]
4389 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
4390 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
4391         CResult_InFlightHtlcsDecodeErrorZ {
4392                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4393                         result: Box::into_raw(Box::new(o)),
4394                 },
4395                 result_ok: true,
4396         }
4397 }
4398 #[no_mangle]
4399 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
4400 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
4401         CResult_InFlightHtlcsDecodeErrorZ {
4402                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
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_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
4411         o.result_ok
4412 }
4413 #[no_mangle]
4414 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
4415 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
4416 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
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::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
4430         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, 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_InFlightHtlcsDecodeErrorZPtr { result }
4435                 } else {
4436                         let err = unsafe { o.contents.err };
4437                         unsafe { o.contents.err = core::ptr::null_mut(); }
4438                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
4439                 };
4440                 Self {
4441                         contents,
4442                         result_ok: o.result_ok,
4443                 }
4444         }
4445 }
4446 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
4447         fn clone(&self) -> Self {
4448                 if self.result_ok {
4449                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
4450                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
4451                         } }
4452                 } else {
4453                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
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_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
4461 /// but with all dynamically-allocated buffers duplicated in new buffers.
4462 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
4463 #[repr(C)]
4464 /// The contents of CResult_RouteHopDecodeErrorZ
4465 pub union CResult_RouteHopDecodeErrorZPtr {
4466         /// A pointer to the contents in the success state.
4467         /// Reading from this pointer when `result_ok` is not set is undefined.
4468         pub result: *mut crate::lightning::routing::router::RouteHop,
4469         /// A pointer to the contents in the error state.
4470         /// Reading from this pointer when `result_ok` is set is undefined.
4471         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4472 }
4473 #[repr(C)]
4474 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
4475 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
4476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4477 pub struct CResult_RouteHopDecodeErrorZ {
4478         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
4479         /// `err` or `result` depending on the state of `result_ok`.
4480         pub contents: CResult_RouteHopDecodeErrorZPtr,
4481         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
4482         pub result_ok: bool,
4483 }
4484 #[no_mangle]
4485 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
4486 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
4487         CResult_RouteHopDecodeErrorZ {
4488                 contents: CResult_RouteHopDecodeErrorZPtr {
4489                         result: Box::into_raw(Box::new(o)),
4490                 },
4491                 result_ok: true,
4492         }
4493 }
4494 #[no_mangle]
4495 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
4496 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
4497         CResult_RouteHopDecodeErrorZ {
4498                 contents: CResult_RouteHopDecodeErrorZPtr {
4499                         err: Box::into_raw(Box::new(e)),
4500                 },
4501                 result_ok: false,
4502         }
4503 }
4504 /// Checks if the given object is currently in the success state
4505 #[no_mangle]
4506 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
4507         o.result_ok
4508 }
4509 #[no_mangle]
4510 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
4511 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
4512 impl Drop for CResult_RouteHopDecodeErrorZ {
4513         fn drop(&mut self) {
4514                 if self.result_ok {
4515                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4516                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4517                         }
4518                 } else {
4519                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4520                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4521                         }
4522                 }
4523         }
4524 }
4525 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
4526         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
4527                 let contents = if o.result_ok {
4528                         let result = unsafe { o.contents.result };
4529                         unsafe { o.contents.result = core::ptr::null_mut() };
4530                         CResult_RouteHopDecodeErrorZPtr { result }
4531                 } else {
4532                         let err = unsafe { o.contents.err };
4533                         unsafe { o.contents.err = core::ptr::null_mut(); }
4534                         CResult_RouteHopDecodeErrorZPtr { err }
4535                 };
4536                 Self {
4537                         contents,
4538                         result_ok: o.result_ok,
4539                 }
4540         }
4541 }
4542 impl Clone for CResult_RouteHopDecodeErrorZ {
4543         fn clone(&self) -> Self {
4544                 if self.result_ok {
4545                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
4546                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
4547                         } }
4548                 } else {
4549                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
4550                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4551                         } }
4552                 }
4553         }
4554 }
4555 #[no_mangle]
4556 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
4557 /// but with all dynamically-allocated buffers duplicated in new buffers.
4558 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
4559 #[repr(C)]
4560 /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
4561 /// This corresponds to std::vector in C++
4562 pub struct CVec_BlindedHopZ {
4563         /// The elements in the array.
4564         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4565         pub data: *mut crate::lightning::blinded_path::BlindedHop,
4566         /// The number of elements pointed to by `data`.
4567         pub datalen: usize
4568 }
4569 impl CVec_BlindedHopZ {
4570         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::BlindedHop> {
4571                 if self.datalen == 0 { return Vec::new(); }
4572                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4573                 self.data = core::ptr::null_mut();
4574                 self.datalen = 0;
4575                 ret
4576         }
4577         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] {
4578                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4579         }
4580 }
4581 impl From<Vec<crate::lightning::blinded_path::BlindedHop>> for CVec_BlindedHopZ {
4582         fn from(v: Vec<crate::lightning::blinded_path::BlindedHop>) -> Self {
4583                 let datalen = v.len();
4584                 let data = Box::into_raw(v.into_boxed_slice());
4585                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4586         }
4587 }
4588 #[no_mangle]
4589 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4590 pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { }
4591 impl Drop for CVec_BlindedHopZ {
4592         fn drop(&mut self) {
4593                 if self.datalen == 0 { return; }
4594                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4595         }
4596 }
4597 impl Clone for CVec_BlindedHopZ {
4598         fn clone(&self) -> Self {
4599                 let mut res = Vec::new();
4600                 if self.datalen == 0 { return Self::from(res); }
4601                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4602                 Self::from(res)
4603         }
4604 }
4605 #[repr(C)]
4606 /// The contents of CResult_BlindedTailDecodeErrorZ
4607 pub union CResult_BlindedTailDecodeErrorZPtr {
4608         /// A pointer to the contents in the success state.
4609         /// Reading from this pointer when `result_ok` is not set is undefined.
4610         pub result: *mut crate::lightning::routing::router::BlindedTail,
4611         /// A pointer to the contents in the error state.
4612         /// Reading from this pointer when `result_ok` is set is undefined.
4613         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4614 }
4615 #[repr(C)]
4616 /// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
4617 /// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure.
4618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4619 pub struct CResult_BlindedTailDecodeErrorZ {
4620         /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
4621         /// `err` or `result` depending on the state of `result_ok`.
4622         pub contents: CResult_BlindedTailDecodeErrorZPtr,
4623         /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
4624         pub result_ok: bool,
4625 }
4626 #[no_mangle]
4627 /// Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
4628 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ {
4629         CResult_BlindedTailDecodeErrorZ {
4630                 contents: CResult_BlindedTailDecodeErrorZPtr {
4631                         result: Box::into_raw(Box::new(o)),
4632                 },
4633                 result_ok: true,
4634         }
4635 }
4636 #[no_mangle]
4637 /// Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
4638 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ {
4639         CResult_BlindedTailDecodeErrorZ {
4640                 contents: CResult_BlindedTailDecodeErrorZPtr {
4641                         err: Box::into_raw(Box::new(e)),
4642                 },
4643                 result_ok: false,
4644         }
4645 }
4646 /// Checks if the given object is currently in the success state
4647 #[no_mangle]
4648 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool {
4649         o.result_ok
4650 }
4651 #[no_mangle]
4652 /// Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
4653 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { }
4654 impl Drop for CResult_BlindedTailDecodeErrorZ {
4655         fn drop(&mut self) {
4656                 if self.result_ok {
4657                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4658                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4659                         }
4660                 } else {
4661                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4662                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4663                         }
4664                 }
4665         }
4666 }
4667 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedTailDecodeErrorZ {
4668         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::BlindedTail, crate::lightning::ln::msgs::DecodeError>) -> Self {
4669                 let contents = if o.result_ok {
4670                         let result = unsafe { o.contents.result };
4671                         unsafe { o.contents.result = core::ptr::null_mut() };
4672                         CResult_BlindedTailDecodeErrorZPtr { result }
4673                 } else {
4674                         let err = unsafe { o.contents.err };
4675                         unsafe { o.contents.err = core::ptr::null_mut(); }
4676                         CResult_BlindedTailDecodeErrorZPtr { err }
4677                 };
4678                 Self {
4679                         contents,
4680                         result_ok: o.result_ok,
4681                 }
4682         }
4683 }
4684 impl Clone for CResult_BlindedTailDecodeErrorZ {
4685         fn clone(&self) -> Self {
4686                 if self.result_ok {
4687                         Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr {
4688                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::BlindedTail>::clone(unsafe { &*self.contents.result })))
4689                         } }
4690                 } else {
4691                         Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr {
4692                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4693                         } }
4694                 }
4695         }
4696 }
4697 #[no_mangle]
4698 /// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
4699 /// but with all dynamically-allocated buffers duplicated in new buffers.
4700 pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) }
4701 #[repr(C)]
4702 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
4703 /// This corresponds to std::vector in C++
4704 pub struct CVec_RouteHopZ {
4705         /// The elements in the array.
4706         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4707         pub data: *mut crate::lightning::routing::router::RouteHop,
4708         /// The number of elements pointed to by `data`.
4709         pub datalen: usize
4710 }
4711 impl CVec_RouteHopZ {
4712         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
4713                 if self.datalen == 0 { return Vec::new(); }
4714                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4715                 self.data = core::ptr::null_mut();
4716                 self.datalen = 0;
4717                 ret
4718         }
4719         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
4720                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4721         }
4722 }
4723 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
4724         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
4725                 let datalen = v.len();
4726                 let data = Box::into_raw(v.into_boxed_slice());
4727                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4728         }
4729 }
4730 #[no_mangle]
4731 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4732 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4733 impl Drop for CVec_RouteHopZ {
4734         fn drop(&mut self) {
4735                 if self.datalen == 0 { return; }
4736                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4737         }
4738 }
4739 impl Clone for CVec_RouteHopZ {
4740         fn clone(&self) -> Self {
4741                 let mut res = Vec::new();
4742                 if self.datalen == 0 { return Self::from(res); }
4743                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4744                 Self::from(res)
4745         }
4746 }
4747 #[repr(C)]
4748 /// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
4749 /// This corresponds to std::vector in C++
4750 pub struct CVec_PathZ {
4751         /// The elements in the array.
4752         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4753         pub data: *mut crate::lightning::routing::router::Path,
4754         /// The number of elements pointed to by `data`.
4755         pub datalen: usize
4756 }
4757 impl CVec_PathZ {
4758         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::Path> {
4759                 if self.datalen == 0 { return Vec::new(); }
4760                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4761                 self.data = core::ptr::null_mut();
4762                 self.datalen = 0;
4763                 ret
4764         }
4765         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::Path] {
4766                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4767         }
4768 }
4769 impl From<Vec<crate::lightning::routing::router::Path>> for CVec_PathZ {
4770         fn from(v: Vec<crate::lightning::routing::router::Path>) -> Self {
4771                 let datalen = v.len();
4772                 let data = Box::into_raw(v.into_boxed_slice());
4773                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4774         }
4775 }
4776 #[no_mangle]
4777 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4778 pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { }
4779 impl Drop for CVec_PathZ {
4780         fn drop(&mut self) {
4781                 if self.datalen == 0 { return; }
4782                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4783         }
4784 }
4785 impl Clone for CVec_PathZ {
4786         fn clone(&self) -> Self {
4787                 let mut res = Vec::new();
4788                 if self.datalen == 0 { return Self::from(res); }
4789                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4790                 Self::from(res)
4791         }
4792 }
4793 #[repr(C)]
4794 /// The contents of CResult_RouteDecodeErrorZ
4795 pub union CResult_RouteDecodeErrorZPtr {
4796         /// A pointer to the contents in the success state.
4797         /// Reading from this pointer when `result_ok` is not set is undefined.
4798         pub result: *mut crate::lightning::routing::router::Route,
4799         /// A pointer to the contents in the error state.
4800         /// Reading from this pointer when `result_ok` is set is undefined.
4801         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4802 }
4803 #[repr(C)]
4804 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
4805 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
4806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4807 pub struct CResult_RouteDecodeErrorZ {
4808         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
4809         /// `err` or `result` depending on the state of `result_ok`.
4810         pub contents: CResult_RouteDecodeErrorZPtr,
4811         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
4812         pub result_ok: bool,
4813 }
4814 #[no_mangle]
4815 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
4816 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4817         CResult_RouteDecodeErrorZ {
4818                 contents: CResult_RouteDecodeErrorZPtr {
4819                         result: Box::into_raw(Box::new(o)),
4820                 },
4821                 result_ok: true,
4822         }
4823 }
4824 #[no_mangle]
4825 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
4826 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4827         CResult_RouteDecodeErrorZ {
4828                 contents: CResult_RouteDecodeErrorZPtr {
4829                         err: Box::into_raw(Box::new(e)),
4830                 },
4831                 result_ok: false,
4832         }
4833 }
4834 /// Checks if the given object is currently in the success state
4835 #[no_mangle]
4836 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
4837         o.result_ok
4838 }
4839 #[no_mangle]
4840 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
4841 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4842 impl Drop for CResult_RouteDecodeErrorZ {
4843         fn drop(&mut self) {
4844                 if self.result_ok {
4845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4847                         }
4848                 } else {
4849                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4850                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4851                         }
4852                 }
4853         }
4854 }
4855 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4856         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
4857                 let contents = if o.result_ok {
4858                         let result = unsafe { o.contents.result };
4859                         unsafe { o.contents.result = core::ptr::null_mut() };
4860                         CResult_RouteDecodeErrorZPtr { result }
4861                 } else {
4862                         let err = unsafe { o.contents.err };
4863                         unsafe { o.contents.err = core::ptr::null_mut(); }
4864                         CResult_RouteDecodeErrorZPtr { err }
4865                 };
4866                 Self {
4867                         contents,
4868                         result_ok: o.result_ok,
4869                 }
4870         }
4871 }
4872 impl Clone for CResult_RouteDecodeErrorZ {
4873         fn clone(&self) -> Self {
4874                 if self.result_ok {
4875                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4876                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4877                         } }
4878                 } else {
4879                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4880                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4881                         } }
4882                 }
4883         }
4884 }
4885 #[no_mangle]
4886 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
4887 /// but with all dynamically-allocated buffers duplicated in new buffers.
4888 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
4889 #[repr(C)]
4890 /// The contents of CResult_RouteParametersDecodeErrorZ
4891 pub union CResult_RouteParametersDecodeErrorZPtr {
4892         /// A pointer to the contents in the success state.
4893         /// Reading from this pointer when `result_ok` is not set is undefined.
4894         pub result: *mut crate::lightning::routing::router::RouteParameters,
4895         /// A pointer to the contents in the error state.
4896         /// Reading from this pointer when `result_ok` is set is undefined.
4897         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4898 }
4899 #[repr(C)]
4900 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
4901 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4903 pub struct CResult_RouteParametersDecodeErrorZ {
4904         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
4905         /// `err` or `result` depending on the state of `result_ok`.
4906         pub contents: CResult_RouteParametersDecodeErrorZPtr,
4907         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
4908         pub result_ok: bool,
4909 }
4910 #[no_mangle]
4911 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
4912 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
4913         CResult_RouteParametersDecodeErrorZ {
4914                 contents: CResult_RouteParametersDecodeErrorZPtr {
4915                         result: Box::into_raw(Box::new(o)),
4916                 },
4917                 result_ok: true,
4918         }
4919 }
4920 #[no_mangle]
4921 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
4922 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
4923         CResult_RouteParametersDecodeErrorZ {
4924                 contents: CResult_RouteParametersDecodeErrorZPtr {
4925                         err: Box::into_raw(Box::new(e)),
4926                 },
4927                 result_ok: false,
4928         }
4929 }
4930 /// Checks if the given object is currently in the success state
4931 #[no_mangle]
4932 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
4933         o.result_ok
4934 }
4935 #[no_mangle]
4936 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
4937 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
4938 impl Drop for CResult_RouteParametersDecodeErrorZ {
4939         fn drop(&mut self) {
4940                 if self.result_ok {
4941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4943                         }
4944                 } else {
4945                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4946                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4947                         }
4948                 }
4949         }
4950 }
4951 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
4952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
4953                 let contents = if o.result_ok {
4954                         let result = unsafe { o.contents.result };
4955                         unsafe { o.contents.result = core::ptr::null_mut() };
4956                         CResult_RouteParametersDecodeErrorZPtr { result }
4957                 } else {
4958                         let err = unsafe { o.contents.err };
4959                         unsafe { o.contents.err = core::ptr::null_mut(); }
4960                         CResult_RouteParametersDecodeErrorZPtr { err }
4961                 };
4962                 Self {
4963                         contents,
4964                         result_ok: o.result_ok,
4965                 }
4966         }
4967 }
4968 impl Clone for CResult_RouteParametersDecodeErrorZ {
4969         fn clone(&self) -> Self {
4970                 if self.result_ok {
4971                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
4972                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
4973                         } }
4974                 } else {
4975                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
4976                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4977                         } }
4978                 }
4979         }
4980 }
4981 #[no_mangle]
4982 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
4983 /// but with all dynamically-allocated buffers duplicated in new buffers.
4984 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
4985 #[repr(C)]
4986 /// A dynamically-allocated array of u64s of arbitrary size.
4987 /// This corresponds to std::vector in C++
4988 pub struct CVec_u64Z {
4989         /// The elements in the array.
4990         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4991         pub data: *mut u64,
4992         /// The number of elements pointed to by `data`.
4993         pub datalen: usize
4994 }
4995 impl CVec_u64Z {
4996         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4997                 if self.datalen == 0 { return Vec::new(); }
4998                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4999                 self.data = core::ptr::null_mut();
5000                 self.datalen = 0;
5001                 ret
5002         }
5003         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5004                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5005         }
5006 }
5007 impl From<Vec<u64>> for CVec_u64Z {
5008         fn from(v: Vec<u64>) -> Self {
5009                 let datalen = v.len();
5010                 let data = Box::into_raw(v.into_boxed_slice());
5011                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5012         }
5013 }
5014 #[no_mangle]
5015 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5016 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5017 impl Drop for CVec_u64Z {
5018         fn drop(&mut self) {
5019                 if self.datalen == 0 { return; }
5020                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5021         }
5022 }
5023 impl Clone for CVec_u64Z {
5024         fn clone(&self) -> Self {
5025                 let mut res = Vec::new();
5026                 if self.datalen == 0 { return Self::from(res); }
5027                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5028                 Self::from(res)
5029         }
5030 }
5031 #[repr(C)]
5032 /// The contents of CResult_PaymentParametersDecodeErrorZ
5033 pub union CResult_PaymentParametersDecodeErrorZPtr {
5034         /// A pointer to the contents in the success state.
5035         /// Reading from this pointer when `result_ok` is not set is undefined.
5036         pub result: *mut crate::lightning::routing::router::PaymentParameters,
5037         /// A pointer to the contents in the error state.
5038         /// Reading from this pointer when `result_ok` is set is undefined.
5039         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5040 }
5041 #[repr(C)]
5042 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
5043 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
5044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5045 pub struct CResult_PaymentParametersDecodeErrorZ {
5046         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
5047         /// `err` or `result` depending on the state of `result_ok`.
5048         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
5049         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
5050         pub result_ok: bool,
5051 }
5052 #[no_mangle]
5053 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
5054 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
5055         CResult_PaymentParametersDecodeErrorZ {
5056                 contents: CResult_PaymentParametersDecodeErrorZPtr {
5057                         result: Box::into_raw(Box::new(o)),
5058                 },
5059                 result_ok: true,
5060         }
5061 }
5062 #[no_mangle]
5063 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
5064 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
5065         CResult_PaymentParametersDecodeErrorZ {
5066                 contents: CResult_PaymentParametersDecodeErrorZPtr {
5067                         err: Box::into_raw(Box::new(e)),
5068                 },
5069                 result_ok: false,
5070         }
5071 }
5072 /// Checks if the given object is currently in the success state
5073 #[no_mangle]
5074 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
5075         o.result_ok
5076 }
5077 #[no_mangle]
5078 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
5079 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
5080 impl Drop for CResult_PaymentParametersDecodeErrorZ {
5081         fn drop(&mut self) {
5082                 if self.result_ok {
5083                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5084                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5085                         }
5086                 } else {
5087                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5088                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5089                         }
5090                 }
5091         }
5092 }
5093 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
5094         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
5095                 let contents = if o.result_ok {
5096                         let result = unsafe { o.contents.result };
5097                         unsafe { o.contents.result = core::ptr::null_mut() };
5098                         CResult_PaymentParametersDecodeErrorZPtr { result }
5099                 } else {
5100                         let err = unsafe { o.contents.err };
5101                         unsafe { o.contents.err = core::ptr::null_mut(); }
5102                         CResult_PaymentParametersDecodeErrorZPtr { err }
5103                 };
5104                 Self {
5105                         contents,
5106                         result_ok: o.result_ok,
5107                 }
5108         }
5109 }
5110 impl Clone for CResult_PaymentParametersDecodeErrorZ {
5111         fn clone(&self) -> Self {
5112                 if self.result_ok {
5113                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
5114                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
5115                         } }
5116                 } else {
5117                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
5118                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5119                         } }
5120                 }
5121         }
5122 }
5123 #[no_mangle]
5124 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
5125 /// but with all dynamically-allocated buffers duplicated in new buffers.
5126 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
5127 #[repr(C)]
5128 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
5129 /// This corresponds to std::vector in C++
5130 pub struct CVec_RouteHintZ {
5131         /// The elements in the array.
5132         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5133         pub data: *mut crate::lightning::routing::router::RouteHint,
5134         /// The number of elements pointed to by `data`.
5135         pub datalen: usize
5136 }
5137 impl CVec_RouteHintZ {
5138         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
5139                 if self.datalen == 0 { return Vec::new(); }
5140                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5141                 self.data = core::ptr::null_mut();
5142                 self.datalen = 0;
5143                 ret
5144         }
5145         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
5146                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5147         }
5148 }
5149 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
5150         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
5151                 let datalen = v.len();
5152                 let data = Box::into_raw(v.into_boxed_slice());
5153                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5154         }
5155 }
5156 #[no_mangle]
5157 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5158 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5159 impl Drop for CVec_RouteHintZ {
5160         fn drop(&mut self) {
5161                 if self.datalen == 0 { return; }
5162                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5163         }
5164 }
5165 impl Clone for CVec_RouteHintZ {
5166         fn clone(&self) -> Self {
5167                 let mut res = Vec::new();
5168                 if self.datalen == 0 { return Self::from(res); }
5169                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5170                 Self::from(res)
5171         }
5172 }
5173 #[repr(C)]
5174 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
5175 /// This corresponds to std::vector in C++
5176 pub struct CVec_RouteHintHopZ {
5177         /// The elements in the array.
5178         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5179         pub data: *mut crate::lightning::routing::router::RouteHintHop,
5180         /// The number of elements pointed to by `data`.
5181         pub datalen: usize
5182 }
5183 impl CVec_RouteHintHopZ {
5184         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
5185                 if self.datalen == 0 { return Vec::new(); }
5186                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5187                 self.data = core::ptr::null_mut();
5188                 self.datalen = 0;
5189                 ret
5190         }
5191         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
5192                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5193         }
5194 }
5195 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
5196         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
5197                 let datalen = v.len();
5198                 let data = Box::into_raw(v.into_boxed_slice());
5199                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5200         }
5201 }
5202 #[no_mangle]
5203 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5204 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
5205 impl Drop for CVec_RouteHintHopZ {
5206         fn drop(&mut self) {
5207                 if self.datalen == 0 { return; }
5208                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5209         }
5210 }
5211 impl Clone for CVec_RouteHintHopZ {
5212         fn clone(&self) -> Self {
5213                 let mut res = Vec::new();
5214                 if self.datalen == 0 { return Self::from(res); }
5215                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5216                 Self::from(res)
5217         }
5218 }
5219 #[repr(C)]
5220 /// The contents of CResult_RouteHintDecodeErrorZ
5221 pub union CResult_RouteHintDecodeErrorZPtr {
5222         /// A pointer to the contents in the success state.
5223         /// Reading from this pointer when `result_ok` is not set is undefined.
5224         pub result: *mut crate::lightning::routing::router::RouteHint,
5225         /// A pointer to the contents in the error state.
5226         /// Reading from this pointer when `result_ok` is set is undefined.
5227         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5228 }
5229 #[repr(C)]
5230 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
5231 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
5232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5233 pub struct CResult_RouteHintDecodeErrorZ {
5234         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
5235         /// `err` or `result` depending on the state of `result_ok`.
5236         pub contents: CResult_RouteHintDecodeErrorZPtr,
5237         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
5238         pub result_ok: bool,
5239 }
5240 #[no_mangle]
5241 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
5242 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
5243         CResult_RouteHintDecodeErrorZ {
5244                 contents: CResult_RouteHintDecodeErrorZPtr {
5245                         result: Box::into_raw(Box::new(o)),
5246                 },
5247                 result_ok: true,
5248         }
5249 }
5250 #[no_mangle]
5251 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
5252 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
5253         CResult_RouteHintDecodeErrorZ {
5254                 contents: CResult_RouteHintDecodeErrorZPtr {
5255                         err: Box::into_raw(Box::new(e)),
5256                 },
5257                 result_ok: false,
5258         }
5259 }
5260 /// Checks if the given object is currently in the success state
5261 #[no_mangle]
5262 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
5263         o.result_ok
5264 }
5265 #[no_mangle]
5266 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
5267 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
5268 impl Drop for CResult_RouteHintDecodeErrorZ {
5269         fn drop(&mut self) {
5270                 if self.result_ok {
5271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5273                         }
5274                 } else {
5275                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5276                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5277                         }
5278                 }
5279         }
5280 }
5281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
5282         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
5283                 let contents = if o.result_ok {
5284                         let result = unsafe { o.contents.result };
5285                         unsafe { o.contents.result = core::ptr::null_mut() };
5286                         CResult_RouteHintDecodeErrorZPtr { result }
5287                 } else {
5288                         let err = unsafe { o.contents.err };
5289                         unsafe { o.contents.err = core::ptr::null_mut(); }
5290                         CResult_RouteHintDecodeErrorZPtr { err }
5291                 };
5292                 Self {
5293                         contents,
5294                         result_ok: o.result_ok,
5295                 }
5296         }
5297 }
5298 impl Clone for CResult_RouteHintDecodeErrorZ {
5299         fn clone(&self) -> Self {
5300                 if self.result_ok {
5301                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
5302                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
5303                         } }
5304                 } else {
5305                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
5306                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5307                         } }
5308                 }
5309         }
5310 }
5311 #[no_mangle]
5312 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
5313 /// but with all dynamically-allocated buffers duplicated in new buffers.
5314 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
5315 #[repr(C)]
5316 /// The contents of CResult_RouteHintHopDecodeErrorZ
5317 pub union CResult_RouteHintHopDecodeErrorZPtr {
5318         /// A pointer to the contents in the success state.
5319         /// Reading from this pointer when `result_ok` is not set is undefined.
5320         pub result: *mut crate::lightning::routing::router::RouteHintHop,
5321         /// A pointer to the contents in the error state.
5322         /// Reading from this pointer when `result_ok` is set is undefined.
5323         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5324 }
5325 #[repr(C)]
5326 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
5327 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
5328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5329 pub struct CResult_RouteHintHopDecodeErrorZ {
5330         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
5331         /// `err` or `result` depending on the state of `result_ok`.
5332         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
5333         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
5334         pub result_ok: bool,
5335 }
5336 #[no_mangle]
5337 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
5338 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
5339         CResult_RouteHintHopDecodeErrorZ {
5340                 contents: CResult_RouteHintHopDecodeErrorZPtr {
5341                         result: Box::into_raw(Box::new(o)),
5342                 },
5343                 result_ok: true,
5344         }
5345 }
5346 #[no_mangle]
5347 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
5348 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
5349         CResult_RouteHintHopDecodeErrorZ {
5350                 contents: CResult_RouteHintHopDecodeErrorZPtr {
5351                         err: Box::into_raw(Box::new(e)),
5352                 },
5353                 result_ok: false,
5354         }
5355 }
5356 /// Checks if the given object is currently in the success state
5357 #[no_mangle]
5358 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
5359         o.result_ok
5360 }
5361 #[no_mangle]
5362 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
5363 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
5364 impl Drop for CResult_RouteHintHopDecodeErrorZ {
5365         fn drop(&mut self) {
5366                 if self.result_ok {
5367                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5368                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5369                         }
5370                 } else {
5371                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5372                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5373                         }
5374                 }
5375         }
5376 }
5377 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
5378         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
5379                 let contents = if o.result_ok {
5380                         let result = unsafe { o.contents.result };
5381                         unsafe { o.contents.result = core::ptr::null_mut() };
5382                         CResult_RouteHintHopDecodeErrorZPtr { result }
5383                 } else {
5384                         let err = unsafe { o.contents.err };
5385                         unsafe { o.contents.err = core::ptr::null_mut(); }
5386                         CResult_RouteHintHopDecodeErrorZPtr { err }
5387                 };
5388                 Self {
5389                         contents,
5390                         result_ok: o.result_ok,
5391                 }
5392         }
5393 }
5394 impl Clone for CResult_RouteHintHopDecodeErrorZ {
5395         fn clone(&self) -> Self {
5396                 if self.result_ok {
5397                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
5398                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
5399                         } }
5400                 } else {
5401                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
5402                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5403                         } }
5404                 }
5405         }
5406 }
5407 #[no_mangle]
5408 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
5409 /// but with all dynamically-allocated buffers duplicated in new buffers.
5410 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
5411 #[repr(C)]
5412 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
5413 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
5414         /// A pointer to the contents in the success state.
5415         /// Reading from this pointer when `result_ok` is not set is undefined.
5416         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
5417         /// A pointer to the contents in the error state.
5418         /// Reading from this pointer when `result_ok` is set is undefined.
5419         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5420 }
5421 #[repr(C)]
5422 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
5423 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5424 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5425 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
5426         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
5427         /// `err` or `result` depending on the state of `result_ok`.
5428         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
5429         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
5430         pub result_ok: bool,
5431 }
5432 #[no_mangle]
5433 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
5434 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5435         CResult_FixedPenaltyScorerDecodeErrorZ {
5436                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5437                         result: Box::into_raw(Box::new(o)),
5438                 },
5439                 result_ok: true,
5440         }
5441 }
5442 #[no_mangle]
5443 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
5444 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
5445         CResult_FixedPenaltyScorerDecodeErrorZ {
5446                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5447                         err: Box::into_raw(Box::new(e)),
5448                 },
5449                 result_ok: false,
5450         }
5451 }
5452 /// Checks if the given object is currently in the success state
5453 #[no_mangle]
5454 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
5455         o.result_ok
5456 }
5457 #[no_mangle]
5458 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
5459 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
5460 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
5461         fn drop(&mut self) {
5462                 if self.result_ok {
5463                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5464                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5465                         }
5466                 } else {
5467                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5468                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5469                         }
5470                 }
5471         }
5472 }
5473 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
5474         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5475                 let contents = if o.result_ok {
5476                         let result = unsafe { o.contents.result };
5477                         unsafe { o.contents.result = core::ptr::null_mut() };
5478                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
5479                 } else {
5480                         let err = unsafe { o.contents.err };
5481                         unsafe { o.contents.err = core::ptr::null_mut(); }
5482                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
5483                 };
5484                 Self {
5485                         contents,
5486                         result_ok: o.result_ok,
5487                 }
5488         }
5489 }
5490 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
5491         fn clone(&self) -> Self {
5492                 if self.result_ok {
5493                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5494                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
5495                         } }
5496                 } else {
5497                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
5498                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5499                         } }
5500                 }
5501         }
5502 }
5503 #[no_mangle]
5504 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
5505 /// but with all dynamically-allocated buffers duplicated in new buffers.
5506 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
5507 #[repr(C)]
5508 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
5509 /// This corresponds to std::vector in C++
5510 pub struct CVec_NodeIdZ {
5511         /// The elements in the array.
5512         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5513         pub data: *mut crate::lightning::routing::gossip::NodeId,
5514         /// The number of elements pointed to by `data`.
5515         pub datalen: usize
5516 }
5517 impl CVec_NodeIdZ {
5518         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
5519                 if self.datalen == 0 { return Vec::new(); }
5520                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5521                 self.data = core::ptr::null_mut();
5522                 self.datalen = 0;
5523                 ret
5524         }
5525         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
5526                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5527         }
5528 }
5529 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
5530         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
5531                 let datalen = v.len();
5532                 let data = Box::into_raw(v.into_boxed_slice());
5533                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5534         }
5535 }
5536 #[no_mangle]
5537 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5538 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
5539 impl Drop for CVec_NodeIdZ {
5540         fn drop(&mut self) {
5541                 if self.datalen == 0 { return; }
5542                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5543         }
5544 }
5545 impl Clone for CVec_NodeIdZ {
5546         fn clone(&self) -> Self {
5547                 let mut res = Vec::new();
5548                 if self.datalen == 0 { return Self::from(res); }
5549                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5550                 Self::from(res)
5551         }
5552 }
5553 #[repr(C)]
5554 /// A tuple of 2 elements. See the individual fields for the types contained.
5555 pub struct C2Tuple_u64u64Z {
5556         /// The element at position 0
5557         pub a: u64,
5558         /// The element at position 1
5559         pub b: u64,
5560 }
5561 impl From<(u64, u64)> for C2Tuple_u64u64Z {
5562         fn from (tup: (u64, u64)) -> Self {
5563                 Self {
5564                         a: tup.0,
5565                         b: tup.1,
5566                 }
5567         }
5568 }
5569 impl C2Tuple_u64u64Z {
5570         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
5571                 (self.a, self.b)
5572         }
5573 }
5574 impl Clone for C2Tuple_u64u64Z {
5575         fn clone(&self) -> Self {
5576                 Self {
5577                         a: Clone::clone(&self.a),
5578                         b: Clone::clone(&self.b),
5579                 }
5580         }
5581 }
5582 #[no_mangle]
5583 /// Creates a new tuple which has the same data as `orig`
5584 /// but with all dynamically-allocated buffers duplicated in new buffers.
5585 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
5586 /// Creates a new C2Tuple_u64u64Z from the contained elements.
5587 #[no_mangle]
5588 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
5589         C2Tuple_u64u64Z { a, b, }
5590 }
5591
5592 #[no_mangle]
5593 /// Frees any resources used by the C2Tuple_u64u64Z.
5594 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
5595 #[repr(C)]
5596 #[derive(Clone)]
5597 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
5598 pub enum COption_C2Tuple_u64u64ZZ {
5599         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
5600         Some(crate::c_types::derived::C2Tuple_u64u64Z),
5601         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
5602         None
5603 }
5604 impl COption_C2Tuple_u64u64ZZ {
5605         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5606                 if let Self::None = self { false } else { true }
5607         }
5608         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5609                 !self.is_some()
5610         }
5611         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
5612                 if let Self::Some(v) = self { v } else { unreachable!() }
5613         }
5614 }
5615 #[no_mangle]
5616 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
5617 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
5618         COption_C2Tuple_u64u64ZZ::Some(o)
5619 }
5620 #[no_mangle]
5621 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
5622 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
5623         COption_C2Tuple_u64u64ZZ::None
5624 }
5625 #[no_mangle]
5626 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
5627 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
5628 #[no_mangle]
5629 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
5630 /// but with all dynamically-allocated buffers duplicated in new buffers.
5631 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
5632 #[repr(C)]
5633 /// A tuple of 2 elements. See the individual fields for the types contained.
5634 pub struct C2Tuple_Z {
5635         /// The element at position 0
5636         pub a: crate::c_types::ThirtyTwoU16s,
5637         /// The element at position 1
5638         pub b: crate::c_types::ThirtyTwoU16s,
5639 }
5640 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z {
5641         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5642                 Self {
5643                         a: tup.0,
5644                         b: tup.1,
5645                 }
5646         }
5647 }
5648 impl C2Tuple_Z {
5649         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5650                 (self.a, self.b)
5651         }
5652 }
5653 /// Creates a new C2Tuple_Z from the contained elements.
5654 #[no_mangle]
5655 pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z {
5656         C2Tuple_Z { a, b, }
5657 }
5658
5659 #[no_mangle]
5660 /// Frees any resources used by the C2Tuple_Z.
5661 pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { }
5662 #[repr(C)]
5663 /// A tuple of 2 elements. See the individual fields for the types contained.
5664 pub struct C2Tuple__u1632_u1632Z {
5665         /// The element at position 0
5666         pub a: crate::c_types::ThirtyTwoU16s,
5667         /// The element at position 1
5668         pub b: crate::c_types::ThirtyTwoU16s,
5669 }
5670 impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z {
5671         fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self {
5672                 Self {
5673                         a: tup.0,
5674                         b: tup.1,
5675                 }
5676         }
5677 }
5678 impl C2Tuple__u1632_u1632Z {
5679         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) {
5680                 (self.a, self.b)
5681         }
5682 }
5683 /// Creates a new C2Tuple__u1632_u1632Z from the contained elements.
5684 #[no_mangle]
5685 pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z {
5686         C2Tuple__u1632_u1632Z { a, b, }
5687 }
5688
5689 #[no_mangle]
5690 /// Frees any resources used by the C2Tuple__u1632_u1632Z.
5691 pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { }
5692 #[repr(C)]
5693 /// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not
5694 pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5695         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z
5696         Some(crate::c_types::derived::C2Tuple__u1632_u1632Z),
5697         /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing
5698         None
5699 }
5700 impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5701         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5702                 if let Self::None = self { false } else { true }
5703         }
5704         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5705                 !self.is_some()
5706         }
5707         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z {
5708                 if let Self::Some(v) = self { v } else { unreachable!() }
5709         }
5710 }
5711 #[no_mangle]
5712 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z
5713 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5714         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o)
5715 }
5716 #[no_mangle]
5717 /// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing
5718 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ {
5719         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None
5720 }
5721 #[no_mangle]
5722 /// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state
5723 pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { }
5724 #[repr(C)]
5725 #[derive(Clone)]
5726 /// An enum which can either contain a f64 or not
5727 pub enum COption_f64Z {
5728         /// When we're in this state, this COption_f64Z contains a f64
5729         Some(f64),
5730         /// When we're in this state, this COption_f64Z contains nothing
5731         None
5732 }
5733 impl COption_f64Z {
5734         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5735                 if let Self::None = self { false } else { true }
5736         }
5737         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5738                 !self.is_some()
5739         }
5740         #[allow(unused)] pub(crate) fn take(mut self) -> f64 {
5741                 if let Self::Some(v) = self { v } else { unreachable!() }
5742         }
5743 }
5744 #[no_mangle]
5745 /// Constructs a new COption_f64Z containing a f64
5746 pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z {
5747         COption_f64Z::Some(o)
5748 }
5749 #[no_mangle]
5750 /// Constructs a new COption_f64Z containing nothing
5751 pub extern "C" fn COption_f64Z_none() -> COption_f64Z {
5752         COption_f64Z::None
5753 }
5754 #[no_mangle]
5755 /// Frees any resources associated with the f64, if we are in the Some state
5756 pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { }
5757 #[no_mangle]
5758 /// Creates a new COption_f64Z which has the same data as `orig`
5759 /// but with all dynamically-allocated buffers duplicated in new buffers.
5760 pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) }
5761 #[repr(C)]
5762 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
5763 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
5764         /// A pointer to the contents in the success state.
5765         /// Reading from this pointer when `result_ok` is not set is undefined.
5766         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
5767         /// A pointer to the contents in the error state.
5768         /// Reading from this pointer when `result_ok` is set is undefined.
5769         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5770 }
5771 #[repr(C)]
5772 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
5773 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
5774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5775 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
5776         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
5777         /// `err` or `result` depending on the state of `result_ok`.
5778         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
5779         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
5780         pub result_ok: bool,
5781 }
5782 #[no_mangle]
5783 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
5784 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
5785         CResult_ProbabilisticScorerDecodeErrorZ {
5786                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5787                         result: Box::into_raw(Box::new(o)),
5788                 },
5789                 result_ok: true,
5790         }
5791 }
5792 #[no_mangle]
5793 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
5794 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
5795         CResult_ProbabilisticScorerDecodeErrorZ {
5796                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
5797                         err: Box::into_raw(Box::new(e)),
5798                 },
5799                 result_ok: false,
5800         }
5801 }
5802 /// Checks if the given object is currently in the success state
5803 #[no_mangle]
5804 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
5805         o.result_ok
5806 }
5807 #[no_mangle]
5808 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
5809 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
5810 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
5811         fn drop(&mut self) {
5812                 if self.result_ok {
5813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5815                         }
5816                 } else {
5817                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5818                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5819                         }
5820                 }
5821         }
5822 }
5823 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
5824         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
5825                 let contents = if o.result_ok {
5826                         let result = unsafe { o.contents.result };
5827                         unsafe { o.contents.result = core::ptr::null_mut() };
5828                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
5829                 } else {
5830                         let err = unsafe { o.contents.err };
5831                         unsafe { o.contents.err = core::ptr::null_mut(); }
5832                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
5833                 };
5834                 Self {
5835                         contents,
5836                         result_ok: o.result_ok,
5837                 }
5838         }
5839 }
5840 #[repr(C)]
5841 /// The contents of CResult_BestBlockDecodeErrorZ
5842 pub union CResult_BestBlockDecodeErrorZPtr {
5843         /// A pointer to the contents in the success state.
5844         /// Reading from this pointer when `result_ok` is not set is undefined.
5845         pub result: *mut crate::lightning::chain::BestBlock,
5846         /// A pointer to the contents in the error state.
5847         /// Reading from this pointer when `result_ok` is set is undefined.
5848         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5849 }
5850 #[repr(C)]
5851 /// A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation,
5852 /// containing a crate::lightning::chain::BestBlock on success and a crate::lightning::ln::msgs::DecodeError on failure.
5853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5854 pub struct CResult_BestBlockDecodeErrorZ {
5855         /// The contents of this CResult_BestBlockDecodeErrorZ, accessible via either
5856         /// `err` or `result` depending on the state of `result_ok`.
5857         pub contents: CResult_BestBlockDecodeErrorZPtr,
5858         /// Whether this CResult_BestBlockDecodeErrorZ represents a success state.
5859         pub result_ok: bool,
5860 }
5861 #[no_mangle]
5862 /// Creates a new CResult_BestBlockDecodeErrorZ in the success state.
5863 pub extern "C" fn CResult_BestBlockDecodeErrorZ_ok(o: crate::lightning::chain::BestBlock) -> CResult_BestBlockDecodeErrorZ {
5864         CResult_BestBlockDecodeErrorZ {
5865                 contents: CResult_BestBlockDecodeErrorZPtr {
5866                         result: Box::into_raw(Box::new(o)),
5867                 },
5868                 result_ok: true,
5869         }
5870 }
5871 #[no_mangle]
5872 /// Creates a new CResult_BestBlockDecodeErrorZ in the error state.
5873 pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BestBlockDecodeErrorZ {
5874         CResult_BestBlockDecodeErrorZ {
5875                 contents: CResult_BestBlockDecodeErrorZPtr {
5876                         err: Box::into_raw(Box::new(e)),
5877                 },
5878                 result_ok: false,
5879         }
5880 }
5881 /// Checks if the given object is currently in the success state
5882 #[no_mangle]
5883 pub extern "C" fn CResult_BestBlockDecodeErrorZ_is_ok(o: &CResult_BestBlockDecodeErrorZ) -> bool {
5884         o.result_ok
5885 }
5886 #[no_mangle]
5887 /// Frees any resources used by the CResult_BestBlockDecodeErrorZ.
5888 pub extern "C" fn CResult_BestBlockDecodeErrorZ_free(_res: CResult_BestBlockDecodeErrorZ) { }
5889 impl Drop for CResult_BestBlockDecodeErrorZ {
5890         fn drop(&mut self) {
5891                 if self.result_ok {
5892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5894                         }
5895                 } else {
5896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5898                         }
5899                 }
5900         }
5901 }
5902 impl From<crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>> for CResult_BestBlockDecodeErrorZ {
5903         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::BestBlock, crate::lightning::ln::msgs::DecodeError>) -> Self {
5904                 let contents = if o.result_ok {
5905                         let result = unsafe { o.contents.result };
5906                         unsafe { o.contents.result = core::ptr::null_mut() };
5907                         CResult_BestBlockDecodeErrorZPtr { result }
5908                 } else {
5909                         let err = unsafe { o.contents.err };
5910                         unsafe { o.contents.err = core::ptr::null_mut(); }
5911                         CResult_BestBlockDecodeErrorZPtr { err }
5912                 };
5913                 Self {
5914                         contents,
5915                         result_ok: o.result_ok,
5916                 }
5917         }
5918 }
5919 impl Clone for CResult_BestBlockDecodeErrorZ {
5920         fn clone(&self) -> Self {
5921                 if self.result_ok {
5922                         Self { result_ok: true, contents: CResult_BestBlockDecodeErrorZPtr {
5923                                 result: Box::into_raw(Box::new(<crate::lightning::chain::BestBlock>::clone(unsafe { &*self.contents.result })))
5924                         } }
5925                 } else {
5926                         Self { result_ok: false, contents: CResult_BestBlockDecodeErrorZPtr {
5927                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5928                         } }
5929                 }
5930         }
5931 }
5932 #[no_mangle]
5933 /// Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig`
5934 /// but with all dynamically-allocated buffers duplicated in new buffers.
5935 pub extern "C" fn CResult_BestBlockDecodeErrorZ_clone(orig: &CResult_BestBlockDecodeErrorZ) -> CResult_BestBlockDecodeErrorZ { Clone::clone(&orig) }
5936 #[repr(C)]
5937 /// A tuple of 2 elements. See the individual fields for the types contained.
5938 pub struct C2Tuple_usizeTransactionZ {
5939         /// The element at position 0
5940         pub a: usize,
5941         /// The element at position 1
5942         pub b: crate::c_types::Transaction,
5943 }
5944 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
5945         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
5946                 Self {
5947                         a: tup.0,
5948                         b: tup.1,
5949                 }
5950         }
5951 }
5952 impl C2Tuple_usizeTransactionZ {
5953         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
5954                 (self.a, self.b)
5955         }
5956 }
5957 impl Clone for C2Tuple_usizeTransactionZ {
5958         fn clone(&self) -> Self {
5959                 Self {
5960                         a: Clone::clone(&self.a),
5961                         b: Clone::clone(&self.b),
5962                 }
5963         }
5964 }
5965 #[no_mangle]
5966 /// Creates a new tuple which has the same data as `orig`
5967 /// but with all dynamically-allocated buffers duplicated in new buffers.
5968 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
5969 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
5970 #[no_mangle]
5971 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
5972         C2Tuple_usizeTransactionZ { a, b, }
5973 }
5974
5975 #[no_mangle]
5976 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
5977 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
5978 #[repr(C)]
5979 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
5980 /// This corresponds to std::vector in C++
5981 pub struct CVec_C2Tuple_usizeTransactionZZ {
5982         /// The elements in the array.
5983         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5984         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
5985         /// The number of elements pointed to by `data`.
5986         pub datalen: usize
5987 }
5988 impl CVec_C2Tuple_usizeTransactionZZ {
5989         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
5990                 if self.datalen == 0 { return Vec::new(); }
5991                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5992                 self.data = core::ptr::null_mut();
5993                 self.datalen = 0;
5994                 ret
5995         }
5996         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
5997                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5998         }
5999 }
6000 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
6001         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
6002                 let datalen = v.len();
6003                 let data = Box::into_raw(v.into_boxed_slice());
6004                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6005         }
6006 }
6007 #[no_mangle]
6008 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6009 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
6010 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
6011         fn drop(&mut self) {
6012                 if self.datalen == 0 { return; }
6013                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6014         }
6015 }
6016 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
6017         fn clone(&self) -> Self {
6018                 let mut res = Vec::new();
6019                 if self.datalen == 0 { return Self::from(res); }
6020                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6021                 Self::from(res)
6022         }
6023 }
6024 #[repr(C)]
6025 /// A tuple of 3 elements. See the individual fields for the types contained.
6026 pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6027         /// The element at position 0
6028         pub a: crate::c_types::ThirtyTwoBytes,
6029         /// The element at position 1
6030         pub b: u32,
6031         /// The element at position 2
6032         pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ,
6033 }
6034 impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6035         fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self {
6036                 Self {
6037                         a: tup.0,
6038                         b: tup.1,
6039                         c: tup.2,
6040                 }
6041         }
6042 }
6043 impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6044         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) {
6045                 (self.a, self.b, self.c)
6046         }
6047 }
6048 impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6049         fn clone(&self) -> Self {
6050                 Self {
6051                         a: Clone::clone(&self.a),
6052                         b: Clone::clone(&self.b),
6053                         c: Clone::clone(&self.c),
6054                 }
6055         }
6056 }
6057 #[no_mangle]
6058 /// Creates a new tuple which has the same data as `orig`
6059 /// but with all dynamically-allocated buffers duplicated in new buffers.
6060 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) }
6061 /// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements.
6062 #[no_mangle]
6063 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: u32, c: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ {
6064         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, }
6065 }
6066
6067 #[no_mangle]
6068 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ.
6069 pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { }
6070 #[repr(C)]
6071 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size.
6072 /// This corresponds to std::vector in C++
6073 pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6074         /// The elements in the array.
6075         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6076         pub data: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ,
6077         /// The number of elements pointed to by `data`.
6078         pub datalen: usize
6079 }
6080 impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6081         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ> {
6082                 if self.datalen == 0 { return Vec::new(); }
6083                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6084                 self.data = core::ptr::null_mut();
6085                 self.datalen = 0;
6086                 ret
6087         }
6088         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] {
6089                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6090         }
6091 }
6092 impl From<Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6093         fn from(v: Vec<crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ>) -> Self {
6094                 let datalen = v.len();
6095                 let data = Box::into_raw(v.into_boxed_slice());
6096                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6097         }
6098 }
6099 #[no_mangle]
6100 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6101 pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { }
6102 impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6103         fn drop(&mut self) {
6104                 if self.datalen == 0 { return; }
6105                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6106         }
6107 }
6108 impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ {
6109         fn clone(&self) -> Self {
6110                 let mut res = Vec::new();
6111                 if self.datalen == 0 { return Self::from(res); }
6112                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6113                 Self::from(res)
6114         }
6115 }
6116 #[repr(C)]
6117 /// The contents of CResult_ChannelMonitorUpdateStatusNoneZ
6118 pub union CResult_ChannelMonitorUpdateStatusNoneZPtr {
6119         /// A pointer to the contents in the success state.
6120         /// Reading from this pointer when `result_ok` is not set is undefined.
6121         pub result: *mut crate::lightning::chain::ChannelMonitorUpdateStatus,
6122         /// Note that this value is always NULL, as there are no contents in the Err variant
6123         pub err: *mut core::ffi::c_void,
6124 }
6125 #[repr(C)]
6126 /// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation,
6127 /// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure.
6128 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6129 pub struct CResult_ChannelMonitorUpdateStatusNoneZ {
6130         /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either
6131         /// `err` or `result` depending on the state of `result_ok`.
6132         pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr,
6133         /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state.
6134         pub result_ok: bool,
6135 }
6136 #[no_mangle]
6137 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state.
6138 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ {
6139         CResult_ChannelMonitorUpdateStatusNoneZ {
6140                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6141                         result: Box::into_raw(Box::new(o)),
6142                 },
6143                 result_ok: true,
6144         }
6145 }
6146 #[no_mangle]
6147 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state.
6148 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ {
6149         CResult_ChannelMonitorUpdateStatusNoneZ {
6150                 contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6151                         err: core::ptr::null_mut(),
6152                 },
6153                 result_ok: false,
6154         }
6155 }
6156 /// Checks if the given object is currently in the success state
6157 #[no_mangle]
6158 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool {
6159         o.result_ok
6160 }
6161 #[no_mangle]
6162 /// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ.
6163 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { }
6164 impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ {
6165         fn drop(&mut self) {
6166                 if self.result_ok {
6167                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6168                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6169                         }
6170                 } else {
6171                 }
6172         }
6173 }
6174 impl From<crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>> for CResult_ChannelMonitorUpdateStatusNoneZ {
6175         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::ChannelMonitorUpdateStatus, ()>) -> Self {
6176                 let contents = if o.result_ok {
6177                         let result = unsafe { o.contents.result };
6178                         unsafe { o.contents.result = core::ptr::null_mut() };
6179                         CResult_ChannelMonitorUpdateStatusNoneZPtr { result }
6180                 } else {
6181                         let _ = unsafe { Box::from_raw(o.contents.err) };
6182                         o.contents.err = core::ptr::null_mut();
6183                         CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() }
6184                 };
6185                 Self {
6186                         contents,
6187                         result_ok: o.result_ok,
6188                 }
6189         }
6190 }
6191 impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ {
6192         fn clone(&self) -> Self {
6193                 if self.result_ok {
6194                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6195                                 result: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateStatus>::clone(unsafe { &*self.contents.result })))
6196                         } }
6197                 } else {
6198                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr {
6199                                 err: core::ptr::null_mut()
6200                         } }
6201                 }
6202         }
6203 }
6204 #[no_mangle]
6205 /// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig`
6206 /// but with all dynamically-allocated buffers duplicated in new buffers.
6207 pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) }
6208 #[repr(C)]
6209 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
6210 /// This corresponds to std::vector in C++
6211 pub struct CVec_MonitorEventZ {
6212         /// The elements in the array.
6213         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6214         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
6215         /// The number of elements pointed to by `data`.
6216         pub datalen: usize
6217 }
6218 impl CVec_MonitorEventZ {
6219         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
6220                 if self.datalen == 0 { return Vec::new(); }
6221                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6222                 self.data = core::ptr::null_mut();
6223                 self.datalen = 0;
6224                 ret
6225         }
6226         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
6227                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6228         }
6229 }
6230 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
6231         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
6232                 let datalen = v.len();
6233                 let data = Box::into_raw(v.into_boxed_slice());
6234                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6235         }
6236 }
6237 #[no_mangle]
6238 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6239 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
6240 impl Drop for CVec_MonitorEventZ {
6241         fn drop(&mut self) {
6242                 if self.datalen == 0 { return; }
6243                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6244         }
6245 }
6246 impl Clone for CVec_MonitorEventZ {
6247         fn clone(&self) -> Self {
6248                 let mut res = Vec::new();
6249                 if self.datalen == 0 { return Self::from(res); }
6250                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6251                 Self::from(res)
6252         }
6253 }
6254 #[repr(C)]
6255 /// A tuple of 4 elements. See the individual fields for the types contained.
6256 pub struct C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6257         /// The element at position 0
6258         pub a: crate::lightning::chain::transaction::OutPoint,
6259         /// The element at position 1
6260         pub b: crate::lightning::ln::types::ChannelId,
6261         /// The element at position 2
6262         pub c: crate::c_types::derived::CVec_MonitorEventZ,
6263         /// The element at position 3
6264         pub d: crate::c_types::PublicKey,
6265 }
6266 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6267         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
6268                 Self {
6269                         a: tup.0,
6270                         b: tup.1,
6271                         c: tup.2,
6272                         d: tup.3,
6273                 }
6274         }
6275 }
6276 impl C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6277         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
6278                 (self.a, self.b, self.c, self.d)
6279         }
6280 }
6281 impl Clone for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6282         fn clone(&self) -> Self {
6283                 Self {
6284                         a: Clone::clone(&self.a),
6285                         b: Clone::clone(&self.b),
6286                         c: Clone::clone(&self.c),
6287                         d: Clone::clone(&self.d),
6288                 }
6289         }
6290 }
6291 #[no_mangle]
6292 /// Creates a new tuple which has the same data as `orig`
6293 /// but with all dynamically-allocated buffers duplicated in new buffers.
6294 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig: &C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
6295 /// Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements.
6296 #[no_mangle]
6297 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId, c: crate::c_types::derived::CVec_MonitorEventZ, d: crate::c_types::PublicKey) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ {
6298         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { a, b, c, d, }
6299 }
6300
6301 #[no_mangle]
6302 /// Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ.
6303 pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res: C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) { }
6304 #[repr(C)]
6305 /// A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size.
6306 /// This corresponds to std::vector in C++
6307 pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6308         /// The elements in the array.
6309         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6310         pub data: *mut crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ,
6311         /// The number of elements pointed to by `data`.
6312         pub datalen: usize
6313 }
6314 impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6315         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ> {
6316                 if self.datalen == 0 { return Vec::new(); }
6317                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6318                 self.data = core::ptr::null_mut();
6319                 self.datalen = 0;
6320                 ret
6321         }
6322         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] {
6323                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6324         }
6325 }
6326 impl From<Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6327         fn from(v: Vec<crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ>) -> Self {
6328                 let datalen = v.len();
6329                 let data = Box::into_raw(v.into_boxed_slice());
6330                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6331         }
6332 }
6333 #[no_mangle]
6334 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6335 pub extern "C" fn CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ) { }
6336 impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6337         fn drop(&mut self) {
6338                 if self.datalen == 0 { return; }
6339                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6340         }
6341 }
6342 impl Clone for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ {
6343         fn clone(&self) -> Self {
6344                 let mut res = Vec::new();
6345                 if self.datalen == 0 { return Self::from(res); }
6346                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6347                 Self::from(res)
6348         }
6349 }
6350 #[repr(C)]
6351 /// The contents of CResult_InitFeaturesDecodeErrorZ
6352 pub union CResult_InitFeaturesDecodeErrorZPtr {
6353         /// A pointer to the contents in the success state.
6354         /// Reading from this pointer when `result_ok` is not set is undefined.
6355         pub result: *mut crate::lightning::ln::features::InitFeatures,
6356         /// A pointer to the contents in the error state.
6357         /// Reading from this pointer when `result_ok` is set is undefined.
6358         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6359 }
6360 #[repr(C)]
6361 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
6362 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6364 pub struct CResult_InitFeaturesDecodeErrorZ {
6365         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
6366         /// `err` or `result` depending on the state of `result_ok`.
6367         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
6368         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
6369         pub result_ok: bool,
6370 }
6371 #[no_mangle]
6372 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
6373 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
6374         CResult_InitFeaturesDecodeErrorZ {
6375                 contents: CResult_InitFeaturesDecodeErrorZPtr {
6376                         result: Box::into_raw(Box::new(o)),
6377                 },
6378                 result_ok: true,
6379         }
6380 }
6381 #[no_mangle]
6382 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
6383 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
6384         CResult_InitFeaturesDecodeErrorZ {
6385                 contents: CResult_InitFeaturesDecodeErrorZPtr {
6386                         err: Box::into_raw(Box::new(e)),
6387                 },
6388                 result_ok: false,
6389         }
6390 }
6391 /// Checks if the given object is currently in the success state
6392 #[no_mangle]
6393 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
6394         o.result_ok
6395 }
6396 #[no_mangle]
6397 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
6398 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
6399 impl Drop for CResult_InitFeaturesDecodeErrorZ {
6400         fn drop(&mut self) {
6401                 if self.result_ok {
6402                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6403                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6404                         }
6405                 } else {
6406                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6407                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6408                         }
6409                 }
6410         }
6411 }
6412 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
6413         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6414                 let contents = if o.result_ok {
6415                         let result = unsafe { o.contents.result };
6416                         unsafe { o.contents.result = core::ptr::null_mut() };
6417                         CResult_InitFeaturesDecodeErrorZPtr { result }
6418                 } else {
6419                         let err = unsafe { o.contents.err };
6420                         unsafe { o.contents.err = core::ptr::null_mut(); }
6421                         CResult_InitFeaturesDecodeErrorZPtr { err }
6422                 };
6423                 Self {
6424                         contents,
6425                         result_ok: o.result_ok,
6426                 }
6427         }
6428 }
6429 impl Clone for CResult_InitFeaturesDecodeErrorZ {
6430         fn clone(&self) -> Self {
6431                 if self.result_ok {
6432                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
6433                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
6434                         } }
6435                 } else {
6436                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
6437                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6438                         } }
6439                 }
6440         }
6441 }
6442 #[no_mangle]
6443 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
6444 /// but with all dynamically-allocated buffers duplicated in new buffers.
6445 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
6446 #[repr(C)]
6447 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
6448 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
6449         /// A pointer to the contents in the success state.
6450         /// Reading from this pointer when `result_ok` is not set is undefined.
6451         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
6452         /// A pointer to the contents in the error state.
6453         /// Reading from this pointer when `result_ok` is set is undefined.
6454         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6455 }
6456 #[repr(C)]
6457 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
6458 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6460 pub struct CResult_ChannelFeaturesDecodeErrorZ {
6461         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
6462         /// `err` or `result` depending on the state of `result_ok`.
6463         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
6464         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
6465         pub result_ok: bool,
6466 }
6467 #[no_mangle]
6468 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
6469 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
6470         CResult_ChannelFeaturesDecodeErrorZ {
6471                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6472                         result: Box::into_raw(Box::new(o)),
6473                 },
6474                 result_ok: true,
6475         }
6476 }
6477 #[no_mangle]
6478 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
6479 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
6480         CResult_ChannelFeaturesDecodeErrorZ {
6481                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6482                         err: Box::into_raw(Box::new(e)),
6483                 },
6484                 result_ok: false,
6485         }
6486 }
6487 /// Checks if the given object is currently in the success state
6488 #[no_mangle]
6489 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
6490         o.result_ok
6491 }
6492 #[no_mangle]
6493 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
6494 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
6495 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
6496         fn drop(&mut self) {
6497                 if self.result_ok {
6498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6500                         }
6501                 } else {
6502                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6503                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6504                         }
6505                 }
6506         }
6507 }
6508 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
6509         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6510                 let contents = if o.result_ok {
6511                         let result = unsafe { o.contents.result };
6512                         unsafe { o.contents.result = core::ptr::null_mut() };
6513                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
6514                 } else {
6515                         let err = unsafe { o.contents.err };
6516                         unsafe { o.contents.err = core::ptr::null_mut(); }
6517                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
6518                 };
6519                 Self {
6520                         contents,
6521                         result_ok: o.result_ok,
6522                 }
6523         }
6524 }
6525 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
6526         fn clone(&self) -> Self {
6527                 if self.result_ok {
6528                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6529                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
6530                         } }
6531                 } else {
6532                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
6533                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6534                         } }
6535                 }
6536         }
6537 }
6538 #[no_mangle]
6539 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
6540 /// but with all dynamically-allocated buffers duplicated in new buffers.
6541 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
6542 #[repr(C)]
6543 /// The contents of CResult_NodeFeaturesDecodeErrorZ
6544 pub union CResult_NodeFeaturesDecodeErrorZPtr {
6545         /// A pointer to the contents in the success state.
6546         /// Reading from this pointer when `result_ok` is not set is undefined.
6547         pub result: *mut crate::lightning::ln::features::NodeFeatures,
6548         /// A pointer to the contents in the error state.
6549         /// Reading from this pointer when `result_ok` is set is undefined.
6550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6551 }
6552 #[repr(C)]
6553 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
6554 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6556 pub struct CResult_NodeFeaturesDecodeErrorZ {
6557         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
6558         /// `err` or `result` depending on the state of `result_ok`.
6559         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
6560         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
6561         pub result_ok: bool,
6562 }
6563 #[no_mangle]
6564 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
6565 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
6566         CResult_NodeFeaturesDecodeErrorZ {
6567                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6568                         result: Box::into_raw(Box::new(o)),
6569                 },
6570                 result_ok: true,
6571         }
6572 }
6573 #[no_mangle]
6574 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
6575 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
6576         CResult_NodeFeaturesDecodeErrorZ {
6577                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
6578                         err: Box::into_raw(Box::new(e)),
6579                 },
6580                 result_ok: false,
6581         }
6582 }
6583 /// Checks if the given object is currently in the success state
6584 #[no_mangle]
6585 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
6586         o.result_ok
6587 }
6588 #[no_mangle]
6589 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
6590 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
6591 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
6592         fn drop(&mut self) {
6593                 if self.result_ok {
6594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6596                         }
6597                 } else {
6598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6600                         }
6601                 }
6602         }
6603 }
6604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
6605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6606                 let contents = if o.result_ok {
6607                         let result = unsafe { o.contents.result };
6608                         unsafe { o.contents.result = core::ptr::null_mut() };
6609                         CResult_NodeFeaturesDecodeErrorZPtr { result }
6610                 } else {
6611                         let err = unsafe { o.contents.err };
6612                         unsafe { o.contents.err = core::ptr::null_mut(); }
6613                         CResult_NodeFeaturesDecodeErrorZPtr { err }
6614                 };
6615                 Self {
6616                         contents,
6617                         result_ok: o.result_ok,
6618                 }
6619         }
6620 }
6621 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
6622         fn clone(&self) -> Self {
6623                 if self.result_ok {
6624                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6625                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
6626                         } }
6627                 } else {
6628                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
6629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6630                         } }
6631                 }
6632         }
6633 }
6634 #[no_mangle]
6635 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
6636 /// but with all dynamically-allocated buffers duplicated in new buffers.
6637 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
6638 #[repr(C)]
6639 /// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ
6640 pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6641         /// A pointer to the contents in the success state.
6642         /// Reading from this pointer when `result_ok` is not set is undefined.
6643         pub result: *mut crate::lightning::ln::features::Bolt11InvoiceFeatures,
6644         /// A pointer to the contents in the error state.
6645         /// Reading from this pointer when `result_ok` is set is undefined.
6646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6647 }
6648 #[repr(C)]
6649 /// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6650 /// containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6652 pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6653         /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either
6654         /// `err` or `result` depending on the state of `result_ok`.
6655         pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr,
6656         /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state.
6657         pub result_ok: bool,
6658 }
6659 #[no_mangle]
6660 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state.
6661 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6662         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6663                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6664                         result: Box::into_raw(Box::new(o)),
6665                 },
6666                 result_ok: true,
6667         }
6668 }
6669 #[no_mangle]
6670 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state.
6671 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6672         CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6673                 contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6674                         err: Box::into_raw(Box::new(e)),
6675                 },
6676                 result_ok: false,
6677         }
6678 }
6679 /// Checks if the given object is currently in the success state
6680 #[no_mangle]
6681 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool {
6682         o.result_ok
6683 }
6684 #[no_mangle]
6685 /// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ.
6686 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { }
6687 impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6688         fn drop(&mut self) {
6689                 if self.result_ok {
6690                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6691                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6692                         }
6693                 } else {
6694                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6695                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6696                         }
6697                 }
6698         }
6699 }
6700 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6701         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt11InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6702                 let contents = if o.result_ok {
6703                         let result = unsafe { o.contents.result };
6704                         unsafe { o.contents.result = core::ptr::null_mut() };
6705                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result }
6706                 } else {
6707                         let err = unsafe { o.contents.err };
6708                         unsafe { o.contents.err = core::ptr::null_mut(); }
6709                         CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err }
6710                 };
6711                 Self {
6712                         contents,
6713                         result_ok: o.result_ok,
6714                 }
6715         }
6716 }
6717 impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ {
6718         fn clone(&self) -> Self {
6719                 if self.result_ok {
6720                         Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6721                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt11InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6722                         } }
6723                 } else {
6724                         Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr {
6725                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6726                         } }
6727                 }
6728         }
6729 }
6730 #[no_mangle]
6731 /// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6732 /// but with all dynamically-allocated buffers duplicated in new buffers.
6733 pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6734 #[repr(C)]
6735 /// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ
6736 pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6737         /// A pointer to the contents in the success state.
6738         /// Reading from this pointer when `result_ok` is not set is undefined.
6739         pub result: *mut crate::lightning::ln::features::Bolt12InvoiceFeatures,
6740         /// A pointer to the contents in the error state.
6741         /// Reading from this pointer when `result_ok` is set is undefined.
6742         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6743 }
6744 #[repr(C)]
6745 /// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
6746 /// containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6748 pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6749         /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either
6750         /// `err` or `result` depending on the state of `result_ok`.
6751         pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr,
6752         /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state.
6753         pub result_ok: bool,
6754 }
6755 #[no_mangle]
6756 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state.
6757 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6758         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6759                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6760                         result: Box::into_raw(Box::new(o)),
6761                 },
6762                 result_ok: true,
6763         }
6764 }
6765 #[no_mangle]
6766 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state.
6767 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6768         CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6769                 contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6770                         err: Box::into_raw(Box::new(e)),
6771                 },
6772                 result_ok: false,
6773         }
6774 }
6775 /// Checks if the given object is currently in the success state
6776 #[no_mangle]
6777 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool {
6778         o.result_ok
6779 }
6780 #[no_mangle]
6781 /// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ.
6782 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { }
6783 impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6784         fn drop(&mut self) {
6785                 if self.result_ok {
6786                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6787                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6788                         }
6789                 } else {
6790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6792                         }
6793                 }
6794         }
6795 }
6796 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6797         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::Bolt12InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6798                 let contents = if o.result_ok {
6799                         let result = unsafe { o.contents.result };
6800                         unsafe { o.contents.result = core::ptr::null_mut() };
6801                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result }
6802                 } else {
6803                         let err = unsafe { o.contents.err };
6804                         unsafe { o.contents.err = core::ptr::null_mut(); }
6805                         CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err }
6806                 };
6807                 Self {
6808                         contents,
6809                         result_ok: o.result_ok,
6810                 }
6811         }
6812 }
6813 impl Clone for CResult_Bolt12InvoiceFeaturesDecodeErrorZ {
6814         fn clone(&self) -> Self {
6815                 if self.result_ok {
6816                         Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6817                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::Bolt12InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
6818                         } }
6819                 } else {
6820                         Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr {
6821                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6822                         } }
6823                 }
6824         }
6825 }
6826 #[no_mangle]
6827 /// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
6828 /// but with all dynamically-allocated buffers duplicated in new buffers.
6829 pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
6830 #[repr(C)]
6831 /// The contents of CResult_BlindedHopFeaturesDecodeErrorZ
6832 pub union CResult_BlindedHopFeaturesDecodeErrorZPtr {
6833         /// A pointer to the contents in the success state.
6834         /// Reading from this pointer when `result_ok` is not set is undefined.
6835         pub result: *mut crate::lightning::ln::features::BlindedHopFeatures,
6836         /// A pointer to the contents in the error state.
6837         /// Reading from this pointer when `result_ok` is set is undefined.
6838         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6839 }
6840 #[repr(C)]
6841 /// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
6842 /// containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6844 pub struct CResult_BlindedHopFeaturesDecodeErrorZ {
6845         /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
6846         /// `err` or `result` depending on the state of `result_ok`.
6847         pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr,
6848         /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
6849         pub result_ok: bool,
6850 }
6851 #[no_mangle]
6852 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state.
6853 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6854         CResult_BlindedHopFeaturesDecodeErrorZ {
6855                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6856                         result: Box::into_raw(Box::new(o)),
6857                 },
6858                 result_ok: true,
6859         }
6860 }
6861 #[no_mangle]
6862 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state.
6863 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ {
6864         CResult_BlindedHopFeaturesDecodeErrorZ {
6865                 contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6866                         err: Box::into_raw(Box::new(e)),
6867                 },
6868                 result_ok: false,
6869         }
6870 }
6871 /// Checks if the given object is currently in the success state
6872 #[no_mangle]
6873 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool {
6874         o.result_ok
6875 }
6876 #[no_mangle]
6877 /// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ.
6878 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { }
6879 impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ {
6880         fn drop(&mut self) {
6881                 if self.result_ok {
6882                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6883                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6884                         }
6885                 } else {
6886                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6887                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6888                         }
6889                 }
6890         }
6891 }
6892 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopFeaturesDecodeErrorZ {
6893         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::BlindedHopFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6894                 let contents = if o.result_ok {
6895                         let result = unsafe { o.contents.result };
6896                         unsafe { o.contents.result = core::ptr::null_mut() };
6897                         CResult_BlindedHopFeaturesDecodeErrorZPtr { result }
6898                 } else {
6899                         let err = unsafe { o.contents.err };
6900                         unsafe { o.contents.err = core::ptr::null_mut(); }
6901                         CResult_BlindedHopFeaturesDecodeErrorZPtr { err }
6902                 };
6903                 Self {
6904                         contents,
6905                         result_ok: o.result_ok,
6906                 }
6907         }
6908 }
6909 impl Clone for CResult_BlindedHopFeaturesDecodeErrorZ {
6910         fn clone(&self) -> Self {
6911                 if self.result_ok {
6912                         Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6913                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::BlindedHopFeatures>::clone(unsafe { &*self.contents.result })))
6914                         } }
6915                 } else {
6916                         Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr {
6917                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6918                         } }
6919                 }
6920         }
6921 }
6922 #[no_mangle]
6923 /// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig`
6924 /// but with all dynamically-allocated buffers duplicated in new buffers.
6925 pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) }
6926 #[repr(C)]
6927 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
6928 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6929         /// A pointer to the contents in the success state.
6930         /// Reading from this pointer when `result_ok` is not set is undefined.
6931         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
6932         /// A pointer to the contents in the error state.
6933         /// Reading from this pointer when `result_ok` is set is undefined.
6934         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6935 }
6936 #[repr(C)]
6937 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
6938 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6940 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
6941         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
6942         /// `err` or `result` depending on the state of `result_ok`.
6943         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
6944         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
6945         pub result_ok: bool,
6946 }
6947 #[no_mangle]
6948 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
6949 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6950         CResult_ChannelTypeFeaturesDecodeErrorZ {
6951                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6952                         result: Box::into_raw(Box::new(o)),
6953                 },
6954                 result_ok: true,
6955         }
6956 }
6957 #[no_mangle]
6958 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
6959 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
6960         CResult_ChannelTypeFeaturesDecodeErrorZ {
6961                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
6962                         err: Box::into_raw(Box::new(e)),
6963                 },
6964                 result_ok: false,
6965         }
6966 }
6967 /// Checks if the given object is currently in the success state
6968 #[no_mangle]
6969 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
6970         o.result_ok
6971 }
6972 #[no_mangle]
6973 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
6974 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
6975 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
6976         fn drop(&mut self) {
6977                 if self.result_ok {
6978                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6979                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6980                         }
6981                 } else {
6982                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6983                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6984                         }
6985                 }
6986         }
6987 }
6988 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
6989         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
6990                 let contents = if o.result_ok {
6991                         let result = unsafe { o.contents.result };
6992                         unsafe { o.contents.result = core::ptr::null_mut() };
6993                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
6994                 } else {
6995                         let err = unsafe { o.contents.err };
6996                         unsafe { o.contents.err = core::ptr::null_mut(); }
6997                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
6998                 };
6999                 Self {
7000                         contents,
7001                         result_ok: o.result_ok,
7002                 }
7003         }
7004 }
7005 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
7006         fn clone(&self) -> Self {
7007                 if self.result_ok {
7008                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
7009                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
7010                         } }
7011                 } else {
7012                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
7013                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7014                         } }
7015                 }
7016         }
7017 }
7018 #[no_mangle]
7019 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
7020 /// but with all dynamically-allocated buffers duplicated in new buffers.
7021 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
7022 #[repr(C)]
7023 /// The contents of CResult_OfferIdDecodeErrorZ
7024 pub union CResult_OfferIdDecodeErrorZPtr {
7025         /// A pointer to the contents in the success state.
7026         /// Reading from this pointer when `result_ok` is not set is undefined.
7027         pub result: *mut crate::lightning::offers::offer::OfferId,
7028         /// A pointer to the contents in the error state.
7029         /// Reading from this pointer when `result_ok` is set is undefined.
7030         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7031 }
7032 #[repr(C)]
7033 /// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation,
7034 /// containing a crate::lightning::offers::offer::OfferId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7036 pub struct CResult_OfferIdDecodeErrorZ {
7037         /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either
7038         /// `err` or `result` depending on the state of `result_ok`.
7039         pub contents: CResult_OfferIdDecodeErrorZPtr,
7040         /// Whether this CResult_OfferIdDecodeErrorZ represents a success state.
7041         pub result_ok: bool,
7042 }
7043 #[no_mangle]
7044 /// Creates a new CResult_OfferIdDecodeErrorZ in the success state.
7045 pub extern "C" fn CResult_OfferIdDecodeErrorZ_ok(o: crate::lightning::offers::offer::OfferId) -> CResult_OfferIdDecodeErrorZ {
7046         CResult_OfferIdDecodeErrorZ {
7047                 contents: CResult_OfferIdDecodeErrorZPtr {
7048                         result: Box::into_raw(Box::new(o)),
7049                 },
7050                 result_ok: true,
7051         }
7052 }
7053 #[no_mangle]
7054 /// Creates a new CResult_OfferIdDecodeErrorZ in the error state.
7055 pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferIdDecodeErrorZ {
7056         CResult_OfferIdDecodeErrorZ {
7057                 contents: CResult_OfferIdDecodeErrorZPtr {
7058                         err: Box::into_raw(Box::new(e)),
7059                 },
7060                 result_ok: false,
7061         }
7062 }
7063 /// Checks if the given object is currently in the success state
7064 #[no_mangle]
7065 pub extern "C" fn CResult_OfferIdDecodeErrorZ_is_ok(o: &CResult_OfferIdDecodeErrorZ) -> bool {
7066         o.result_ok
7067 }
7068 #[no_mangle]
7069 /// Frees any resources used by the CResult_OfferIdDecodeErrorZ.
7070 pub extern "C" fn CResult_OfferIdDecodeErrorZ_free(_res: CResult_OfferIdDecodeErrorZ) { }
7071 impl Drop for CResult_OfferIdDecodeErrorZ {
7072         fn drop(&mut self) {
7073                 if self.result_ok {
7074                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7075                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7076                         }
7077                 } else {
7078                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7079                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7080                         }
7081                 }
7082         }
7083 }
7084 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>> for CResult_OfferIdDecodeErrorZ {
7085         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7086                 let contents = if o.result_ok {
7087                         let result = unsafe { o.contents.result };
7088                         unsafe { o.contents.result = core::ptr::null_mut() };
7089                         CResult_OfferIdDecodeErrorZPtr { result }
7090                 } else {
7091                         let err = unsafe { o.contents.err };
7092                         unsafe { o.contents.err = core::ptr::null_mut(); }
7093                         CResult_OfferIdDecodeErrorZPtr { err }
7094                 };
7095                 Self {
7096                         contents,
7097                         result_ok: o.result_ok,
7098                 }
7099         }
7100 }
7101 impl Clone for CResult_OfferIdDecodeErrorZ {
7102         fn clone(&self) -> Self {
7103                 if self.result_ok {
7104                         Self { result_ok: true, contents: CResult_OfferIdDecodeErrorZPtr {
7105                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferId>::clone(unsafe { &*self.contents.result })))
7106                         } }
7107                 } else {
7108                         Self { result_ok: false, contents: CResult_OfferIdDecodeErrorZPtr {
7109                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7110                         } }
7111                 }
7112         }
7113 }
7114 #[no_mangle]
7115 /// Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig`
7116 /// but with all dynamically-allocated buffers duplicated in new buffers.
7117 pub extern "C" fn CResult_OfferIdDecodeErrorZ_clone(orig: &CResult_OfferIdDecodeErrorZ) -> CResult_OfferIdDecodeErrorZ { Clone::clone(&orig) }
7118 #[repr(C)]
7119 /// The contents of CResult_NoneBolt12SemanticErrorZ
7120 pub union CResult_NoneBolt12SemanticErrorZPtr {
7121         /// Note that this value is always NULL, as there are no contents in the OK variant
7122         pub result: *mut core::ffi::c_void,
7123         /// A pointer to the contents in the error state.
7124         /// Reading from this pointer when `result_ok` is set is undefined.
7125         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7126 }
7127 #[repr(C)]
7128 /// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation,
7129 /// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7131 pub struct CResult_NoneBolt12SemanticErrorZ {
7132         /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either
7133         /// `err` or `result` depending on the state of `result_ok`.
7134         pub contents: CResult_NoneBolt12SemanticErrorZPtr,
7135         /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state.
7136         pub result_ok: bool,
7137 }
7138 #[no_mangle]
7139 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state.
7140 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ {
7141         CResult_NoneBolt12SemanticErrorZ {
7142                 contents: CResult_NoneBolt12SemanticErrorZPtr {
7143                         result: core::ptr::null_mut(),
7144                 },
7145                 result_ok: true,
7146         }
7147 }
7148 #[no_mangle]
7149 /// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state.
7150 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ {
7151         CResult_NoneBolt12SemanticErrorZ {
7152                 contents: CResult_NoneBolt12SemanticErrorZPtr {
7153                         err: Box::into_raw(Box::new(e)),
7154                 },
7155                 result_ok: false,
7156         }
7157 }
7158 /// Checks if the given object is currently in the success state
7159 #[no_mangle]
7160 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool {
7161         o.result_ok
7162 }
7163 #[no_mangle]
7164 /// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ.
7165 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { }
7166 impl Drop for CResult_NoneBolt12SemanticErrorZ {
7167         fn drop(&mut self) {
7168                 if self.result_ok {
7169                 } else {
7170                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7171                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7172                         }
7173                 }
7174         }
7175 }
7176 impl From<crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_NoneBolt12SemanticErrorZ {
7177         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7178                 let contents = if o.result_ok {
7179                         let _ = unsafe { Box::from_raw(o.contents.result) };
7180                         o.contents.result = core::ptr::null_mut();
7181                         CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() }
7182                 } else {
7183                         let err = unsafe { o.contents.err };
7184                         unsafe { o.contents.err = core::ptr::null_mut(); }
7185                         CResult_NoneBolt12SemanticErrorZPtr { err }
7186                 };
7187                 Self {
7188                         contents,
7189                         result_ok: o.result_ok,
7190                 }
7191         }
7192 }
7193 impl Clone for CResult_NoneBolt12SemanticErrorZ {
7194         fn clone(&self) -> Self {
7195                 if self.result_ok {
7196                         Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr {
7197                                 result: core::ptr::null_mut()
7198                         } }
7199                 } else {
7200                         Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr {
7201                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
7202                         } }
7203                 }
7204         }
7205 }
7206 #[no_mangle]
7207 /// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig`
7208 /// but with all dynamically-allocated buffers duplicated in new buffers.
7209 pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) }
7210 #[repr(C)]
7211 /// The contents of CResult_OfferBolt12SemanticErrorZ
7212 pub union CResult_OfferBolt12SemanticErrorZPtr {
7213         /// A pointer to the contents in the success state.
7214         /// Reading from this pointer when `result_ok` is not set is undefined.
7215         pub result: *mut crate::lightning::offers::offer::Offer,
7216         /// A pointer to the contents in the error state.
7217         /// Reading from this pointer when `result_ok` is set is undefined.
7218         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7219 }
7220 #[repr(C)]
7221 /// A CResult_OfferBolt12SemanticErrorZ represents the result of a fallible operation,
7222 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7224 pub struct CResult_OfferBolt12SemanticErrorZ {
7225         /// The contents of this CResult_OfferBolt12SemanticErrorZ, accessible via either
7226         /// `err` or `result` depending on the state of `result_ok`.
7227         pub contents: CResult_OfferBolt12SemanticErrorZPtr,
7228         /// Whether this CResult_OfferBolt12SemanticErrorZ represents a success state.
7229         pub result_ok: bool,
7230 }
7231 #[no_mangle]
7232 /// Creates a new CResult_OfferBolt12SemanticErrorZ in the success state.
7233 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12SemanticErrorZ {
7234         CResult_OfferBolt12SemanticErrorZ {
7235                 contents: CResult_OfferBolt12SemanticErrorZPtr {
7236                         result: Box::into_raw(Box::new(o)),
7237                 },
7238                 result_ok: true,
7239         }
7240 }
7241 #[no_mangle]
7242 /// Creates a new CResult_OfferBolt12SemanticErrorZ in the error state.
7243 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferBolt12SemanticErrorZ {
7244         CResult_OfferBolt12SemanticErrorZ {
7245                 contents: CResult_OfferBolt12SemanticErrorZPtr {
7246                         err: Box::into_raw(Box::new(e)),
7247                 },
7248                 result_ok: false,
7249         }
7250 }
7251 /// Checks if the given object is currently in the success state
7252 #[no_mangle]
7253 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_is_ok(o: &CResult_OfferBolt12SemanticErrorZ) -> bool {
7254         o.result_ok
7255 }
7256 #[no_mangle]
7257 /// Frees any resources used by the CResult_OfferBolt12SemanticErrorZ.
7258 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_free(_res: CResult_OfferBolt12SemanticErrorZ) { }
7259 impl Drop for CResult_OfferBolt12SemanticErrorZ {
7260         fn drop(&mut self) {
7261                 if self.result_ok {
7262                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7263                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7264                         }
7265                 } else {
7266                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7267                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7268                         }
7269                 }
7270         }
7271 }
7272 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_OfferBolt12SemanticErrorZ {
7273         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7274                 let contents = if o.result_ok {
7275                         let result = unsafe { o.contents.result };
7276                         unsafe { o.contents.result = core::ptr::null_mut() };
7277                         CResult_OfferBolt12SemanticErrorZPtr { result }
7278                 } else {
7279                         let err = unsafe { o.contents.err };
7280                         unsafe { o.contents.err = core::ptr::null_mut(); }
7281                         CResult_OfferBolt12SemanticErrorZPtr { err }
7282                 };
7283                 Self {
7284                         contents,
7285                         result_ok: o.result_ok,
7286                 }
7287         }
7288 }
7289 impl Clone for CResult_OfferBolt12SemanticErrorZ {
7290         fn clone(&self) -> Self {
7291                 if self.result_ok {
7292                         Self { result_ok: true, contents: CResult_OfferBolt12SemanticErrorZPtr {
7293                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
7294                         } }
7295                 } else {
7296                         Self { result_ok: false, contents: CResult_OfferBolt12SemanticErrorZPtr {
7297                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
7298                         } }
7299                 }
7300         }
7301 }
7302 #[no_mangle]
7303 /// Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig`
7304 /// but with all dynamically-allocated buffers duplicated in new buffers.
7305 pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_clone(orig: &CResult_OfferBolt12SemanticErrorZ) -> CResult_OfferBolt12SemanticErrorZ { Clone::clone(&orig) }
7306 #[repr(C)]
7307 /// The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ
7308 pub union CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7309         /// A pointer to the contents in the success state.
7310         /// Reading from this pointer when `result_ok` is not set is undefined.
7311         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder,
7312         /// A pointer to the contents in the error state.
7313         /// Reading from this pointer when `result_ok` is set is undefined.
7314         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7315 }
7316 #[repr(C)]
7317 /// A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7318 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7320 pub struct CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7321         /// The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7322         /// `err` or `result` depending on the state of `result_ok`.
7323         pub contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr,
7324         /// Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7325         pub result_ok: bool,
7326 }
7327 #[no_mangle]
7328 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state.
7329 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7330         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7331                 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7332                         result: Box::into_raw(Box::new(o)),
7333                 },
7334                 result_ok: true,
7335         }
7336 }
7337 #[no_mangle]
7338 /// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state.
7339 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7340         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7341                 contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr {
7342                         err: Box::into_raw(Box::new(e)),
7343                 },
7344                 result_ok: false,
7345         }
7346 }
7347 /// Checks if the given object is currently in the success state
7348 #[no_mangle]
7349 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7350         o.result_ok
7351 }
7352 #[no_mangle]
7353 /// Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ.
7354 pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) { }
7355 impl Drop for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7356         fn drop(&mut self) {
7357                 if self.result_ok {
7358                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7359                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7360                         }
7361                 } else {
7362                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7363                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7364                         }
7365                 }
7366         }
7367 }
7368 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ {
7369         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7370                 let contents = if o.result_ok {
7371                         let result = unsafe { o.contents.result };
7372                         unsafe { o.contents.result = core::ptr::null_mut() };
7373                         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { result }
7374                 } else {
7375                         let err = unsafe { o.contents.err };
7376                         unsafe { o.contents.err = core::ptr::null_mut(); }
7377                         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { err }
7378                 };
7379                 Self {
7380                         contents,
7381                         result_ok: o.result_ok,
7382                 }
7383         }
7384 }
7385 #[repr(C)]
7386 /// The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ
7387 pub union CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7388         /// A pointer to the contents in the success state.
7389         /// Reading from this pointer when `result_ok` is not set is undefined.
7390         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder,
7391         /// A pointer to the contents in the error state.
7392         /// Reading from this pointer when `result_ok` is set is undefined.
7393         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
7394 }
7395 #[repr(C)]
7396 /// A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
7397 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
7398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7399 pub struct CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7400         /// The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either
7401         /// `err` or `result` depending on the state of `result_ok`.
7402         pub contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr,
7403         /// Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state.
7404         pub result_ok: bool,
7405 }
7406 #[no_mangle]
7407 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state.
7408 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7409         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7410                 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7411                         result: Box::into_raw(Box::new(o)),
7412                 },
7413                 result_ok: true,
7414         }
7415 }
7416 #[no_mangle]
7417 /// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state.
7418 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7419         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7420                 contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr {
7421                         err: Box::into_raw(Box::new(e)),
7422                 },
7423                 result_ok: false,
7424         }
7425 }
7426 /// Checks if the given object is currently in the success state
7427 #[no_mangle]
7428 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) -> bool {
7429         o.result_ok
7430 }
7431 #[no_mangle]
7432 /// Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.
7433 pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) { }
7434 impl Drop for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7435         fn drop(&mut self) {
7436                 if self.result_ok {
7437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7439                         }
7440                 } else {
7441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7443                         }
7444                 }
7445         }
7446 }
7447 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
7448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
7449                 let contents = if o.result_ok {
7450                         let result = unsafe { o.contents.result };
7451                         unsafe { o.contents.result = core::ptr::null_mut() };
7452                         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { result }
7453                 } else {
7454                         let err = unsafe { o.contents.err };
7455                         unsafe { o.contents.err = core::ptr::null_mut(); }
7456                         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { err }
7457                 };
7458                 Self {
7459                         contents,
7460                         result_ok: o.result_ok,
7461                 }
7462         }
7463 }
7464 #[repr(C)]
7465 /// The contents of CResult_OfferBolt12ParseErrorZ
7466 pub union CResult_OfferBolt12ParseErrorZPtr {
7467         /// A pointer to the contents in the success state.
7468         /// Reading from this pointer when `result_ok` is not set is undefined.
7469         pub result: *mut crate::lightning::offers::offer::Offer,
7470         /// A pointer to the contents in the error state.
7471         /// Reading from this pointer when `result_ok` is set is undefined.
7472         pub err: *mut crate::lightning::offers::parse::Bolt12ParseError,
7473 }
7474 #[repr(C)]
7475 /// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation,
7476 /// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure.
7477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7478 pub struct CResult_OfferBolt12ParseErrorZ {
7479         /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either
7480         /// `err` or `result` depending on the state of `result_ok`.
7481         pub contents: CResult_OfferBolt12ParseErrorZPtr,
7482         /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state.
7483         pub result_ok: bool,
7484 }
7485 #[no_mangle]
7486 /// Creates a new CResult_OfferBolt12ParseErrorZ in the success state.
7487 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ {
7488         CResult_OfferBolt12ParseErrorZ {
7489                 contents: CResult_OfferBolt12ParseErrorZPtr {
7490                         result: Box::into_raw(Box::new(o)),
7491                 },
7492                 result_ok: true,
7493         }
7494 }
7495 #[no_mangle]
7496 /// Creates a new CResult_OfferBolt12ParseErrorZ in the error state.
7497 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ {
7498         CResult_OfferBolt12ParseErrorZ {
7499                 contents: CResult_OfferBolt12ParseErrorZPtr {
7500                         err: Box::into_raw(Box::new(e)),
7501                 },
7502                 result_ok: false,
7503         }
7504 }
7505 /// Checks if the given object is currently in the success state
7506 #[no_mangle]
7507 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool {
7508         o.result_ok
7509 }
7510 #[no_mangle]
7511 /// Frees any resources used by the CResult_OfferBolt12ParseErrorZ.
7512 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { }
7513 impl Drop for CResult_OfferBolt12ParseErrorZ {
7514         fn drop(&mut self) {
7515                 if self.result_ok {
7516                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7517                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7518                         }
7519                 } else {
7520                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7521                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7522                         }
7523                 }
7524         }
7525 }
7526 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>> for CResult_OfferBolt12ParseErrorZ {
7527         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::Offer, crate::lightning::offers::parse::Bolt12ParseError>) -> Self {
7528                 let contents = if o.result_ok {
7529                         let result = unsafe { o.contents.result };
7530                         unsafe { o.contents.result = core::ptr::null_mut() };
7531                         CResult_OfferBolt12ParseErrorZPtr { result }
7532                 } else {
7533                         let err = unsafe { o.contents.err };
7534                         unsafe { o.contents.err = core::ptr::null_mut(); }
7535                         CResult_OfferBolt12ParseErrorZPtr { err }
7536                 };
7537                 Self {
7538                         contents,
7539                         result_ok: o.result_ok,
7540                 }
7541         }
7542 }
7543 impl Clone for CResult_OfferBolt12ParseErrorZ {
7544         fn clone(&self) -> Self {
7545                 if self.result_ok {
7546                         Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr {
7547                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::Offer>::clone(unsafe { &*self.contents.result })))
7548                         } }
7549                 } else {
7550                         Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr {
7551                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12ParseError>::clone(unsafe { &*self.contents.err })))
7552                         } }
7553                 }
7554         }
7555 }
7556 #[no_mangle]
7557 /// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig`
7558 /// but with all dynamically-allocated buffers duplicated in new buffers.
7559 pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) }
7560 #[repr(C)]
7561 /// The contents of CResult_NodeIdDecodeErrorZ
7562 pub union CResult_NodeIdDecodeErrorZPtr {
7563         /// A pointer to the contents in the success state.
7564         /// Reading from this pointer when `result_ok` is not set is undefined.
7565         pub result: *mut crate::lightning::routing::gossip::NodeId,
7566         /// A pointer to the contents in the error state.
7567         /// Reading from this pointer when `result_ok` is set is undefined.
7568         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7569 }
7570 #[repr(C)]
7571 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
7572 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
7573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7574 pub struct CResult_NodeIdDecodeErrorZ {
7575         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
7576         /// `err` or `result` depending on the state of `result_ok`.
7577         pub contents: CResult_NodeIdDecodeErrorZPtr,
7578         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
7579         pub result_ok: bool,
7580 }
7581 #[no_mangle]
7582 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
7583 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
7584         CResult_NodeIdDecodeErrorZ {
7585                 contents: CResult_NodeIdDecodeErrorZPtr {
7586                         result: Box::into_raw(Box::new(o)),
7587                 },
7588                 result_ok: true,
7589         }
7590 }
7591 #[no_mangle]
7592 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
7593 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
7594         CResult_NodeIdDecodeErrorZ {
7595                 contents: CResult_NodeIdDecodeErrorZPtr {
7596                         err: Box::into_raw(Box::new(e)),
7597                 },
7598                 result_ok: false,
7599         }
7600 }
7601 /// Checks if the given object is currently in the success state
7602 #[no_mangle]
7603 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
7604         o.result_ok
7605 }
7606 #[no_mangle]
7607 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
7608 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
7609 impl Drop for CResult_NodeIdDecodeErrorZ {
7610         fn drop(&mut self) {
7611                 if self.result_ok {
7612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7614                         }
7615                 } else {
7616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7618                         }
7619                 }
7620         }
7621 }
7622 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
7623         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
7624                 let contents = if o.result_ok {
7625                         let result = unsafe { o.contents.result };
7626                         unsafe { o.contents.result = core::ptr::null_mut() };
7627                         CResult_NodeIdDecodeErrorZPtr { result }
7628                 } else {
7629                         let err = unsafe { o.contents.err };
7630                         unsafe { o.contents.err = core::ptr::null_mut(); }
7631                         CResult_NodeIdDecodeErrorZPtr { err }
7632                 };
7633                 Self {
7634                         contents,
7635                         result_ok: o.result_ok,
7636                 }
7637         }
7638 }
7639 impl Clone for CResult_NodeIdDecodeErrorZ {
7640         fn clone(&self) -> Self {
7641                 if self.result_ok {
7642                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
7643                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
7644                         } }
7645                 } else {
7646                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
7647                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7648                         } }
7649                 }
7650         }
7651 }
7652 #[no_mangle]
7653 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
7654 /// but with all dynamically-allocated buffers duplicated in new buffers.
7655 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
7656 #[repr(C)]
7657 /// The contents of CResult_PublicKeySecp256k1ErrorZ
7658 pub union CResult_PublicKeySecp256k1ErrorZPtr {
7659         /// A pointer to the contents in the success state.
7660         /// Reading from this pointer when `result_ok` is not set is undefined.
7661         pub result: *mut crate::c_types::PublicKey,
7662         /// A pointer to the contents in the error state.
7663         /// Reading from this pointer when `result_ok` is set is undefined.
7664         pub err: *mut crate::c_types::Secp256k1Error,
7665 }
7666 #[repr(C)]
7667 /// A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation,
7668 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
7669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7670 pub struct CResult_PublicKeySecp256k1ErrorZ {
7671         /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either
7672         /// `err` or `result` depending on the state of `result_ok`.
7673         pub contents: CResult_PublicKeySecp256k1ErrorZPtr,
7674         /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state.
7675         pub result_ok: bool,
7676 }
7677 #[no_mangle]
7678 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state.
7679 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ {
7680         CResult_PublicKeySecp256k1ErrorZ {
7681                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7682                         result: Box::into_raw(Box::new(o)),
7683                 },
7684                 result_ok: true,
7685         }
7686 }
7687 #[no_mangle]
7688 /// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state.
7689 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ {
7690         CResult_PublicKeySecp256k1ErrorZ {
7691                 contents: CResult_PublicKeySecp256k1ErrorZPtr {
7692                         err: Box::into_raw(Box::new(e)),
7693                 },
7694                 result_ok: false,
7695         }
7696 }
7697 /// Checks if the given object is currently in the success state
7698 #[no_mangle]
7699 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool {
7700         o.result_ok
7701 }
7702 #[no_mangle]
7703 /// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ.
7704 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { }
7705 impl Drop for CResult_PublicKeySecp256k1ErrorZ {
7706         fn drop(&mut self) {
7707                 if self.result_ok {
7708                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7709                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7710                         }
7711                 } else {
7712                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7713                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7714                         }
7715                 }
7716         }
7717 }
7718 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeySecp256k1ErrorZ {
7719         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
7720                 let contents = if o.result_ok {
7721                         let result = unsafe { o.contents.result };
7722                         unsafe { o.contents.result = core::ptr::null_mut() };
7723                         CResult_PublicKeySecp256k1ErrorZPtr { result }
7724                 } else {
7725                         let err = unsafe { o.contents.err };
7726                         unsafe { o.contents.err = core::ptr::null_mut(); }
7727                         CResult_PublicKeySecp256k1ErrorZPtr { err }
7728                 };
7729                 Self {
7730                         contents,
7731                         result_ok: o.result_ok,
7732                 }
7733         }
7734 }
7735 impl Clone for CResult_PublicKeySecp256k1ErrorZ {
7736         fn clone(&self) -> Self {
7737                 if self.result_ok {
7738                         Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7739                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7740                         } }
7741                 } else {
7742                         Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr {
7743                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7744                         } }
7745                 }
7746         }
7747 }
7748 #[no_mangle]
7749 /// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig`
7750 /// but with all dynamically-allocated buffers duplicated in new buffers.
7751 pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) }
7752 #[repr(C)]
7753 #[derive(Clone)]
7754 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
7755 pub enum COption_NetworkUpdateZ {
7756         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
7757         Some(crate::lightning::routing::gossip::NetworkUpdate),
7758         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
7759         None
7760 }
7761 impl COption_NetworkUpdateZ {
7762         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7763                 if let Self::None = self { false } else { true }
7764         }
7765         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7766                 !self.is_some()
7767         }
7768         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
7769                 if let Self::Some(v) = self { v } else { unreachable!() }
7770         }
7771 }
7772 #[no_mangle]
7773 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
7774 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
7775         COption_NetworkUpdateZ::Some(o)
7776 }
7777 #[no_mangle]
7778 /// Constructs a new COption_NetworkUpdateZ containing nothing
7779 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
7780         COption_NetworkUpdateZ::None
7781 }
7782 #[no_mangle]
7783 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
7784 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
7785 #[no_mangle]
7786 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
7787 /// but with all dynamically-allocated buffers duplicated in new buffers.
7788 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
7789 #[repr(C)]
7790 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
7791 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7792         /// A pointer to the contents in the success state.
7793         /// Reading from this pointer when `result_ok` is not set is undefined.
7794         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
7795         /// A pointer to the contents in the error state.
7796         /// Reading from this pointer when `result_ok` is set is undefined.
7797         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7798 }
7799 #[repr(C)]
7800 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
7801 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7803 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
7804         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
7805         /// `err` or `result` depending on the state of `result_ok`.
7806         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
7807         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
7808         pub result_ok: bool,
7809 }
7810 #[no_mangle]
7811 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
7812 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7813         CResult_COption_NetworkUpdateZDecodeErrorZ {
7814                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7815                         result: Box::into_raw(Box::new(o)),
7816                 },
7817                 result_ok: true,
7818         }
7819 }
7820 #[no_mangle]
7821 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
7822 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
7823         CResult_COption_NetworkUpdateZDecodeErrorZ {
7824                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7825                         err: Box::into_raw(Box::new(e)),
7826                 },
7827                 result_ok: false,
7828         }
7829 }
7830 /// Checks if the given object is currently in the success state
7831 #[no_mangle]
7832 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
7833         o.result_ok
7834 }
7835 #[no_mangle]
7836 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
7837 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
7838 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
7839         fn drop(&mut self) {
7840                 if self.result_ok {
7841                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7842                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7843                         }
7844                 } else {
7845                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7846                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7847                         }
7848                 }
7849         }
7850 }
7851 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
7852         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7853                 let contents = if o.result_ok {
7854                         let result = unsafe { o.contents.result };
7855                         unsafe { o.contents.result = core::ptr::null_mut() };
7856                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
7857                 } else {
7858                         let err = unsafe { o.contents.err };
7859                         unsafe { o.contents.err = core::ptr::null_mut(); }
7860                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
7861                 };
7862                 Self {
7863                         contents,
7864                         result_ok: o.result_ok,
7865                 }
7866         }
7867 }
7868 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
7869         fn clone(&self) -> Self {
7870                 if self.result_ok {
7871                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7872                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
7873                         } }
7874                 } else {
7875                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
7876                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7877                         } }
7878                 }
7879         }
7880 }
7881 #[no_mangle]
7882 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
7883 /// but with all dynamically-allocated buffers duplicated in new buffers.
7884 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
7885 #[repr(C)]
7886 /// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not
7887 pub enum COption_UtxoLookupZ {
7888         /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup
7889         Some(crate::lightning::routing::utxo::UtxoLookup),
7890         /// When we're in this state, this COption_UtxoLookupZ contains nothing
7891         None
7892 }
7893 impl COption_UtxoLookupZ {
7894         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7895                 if let Self::None = self { false } else { true }
7896         }
7897         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7898                 !self.is_some()
7899         }
7900         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup {
7901                 if let Self::Some(v) = self { v } else { unreachable!() }
7902         }
7903 }
7904 #[no_mangle]
7905 /// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup
7906 pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ {
7907         COption_UtxoLookupZ::Some(o)
7908 }
7909 #[no_mangle]
7910 /// Constructs a new COption_UtxoLookupZ containing nothing
7911 pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ {
7912         COption_UtxoLookupZ::None
7913 }
7914 #[no_mangle]
7915 /// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state
7916 pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { }
7917 #[repr(C)]
7918 /// The contents of CResult_NoneLightningErrorZ
7919 pub union CResult_NoneLightningErrorZPtr {
7920         /// Note that this value is always NULL, as there are no contents in the OK variant
7921         pub result: *mut core::ffi::c_void,
7922         /// A pointer to the contents in the error state.
7923         /// Reading from this pointer when `result_ok` is set is undefined.
7924         pub err: *mut crate::lightning::ln::msgs::LightningError,
7925 }
7926 #[repr(C)]
7927 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
7928 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
7929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7930 pub struct CResult_NoneLightningErrorZ {
7931         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
7932         /// `err` or `result` depending on the state of `result_ok`.
7933         pub contents: CResult_NoneLightningErrorZPtr,
7934         /// Whether this CResult_NoneLightningErrorZ represents a success state.
7935         pub result_ok: bool,
7936 }
7937 #[no_mangle]
7938 /// Creates a new CResult_NoneLightningErrorZ in the success state.
7939 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
7940         CResult_NoneLightningErrorZ {
7941                 contents: CResult_NoneLightningErrorZPtr {
7942                         result: core::ptr::null_mut(),
7943                 },
7944                 result_ok: true,
7945         }
7946 }
7947 #[no_mangle]
7948 /// Creates a new CResult_NoneLightningErrorZ in the error state.
7949 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
7950         CResult_NoneLightningErrorZ {
7951                 contents: CResult_NoneLightningErrorZPtr {
7952                         err: Box::into_raw(Box::new(e)),
7953                 },
7954                 result_ok: false,
7955         }
7956 }
7957 /// Checks if the given object is currently in the success state
7958 #[no_mangle]
7959 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
7960         o.result_ok
7961 }
7962 #[no_mangle]
7963 /// Frees any resources used by the CResult_NoneLightningErrorZ.
7964 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
7965 impl Drop for CResult_NoneLightningErrorZ {
7966         fn drop(&mut self) {
7967                 if self.result_ok {
7968                 } else {
7969                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7970                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7971                         }
7972                 }
7973         }
7974 }
7975 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
7976         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
7977                 let contents = if o.result_ok {
7978                         let _ = unsafe { Box::from_raw(o.contents.result) };
7979                         o.contents.result = core::ptr::null_mut();
7980                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
7981                 } else {
7982                         let err = unsafe { o.contents.err };
7983                         unsafe { o.contents.err = core::ptr::null_mut(); }
7984                         CResult_NoneLightningErrorZPtr { err }
7985                 };
7986                 Self {
7987                         contents,
7988                         result_ok: o.result_ok,
7989                 }
7990         }
7991 }
7992 impl Clone for CResult_NoneLightningErrorZ {
7993         fn clone(&self) -> Self {
7994                 if self.result_ok {
7995                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
7996                                 result: core::ptr::null_mut()
7997                         } }
7998                 } else {
7999                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
8000                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8001                         } }
8002                 }
8003         }
8004 }
8005 #[no_mangle]
8006 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8007 /// but with all dynamically-allocated buffers duplicated in new buffers.
8008 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
8009 #[repr(C)]
8010 /// The contents of CResult_boolLightningErrorZ
8011 pub union CResult_boolLightningErrorZPtr {
8012         /// A pointer to the contents in the success state.
8013         /// Reading from this pointer when `result_ok` is not set is undefined.
8014         pub result: *mut bool,
8015         /// A pointer to the contents in the error state.
8016         /// Reading from this pointer when `result_ok` is set is undefined.
8017         pub err: *mut crate::lightning::ln::msgs::LightningError,
8018 }
8019 #[repr(C)]
8020 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
8021 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8023 pub struct CResult_boolLightningErrorZ {
8024         /// The contents of this CResult_boolLightningErrorZ, accessible via either
8025         /// `err` or `result` depending on the state of `result_ok`.
8026         pub contents: CResult_boolLightningErrorZPtr,
8027         /// Whether this CResult_boolLightningErrorZ represents a success state.
8028         pub result_ok: bool,
8029 }
8030 #[no_mangle]
8031 /// Creates a new CResult_boolLightningErrorZ in the success state.
8032 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
8033         CResult_boolLightningErrorZ {
8034                 contents: CResult_boolLightningErrorZPtr {
8035                         result: Box::into_raw(Box::new(o)),
8036                 },
8037                 result_ok: true,
8038         }
8039 }
8040 #[no_mangle]
8041 /// Creates a new CResult_boolLightningErrorZ in the error state.
8042 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
8043         CResult_boolLightningErrorZ {
8044                 contents: CResult_boolLightningErrorZPtr {
8045                         err: Box::into_raw(Box::new(e)),
8046                 },
8047                 result_ok: false,
8048         }
8049 }
8050 /// Checks if the given object is currently in the success state
8051 #[no_mangle]
8052 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
8053         o.result_ok
8054 }
8055 #[no_mangle]
8056 /// Frees any resources used by the CResult_boolLightningErrorZ.
8057 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
8058 impl Drop for CResult_boolLightningErrorZ {
8059         fn drop(&mut self) {
8060                 if self.result_ok {
8061                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8062                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8063                         }
8064                 } else {
8065                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8066                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8067                         }
8068                 }
8069         }
8070 }
8071 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
8072         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
8073                 let contents = if o.result_ok {
8074                         let result = unsafe { o.contents.result };
8075                         unsafe { o.contents.result = core::ptr::null_mut() };
8076                         CResult_boolLightningErrorZPtr { result }
8077                 } else {
8078                         let err = unsafe { o.contents.err };
8079                         unsafe { o.contents.err = core::ptr::null_mut(); }
8080                         CResult_boolLightningErrorZPtr { err }
8081                 };
8082                 Self {
8083                         contents,
8084                         result_ok: o.result_ok,
8085                 }
8086         }
8087 }
8088 impl Clone for CResult_boolLightningErrorZ {
8089         fn clone(&self) -> Self {
8090                 if self.result_ok {
8091                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
8092                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
8093                         } }
8094                 } else {
8095                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
8096                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
8097                         } }
8098                 }
8099         }
8100 }
8101 #[no_mangle]
8102 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8103 /// but with all dynamically-allocated buffers duplicated in new buffers.
8104 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
8105 #[repr(C)]
8106 /// A tuple of 3 elements. See the individual fields for the types contained.
8107 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8108         /// The element at position 0
8109         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
8110         /// The element at position 1
8111         pub b: crate::lightning::ln::msgs::ChannelUpdate,
8112         /// The element at position 2
8113         pub c: crate::lightning::ln::msgs::ChannelUpdate,
8114 }
8115 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8116         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
8117                 Self {
8118                         a: tup.0,
8119                         b: tup.1,
8120                         c: tup.2,
8121                 }
8122         }
8123 }
8124 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8125         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
8126                 (self.a, self.b, self.c)
8127         }
8128 }
8129 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8130         fn clone(&self) -> Self {
8131                 Self {
8132                         a: Clone::clone(&self.a),
8133                         b: Clone::clone(&self.b),
8134                         c: Clone::clone(&self.c),
8135                 }
8136         }
8137 }
8138 #[no_mangle]
8139 /// Creates a new tuple which has the same data as `orig`
8140 /// but with all dynamically-allocated buffers duplicated in new buffers.
8141 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
8142 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8143 #[no_mangle]
8144 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 {
8145         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
8146 }
8147
8148 #[no_mangle]
8149 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8150 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
8151 #[repr(C)]
8152 #[derive(Clone)]
8153 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
8154 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8155         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
8156         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
8157         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
8158         None
8159 }
8160 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8161         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8162                 if let Self::None = self { false } else { true }
8163         }
8164         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8165                 !self.is_some()
8166         }
8167         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8168                 if let Self::Some(v) = self { v } else { unreachable!() }
8169         }
8170 }
8171 #[no_mangle]
8172 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
8173 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8174         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
8175 }
8176 #[no_mangle]
8177 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
8178 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8179         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
8180 }
8181 #[no_mangle]
8182 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
8183 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
8184 #[no_mangle]
8185 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
8186 /// but with all dynamically-allocated buffers duplicated in new buffers.
8187 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
8188 #[repr(C)]
8189 /// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
8190 /// This corresponds to std::vector in C++
8191 pub struct CVec_MessageSendEventZ {
8192         /// The elements in the array.
8193         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8194         pub data: *mut crate::lightning::events::MessageSendEvent,
8195         /// The number of elements pointed to by `data`.
8196         pub datalen: usize
8197 }
8198 impl CVec_MessageSendEventZ {
8199         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::MessageSendEvent> {
8200                 if self.datalen == 0 { return Vec::new(); }
8201                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8202                 self.data = core::ptr::null_mut();
8203                 self.datalen = 0;
8204                 ret
8205         }
8206         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::MessageSendEvent] {
8207                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8208         }
8209 }
8210 impl From<Vec<crate::lightning::events::MessageSendEvent>> for CVec_MessageSendEventZ {
8211         fn from(v: Vec<crate::lightning::events::MessageSendEvent>) -> Self {
8212                 let datalen = v.len();
8213                 let data = Box::into_raw(v.into_boxed_slice());
8214                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8215         }
8216 }
8217 #[no_mangle]
8218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8219 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
8220 impl Drop for CVec_MessageSendEventZ {
8221         fn drop(&mut self) {
8222                 if self.datalen == 0 { return; }
8223                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8224         }
8225 }
8226 impl Clone for CVec_MessageSendEventZ {
8227         fn clone(&self) -> Self {
8228                 let mut res = Vec::new();
8229                 if self.datalen == 0 { return Self::from(res); }
8230                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8231                 Self::from(res)
8232         }
8233 }
8234 #[repr(C)]
8235 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8236 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
8237         /// A pointer to the contents in the success state.
8238         /// Reading from this pointer when `result_ok` is not set is undefined.
8239         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
8240         /// A pointer to the contents in the error state.
8241         /// Reading from this pointer when `result_ok` is set is undefined.
8242         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8243 }
8244 #[repr(C)]
8245 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8246 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8248 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
8249         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8250         /// `err` or `result` depending on the state of `result_ok`.
8251         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
8252         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8253         pub result_ok: bool,
8254 }
8255 #[no_mangle]
8256 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
8257 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8258         CResult_ChannelUpdateInfoDecodeErrorZ {
8259                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8260                         result: Box::into_raw(Box::new(o)),
8261                 },
8262                 result_ok: true,
8263         }
8264 }
8265 #[no_mangle]
8266 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
8267 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
8268         CResult_ChannelUpdateInfoDecodeErrorZ {
8269                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8270                         err: Box::into_raw(Box::new(e)),
8271                 },
8272                 result_ok: false,
8273         }
8274 }
8275 /// Checks if the given object is currently in the success state
8276 #[no_mangle]
8277 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
8278         o.result_ok
8279 }
8280 #[no_mangle]
8281 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
8282 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
8283 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
8284         fn drop(&mut self) {
8285                 if self.result_ok {
8286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8288                         }
8289                 } else {
8290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8292                         }
8293                 }
8294         }
8295 }
8296 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
8297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8298                 let contents = if o.result_ok {
8299                         let result = unsafe { o.contents.result };
8300                         unsafe { o.contents.result = core::ptr::null_mut() };
8301                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
8302                 } else {
8303                         let err = unsafe { o.contents.err };
8304                         unsafe { o.contents.err = core::ptr::null_mut(); }
8305                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
8306                 };
8307                 Self {
8308                         contents,
8309                         result_ok: o.result_ok,
8310                 }
8311         }
8312 }
8313 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
8314         fn clone(&self) -> Self {
8315                 if self.result_ok {
8316                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8317                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
8318                         } }
8319                 } else {
8320                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
8321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8322                         } }
8323                 }
8324         }
8325 }
8326 #[no_mangle]
8327 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
8328 /// but with all dynamically-allocated buffers duplicated in new buffers.
8329 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
8330 #[repr(C)]
8331 /// The contents of CResult_ChannelInfoDecodeErrorZ
8332 pub union CResult_ChannelInfoDecodeErrorZPtr {
8333         /// A pointer to the contents in the success state.
8334         /// Reading from this pointer when `result_ok` is not set is undefined.
8335         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
8336         /// A pointer to the contents in the error state.
8337         /// Reading from this pointer when `result_ok` is set is undefined.
8338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8339 }
8340 #[repr(C)]
8341 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8342 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8344 pub struct CResult_ChannelInfoDecodeErrorZ {
8345         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8346         /// `err` or `result` depending on the state of `result_ok`.
8347         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
8348         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8349         pub result_ok: bool,
8350 }
8351 #[no_mangle]
8352 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8353 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
8354         CResult_ChannelInfoDecodeErrorZ {
8355                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8356                         result: Box::into_raw(Box::new(o)),
8357                 },
8358                 result_ok: true,
8359         }
8360 }
8361 #[no_mangle]
8362 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8363 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
8364         CResult_ChannelInfoDecodeErrorZ {
8365                 contents: CResult_ChannelInfoDecodeErrorZPtr {
8366                         err: Box::into_raw(Box::new(e)),
8367                 },
8368                 result_ok: false,
8369         }
8370 }
8371 /// Checks if the given object is currently in the success state
8372 #[no_mangle]
8373 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
8374         o.result_ok
8375 }
8376 #[no_mangle]
8377 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8378 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
8379 impl Drop for CResult_ChannelInfoDecodeErrorZ {
8380         fn drop(&mut self) {
8381                 if self.result_ok {
8382                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8383                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8384                         }
8385                 } else {
8386                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8387                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8388                         }
8389                 }
8390         }
8391 }
8392 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
8393         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8394                 let contents = if o.result_ok {
8395                         let result = unsafe { o.contents.result };
8396                         unsafe { o.contents.result = core::ptr::null_mut() };
8397                         CResult_ChannelInfoDecodeErrorZPtr { result }
8398                 } else {
8399                         let err = unsafe { o.contents.err };
8400                         unsafe { o.contents.err = core::ptr::null_mut(); }
8401                         CResult_ChannelInfoDecodeErrorZPtr { err }
8402                 };
8403                 Self {
8404                         contents,
8405                         result_ok: o.result_ok,
8406                 }
8407         }
8408 }
8409 impl Clone for CResult_ChannelInfoDecodeErrorZ {
8410         fn clone(&self) -> Self {
8411                 if self.result_ok {
8412                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
8413                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
8414                         } }
8415                 } else {
8416                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
8417                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8418                         } }
8419                 }
8420         }
8421 }
8422 #[no_mangle]
8423 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8424 /// but with all dynamically-allocated buffers duplicated in new buffers.
8425 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
8426 #[repr(C)]
8427 /// The contents of CResult_RoutingFeesDecodeErrorZ
8428 pub union CResult_RoutingFeesDecodeErrorZPtr {
8429         /// A pointer to the contents in the success state.
8430         /// Reading from this pointer when `result_ok` is not set is undefined.
8431         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
8432         /// A pointer to the contents in the error state.
8433         /// Reading from this pointer when `result_ok` is set is undefined.
8434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8435 }
8436 #[repr(C)]
8437 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8438 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8440 pub struct CResult_RoutingFeesDecodeErrorZ {
8441         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8442         /// `err` or `result` depending on the state of `result_ok`.
8443         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
8444         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8445         pub result_ok: bool,
8446 }
8447 #[no_mangle]
8448 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8449 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
8450         CResult_RoutingFeesDecodeErrorZ {
8451                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8452                         result: Box::into_raw(Box::new(o)),
8453                 },
8454                 result_ok: true,
8455         }
8456 }
8457 #[no_mangle]
8458 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8459 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
8460         CResult_RoutingFeesDecodeErrorZ {
8461                 contents: CResult_RoutingFeesDecodeErrorZPtr {
8462                         err: Box::into_raw(Box::new(e)),
8463                 },
8464                 result_ok: false,
8465         }
8466 }
8467 /// Checks if the given object is currently in the success state
8468 #[no_mangle]
8469 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
8470         o.result_ok
8471 }
8472 #[no_mangle]
8473 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8474 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
8475 impl Drop for CResult_RoutingFeesDecodeErrorZ {
8476         fn drop(&mut self) {
8477                 if self.result_ok {
8478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8480                         }
8481                 } else {
8482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8484                         }
8485                 }
8486         }
8487 }
8488 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
8489         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
8490                 let contents = if o.result_ok {
8491                         let result = unsafe { o.contents.result };
8492                         unsafe { o.contents.result = core::ptr::null_mut() };
8493                         CResult_RoutingFeesDecodeErrorZPtr { result }
8494                 } else {
8495                         let err = unsafe { o.contents.err };
8496                         unsafe { o.contents.err = core::ptr::null_mut(); }
8497                         CResult_RoutingFeesDecodeErrorZPtr { err }
8498                 };
8499                 Self {
8500                         contents,
8501                         result_ok: o.result_ok,
8502                 }
8503         }
8504 }
8505 impl Clone for CResult_RoutingFeesDecodeErrorZ {
8506         fn clone(&self) -> Self {
8507                 if self.result_ok {
8508                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
8509                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
8510                         } }
8511                 } else {
8512                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
8513                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8514                         } }
8515                 }
8516         }
8517 }
8518 #[no_mangle]
8519 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8520 /// but with all dynamically-allocated buffers duplicated in new buffers.
8521 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
8522 #[repr(C)]
8523 /// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size.
8524 /// This corresponds to std::vector in C++
8525 pub struct CVec_SocketAddressZ {
8526         /// The elements in the array.
8527         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8528         pub data: *mut crate::lightning::ln::msgs::SocketAddress,
8529         /// The number of elements pointed to by `data`.
8530         pub datalen: usize
8531 }
8532 impl CVec_SocketAddressZ {
8533         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::SocketAddress> {
8534                 if self.datalen == 0 { return Vec::new(); }
8535                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8536                 self.data = core::ptr::null_mut();
8537                 self.datalen = 0;
8538                 ret
8539         }
8540         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] {
8541                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8542         }
8543 }
8544 impl From<Vec<crate::lightning::ln::msgs::SocketAddress>> for CVec_SocketAddressZ {
8545         fn from(v: Vec<crate::lightning::ln::msgs::SocketAddress>) -> Self {
8546                 let datalen = v.len();
8547                 let data = Box::into_raw(v.into_boxed_slice());
8548                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8549         }
8550 }
8551 #[no_mangle]
8552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8553 pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { }
8554 impl Drop for CVec_SocketAddressZ {
8555         fn drop(&mut self) {
8556                 if self.datalen == 0 { return; }
8557                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8558         }
8559 }
8560 impl Clone for CVec_SocketAddressZ {
8561         fn clone(&self) -> Self {
8562                 let mut res = Vec::new();
8563                 if self.datalen == 0 { return Self::from(res); }
8564                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8565                 Self::from(res)
8566         }
8567 }
8568 #[repr(C)]
8569 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8570 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8571         /// A pointer to the contents in the success state.
8572         /// Reading from this pointer when `result_ok` is not set is undefined.
8573         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
8574         /// A pointer to the contents in the error state.
8575         /// Reading from this pointer when `result_ok` is set is undefined.
8576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8577 }
8578 #[repr(C)]
8579 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8580 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8582 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
8583         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8584         /// `err` or `result` depending on the state of `result_ok`.
8585         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
8586         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8587         pub result_ok: bool,
8588 }
8589 #[no_mangle]
8590 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8591 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8592         CResult_NodeAnnouncementInfoDecodeErrorZ {
8593                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8594                         result: Box::into_raw(Box::new(o)),
8595                 },
8596                 result_ok: true,
8597         }
8598 }
8599 #[no_mangle]
8600 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8601 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
8602         CResult_NodeAnnouncementInfoDecodeErrorZ {
8603                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8604                         err: Box::into_raw(Box::new(e)),
8605                 },
8606                 result_ok: false,
8607         }
8608 }
8609 /// Checks if the given object is currently in the success state
8610 #[no_mangle]
8611 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
8612         o.result_ok
8613 }
8614 #[no_mangle]
8615 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8616 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
8617 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
8618         fn drop(&mut self) {
8619                 if self.result_ok {
8620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8622                         }
8623                 } else {
8624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8626                         }
8627                 }
8628         }
8629 }
8630 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
8631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8632                 let contents = if o.result_ok {
8633                         let result = unsafe { o.contents.result };
8634                         unsafe { o.contents.result = core::ptr::null_mut() };
8635                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
8636                 } else {
8637                         let err = unsafe { o.contents.err };
8638                         unsafe { o.contents.err = core::ptr::null_mut(); }
8639                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
8640                 };
8641                 Self {
8642                         contents,
8643                         result_ok: o.result_ok,
8644                 }
8645         }
8646 }
8647 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
8648         fn clone(&self) -> Self {
8649                 if self.result_ok {
8650                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8651                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
8652                         } }
8653                 } else {
8654                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
8655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8656                         } }
8657                 }
8658         }
8659 }
8660 #[no_mangle]
8661 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8662 /// but with all dynamically-allocated buffers duplicated in new buffers.
8663 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
8664 #[repr(C)]
8665 /// The contents of CResult_NodeAliasDecodeErrorZ
8666 pub union CResult_NodeAliasDecodeErrorZPtr {
8667         /// A pointer to the contents in the success state.
8668         /// Reading from this pointer when `result_ok` is not set is undefined.
8669         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
8670         /// A pointer to the contents in the error state.
8671         /// Reading from this pointer when `result_ok` is set is undefined.
8672         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8673 }
8674 #[repr(C)]
8675 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
8676 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
8677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8678 pub struct CResult_NodeAliasDecodeErrorZ {
8679         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
8680         /// `err` or `result` depending on the state of `result_ok`.
8681         pub contents: CResult_NodeAliasDecodeErrorZPtr,
8682         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
8683         pub result_ok: bool,
8684 }
8685 #[no_mangle]
8686 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
8687 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
8688         CResult_NodeAliasDecodeErrorZ {
8689                 contents: CResult_NodeAliasDecodeErrorZPtr {
8690                         result: Box::into_raw(Box::new(o)),
8691                 },
8692                 result_ok: true,
8693         }
8694 }
8695 #[no_mangle]
8696 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
8697 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
8698         CResult_NodeAliasDecodeErrorZ {
8699                 contents: CResult_NodeAliasDecodeErrorZPtr {
8700                         err: Box::into_raw(Box::new(e)),
8701                 },
8702                 result_ok: false,
8703         }
8704 }
8705 /// Checks if the given object is currently in the success state
8706 #[no_mangle]
8707 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
8708         o.result_ok
8709 }
8710 #[no_mangle]
8711 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
8712 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
8713 impl Drop for CResult_NodeAliasDecodeErrorZ {
8714         fn drop(&mut self) {
8715                 if self.result_ok {
8716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8718                         }
8719                 } else {
8720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8722                         }
8723                 }
8724         }
8725 }
8726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
8727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
8728                 let contents = if o.result_ok {
8729                         let result = unsafe { o.contents.result };
8730                         unsafe { o.contents.result = core::ptr::null_mut() };
8731                         CResult_NodeAliasDecodeErrorZPtr { result }
8732                 } else {
8733                         let err = unsafe { o.contents.err };
8734                         unsafe { o.contents.err = core::ptr::null_mut(); }
8735                         CResult_NodeAliasDecodeErrorZPtr { err }
8736                 };
8737                 Self {
8738                         contents,
8739                         result_ok: o.result_ok,
8740                 }
8741         }
8742 }
8743 impl Clone for CResult_NodeAliasDecodeErrorZ {
8744         fn clone(&self) -> Self {
8745                 if self.result_ok {
8746                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
8747                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
8748                         } }
8749                 } else {
8750                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
8751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8752                         } }
8753                 }
8754         }
8755 }
8756 #[no_mangle]
8757 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
8758 /// but with all dynamically-allocated buffers duplicated in new buffers.
8759 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
8760 #[repr(C)]
8761 /// The contents of CResult_NodeInfoDecodeErrorZ
8762 pub union CResult_NodeInfoDecodeErrorZPtr {
8763         /// A pointer to the contents in the success state.
8764         /// Reading from this pointer when `result_ok` is not set is undefined.
8765         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
8766         /// A pointer to the contents in the error state.
8767         /// Reading from this pointer when `result_ok` is set is undefined.
8768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8769 }
8770 #[repr(C)]
8771 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8772 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8774 pub struct CResult_NodeInfoDecodeErrorZ {
8775         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8776         /// `err` or `result` depending on the state of `result_ok`.
8777         pub contents: CResult_NodeInfoDecodeErrorZPtr,
8778         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8779         pub result_ok: bool,
8780 }
8781 #[no_mangle]
8782 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8783 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
8784         CResult_NodeInfoDecodeErrorZ {
8785                 contents: CResult_NodeInfoDecodeErrorZPtr {
8786                         result: Box::into_raw(Box::new(o)),
8787                 },
8788                 result_ok: true,
8789         }
8790 }
8791 #[no_mangle]
8792 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8793 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
8794         CResult_NodeInfoDecodeErrorZ {
8795                 contents: CResult_NodeInfoDecodeErrorZPtr {
8796                         err: Box::into_raw(Box::new(e)),
8797                 },
8798                 result_ok: false,
8799         }
8800 }
8801 /// Checks if the given object is currently in the success state
8802 #[no_mangle]
8803 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
8804         o.result_ok
8805 }
8806 #[no_mangle]
8807 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8808 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
8809 impl Drop for CResult_NodeInfoDecodeErrorZ {
8810         fn drop(&mut self) {
8811                 if self.result_ok {
8812                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8813                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8814                         }
8815                 } else {
8816                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8817                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8818                         }
8819                 }
8820         }
8821 }
8822 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
8823         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8824                 let contents = if o.result_ok {
8825                         let result = unsafe { o.contents.result };
8826                         unsafe { o.contents.result = core::ptr::null_mut() };
8827                         CResult_NodeInfoDecodeErrorZPtr { result }
8828                 } else {
8829                         let err = unsafe { o.contents.err };
8830                         unsafe { o.contents.err = core::ptr::null_mut(); }
8831                         CResult_NodeInfoDecodeErrorZPtr { err }
8832                 };
8833                 Self {
8834                         contents,
8835                         result_ok: o.result_ok,
8836                 }
8837         }
8838 }
8839 impl Clone for CResult_NodeInfoDecodeErrorZ {
8840         fn clone(&self) -> Self {
8841                 if self.result_ok {
8842                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
8843                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
8844                         } }
8845                 } else {
8846                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
8847                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8848                         } }
8849                 }
8850         }
8851 }
8852 #[no_mangle]
8853 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8854 /// but with all dynamically-allocated buffers duplicated in new buffers.
8855 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
8856 #[repr(C)]
8857 /// The contents of CResult_NetworkGraphDecodeErrorZ
8858 pub union CResult_NetworkGraphDecodeErrorZPtr {
8859         /// A pointer to the contents in the success state.
8860         /// Reading from this pointer when `result_ok` is not set is undefined.
8861         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
8862         /// A pointer to the contents in the error state.
8863         /// Reading from this pointer when `result_ok` is set is undefined.
8864         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8865 }
8866 #[repr(C)]
8867 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8868 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8870 pub struct CResult_NetworkGraphDecodeErrorZ {
8871         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8872         /// `err` or `result` depending on the state of `result_ok`.
8873         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
8874         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8875         pub result_ok: bool,
8876 }
8877 #[no_mangle]
8878 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8879 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
8880         CResult_NetworkGraphDecodeErrorZ {
8881                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8882                         result: Box::into_raw(Box::new(o)),
8883                 },
8884                 result_ok: true,
8885         }
8886 }
8887 #[no_mangle]
8888 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8889 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
8890         CResult_NetworkGraphDecodeErrorZ {
8891                 contents: CResult_NetworkGraphDecodeErrorZPtr {
8892                         err: Box::into_raw(Box::new(e)),
8893                 },
8894                 result_ok: false,
8895         }
8896 }
8897 /// Checks if the given object is currently in the success state
8898 #[no_mangle]
8899 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
8900         o.result_ok
8901 }
8902 #[no_mangle]
8903 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8904 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
8905 impl Drop for CResult_NetworkGraphDecodeErrorZ {
8906         fn drop(&mut self) {
8907                 if self.result_ok {
8908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8910                         }
8911                 } else {
8912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8914                         }
8915                 }
8916         }
8917 }
8918 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
8919         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
8920                 let contents = if o.result_ok {
8921                         let result = unsafe { o.contents.result };
8922                         unsafe { o.contents.result = core::ptr::null_mut() };
8923                         CResult_NetworkGraphDecodeErrorZPtr { result }
8924                 } else {
8925                         let err = unsafe { o.contents.err };
8926                         unsafe { o.contents.err = core::ptr::null_mut(); }
8927                         CResult_NetworkGraphDecodeErrorZPtr { err }
8928                 };
8929                 Self {
8930                         contents,
8931                         result_ok: o.result_ok,
8932                 }
8933         }
8934 }
8935 #[repr(C)]
8936 #[derive(Clone)]
8937 /// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not
8938 pub enum COption_CVec_SocketAddressZZ {
8939         /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ
8940         Some(crate::c_types::derived::CVec_SocketAddressZ),
8941         /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing
8942         None
8943 }
8944 impl COption_CVec_SocketAddressZZ {
8945         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8946                 if let Self::None = self { false } else { true }
8947         }
8948         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8949                 !self.is_some()
8950         }
8951         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_SocketAddressZ {
8952                 if let Self::Some(v) = self { v } else { unreachable!() }
8953         }
8954 }
8955 #[no_mangle]
8956 /// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ
8957 pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ {
8958         COption_CVec_SocketAddressZZ::Some(o)
8959 }
8960 #[no_mangle]
8961 /// Constructs a new COption_CVec_SocketAddressZZ containing nothing
8962 pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ {
8963         COption_CVec_SocketAddressZZ::None
8964 }
8965 #[no_mangle]
8966 /// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state
8967 pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { }
8968 #[no_mangle]
8969 /// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig`
8970 /// but with all dynamically-allocated buffers duplicated in new buffers.
8971 pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) }
8972 #[repr(C)]
8973 /// The contents of CResult_u64ShortChannelIdErrorZ
8974 pub union CResult_u64ShortChannelIdErrorZPtr {
8975         /// A pointer to the contents in the success state.
8976         /// Reading from this pointer when `result_ok` is not set is undefined.
8977         pub result: *mut u64,
8978         /// A pointer to the contents in the error state.
8979         /// Reading from this pointer when `result_ok` is set is undefined.
8980         pub err: *mut crate::lightning::util::scid_utils::ShortChannelIdError,
8981 }
8982 #[repr(C)]
8983 /// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation,
8984 /// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure.
8985 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8986 pub struct CResult_u64ShortChannelIdErrorZ {
8987         /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either
8988         /// `err` or `result` depending on the state of `result_ok`.
8989         pub contents: CResult_u64ShortChannelIdErrorZPtr,
8990         /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state.
8991         pub result_ok: bool,
8992 }
8993 #[no_mangle]
8994 /// Creates a new CResult_u64ShortChannelIdErrorZ in the success state.
8995 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ {
8996         CResult_u64ShortChannelIdErrorZ {
8997                 contents: CResult_u64ShortChannelIdErrorZPtr {
8998                         result: Box::into_raw(Box::new(o)),
8999                 },
9000                 result_ok: true,
9001         }
9002 }
9003 #[no_mangle]
9004 /// Creates a new CResult_u64ShortChannelIdErrorZ in the error state.
9005 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ {
9006         CResult_u64ShortChannelIdErrorZ {
9007                 contents: CResult_u64ShortChannelIdErrorZPtr {
9008                         err: Box::into_raw(Box::new(e)),
9009                 },
9010                 result_ok: false,
9011         }
9012 }
9013 /// Checks if the given object is currently in the success state
9014 #[no_mangle]
9015 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool {
9016         o.result_ok
9017 }
9018 #[no_mangle]
9019 /// Frees any resources used by the CResult_u64ShortChannelIdErrorZ.
9020 pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { }
9021 impl Drop for CResult_u64ShortChannelIdErrorZ {
9022         fn drop(&mut self) {
9023                 if self.result_ok {
9024                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9025                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9026                         }
9027                 } else {
9028                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9029                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9030                         }
9031                 }
9032         }
9033 }
9034 impl From<crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>> for CResult_u64ShortChannelIdErrorZ {
9035         fn from(mut o: crate::c_types::CResultTempl<u64, crate::lightning::util::scid_utils::ShortChannelIdError>) -> Self {
9036                 let contents = if o.result_ok {
9037                         let result = unsafe { o.contents.result };
9038                         unsafe { o.contents.result = core::ptr::null_mut() };
9039                         CResult_u64ShortChannelIdErrorZPtr { result }
9040                 } else {
9041                         let err = unsafe { o.contents.err };
9042                         unsafe { o.contents.err = core::ptr::null_mut(); }
9043                         CResult_u64ShortChannelIdErrorZPtr { err }
9044                 };
9045                 Self {
9046                         contents,
9047                         result_ok: o.result_ok,
9048                 }
9049         }
9050 }
9051 #[repr(C)]
9052 /// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ
9053 pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9054         /// A pointer to the contents in the success state.
9055         /// Reading from this pointer when `result_ok` is not set is undefined.
9056         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
9057         /// A pointer to the contents in the error state.
9058         /// Reading from this pointer when `result_ok` is set is undefined.
9059         pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr,
9060 }
9061 #[repr(C)]
9062 /// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation,
9063 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure.
9064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9065 pub struct CResult_PendingHTLCInfoInboundHTLCErrZ {
9066         /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either
9067         /// `err` or `result` depending on the state of `result_ok`.
9068         pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr,
9069         /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state.
9070         pub result_ok: bool,
9071 }
9072 #[no_mangle]
9073 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state.
9074 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
9075         CResult_PendingHTLCInfoInboundHTLCErrZ {
9076                 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9077                         result: Box::into_raw(Box::new(o)),
9078                 },
9079                 result_ok: true,
9080         }
9081 }
9082 #[no_mangle]
9083 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state.
9084 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ {
9085         CResult_PendingHTLCInfoInboundHTLCErrZ {
9086                 contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9087                         err: Box::into_raw(Box::new(e)),
9088                 },
9089                 result_ok: false,
9090         }
9091 }
9092 /// Checks if the given object is currently in the success state
9093 #[no_mangle]
9094 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool {
9095         o.result_ok
9096 }
9097 #[no_mangle]
9098 /// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ.
9099 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { }
9100 impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ {
9101         fn drop(&mut self) {
9102                 if self.result_ok {
9103                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9104                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9105                         }
9106                 } else {
9107                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9108                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9109                         }
9110                 }
9111         }
9112 }
9113 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>> for CResult_PendingHTLCInfoInboundHTLCErrZ {
9114         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::onion_payment::InboundHTLCErr>) -> Self {
9115                 let contents = if o.result_ok {
9116                         let result = unsafe { o.contents.result };
9117                         unsafe { o.contents.result = core::ptr::null_mut() };
9118                         CResult_PendingHTLCInfoInboundHTLCErrZPtr { result }
9119                 } else {
9120                         let err = unsafe { o.contents.err };
9121                         unsafe { o.contents.err = core::ptr::null_mut(); }
9122                         CResult_PendingHTLCInfoInboundHTLCErrZPtr { err }
9123                 };
9124                 Self {
9125                         contents,
9126                         result_ok: o.result_ok,
9127                 }
9128         }
9129 }
9130 impl Clone for CResult_PendingHTLCInfoInboundHTLCErrZ {
9131         fn clone(&self) -> Self {
9132                 if self.result_ok {
9133                         Self { result_ok: true, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9134                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
9135                         } }
9136                 } else {
9137                         Self { result_ok: false, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr {
9138                                 err: Box::into_raw(Box::new(<crate::lightning::ln::onion_payment::InboundHTLCErr>::clone(unsafe { &*self.contents.err })))
9139                         } }
9140                 }
9141         }
9142 }
9143 #[no_mangle]
9144 /// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig`
9145 /// but with all dynamically-allocated buffers duplicated in new buffers.
9146 pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> CResult_PendingHTLCInfoInboundHTLCErrZ { Clone::clone(&orig) }
9147 #[repr(C)]
9148 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size.
9149 /// This corresponds to std::vector in C++
9150 pub struct CVec_HTLCOutputInCommitmentZ {
9151         /// The elements in the array.
9152         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9153         pub data: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
9154         /// The number of elements pointed to by `data`.
9155         pub datalen: usize
9156 }
9157 impl CVec_HTLCOutputInCommitmentZ {
9158         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment> {
9159                 if self.datalen == 0 { return Vec::new(); }
9160                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9161                 self.data = core::ptr::null_mut();
9162                 self.datalen = 0;
9163                 ret
9164         }
9165         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] {
9166                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9167         }
9168 }
9169 impl From<Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>> for CVec_HTLCOutputInCommitmentZ {
9170         fn from(v: Vec<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>) -> Self {
9171                 let datalen = v.len();
9172                 let data = Box::into_raw(v.into_boxed_slice());
9173                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9174         }
9175 }
9176 #[no_mangle]
9177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9178 pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { }
9179 impl Drop for CVec_HTLCOutputInCommitmentZ {
9180         fn drop(&mut self) {
9181                 if self.datalen == 0 { return; }
9182                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9183         }
9184 }
9185 impl Clone for CVec_HTLCOutputInCommitmentZ {
9186         fn clone(&self) -> Self {
9187                 let mut res = Vec::new();
9188                 if self.datalen == 0 { return Self::from(res); }
9189                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9190                 Self::from(res)
9191         }
9192 }
9193 #[repr(C)]
9194 /// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size.
9195 /// This corresponds to std::vector in C++
9196 pub struct CVec_HTLCDescriptorZ {
9197         /// The elements in the array.
9198         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9199         pub data: *mut crate::lightning::sign::HTLCDescriptor,
9200         /// The number of elements pointed to by `data`.
9201         pub datalen: usize
9202 }
9203 impl CVec_HTLCDescriptorZ {
9204         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::sign::HTLCDescriptor> {
9205                 if self.datalen == 0 { return Vec::new(); }
9206                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9207                 self.data = core::ptr::null_mut();
9208                 self.datalen = 0;
9209                 ret
9210         }
9211         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::HTLCDescriptor] {
9212                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9213         }
9214 }
9215 impl From<Vec<crate::lightning::sign::HTLCDescriptor>> for CVec_HTLCDescriptorZ {
9216         fn from(v: Vec<crate::lightning::sign::HTLCDescriptor>) -> Self {
9217                 let datalen = v.len();
9218                 let data = Box::into_raw(v.into_boxed_slice());
9219                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9220         }
9221 }
9222 #[no_mangle]
9223 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9224 pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { }
9225 impl Drop for CVec_HTLCDescriptorZ {
9226         fn drop(&mut self) {
9227                 if self.datalen == 0 { return; }
9228                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9229         }
9230 }
9231 impl Clone for CVec_HTLCDescriptorZ {
9232         fn clone(&self) -> Self {
9233                 let mut res = Vec::new();
9234                 if self.datalen == 0 { return Self::from(res); }
9235                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9236                 Self::from(res)
9237         }
9238 }
9239 #[repr(C)]
9240 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size.
9241 /// This corresponds to std::vector in C++
9242 pub struct CVec_UtxoZ {
9243         /// The elements in the array.
9244         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9245         pub data: *mut crate::lightning::events::bump_transaction::Utxo,
9246         /// The number of elements pointed to by `data`.
9247         pub datalen: usize
9248 }
9249 impl CVec_UtxoZ {
9250         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Utxo> {
9251                 if self.datalen == 0 { return Vec::new(); }
9252                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9253                 self.data = core::ptr::null_mut();
9254                 self.datalen = 0;
9255                 ret
9256         }
9257         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Utxo] {
9258                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9259         }
9260 }
9261 impl From<Vec<crate::lightning::events::bump_transaction::Utxo>> for CVec_UtxoZ {
9262         fn from(v: Vec<crate::lightning::events::bump_transaction::Utxo>) -> Self {
9263                 let datalen = v.len();
9264                 let data = Box::into_raw(v.into_boxed_slice());
9265                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9266         }
9267 }
9268 #[no_mangle]
9269 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9270 pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { }
9271 impl Drop for CVec_UtxoZ {
9272         fn drop(&mut self) {
9273                 if self.datalen == 0 { return; }
9274                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9275         }
9276 }
9277 impl Clone for CVec_UtxoZ {
9278         fn clone(&self) -> Self {
9279                 let mut res = Vec::new();
9280                 if self.datalen == 0 { return Self::from(res); }
9281                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9282                 Self::from(res)
9283         }
9284 }
9285 #[repr(C)]
9286 #[derive(Clone)]
9287 /// An enum which can either contain a crate::c_types::TxOut or not
9288 pub enum COption_TxOutZ {
9289         /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut
9290         Some(crate::c_types::TxOut),
9291         /// When we're in this state, this COption_TxOutZ contains nothing
9292         None
9293 }
9294 impl COption_TxOutZ {
9295         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9296                 if let Self::None = self { false } else { true }
9297         }
9298         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9299                 !self.is_some()
9300         }
9301         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut {
9302                 if let Self::Some(v) = self { v } else { unreachable!() }
9303         }
9304 }
9305 #[no_mangle]
9306 /// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut
9307 pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ {
9308         COption_TxOutZ::Some(o)
9309 }
9310 #[no_mangle]
9311 /// Constructs a new COption_TxOutZ containing nothing
9312 pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ {
9313         COption_TxOutZ::None
9314 }
9315 #[no_mangle]
9316 /// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state
9317 pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { }
9318 #[no_mangle]
9319 /// Creates a new COption_TxOutZ which has the same data as `orig`
9320 /// but with all dynamically-allocated buffers duplicated in new buffers.
9321 pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) }
9322 #[repr(C)]
9323 /// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size.
9324 /// This corresponds to std::vector in C++
9325 pub struct CVec_InputZ {
9326         /// The elements in the array.
9327         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9328         pub data: *mut crate::lightning::events::bump_transaction::Input,
9329         /// The number of elements pointed to by `data`.
9330         pub datalen: usize
9331 }
9332 impl CVec_InputZ {
9333         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::bump_transaction::Input> {
9334                 if self.datalen == 0 { return Vec::new(); }
9335                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9336                 self.data = core::ptr::null_mut();
9337                 self.datalen = 0;
9338                 ret
9339         }
9340         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] {
9341                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9342         }
9343 }
9344 impl From<Vec<crate::lightning::events::bump_transaction::Input>> for CVec_InputZ {
9345         fn from(v: Vec<crate::lightning::events::bump_transaction::Input>) -> Self {
9346                 let datalen = v.len();
9347                 let data = Box::into_raw(v.into_boxed_slice());
9348                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9349         }
9350 }
9351 #[no_mangle]
9352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9353 pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { }
9354 impl Drop for CVec_InputZ {
9355         fn drop(&mut self) {
9356                 if self.datalen == 0 { return; }
9357                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9358         }
9359 }
9360 impl Clone for CVec_InputZ {
9361         fn clone(&self) -> Self {
9362                 let mut res = Vec::new();
9363                 if self.datalen == 0 { return Self::from(res); }
9364                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9365                 Self::from(res)
9366         }
9367 }
9368 #[repr(C)]
9369 /// The contents of CResult_CoinSelectionNoneZ
9370 pub union CResult_CoinSelectionNoneZPtr {
9371         /// A pointer to the contents in the success state.
9372         /// Reading from this pointer when `result_ok` is not set is undefined.
9373         pub result: *mut crate::lightning::events::bump_transaction::CoinSelection,
9374         /// Note that this value is always NULL, as there are no contents in the Err variant
9375         pub err: *mut core::ffi::c_void,
9376 }
9377 #[repr(C)]
9378 /// A CResult_CoinSelectionNoneZ represents the result of a fallible operation,
9379 /// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure.
9380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9381 pub struct CResult_CoinSelectionNoneZ {
9382         /// The contents of this CResult_CoinSelectionNoneZ, accessible via either
9383         /// `err` or `result` depending on the state of `result_ok`.
9384         pub contents: CResult_CoinSelectionNoneZPtr,
9385         /// Whether this CResult_CoinSelectionNoneZ represents a success state.
9386         pub result_ok: bool,
9387 }
9388 #[no_mangle]
9389 /// Creates a new CResult_CoinSelectionNoneZ in the success state.
9390 pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ {
9391         CResult_CoinSelectionNoneZ {
9392                 contents: CResult_CoinSelectionNoneZPtr {
9393                         result: Box::into_raw(Box::new(o)),
9394                 },
9395                 result_ok: true,
9396         }
9397 }
9398 #[no_mangle]
9399 /// Creates a new CResult_CoinSelectionNoneZ in the error state.
9400 pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ {
9401         CResult_CoinSelectionNoneZ {
9402                 contents: CResult_CoinSelectionNoneZPtr {
9403                         err: core::ptr::null_mut(),
9404                 },
9405                 result_ok: false,
9406         }
9407 }
9408 /// Checks if the given object is currently in the success state
9409 #[no_mangle]
9410 pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool {
9411         o.result_ok
9412 }
9413 #[no_mangle]
9414 /// Frees any resources used by the CResult_CoinSelectionNoneZ.
9415 pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { }
9416 impl Drop for CResult_CoinSelectionNoneZ {
9417         fn drop(&mut self) {
9418                 if self.result_ok {
9419                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9420                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9421                         }
9422                 } else {
9423                 }
9424         }
9425 }
9426 impl From<crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>> for CResult_CoinSelectionNoneZ {
9427         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::bump_transaction::CoinSelection, ()>) -> Self {
9428                 let contents = if o.result_ok {
9429                         let result = unsafe { o.contents.result };
9430                         unsafe { o.contents.result = core::ptr::null_mut() };
9431                         CResult_CoinSelectionNoneZPtr { result }
9432                 } else {
9433                         let _ = unsafe { Box::from_raw(o.contents.err) };
9434                         o.contents.err = core::ptr::null_mut();
9435                         CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() }
9436                 };
9437                 Self {
9438                         contents,
9439                         result_ok: o.result_ok,
9440                 }
9441         }
9442 }
9443 impl Clone for CResult_CoinSelectionNoneZ {
9444         fn clone(&self) -> Self {
9445                 if self.result_ok {
9446                         Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr {
9447                                 result: Box::into_raw(Box::new(<crate::lightning::events::bump_transaction::CoinSelection>::clone(unsafe { &*self.contents.result })))
9448                         } }
9449                 } else {
9450                         Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr {
9451                                 err: core::ptr::null_mut()
9452                         } }
9453                 }
9454         }
9455 }
9456 #[no_mangle]
9457 /// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig`
9458 /// but with all dynamically-allocated buffers duplicated in new buffers.
9459 pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) }
9460 #[repr(C)]
9461 /// The contents of CResult_CVec_UtxoZNoneZ
9462 pub union CResult_CVec_UtxoZNoneZPtr {
9463         /// A pointer to the contents in the success state.
9464         /// Reading from this pointer when `result_ok` is not set is undefined.
9465         pub result: *mut crate::c_types::derived::CVec_UtxoZ,
9466         /// Note that this value is always NULL, as there are no contents in the Err variant
9467         pub err: *mut core::ffi::c_void,
9468 }
9469 #[repr(C)]
9470 /// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation,
9471 /// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure.
9472 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9473 pub struct CResult_CVec_UtxoZNoneZ {
9474         /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either
9475         /// `err` or `result` depending on the state of `result_ok`.
9476         pub contents: CResult_CVec_UtxoZNoneZPtr,
9477         /// Whether this CResult_CVec_UtxoZNoneZ represents a success state.
9478         pub result_ok: bool,
9479 }
9480 #[no_mangle]
9481 /// Creates a new CResult_CVec_UtxoZNoneZ in the success state.
9482 pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ {
9483         CResult_CVec_UtxoZNoneZ {
9484                 contents: CResult_CVec_UtxoZNoneZPtr {
9485                         result: Box::into_raw(Box::new(o)),
9486                 },
9487                 result_ok: true,
9488         }
9489 }
9490 #[no_mangle]
9491 /// Creates a new CResult_CVec_UtxoZNoneZ in the error state.
9492 pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ {
9493         CResult_CVec_UtxoZNoneZ {
9494                 contents: CResult_CVec_UtxoZNoneZPtr {
9495                         err: core::ptr::null_mut(),
9496                 },
9497                 result_ok: false,
9498         }
9499 }
9500 /// Checks if the given object is currently in the success state
9501 #[no_mangle]
9502 pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool {
9503         o.result_ok
9504 }
9505 #[no_mangle]
9506 /// Frees any resources used by the CResult_CVec_UtxoZNoneZ.
9507 pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { }
9508 impl Drop for CResult_CVec_UtxoZNoneZ {
9509         fn drop(&mut self) {
9510                 if self.result_ok {
9511                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9512                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9513                         }
9514                 } else {
9515                 }
9516         }
9517 }
9518 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>> for CResult_CVec_UtxoZNoneZ {
9519         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_UtxoZ, ()>) -> Self {
9520                 let contents = if o.result_ok {
9521                         let result = unsafe { o.contents.result };
9522                         unsafe { o.contents.result = core::ptr::null_mut() };
9523                         CResult_CVec_UtxoZNoneZPtr { result }
9524                 } else {
9525                         let _ = unsafe { Box::from_raw(o.contents.err) };
9526                         o.contents.err = core::ptr::null_mut();
9527                         CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() }
9528                 };
9529                 Self {
9530                         contents,
9531                         result_ok: o.result_ok,
9532                 }
9533         }
9534 }
9535 impl Clone for CResult_CVec_UtxoZNoneZ {
9536         fn clone(&self) -> Self {
9537                 if self.result_ok {
9538                         Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr {
9539                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_UtxoZ>::clone(unsafe { &*self.contents.result })))
9540                         } }
9541                 } else {
9542                         Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr {
9543                                 err: core::ptr::null_mut()
9544                         } }
9545                 }
9546         }
9547 }
9548 #[no_mangle]
9549 /// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig`
9550 /// but with all dynamically-allocated buffers duplicated in new buffers.
9551 pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) }
9552 #[repr(C)]
9553 #[derive(Clone)]
9554 /// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not
9555 pub enum COption_PaymentContextZ {
9556         /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext
9557         Some(crate::lightning::blinded_path::payment::PaymentContext),
9558         /// When we're in this state, this COption_PaymentContextZ contains nothing
9559         None
9560 }
9561 impl COption_PaymentContextZ {
9562         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9563                 if let Self::None = self { false } else { true }
9564         }
9565         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9566                 !self.is_some()
9567         }
9568         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::payment::PaymentContext {
9569                 if let Self::Some(v) = self { v } else { unreachable!() }
9570         }
9571 }
9572 #[no_mangle]
9573 /// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext
9574 pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ {
9575         COption_PaymentContextZ::Some(o)
9576 }
9577 #[no_mangle]
9578 /// Constructs a new COption_PaymentContextZ containing nothing
9579 pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ {
9580         COption_PaymentContextZ::None
9581 }
9582 #[no_mangle]
9583 /// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state
9584 pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { }
9585 #[no_mangle]
9586 /// Creates a new COption_PaymentContextZ which has the same data as `orig`
9587 /// but with all dynamically-allocated buffers duplicated in new buffers.
9588 pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) }
9589 #[repr(C)]
9590 /// A tuple of 2 elements. See the individual fields for the types contained.
9591 pub struct C2Tuple_u64u16Z {
9592         /// The element at position 0
9593         pub a: u64,
9594         /// The element at position 1
9595         pub b: u16,
9596 }
9597 impl From<(u64, u16)> for C2Tuple_u64u16Z {
9598         fn from (tup: (u64, u16)) -> Self {
9599                 Self {
9600                         a: tup.0,
9601                         b: tup.1,
9602                 }
9603         }
9604 }
9605 impl C2Tuple_u64u16Z {
9606         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) {
9607                 (self.a, self.b)
9608         }
9609 }
9610 impl Clone for C2Tuple_u64u16Z {
9611         fn clone(&self) -> Self {
9612                 Self {
9613                         a: Clone::clone(&self.a),
9614                         b: Clone::clone(&self.b),
9615                 }
9616         }
9617 }
9618 #[no_mangle]
9619 /// Creates a new tuple which has the same data as `orig`
9620 /// but with all dynamically-allocated buffers duplicated in new buffers.
9621 pub extern "C" fn C2Tuple_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) }
9622 /// Creates a new C2Tuple_u64u16Z from the contained elements.
9623 #[no_mangle]
9624 pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z {
9625         C2Tuple_u64u16Z { a, b, }
9626 }
9627
9628 #[no_mangle]
9629 /// Frees any resources used by the C2Tuple_u64u16Z.
9630 pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { }
9631 #[repr(C)]
9632 #[derive(Clone)]
9633 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not
9634 pub enum COption_C2Tuple_u64u16ZZ {
9635         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z
9636         Some(crate::c_types::derived::C2Tuple_u64u16Z),
9637         /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing
9638         None
9639 }
9640 impl COption_C2Tuple_u64u16ZZ {
9641         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9642                 if let Self::None = self { false } else { true }
9643         }
9644         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9645                 !self.is_some()
9646         }
9647         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z {
9648                 if let Self::Some(v) = self { v } else { unreachable!() }
9649         }
9650 }
9651 #[no_mangle]
9652 /// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z
9653 pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ {
9654         COption_C2Tuple_u64u16ZZ::Some(o)
9655 }
9656 #[no_mangle]
9657 /// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing
9658 pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ {
9659         COption_C2Tuple_u64u16ZZ::None
9660 }
9661 #[no_mangle]
9662 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state
9663 pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { }
9664 #[no_mangle]
9665 /// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig`
9666 /// but with all dynamically-allocated buffers duplicated in new buffers.
9667 pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) }
9668 #[repr(C)]
9669 #[derive(Clone)]
9670 /// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
9671 pub enum COption_ChannelShutdownStateZ {
9672         /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
9673         Some(crate::lightning::ln::channelmanager::ChannelShutdownState),
9674         /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
9675         None
9676 }
9677 impl COption_ChannelShutdownStateZ {
9678         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9679                 if let Self::None = self { false } else { true }
9680         }
9681         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9682                 !self.is_some()
9683         }
9684         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channelmanager::ChannelShutdownState {
9685                 if let Self::Some(v) = self { v } else { unreachable!() }
9686         }
9687 }
9688 #[no_mangle]
9689 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
9690 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
9691         COption_ChannelShutdownStateZ::Some(o)
9692 }
9693 #[no_mangle]
9694 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
9695 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
9696         COption_ChannelShutdownStateZ::None
9697 }
9698 #[no_mangle]
9699 /// Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state
9700 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
9701 #[no_mangle]
9702 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
9703 /// but with all dynamically-allocated buffers duplicated in new buffers.
9704 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
9705 #[repr(C)]
9706 /// The contents of CResult_ChannelIdAPIErrorZ
9707 pub union CResult_ChannelIdAPIErrorZPtr {
9708         /// A pointer to the contents in the success state.
9709         /// Reading from this pointer when `result_ok` is not set is undefined.
9710         pub result: *mut crate::lightning::ln::types::ChannelId,
9711         /// A pointer to the contents in the error state.
9712         /// Reading from this pointer when `result_ok` is set is undefined.
9713         pub err: *mut crate::lightning::util::errors::APIError,
9714 }
9715 #[repr(C)]
9716 /// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9717 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9719 pub struct CResult_ChannelIdAPIErrorZ {
9720         /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9721         /// `err` or `result` depending on the state of `result_ok`.
9722         pub contents: CResult_ChannelIdAPIErrorZPtr,
9723         /// Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9724         pub result_ok: bool,
9725 }
9726 #[no_mangle]
9727 /// Creates a new CResult_ChannelIdAPIErrorZ in the success state.
9728 pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ {
9729         CResult_ChannelIdAPIErrorZ {
9730                 contents: CResult_ChannelIdAPIErrorZPtr {
9731                         result: Box::into_raw(Box::new(o)),
9732                 },
9733                 result_ok: true,
9734         }
9735 }
9736 #[no_mangle]
9737 /// Creates a new CResult_ChannelIdAPIErrorZ in the error state.
9738 pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ {
9739         CResult_ChannelIdAPIErrorZ {
9740                 contents: CResult_ChannelIdAPIErrorZPtr {
9741                         err: Box::into_raw(Box::new(e)),
9742                 },
9743                 result_ok: false,
9744         }
9745 }
9746 /// Checks if the given object is currently in the success state
9747 #[no_mangle]
9748 pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool {
9749         o.result_ok
9750 }
9751 #[no_mangle]
9752 /// Frees any resources used by the CResult_ChannelIdAPIErrorZ.
9753 pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { }
9754 impl Drop for CResult_ChannelIdAPIErrorZ {
9755         fn drop(&mut self) {
9756                 if self.result_ok {
9757                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9758                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9759                         }
9760                 } else {
9761                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9762                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9763                         }
9764                 }
9765         }
9766 }
9767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>> for CResult_ChannelIdAPIErrorZ {
9768         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>) -> Self {
9769                 let contents = if o.result_ok {
9770                         let result = unsafe { o.contents.result };
9771                         unsafe { o.contents.result = core::ptr::null_mut() };
9772                         CResult_ChannelIdAPIErrorZPtr { result }
9773                 } else {
9774                         let err = unsafe { o.contents.err };
9775                         unsafe { o.contents.err = core::ptr::null_mut(); }
9776                         CResult_ChannelIdAPIErrorZPtr { err }
9777                 };
9778                 Self {
9779                         contents,
9780                         result_ok: o.result_ok,
9781                 }
9782         }
9783 }
9784 impl Clone for CResult_ChannelIdAPIErrorZ {
9785         fn clone(&self) -> Self {
9786                 if self.result_ok {
9787                         Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr {
9788                                 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
9789                         } }
9790                 } else {
9791                         Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr {
9792                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9793                         } }
9794                 }
9795         }
9796 }
9797 #[no_mangle]
9798 /// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
9799 /// but with all dynamically-allocated buffers duplicated in new buffers.
9800 pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) }
9801 #[repr(C)]
9802 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9803 /// This corresponds to std::vector in C++
9804 pub struct CVec_RecentPaymentDetailsZ {
9805         /// The elements in the array.
9806         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9807         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
9808         /// The number of elements pointed to by `data`.
9809         pub datalen: usize
9810 }
9811 impl CVec_RecentPaymentDetailsZ {
9812         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
9813                 if self.datalen == 0 { return Vec::new(); }
9814                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9815                 self.data = core::ptr::null_mut();
9816                 self.datalen = 0;
9817                 ret
9818         }
9819         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
9820                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9821         }
9822 }
9823 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
9824         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
9825                 let datalen = v.len();
9826                 let data = Box::into_raw(v.into_boxed_slice());
9827                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9828         }
9829 }
9830 #[no_mangle]
9831 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9832 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
9833 impl Drop for CVec_RecentPaymentDetailsZ {
9834         fn drop(&mut self) {
9835                 if self.datalen == 0 { return; }
9836                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9837         }
9838 }
9839 #[repr(C)]
9840 /// The contents of CResult_NonePaymentSendFailureZ
9841 pub union CResult_NonePaymentSendFailureZPtr {
9842         /// Note that this value is always NULL, as there are no contents in the OK variant
9843         pub result: *mut core::ffi::c_void,
9844         /// A pointer to the contents in the error state.
9845         /// Reading from this pointer when `result_ok` is set is undefined.
9846         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9847 }
9848 #[repr(C)]
9849 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9850 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9852 pub struct CResult_NonePaymentSendFailureZ {
9853         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9854         /// `err` or `result` depending on the state of `result_ok`.
9855         pub contents: CResult_NonePaymentSendFailureZPtr,
9856         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9857         pub result_ok: bool,
9858 }
9859 #[no_mangle]
9860 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9861 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9862         CResult_NonePaymentSendFailureZ {
9863                 contents: CResult_NonePaymentSendFailureZPtr {
9864                         result: core::ptr::null_mut(),
9865                 },
9866                 result_ok: true,
9867         }
9868 }
9869 #[no_mangle]
9870 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9871 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9872         CResult_NonePaymentSendFailureZ {
9873                 contents: CResult_NonePaymentSendFailureZPtr {
9874                         err: Box::into_raw(Box::new(e)),
9875                 },
9876                 result_ok: false,
9877         }
9878 }
9879 /// Checks if the given object is currently in the success state
9880 #[no_mangle]
9881 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
9882         o.result_ok
9883 }
9884 #[no_mangle]
9885 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9886 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9887 impl Drop for CResult_NonePaymentSendFailureZ {
9888         fn drop(&mut self) {
9889                 if self.result_ok {
9890                 } else {
9891                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9892                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9893                         }
9894                 }
9895         }
9896 }
9897 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9898         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9899                 let contents = if o.result_ok {
9900                         let _ = unsafe { Box::from_raw(o.contents.result) };
9901                         o.contents.result = core::ptr::null_mut();
9902                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
9903                 } else {
9904                         let err = unsafe { o.contents.err };
9905                         unsafe { o.contents.err = core::ptr::null_mut(); }
9906                         CResult_NonePaymentSendFailureZPtr { err }
9907                 };
9908                 Self {
9909                         contents,
9910                         result_ok: o.result_ok,
9911                 }
9912         }
9913 }
9914 impl Clone for CResult_NonePaymentSendFailureZ {
9915         fn clone(&self) -> Self {
9916                 if self.result_ok {
9917                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9918                                 result: core::ptr::null_mut()
9919                         } }
9920                 } else {
9921                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9922                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9923                         } }
9924                 }
9925         }
9926 }
9927 #[no_mangle]
9928 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9929 /// but with all dynamically-allocated buffers duplicated in new buffers.
9930 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
9931 #[repr(C)]
9932 /// The contents of CResult_NoneRetryableSendFailureZ
9933 pub union CResult_NoneRetryableSendFailureZPtr {
9934         /// Note that this value is always NULL, as there are no contents in the OK variant
9935         pub result: *mut core::ffi::c_void,
9936         /// A pointer to the contents in the error state.
9937         /// Reading from this pointer when `result_ok` is set is undefined.
9938         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9939 }
9940 #[repr(C)]
9941 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9942 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9944 pub struct CResult_NoneRetryableSendFailureZ {
9945         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9946         /// `err` or `result` depending on the state of `result_ok`.
9947         pub contents: CResult_NoneRetryableSendFailureZPtr,
9948         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9949         pub result_ok: bool,
9950 }
9951 #[no_mangle]
9952 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
9953 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
9954         CResult_NoneRetryableSendFailureZ {
9955                 contents: CResult_NoneRetryableSendFailureZPtr {
9956                         result: core::ptr::null_mut(),
9957                 },
9958                 result_ok: true,
9959         }
9960 }
9961 #[no_mangle]
9962 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
9963 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
9964         CResult_NoneRetryableSendFailureZ {
9965                 contents: CResult_NoneRetryableSendFailureZPtr {
9966                         err: Box::into_raw(Box::new(e)),
9967                 },
9968                 result_ok: false,
9969         }
9970 }
9971 /// Checks if the given object is currently in the success state
9972 #[no_mangle]
9973 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9974         o.result_ok
9975 }
9976 #[no_mangle]
9977 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9978 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9979 impl Drop for CResult_NoneRetryableSendFailureZ {
9980         fn drop(&mut self) {
9981                 if self.result_ok {
9982                 } else {
9983                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9984                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9985                         }
9986                 }
9987         }
9988 }
9989 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9990         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9991                 let contents = if o.result_ok {
9992                         let _ = unsafe { Box::from_raw(o.contents.result) };
9993                         o.contents.result = core::ptr::null_mut();
9994                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9995                 } else {
9996                         let err = unsafe { o.contents.err };
9997                         unsafe { o.contents.err = core::ptr::null_mut(); }
9998                         CResult_NoneRetryableSendFailureZPtr { err }
9999                 };
10000                 Self {
10001                         contents,
10002                         result_ok: o.result_ok,
10003                 }
10004         }
10005 }
10006 impl Clone for CResult_NoneRetryableSendFailureZ {
10007         fn clone(&self) -> Self {
10008                 if self.result_ok {
10009                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
10010                                 result: core::ptr::null_mut()
10011                         } }
10012                 } else {
10013                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
10014                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
10015                         } }
10016                 }
10017         }
10018 }
10019 #[no_mangle]
10020 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
10021 /// but with all dynamically-allocated buffers duplicated in new buffers.
10022 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
10023 #[repr(C)]
10024 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
10025 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10026         /// A pointer to the contents in the success state.
10027         /// Reading from this pointer when `result_ok` is not set is undefined.
10028         pub result: *mut crate::c_types::ThirtyTwoBytes,
10029         /// A pointer to the contents in the error state.
10030         /// Reading from this pointer when `result_ok` is set is undefined.
10031         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10032 }
10033 #[repr(C)]
10034 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
10035 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10037 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
10038         /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
10039         /// `err` or `result` depending on the state of `result_ok`.
10040         pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
10041         /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
10042         pub result_ok: bool,
10043 }
10044 #[no_mangle]
10045 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
10046 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10047         CResult_ThirtyTwoBytesPaymentSendFailureZ {
10048                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10049                         result: Box::into_raw(Box::new(o)),
10050                 },
10051                 result_ok: true,
10052         }
10053 }
10054 #[no_mangle]
10055 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
10056 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10057         CResult_ThirtyTwoBytesPaymentSendFailureZ {
10058                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10059                         err: Box::into_raw(Box::new(e)),
10060                 },
10061                 result_ok: false,
10062         }
10063 }
10064 /// Checks if the given object is currently in the success state
10065 #[no_mangle]
10066 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
10067         o.result_ok
10068 }
10069 #[no_mangle]
10070 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
10071 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
10072 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10073         fn drop(&mut self) {
10074                 if self.result_ok {
10075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10077                         }
10078                 } else {
10079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10081                         }
10082                 }
10083         }
10084 }
10085 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10086         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10087                 let contents = if o.result_ok {
10088                         let result = unsafe { o.contents.result };
10089                         unsafe { o.contents.result = core::ptr::null_mut() };
10090                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
10091                 } else {
10092                         let err = unsafe { o.contents.err };
10093                         unsafe { o.contents.err = core::ptr::null_mut(); }
10094                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
10095                 };
10096                 Self {
10097                         contents,
10098                         result_ok: o.result_ok,
10099                 }
10100         }
10101 }
10102 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10103         fn clone(&self) -> Self {
10104                 if self.result_ok {
10105                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10106                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10107                         } }
10108                 } else {
10109                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10110                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10111                         } }
10112                 }
10113         }
10114 }
10115 #[no_mangle]
10116 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
10117 /// but with all dynamically-allocated buffers duplicated in new buffers.
10118 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
10119 #[repr(C)]
10120 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
10121 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10122         /// A pointer to the contents in the success state.
10123         /// Reading from this pointer when `result_ok` is not set is undefined.
10124         pub result: *mut crate::c_types::ThirtyTwoBytes,
10125         /// A pointer to the contents in the error state.
10126         /// Reading from this pointer when `result_ok` is set is undefined.
10127         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
10128 }
10129 #[repr(C)]
10130 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
10131 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
10132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10133 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
10134         /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
10135         /// `err` or `result` depending on the state of `result_ok`.
10136         pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
10137         /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
10138         pub result_ok: bool,
10139 }
10140 #[no_mangle]
10141 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
10142 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10143         CResult_ThirtyTwoBytesRetryableSendFailureZ {
10144                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10145                         result: Box::into_raw(Box::new(o)),
10146                 },
10147                 result_ok: true,
10148         }
10149 }
10150 #[no_mangle]
10151 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
10152 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10153         CResult_ThirtyTwoBytesRetryableSendFailureZ {
10154                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10155                         err: Box::into_raw(Box::new(e)),
10156                 },
10157                 result_ok: false,
10158         }
10159 }
10160 /// Checks if the given object is currently in the success state
10161 #[no_mangle]
10162 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
10163         o.result_ok
10164 }
10165 #[no_mangle]
10166 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
10167 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
10168 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10169         fn drop(&mut self) {
10170                 if self.result_ok {
10171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10173                         }
10174                 } else {
10175                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10176                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10177                         }
10178                 }
10179         }
10180 }
10181 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10182         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
10183                 let contents = if o.result_ok {
10184                         let result = unsafe { o.contents.result };
10185                         unsafe { o.contents.result = core::ptr::null_mut() };
10186                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
10187                 } else {
10188                         let err = unsafe { o.contents.err };
10189                         unsafe { o.contents.err = core::ptr::null_mut(); }
10190                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
10191                 };
10192                 Self {
10193                         contents,
10194                         result_ok: o.result_ok,
10195                 }
10196         }
10197 }
10198 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10199         fn clone(&self) -> Self {
10200                 if self.result_ok {
10201                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10202                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10203                         } }
10204                 } else {
10205                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10206                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
10207                         } }
10208                 }
10209         }
10210 }
10211 #[no_mangle]
10212 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
10213 /// but with all dynamically-allocated buffers duplicated in new buffers.
10214 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
10215 #[repr(C)]
10216 /// A tuple of 2 elements. See the individual fields for the types contained.
10217 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10218         /// The element at position 0
10219         pub a: crate::c_types::ThirtyTwoBytes,
10220         /// The element at position 1
10221         pub b: crate::c_types::ThirtyTwoBytes,
10222 }
10223 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10224         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10225                 Self {
10226                         a: tup.0,
10227                         b: tup.1,
10228                 }
10229         }
10230 }
10231 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10232         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10233                 (self.a, self.b)
10234         }
10235 }
10236 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10237         fn clone(&self) -> Self {
10238                 Self {
10239                         a: Clone::clone(&self.a),
10240                         b: Clone::clone(&self.b),
10241                 }
10242         }
10243 }
10244 #[no_mangle]
10245 /// Creates a new tuple which has the same data as `orig`
10246 /// but with all dynamically-allocated buffers duplicated in new buffers.
10247 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
10248 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
10249 #[no_mangle]
10250 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10251         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
10252 }
10253
10254 #[no_mangle]
10255 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
10256 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
10257 #[repr(C)]
10258 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10259 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10260         /// A pointer to the contents in the success state.
10261         /// Reading from this pointer when `result_ok` is not set is undefined.
10262         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10263         /// A pointer to the contents in the error state.
10264         /// Reading from this pointer when `result_ok` is set is undefined.
10265         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10266 }
10267 #[repr(C)]
10268 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10269 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10271 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10272         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10273         /// `err` or `result` depending on the state of `result_ok`.
10274         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
10275         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10276         pub result_ok: bool,
10277 }
10278 #[no_mangle]
10279 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
10280 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10281         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10282                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10283                         result: Box::into_raw(Box::new(o)),
10284                 },
10285                 result_ok: true,
10286         }
10287 }
10288 #[no_mangle]
10289 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
10290 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10291         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10292                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10293                         err: Box::into_raw(Box::new(e)),
10294                 },
10295                 result_ok: false,
10296         }
10297 }
10298 /// Checks if the given object is currently in the success state
10299 #[no_mangle]
10300 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
10301         o.result_ok
10302 }
10303 #[no_mangle]
10304 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
10305 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
10306 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10307         fn drop(&mut self) {
10308                 if self.result_ok {
10309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10311                         }
10312                 } else {
10313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10315                         }
10316                 }
10317         }
10318 }
10319 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10320         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10321                 let contents = if o.result_ok {
10322                         let result = unsafe { o.contents.result };
10323                         unsafe { o.contents.result = core::ptr::null_mut() };
10324                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
10325                 } else {
10326                         let err = unsafe { o.contents.err };
10327                         unsafe { o.contents.err = core::ptr::null_mut(); }
10328                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
10329                 };
10330                 Self {
10331                         contents,
10332                         result_ok: o.result_ok,
10333                 }
10334         }
10335 }
10336 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10337         fn clone(&self) -> Self {
10338                 if self.result_ok {
10339                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10340                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10341                         } }
10342                 } else {
10343                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10345                         } }
10346                 }
10347         }
10348 }
10349 #[no_mangle]
10350 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
10351 /// but with all dynamically-allocated buffers duplicated in new buffers.
10352 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
10353 #[repr(C)]
10354 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10355 /// This corresponds to std::vector in C++
10356 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10357         /// The elements in the array.
10358         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10359         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10360         /// The number of elements pointed to by `data`.
10361         pub datalen: usize
10362 }
10363 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10364         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
10365                 if self.datalen == 0 { return Vec::new(); }
10366                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10367                 self.data = core::ptr::null_mut();
10368                 self.datalen = 0;
10369                 ret
10370         }
10371         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
10372                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10373         }
10374 }
10375 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10376         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
10377                 let datalen = v.len();
10378                 let data = Box::into_raw(v.into_boxed_slice());
10379                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10380         }
10381 }
10382 #[no_mangle]
10383 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10384 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
10385 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10386         fn drop(&mut self) {
10387                 if self.datalen == 0 { return; }
10388                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10389         }
10390 }
10391 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10392         fn clone(&self) -> Self {
10393                 let mut res = Vec::new();
10394                 if self.datalen == 0 { return Self::from(res); }
10395                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10396                 Self::from(res)
10397         }
10398 }
10399 #[repr(C)]
10400 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10401 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10402         /// A pointer to the contents in the success state.
10403         /// Reading from this pointer when `result_ok` is not set is undefined.
10404         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
10405         /// A pointer to the contents in the error state.
10406         /// Reading from this pointer when `result_ok` is set is undefined.
10407         pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
10408 }
10409 #[repr(C)]
10410 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10411 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10412 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10413 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10414         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10415         /// `err` or `result` depending on the state of `result_ok`.
10416         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
10417         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10418         pub result_ok: bool,
10419 }
10420 #[no_mangle]
10421 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
10422 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10423         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10424                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10425                         result: Box::into_raw(Box::new(o)),
10426                 },
10427                 result_ok: true,
10428         }
10429 }
10430 #[no_mangle]
10431 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
10432 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10433         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10434                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10435                         err: Box::into_raw(Box::new(e)),
10436                 },
10437                 result_ok: false,
10438         }
10439 }
10440 /// Checks if the given object is currently in the success state
10441 #[no_mangle]
10442 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
10443         o.result_ok
10444 }
10445 #[no_mangle]
10446 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
10447 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
10448 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10449         fn drop(&mut self) {
10450                 if self.result_ok {
10451                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10452                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10453                         }
10454                 } else {
10455                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10456                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10457                         }
10458                 }
10459         }
10460 }
10461 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10462         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
10463                 let contents = if o.result_ok {
10464                         let result = unsafe { o.contents.result };
10465                         unsafe { o.contents.result = core::ptr::null_mut() };
10466                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
10467                 } else {
10468                         let err = unsafe { o.contents.err };
10469                         unsafe { o.contents.err = core::ptr::null_mut(); }
10470                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
10471                 };
10472                 Self {
10473                         contents,
10474                         result_ok: o.result_ok,
10475                 }
10476         }
10477 }
10478 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10479         fn clone(&self) -> Self {
10480                 if self.result_ok {
10481                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10482                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
10483                         } }
10484                 } else {
10485                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10486                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
10487                         } }
10488                 }
10489         }
10490 }
10491 #[no_mangle]
10492 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
10493 /// but with all dynamically-allocated buffers duplicated in new buffers.
10494 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
10495 #[repr(C)]
10496 /// A tuple of 2 elements. See the individual fields for the types contained.
10497 pub struct C2Tuple_ChannelIdPublicKeyZ {
10498         /// The element at position 0
10499         pub a: crate::lightning::ln::types::ChannelId,
10500         /// The element at position 1
10501         pub b: crate::c_types::PublicKey,
10502 }
10503 impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ {
10504         fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self {
10505                 Self {
10506                         a: tup.0,
10507                         b: tup.1,
10508                 }
10509         }
10510 }
10511 impl C2Tuple_ChannelIdPublicKeyZ {
10512         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) {
10513                 (self.a, self.b)
10514         }
10515 }
10516 impl Clone for C2Tuple_ChannelIdPublicKeyZ {
10517         fn clone(&self) -> Self {
10518                 Self {
10519                         a: Clone::clone(&self.a),
10520                         b: Clone::clone(&self.b),
10521                 }
10522         }
10523 }
10524 #[no_mangle]
10525 /// Creates a new tuple which has the same data as `orig`
10526 /// but with all dynamically-allocated buffers duplicated in new buffers.
10527 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) }
10528 /// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
10529 #[no_mangle]
10530 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ {
10531         C2Tuple_ChannelIdPublicKeyZ { a, b, }
10532 }
10533
10534 #[no_mangle]
10535 /// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
10536 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { }
10537 #[repr(C)]
10538 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10539 /// This corresponds to std::vector in C++
10540 pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ {
10541         /// The elements in the array.
10542         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10543         pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ,
10544         /// The number of elements pointed to by `data`.
10545         pub datalen: usize
10546 }
10547 impl CVec_C2Tuple_ChannelIdPublicKeyZZ {
10548         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ> {
10549                 if self.datalen == 0 { return Vec::new(); }
10550                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10551                 self.data = core::ptr::null_mut();
10552                 self.datalen = 0;
10553                 ret
10554         }
10555         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] {
10556                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10557         }
10558 }
10559 impl From<Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>> for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10560         fn from(v: Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>) -> Self {
10561                 let datalen = v.len();
10562                 let data = Box::into_raw(v.into_boxed_slice());
10563                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10564         }
10565 }
10566 #[no_mangle]
10567 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10568 pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { }
10569 impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10570         fn drop(&mut self) {
10571                 if self.datalen == 0 { return; }
10572                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10573         }
10574 }
10575 impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10576         fn clone(&self) -> Self {
10577                 let mut res = Vec::new();
10578                 if self.datalen == 0 { return Self::from(res); }
10579                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10580                 Self::from(res)
10581         }
10582 }
10583 #[repr(C)]
10584 /// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10585 /// This corresponds to std::vector in C++
10586 pub struct CVec_ChannelIdZ {
10587         /// The elements in the array.
10588         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10589         pub data: *mut crate::lightning::ln::types::ChannelId,
10590         /// The number of elements pointed to by `data`.
10591         pub datalen: usize
10592 }
10593 impl CVec_ChannelIdZ {
10594         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::types::ChannelId> {
10595                 if self.datalen == 0 { return Vec::new(); }
10596                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10597                 self.data = core::ptr::null_mut();
10598                 self.datalen = 0;
10599                 ret
10600         }
10601         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] {
10602                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10603         }
10604 }
10605 impl From<Vec<crate::lightning::ln::types::ChannelId>> for CVec_ChannelIdZ {
10606         fn from(v: Vec<crate::lightning::ln::types::ChannelId>) -> Self {
10607                 let datalen = v.len();
10608                 let data = Box::into_raw(v.into_boxed_slice());
10609                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10610         }
10611 }
10612 #[no_mangle]
10613 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10614 pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { }
10615 impl Drop for CVec_ChannelIdZ {
10616         fn drop(&mut self) {
10617                 if self.datalen == 0 { return; }
10618                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10619         }
10620 }
10621 impl Clone for CVec_ChannelIdZ {
10622         fn clone(&self) -> Self {
10623                 let mut res = Vec::new();
10624                 if self.datalen == 0 { return Self::from(res); }
10625                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10626                 Self::from(res)
10627         }
10628 }
10629 #[repr(C)]
10630 /// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ
10631 pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10632         /// A pointer to the contents in the success state.
10633         /// Reading from this pointer when `result_ok` is not set is undefined.
10634         pub result: *mut crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder,
10635         /// A pointer to the contents in the error state.
10636         /// Reading from this pointer when `result_ok` is set is undefined.
10637         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
10638 }
10639 #[repr(C)]
10640 /// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
10641 /// containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10643 pub struct CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10644         /// The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
10645         /// `err` or `result` depending on the state of `result_ok`.
10646         pub contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
10647         /// Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
10648         pub result_ok: bool,
10649 }
10650 #[no_mangle]
10651 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
10652 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10653         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10654                 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10655                         result: Box::into_raw(Box::new(o)),
10656                 },
10657                 result_ok: true,
10658         }
10659 }
10660 #[no_mangle]
10661 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
10662 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10663         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10664                 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10665                         err: Box::into_raw(Box::new(e)),
10666                 },
10667                 result_ok: false,
10668         }
10669 }
10670 /// Checks if the given object is currently in the success state
10671 #[no_mangle]
10672 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
10673         o.result_ok
10674 }
10675 #[no_mangle]
10676 /// Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ.
10677 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
10678 impl Drop for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10679         fn drop(&mut self) {
10680                 if self.result_ok {
10681                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10682                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10683                         }
10684                 } else {
10685                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10686                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10687                         }
10688                 }
10689         }
10690 }
10691 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10692         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
10693                 let contents = if o.result_ok {
10694                         let result = unsafe { o.contents.result };
10695                         unsafe { o.contents.result = core::ptr::null_mut() };
10696                         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
10697                 } else {
10698                         let err = unsafe { o.contents.err };
10699                         unsafe { o.contents.err = core::ptr::null_mut(); }
10700                         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
10701                 };
10702                 Self {
10703                         contents,
10704                         result_ok: o.result_ok,
10705                 }
10706         }
10707 }
10708 impl Clone for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10709         fn clone(&self) -> Self {
10710                 if self.result_ok {
10711                         Self { result_ok: true, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10712                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder>::clone(unsafe { &*self.contents.result })))
10713                         } }
10714                 } else {
10715                         Self { result_ok: false, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10716                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
10717                         } }
10718                 }
10719         }
10720 }
10721 #[no_mangle]
10722 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
10723 /// but with all dynamically-allocated buffers duplicated in new buffers.
10724 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) }
10725 #[repr(C)]
10726 #[derive(Clone)]
10727 /// An enum which can either contain a crate::c_types::Str or not
10728 pub enum COption_StrZ {
10729         /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
10730         Some(crate::c_types::Str),
10731         /// When we're in this state, this COption_StrZ contains nothing
10732         None
10733 }
10734 impl COption_StrZ {
10735         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10736                 if let Self::None = self { false } else { true }
10737         }
10738         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10739                 !self.is_some()
10740         }
10741         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
10742                 if let Self::Some(v) = self { v } else { unreachable!() }
10743         }
10744 }
10745 #[no_mangle]
10746 /// Constructs a new COption_StrZ containing a crate::c_types::Str
10747 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
10748         COption_StrZ::Some(o)
10749 }
10750 #[no_mangle]
10751 /// Constructs a new COption_StrZ containing nothing
10752 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
10753         COption_StrZ::None
10754 }
10755 #[no_mangle]
10756 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
10757 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
10758 #[no_mangle]
10759 /// Creates a new COption_StrZ which has the same data as `orig`
10760 /// but with all dynamically-allocated buffers duplicated in new buffers.
10761 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
10762 #[repr(C)]
10763 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10764 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10765         /// A pointer to the contents in the success state.
10766         /// Reading from this pointer when `result_ok` is not set is undefined.
10767         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10768         /// Note that this value is always NULL, as there are no contents in the Err variant
10769         pub err: *mut core::ffi::c_void,
10770 }
10771 #[repr(C)]
10772 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10773 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10775 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10776         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10777         /// `err` or `result` depending on the state of `result_ok`.
10778         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
10779         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10780         pub result_ok: bool,
10781 }
10782 #[no_mangle]
10783 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
10784 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10785         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10786                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10787                         result: Box::into_raw(Box::new(o)),
10788                 },
10789                 result_ok: true,
10790         }
10791 }
10792 #[no_mangle]
10793 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
10794 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10795         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10796                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10797                         err: core::ptr::null_mut(),
10798                 },
10799                 result_ok: false,
10800         }
10801 }
10802 /// Checks if the given object is currently in the success state
10803 #[no_mangle]
10804 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
10805         o.result_ok
10806 }
10807 #[no_mangle]
10808 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
10809 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
10810 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10811         fn drop(&mut self) {
10812                 if self.result_ok {
10813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10815                         }
10816                 } else {
10817                 }
10818         }
10819 }
10820 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10821         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
10822                 let contents = if o.result_ok {
10823                         let result = unsafe { o.contents.result };
10824                         unsafe { o.contents.result = core::ptr::null_mut() };
10825                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
10826                 } else {
10827                         let _ = unsafe { Box::from_raw(o.contents.err) };
10828                         o.contents.err = core::ptr::null_mut();
10829                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
10830                 };
10831                 Self {
10832                         contents,
10833                         result_ok: o.result_ok,
10834                 }
10835         }
10836 }
10837 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10838         fn clone(&self) -> Self {
10839                 if self.result_ok {
10840                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10841                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10842                         } }
10843                 } else {
10844                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10845                                 err: core::ptr::null_mut()
10846                         } }
10847                 }
10848         }
10849 }
10850 #[no_mangle]
10851 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
10852 /// but with all dynamically-allocated buffers duplicated in new buffers.
10853 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
10854 #[repr(C)]
10855 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
10856 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
10857         /// A pointer to the contents in the success state.
10858         /// Reading from this pointer when `result_ok` is not set is undefined.
10859         pub result: *mut crate::c_types::ThirtyTwoBytes,
10860         /// A pointer to the contents in the error state.
10861         /// Reading from this pointer when `result_ok` is set is undefined.
10862         pub err: *mut crate::lightning::util::errors::APIError,
10863 }
10864 #[repr(C)]
10865 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10866 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10867 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10868 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
10869         /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10870         /// `err` or `result` depending on the state of `result_ok`.
10871         pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
10872         /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10873         pub result_ok: bool,
10874 }
10875 #[no_mangle]
10876 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
10877 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
10878         CResult_ThirtyTwoBytesAPIErrorZ {
10879                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10880                         result: Box::into_raw(Box::new(o)),
10881                 },
10882                 result_ok: true,
10883         }
10884 }
10885 #[no_mangle]
10886 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
10887 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
10888         CResult_ThirtyTwoBytesAPIErrorZ {
10889                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10890                         err: Box::into_raw(Box::new(e)),
10891                 },
10892                 result_ok: false,
10893         }
10894 }
10895 /// Checks if the given object is currently in the success state
10896 #[no_mangle]
10897 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
10898         o.result_ok
10899 }
10900 #[no_mangle]
10901 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
10902 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
10903 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
10904         fn drop(&mut self) {
10905                 if self.result_ok {
10906                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10907                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10908                         }
10909                 } else {
10910                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10911                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10912                         }
10913                 }
10914         }
10915 }
10916 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
10917         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10918                 let contents = if o.result_ok {
10919                         let result = unsafe { o.contents.result };
10920                         unsafe { o.contents.result = core::ptr::null_mut() };
10921                         CResult_ThirtyTwoBytesAPIErrorZPtr { result }
10922                 } else {
10923                         let err = unsafe { o.contents.err };
10924                         unsafe { o.contents.err = core::ptr::null_mut(); }
10925                         CResult_ThirtyTwoBytesAPIErrorZPtr { err }
10926                 };
10927                 Self {
10928                         contents,
10929                         result_ok: o.result_ok,
10930                 }
10931         }
10932 }
10933 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
10934         fn clone(&self) -> Self {
10935                 if self.result_ok {
10936                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10937                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10938                         } }
10939                 } else {
10940                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10941                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10942                         } }
10943                 }
10944         }
10945 }
10946 #[no_mangle]
10947 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
10948 /// but with all dynamically-allocated buffers duplicated in new buffers.
10949 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
10950 #[repr(C)]
10951 #[derive(Clone)]
10952 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10953 pub enum COption_OffersMessageZ {
10954         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10955         Some(crate::lightning::onion_message::offers::OffersMessage),
10956         /// When we're in this state, this COption_OffersMessageZ contains nothing
10957         None
10958 }
10959 impl COption_OffersMessageZ {
10960         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10961                 if let Self::None = self { false } else { true }
10962         }
10963         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10964                 !self.is_some()
10965         }
10966         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10967                 if let Self::Some(v) = self { v } else { unreachable!() }
10968         }
10969 }
10970 #[no_mangle]
10971 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10972 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10973         COption_OffersMessageZ::Some(o)
10974 }
10975 #[no_mangle]
10976 /// Constructs a new COption_OffersMessageZ containing nothing
10977 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10978         COption_OffersMessageZ::None
10979 }
10980 #[no_mangle]
10981 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10982 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10983 #[no_mangle]
10984 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10985 /// but with all dynamically-allocated buffers duplicated in new buffers.
10986 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10987 #[repr(C)]
10988 /// A tuple of 3 elements. See the individual fields for the types contained.
10989 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
10990         /// The element at position 0
10991         pub a: crate::lightning::onion_message::offers::OffersMessage,
10992         /// The element at position 1
10993         pub b: crate::lightning::onion_message::messenger::Destination,
10994         /// The element at position 2
10995         pub c: crate::lightning::blinded_path::BlindedPath,
10996 }
10997 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
10998         fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
10999                 Self {
11000                         a: tup.0,
11001                         b: tup.1,
11002                         c: tup.2,
11003                 }
11004         }
11005 }
11006 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
11007         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
11008                 (self.a, self.b, self.c)
11009         }
11010 }
11011 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
11012         fn clone(&self) -> Self {
11013                 Self {
11014                         a: Clone::clone(&self.a),
11015                         b: Clone::clone(&self.b),
11016                         c: Clone::clone(&self.c),
11017                 }
11018         }
11019 }
11020 #[no_mangle]
11021 /// Creates a new tuple which has the same data as `orig`
11022 /// but with all dynamically-allocated buffers duplicated in new buffers.
11023 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
11024 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
11025 #[no_mangle]
11026 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OffersMessageDestinationBlindedPathZ {
11027         C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
11028 }
11029
11030 #[no_mangle]
11031 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
11032 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
11033 #[repr(C)]
11034 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
11035 /// This corresponds to std::vector in C++
11036 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11037         /// The elements in the array.
11038         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11039         pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
11040         /// The number of elements pointed to by `data`.
11041         pub datalen: usize
11042 }
11043 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11044         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
11045                 if self.datalen == 0 { return Vec::new(); }
11046                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11047                 self.data = core::ptr::null_mut();
11048                 self.datalen = 0;
11049                 ret
11050         }
11051         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
11052                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11053         }
11054 }
11055 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11056         fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
11057                 let datalen = v.len();
11058                 let data = Box::into_raw(v.into_boxed_slice());
11059                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11060         }
11061 }
11062 #[no_mangle]
11063 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11064 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
11065 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11066         fn drop(&mut self) {
11067                 if self.datalen == 0 { return; }
11068                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11069         }
11070 }
11071 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11072         fn clone(&self) -> Self {
11073                 let mut res = Vec::new();
11074                 if self.datalen == 0 { return Self::from(res); }
11075                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11076                 Self::from(res)
11077         }
11078 }
11079 #[repr(C)]
11080 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
11081 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11082         /// A pointer to the contents in the success state.
11083         /// Reading from this pointer when `result_ok` is not set is undefined.
11084         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
11085         /// A pointer to the contents in the error state.
11086         /// Reading from this pointer when `result_ok` is set is undefined.
11087         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11088 }
11089 #[repr(C)]
11090 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
11091 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11093 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
11094         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
11095         /// `err` or `result` depending on the state of `result_ok`.
11096         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
11097         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
11098         pub result_ok: bool,
11099 }
11100 #[no_mangle]
11101 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
11102 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
11103         CResult_CounterpartyForwardingInfoDecodeErrorZ {
11104                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11105                         result: Box::into_raw(Box::new(o)),
11106                 },
11107                 result_ok: true,
11108         }
11109 }
11110 #[no_mangle]
11111 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
11112 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
11113         CResult_CounterpartyForwardingInfoDecodeErrorZ {
11114                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11115                         err: Box::into_raw(Box::new(e)),
11116                 },
11117                 result_ok: false,
11118         }
11119 }
11120 /// Checks if the given object is currently in the success state
11121 #[no_mangle]
11122 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
11123         o.result_ok
11124 }
11125 #[no_mangle]
11126 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
11127 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
11128 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
11129         fn drop(&mut self) {
11130                 if self.result_ok {
11131                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11132                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11133                         }
11134                 } else {
11135                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11136                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11137                         }
11138                 }
11139         }
11140 }
11141 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
11142         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11143                 let contents = if o.result_ok {
11144                         let result = unsafe { o.contents.result };
11145                         unsafe { o.contents.result = core::ptr::null_mut() };
11146                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
11147                 } else {
11148                         let err = unsafe { o.contents.err };
11149                         unsafe { o.contents.err = core::ptr::null_mut(); }
11150                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
11151                 };
11152                 Self {
11153                         contents,
11154                         result_ok: o.result_ok,
11155                 }
11156         }
11157 }
11158 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
11159         fn clone(&self) -> Self {
11160                 if self.result_ok {
11161                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11162                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
11163                         } }
11164                 } else {
11165                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
11166                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11167                         } }
11168                 }
11169         }
11170 }
11171 #[no_mangle]
11172 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
11173 /// but with all dynamically-allocated buffers duplicated in new buffers.
11174 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
11175 #[repr(C)]
11176 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
11177 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
11178         /// A pointer to the contents in the success state.
11179         /// Reading from this pointer when `result_ok` is not set is undefined.
11180         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
11181         /// A pointer to the contents in the error state.
11182         /// Reading from this pointer when `result_ok` is set is undefined.
11183         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11184 }
11185 #[repr(C)]
11186 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
11187 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
11188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11189 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
11190         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
11191         /// `err` or `result` depending on the state of `result_ok`.
11192         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
11193         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
11194         pub result_ok: bool,
11195 }
11196 #[no_mangle]
11197 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
11198 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
11199         CResult_ChannelCounterpartyDecodeErrorZ {
11200                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11201                         result: Box::into_raw(Box::new(o)),
11202                 },
11203                 result_ok: true,
11204         }
11205 }
11206 #[no_mangle]
11207 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
11208 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
11209         CResult_ChannelCounterpartyDecodeErrorZ {
11210                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11211                         err: Box::into_raw(Box::new(e)),
11212                 },
11213                 result_ok: false,
11214         }
11215 }
11216 /// Checks if the given object is currently in the success state
11217 #[no_mangle]
11218 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
11219         o.result_ok
11220 }
11221 #[no_mangle]
11222 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
11223 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
11224 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
11225         fn drop(&mut self) {
11226                 if self.result_ok {
11227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11229                         }
11230                 } else {
11231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11233                         }
11234                 }
11235         }
11236 }
11237 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
11238         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
11239                 let contents = if o.result_ok {
11240                         let result = unsafe { o.contents.result };
11241                         unsafe { o.contents.result = core::ptr::null_mut() };
11242                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
11243                 } else {
11244                         let err = unsafe { o.contents.err };
11245                         unsafe { o.contents.err = core::ptr::null_mut(); }
11246                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
11247                 };
11248                 Self {
11249                         contents,
11250                         result_ok: o.result_ok,
11251                 }
11252         }
11253 }
11254 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
11255         fn clone(&self) -> Self {
11256                 if self.result_ok {
11257                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11258                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
11259                         } }
11260                 } else {
11261                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
11262                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11263                         } }
11264                 }
11265         }
11266 }
11267 #[no_mangle]
11268 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
11269 /// but with all dynamically-allocated buffers duplicated in new buffers.
11270 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
11271 #[repr(C)]
11272 /// The contents of CResult_ChannelDetailsDecodeErrorZ
11273 pub union CResult_ChannelDetailsDecodeErrorZPtr {
11274         /// A pointer to the contents in the success state.
11275         /// Reading from this pointer when `result_ok` is not set is undefined.
11276         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
11277         /// A pointer to the contents in the error state.
11278         /// Reading from this pointer when `result_ok` is set is undefined.
11279         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11280 }
11281 #[repr(C)]
11282 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
11283 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
11284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11285 pub struct CResult_ChannelDetailsDecodeErrorZ {
11286         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
11287         /// `err` or `result` depending on the state of `result_ok`.
11288         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
11289         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
11290         pub result_ok: bool,
11291 }
11292 #[no_mangle]
11293 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
11294 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
11295         CResult_ChannelDetailsDecodeErrorZ {
11296                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11297                         result: Box::into_raw(Box::new(o)),
11298                 },
11299                 result_ok: true,
11300         }
11301 }
11302 #[no_mangle]
11303 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
11304 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
11305         CResult_ChannelDetailsDecodeErrorZ {
11306                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
11307                         err: Box::into_raw(Box::new(e)),
11308                 },
11309                 result_ok: false,
11310         }
11311 }
11312 /// Checks if the given object is currently in the success state
11313 #[no_mangle]
11314 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
11315         o.result_ok
11316 }
11317 #[no_mangle]
11318 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
11319 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
11320 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
11321         fn drop(&mut self) {
11322                 if self.result_ok {
11323                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11324                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11325                         }
11326                 } else {
11327                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11328                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11329                         }
11330                 }
11331         }
11332 }
11333 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
11334         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
11335                 let contents = if o.result_ok {
11336                         let result = unsafe { o.contents.result };
11337                         unsafe { o.contents.result = core::ptr::null_mut() };
11338                         CResult_ChannelDetailsDecodeErrorZPtr { result }
11339                 } else {
11340                         let err = unsafe { o.contents.err };
11341                         unsafe { o.contents.err = core::ptr::null_mut(); }
11342                         CResult_ChannelDetailsDecodeErrorZPtr { err }
11343                 };
11344                 Self {
11345                         contents,
11346                         result_ok: o.result_ok,
11347                 }
11348         }
11349 }
11350 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
11351         fn clone(&self) -> Self {
11352                 if self.result_ok {
11353                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11354                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
11355                         } }
11356                 } else {
11357                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
11358                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11359                         } }
11360                 }
11361         }
11362 }
11363 #[no_mangle]
11364 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
11365 /// but with all dynamically-allocated buffers duplicated in new buffers.
11366 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
11367 #[repr(C)]
11368 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
11369 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
11370         /// A pointer to the contents in the success state.
11371         /// Reading from this pointer when `result_ok` is not set is undefined.
11372         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
11373         /// A pointer to the contents in the error state.
11374         /// Reading from this pointer when `result_ok` is set is undefined.
11375         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11376 }
11377 #[repr(C)]
11378 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
11379 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
11380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11381 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
11382         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
11383         /// `err` or `result` depending on the state of `result_ok`.
11384         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
11385         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
11386         pub result_ok: bool,
11387 }
11388 #[no_mangle]
11389 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
11390 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
11391         CResult_PhantomRouteHintsDecodeErrorZ {
11392                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11393                         result: Box::into_raw(Box::new(o)),
11394                 },
11395                 result_ok: true,
11396         }
11397 }
11398 #[no_mangle]
11399 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
11400 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
11401         CResult_PhantomRouteHintsDecodeErrorZ {
11402                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11403                         err: Box::into_raw(Box::new(e)),
11404                 },
11405                 result_ok: false,
11406         }
11407 }
11408 /// Checks if the given object is currently in the success state
11409 #[no_mangle]
11410 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
11411         o.result_ok
11412 }
11413 #[no_mangle]
11414 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
11415 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
11416 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
11417         fn drop(&mut self) {
11418                 if self.result_ok {
11419                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11420                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11421                         }
11422                 } else {
11423                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11424                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11425                         }
11426                 }
11427         }
11428 }
11429 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
11430         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
11431                 let contents = if o.result_ok {
11432                         let result = unsafe { o.contents.result };
11433                         unsafe { o.contents.result = core::ptr::null_mut() };
11434                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
11435                 } else {
11436                         let err = unsafe { o.contents.err };
11437                         unsafe { o.contents.err = core::ptr::null_mut(); }
11438                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
11439                 };
11440                 Self {
11441                         contents,
11442                         result_ok: o.result_ok,
11443                 }
11444         }
11445 }
11446 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
11447         fn clone(&self) -> Self {
11448                 if self.result_ok {
11449                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11450                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
11451                         } }
11452                 } else {
11453                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11454                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11455                         } }
11456                 }
11457         }
11458 }
11459 #[no_mangle]
11460 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
11461 /// but with all dynamically-allocated buffers duplicated in new buffers.
11462 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
11463 #[repr(C)]
11464 /// The contents of CResult_BlindedForwardDecodeErrorZ
11465 pub union CResult_BlindedForwardDecodeErrorZPtr {
11466         /// A pointer to the contents in the success state.
11467         /// Reading from this pointer when `result_ok` is not set is undefined.
11468         pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
11469         /// A pointer to the contents in the error state.
11470         /// Reading from this pointer when `result_ok` is set is undefined.
11471         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11472 }
11473 #[repr(C)]
11474 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
11475 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
11476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11477 pub struct CResult_BlindedForwardDecodeErrorZ {
11478         /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
11479         /// `err` or `result` depending on the state of `result_ok`.
11480         pub contents: CResult_BlindedForwardDecodeErrorZPtr,
11481         /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
11482         pub result_ok: bool,
11483 }
11484 #[no_mangle]
11485 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
11486 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
11487         CResult_BlindedForwardDecodeErrorZ {
11488                 contents: CResult_BlindedForwardDecodeErrorZPtr {
11489                         result: Box::into_raw(Box::new(o)),
11490                 },
11491                 result_ok: true,
11492         }
11493 }
11494 #[no_mangle]
11495 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
11496 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
11497         CResult_BlindedForwardDecodeErrorZ {
11498                 contents: CResult_BlindedForwardDecodeErrorZPtr {
11499                         err: Box::into_raw(Box::new(e)),
11500                 },
11501                 result_ok: false,
11502         }
11503 }
11504 /// Checks if the given object is currently in the success state
11505 #[no_mangle]
11506 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
11507         o.result_ok
11508 }
11509 #[no_mangle]
11510 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
11511 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
11512 impl Drop for CResult_BlindedForwardDecodeErrorZ {
11513         fn drop(&mut self) {
11514                 if self.result_ok {
11515                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11516                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11517                         }
11518                 } else {
11519                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11520                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11521                         }
11522                 }
11523         }
11524 }
11525 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
11526         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
11527                 let contents = if o.result_ok {
11528                         let result = unsafe { o.contents.result };
11529                         unsafe { o.contents.result = core::ptr::null_mut() };
11530                         CResult_BlindedForwardDecodeErrorZPtr { result }
11531                 } else {
11532                         let err = unsafe { o.contents.err };
11533                         unsafe { o.contents.err = core::ptr::null_mut(); }
11534                         CResult_BlindedForwardDecodeErrorZPtr { err }
11535                 };
11536                 Self {
11537                         contents,
11538                         result_ok: o.result_ok,
11539                 }
11540         }
11541 }
11542 impl Clone for CResult_BlindedForwardDecodeErrorZ {
11543         fn clone(&self) -> Self {
11544                 if self.result_ok {
11545                         Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
11546                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
11547                         } }
11548                 } else {
11549                         Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
11550                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11551                         } }
11552                 }
11553         }
11554 }
11555 #[no_mangle]
11556 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
11557 /// but with all dynamically-allocated buffers duplicated in new buffers.
11558 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
11559 #[repr(C)]
11560 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
11561 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
11562         /// A pointer to the contents in the success state.
11563         /// Reading from this pointer when `result_ok` is not set is undefined.
11564         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
11565         /// A pointer to the contents in the error state.
11566         /// Reading from this pointer when `result_ok` is set is undefined.
11567         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11568 }
11569 #[repr(C)]
11570 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
11571 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
11572 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11573 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
11574         /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
11575         /// `err` or `result` depending on the state of `result_ok`.
11576         pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
11577         /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
11578         pub result_ok: bool,
11579 }
11580 #[no_mangle]
11581 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
11582 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11583         CResult_PendingHTLCRoutingDecodeErrorZ {
11584                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11585                         result: Box::into_raw(Box::new(o)),
11586                 },
11587                 result_ok: true,
11588         }
11589 }
11590 #[no_mangle]
11591 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
11592 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11593         CResult_PendingHTLCRoutingDecodeErrorZ {
11594                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11595                         err: Box::into_raw(Box::new(e)),
11596                 },
11597                 result_ok: false,
11598         }
11599 }
11600 /// Checks if the given object is currently in the success state
11601 #[no_mangle]
11602 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
11603         o.result_ok
11604 }
11605 #[no_mangle]
11606 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
11607 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
11608 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
11609         fn drop(&mut self) {
11610                 if self.result_ok {
11611                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11612                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11613                         }
11614                 } else {
11615                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11616                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11617                         }
11618                 }
11619         }
11620 }
11621 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
11622         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
11623                 let contents = if o.result_ok {
11624                         let result = unsafe { o.contents.result };
11625                         unsafe { o.contents.result = core::ptr::null_mut() };
11626                         CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
11627                 } else {
11628                         let err = unsafe { o.contents.err };
11629                         unsafe { o.contents.err = core::ptr::null_mut(); }
11630                         CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
11631                 };
11632                 Self {
11633                         contents,
11634                         result_ok: o.result_ok,
11635                 }
11636         }
11637 }
11638 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
11639         fn clone(&self) -> Self {
11640                 if self.result_ok {
11641                         Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11642                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
11643                         } }
11644                 } else {
11645                         Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11646                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11647                         } }
11648                 }
11649         }
11650 }
11651 #[no_mangle]
11652 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
11653 /// but with all dynamically-allocated buffers duplicated in new buffers.
11654 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
11655 #[repr(C)]
11656 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
11657 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
11658         /// A pointer to the contents in the success state.
11659         /// Reading from this pointer when `result_ok` is not set is undefined.
11660         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
11661         /// A pointer to the contents in the error state.
11662         /// Reading from this pointer when `result_ok` is set is undefined.
11663         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11664 }
11665 #[repr(C)]
11666 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11667 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11669 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
11670         /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11671         /// `err` or `result` depending on the state of `result_ok`.
11672         pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
11673         /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11674         pub result_ok: bool,
11675 }
11676 #[no_mangle]
11677 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
11678 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
11679         CResult_PendingHTLCInfoDecodeErrorZ {
11680                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11681                         result: Box::into_raw(Box::new(o)),
11682                 },
11683                 result_ok: true,
11684         }
11685 }
11686 #[no_mangle]
11687 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
11688 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
11689         CResult_PendingHTLCInfoDecodeErrorZ {
11690                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11691                         err: Box::into_raw(Box::new(e)),
11692                 },
11693                 result_ok: false,
11694         }
11695 }
11696 /// Checks if the given object is currently in the success state
11697 #[no_mangle]
11698 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
11699         o.result_ok
11700 }
11701 #[no_mangle]
11702 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
11703 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
11704 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
11705         fn drop(&mut self) {
11706                 if self.result_ok {
11707                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11708                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11709                         }
11710                 } else {
11711                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11712                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11713                         }
11714                 }
11715         }
11716 }
11717 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
11718         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11719                 let contents = if o.result_ok {
11720                         let result = unsafe { o.contents.result };
11721                         unsafe { o.contents.result = core::ptr::null_mut() };
11722                         CResult_PendingHTLCInfoDecodeErrorZPtr { result }
11723                 } else {
11724                         let err = unsafe { o.contents.err };
11725                         unsafe { o.contents.err = core::ptr::null_mut(); }
11726                         CResult_PendingHTLCInfoDecodeErrorZPtr { err }
11727                 };
11728                 Self {
11729                         contents,
11730                         result_ok: o.result_ok,
11731                 }
11732         }
11733 }
11734 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
11735         fn clone(&self) -> Self {
11736                 if self.result_ok {
11737                         Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11738                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
11739                         } }
11740                 } else {
11741                         Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11742                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11743                         } }
11744                 }
11745         }
11746 }
11747 #[no_mangle]
11748 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
11749 /// but with all dynamically-allocated buffers duplicated in new buffers.
11750 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
11751 #[repr(C)]
11752 /// The contents of CResult_BlindedFailureDecodeErrorZ
11753 pub union CResult_BlindedFailureDecodeErrorZPtr {
11754         /// A pointer to the contents in the success state.
11755         /// Reading from this pointer when `result_ok` is not set is undefined.
11756         pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
11757         /// A pointer to the contents in the error state.
11758         /// Reading from this pointer when `result_ok` is set is undefined.
11759         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11760 }
11761 #[repr(C)]
11762 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11763 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11764 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11765 pub struct CResult_BlindedFailureDecodeErrorZ {
11766         /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11767         /// `err` or `result` depending on the state of `result_ok`.
11768         pub contents: CResult_BlindedFailureDecodeErrorZPtr,
11769         /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11770         pub result_ok: bool,
11771 }
11772 #[no_mangle]
11773 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
11774 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
11775         CResult_BlindedFailureDecodeErrorZ {
11776                 contents: CResult_BlindedFailureDecodeErrorZPtr {
11777                         result: Box::into_raw(Box::new(o)),
11778                 },
11779                 result_ok: true,
11780         }
11781 }
11782 #[no_mangle]
11783 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
11784 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
11785         CResult_BlindedFailureDecodeErrorZ {
11786                 contents: CResult_BlindedFailureDecodeErrorZPtr {
11787                         err: Box::into_raw(Box::new(e)),
11788                 },
11789                 result_ok: false,
11790         }
11791 }
11792 /// Checks if the given object is currently in the success state
11793 #[no_mangle]
11794 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
11795         o.result_ok
11796 }
11797 #[no_mangle]
11798 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
11799 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
11800 impl Drop for CResult_BlindedFailureDecodeErrorZ {
11801         fn drop(&mut self) {
11802                 if self.result_ok {
11803                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11804                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11805                         }
11806                 } else {
11807                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11808                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11809                         }
11810                 }
11811         }
11812 }
11813 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
11814         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11815                 let contents = if o.result_ok {
11816                         let result = unsafe { o.contents.result };
11817                         unsafe { o.contents.result = core::ptr::null_mut() };
11818                         CResult_BlindedFailureDecodeErrorZPtr { result }
11819                 } else {
11820                         let err = unsafe { o.contents.err };
11821                         unsafe { o.contents.err = core::ptr::null_mut(); }
11822                         CResult_BlindedFailureDecodeErrorZPtr { err }
11823                 };
11824                 Self {
11825                         contents,
11826                         result_ok: o.result_ok,
11827                 }
11828         }
11829 }
11830 impl Clone for CResult_BlindedFailureDecodeErrorZ {
11831         fn clone(&self) -> Self {
11832                 if self.result_ok {
11833                         Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
11834                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
11835                         } }
11836                 } else {
11837                         Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
11838                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11839                         } }
11840                 }
11841         }
11842 }
11843 #[no_mangle]
11844 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
11845 /// but with all dynamically-allocated buffers duplicated in new buffers.
11846 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
11847 #[repr(C)]
11848 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
11849 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
11850         /// A pointer to the contents in the success state.
11851         /// Reading from this pointer when `result_ok` is not set is undefined.
11852         pub result: *mut crate::lightning::ln::channelmanager::ChannelShutdownState,
11853         /// A pointer to the contents in the error state.
11854         /// Reading from this pointer when `result_ok` is set is undefined.
11855         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11856 }
11857 #[repr(C)]
11858 /// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
11859 /// containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure.
11860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11861 pub struct CResult_ChannelShutdownStateDecodeErrorZ {
11862         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
11863         /// `err` or `result` depending on the state of `result_ok`.
11864         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
11865         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
11866         pub result_ok: bool,
11867 }
11868 #[no_mangle]
11869 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
11870 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
11871         CResult_ChannelShutdownStateDecodeErrorZ {
11872                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11873                         result: Box::into_raw(Box::new(o)),
11874                 },
11875                 result_ok: true,
11876         }
11877 }
11878 #[no_mangle]
11879 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
11880 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
11881         CResult_ChannelShutdownStateDecodeErrorZ {
11882                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11883                         err: Box::into_raw(Box::new(e)),
11884                 },
11885                 result_ok: false,
11886         }
11887 }
11888 /// Checks if the given object is currently in the success state
11889 #[no_mangle]
11890 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
11891         o.result_ok
11892 }
11893 #[no_mangle]
11894 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
11895 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
11896 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
11897         fn drop(&mut self) {
11898                 if self.result_ok {
11899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11901                         }
11902                 } else {
11903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11905                         }
11906                 }
11907         }
11908 }
11909 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
11910         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>) -> Self {
11911                 let contents = if o.result_ok {
11912                         let result = unsafe { o.contents.result };
11913                         unsafe { o.contents.result = core::ptr::null_mut() };
11914                         CResult_ChannelShutdownStateDecodeErrorZPtr { result }
11915                 } else {
11916                         let err = unsafe { o.contents.err };
11917                         unsafe { o.contents.err = core::ptr::null_mut(); }
11918                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
11919                 };
11920                 Self {
11921                         contents,
11922                         result_ok: o.result_ok,
11923                 }
11924         }
11925 }
11926 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
11927         fn clone(&self) -> Self {
11928                 if self.result_ok {
11929                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11930                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
11931                         } }
11932                 } else {
11933                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
11934                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11935                         } }
11936                 }
11937         }
11938 }
11939 #[no_mangle]
11940 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
11941 /// but with all dynamically-allocated buffers duplicated in new buffers.
11942 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
11943 #[repr(C)]
11944 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11945 /// This corresponds to std::vector in C++
11946 pub struct CVec_ChannelMonitorZ {
11947         /// The elements in the array.
11948         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11949         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
11950         /// The number of elements pointed to by `data`.
11951         pub datalen: usize
11952 }
11953 impl CVec_ChannelMonitorZ {
11954         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
11955                 if self.datalen == 0 { return Vec::new(); }
11956                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11957                 self.data = core::ptr::null_mut();
11958                 self.datalen = 0;
11959                 ret
11960         }
11961         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
11962                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11963         }
11964 }
11965 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
11966         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
11967                 let datalen = v.len();
11968                 let data = Box::into_raw(v.into_boxed_slice());
11969                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11970         }
11971 }
11972 #[no_mangle]
11973 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11974 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
11975 impl Drop for CVec_ChannelMonitorZ {
11976         fn drop(&mut self) {
11977                 if self.datalen == 0 { return; }
11978                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11979         }
11980 }
11981 impl Clone for CVec_ChannelMonitorZ {
11982         fn clone(&self) -> Self {
11983                 let mut res = Vec::new();
11984                 if self.datalen == 0 { return Self::from(res); }
11985                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11986                 Self::from(res)
11987         }
11988 }
11989 #[repr(C)]
11990 /// A tuple of 2 elements. See the individual fields for the types contained.
11991 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
11992         /// The element at position 0
11993         pub a: crate::c_types::ThirtyTwoBytes,
11994         /// The element at position 1
11995         pub b: crate::lightning::ln::channelmanager::ChannelManager,
11996 }
11997 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
11998         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
11999                 Self {
12000                         a: tup.0,
12001                         b: tup.1,
12002                 }
12003         }
12004 }
12005 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
12006         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
12007                 (self.a, self.b)
12008         }
12009 }
12010 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
12011 #[no_mangle]
12012 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
12013         C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
12014 }
12015
12016 #[no_mangle]
12017 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
12018 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
12019 #[repr(C)]
12020 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
12021 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12022         /// A pointer to the contents in the success state.
12023         /// Reading from this pointer when `result_ok` is not set is undefined.
12024         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
12025         /// A pointer to the contents in the error state.
12026         /// Reading from this pointer when `result_ok` is set is undefined.
12027         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12028 }
12029 #[repr(C)]
12030 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
12031 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12033 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12034         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
12035         /// `err` or `result` depending on the state of `result_ok`.
12036         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
12037         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
12038         pub result_ok: bool,
12039 }
12040 #[no_mangle]
12041 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
12042 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12043         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12044                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12045                         result: Box::into_raw(Box::new(o)),
12046                 },
12047                 result_ok: true,
12048         }
12049 }
12050 #[no_mangle]
12051 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
12052 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12053         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12054                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
12055                         err: Box::into_raw(Box::new(e)),
12056                 },
12057                 result_ok: false,
12058         }
12059 }
12060 /// Checks if the given object is currently in the success state
12061 #[no_mangle]
12062 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
12063         o.result_ok
12064 }
12065 #[no_mangle]
12066 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
12067 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
12068 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12069         fn drop(&mut self) {
12070                 if self.result_ok {
12071                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12072                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12073                         }
12074                 } else {
12075                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12076                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12077                         }
12078                 }
12079         }
12080 }
12081 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
12082         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12083                 let contents = if o.result_ok {
12084                         let result = unsafe { o.contents.result };
12085                         unsafe { o.contents.result = core::ptr::null_mut() };
12086                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
12087                 } else {
12088                         let err = unsafe { o.contents.err };
12089                         unsafe { o.contents.err = core::ptr::null_mut(); }
12090                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
12091                 };
12092                 Self {
12093                         contents,
12094                         result_ok: o.result_ok,
12095                 }
12096         }
12097 }
12098 #[repr(C)]
12099 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
12100 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12101         /// A pointer to the contents in the success state.
12102         /// Reading from this pointer when `result_ok` is not set is undefined.
12103         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
12104         /// A pointer to the contents in the error state.
12105         /// Reading from this pointer when `result_ok` is set is undefined.
12106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12107 }
12108 #[repr(C)]
12109 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
12110 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
12111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12112 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
12113         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
12114         /// `err` or `result` depending on the state of `result_ok`.
12115         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
12116         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
12117         pub result_ok: bool,
12118 }
12119 #[no_mangle]
12120 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
12121 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
12122         CResult_MaxDustHTLCExposureDecodeErrorZ {
12123                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12124                         result: Box::into_raw(Box::new(o)),
12125                 },
12126                 result_ok: true,
12127         }
12128 }
12129 #[no_mangle]
12130 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
12131 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
12132         CResult_MaxDustHTLCExposureDecodeErrorZ {
12133                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12134                         err: Box::into_raw(Box::new(e)),
12135                 },
12136                 result_ok: false,
12137         }
12138 }
12139 /// Checks if the given object is currently in the success state
12140 #[no_mangle]
12141 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
12142         o.result_ok
12143 }
12144 #[no_mangle]
12145 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
12146 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
12147 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
12148         fn drop(&mut self) {
12149                 if self.result_ok {
12150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12152                         }
12153                 } else {
12154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12156                         }
12157                 }
12158         }
12159 }
12160 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
12161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
12162                 let contents = if o.result_ok {
12163                         let result = unsafe { o.contents.result };
12164                         unsafe { o.contents.result = core::ptr::null_mut() };
12165                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
12166                 } else {
12167                         let err = unsafe { o.contents.err };
12168                         unsafe { o.contents.err = core::ptr::null_mut(); }
12169                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
12170                 };
12171                 Self {
12172                         contents,
12173                         result_ok: o.result_ok,
12174                 }
12175         }
12176 }
12177 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
12178         fn clone(&self) -> Self {
12179                 if self.result_ok {
12180                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12181                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
12182                         } }
12183                 } else {
12184                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
12185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12186                         } }
12187                 }
12188         }
12189 }
12190 #[no_mangle]
12191 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
12192 /// but with all dynamically-allocated buffers duplicated in new buffers.
12193 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
12194 #[repr(C)]
12195 /// The contents of CResult_ChannelConfigDecodeErrorZ
12196 pub union CResult_ChannelConfigDecodeErrorZPtr {
12197         /// A pointer to the contents in the success state.
12198         /// Reading from this pointer when `result_ok` is not set is undefined.
12199         pub result: *mut crate::lightning::util::config::ChannelConfig,
12200         /// A pointer to the contents in the error state.
12201         /// Reading from this pointer when `result_ok` is set is undefined.
12202         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12203 }
12204 #[repr(C)]
12205 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
12206 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
12207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12208 pub struct CResult_ChannelConfigDecodeErrorZ {
12209         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
12210         /// `err` or `result` depending on the state of `result_ok`.
12211         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
12212         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
12213         pub result_ok: bool,
12214 }
12215 #[no_mangle]
12216 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
12217 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
12218         CResult_ChannelConfigDecodeErrorZ {
12219                 contents: CResult_ChannelConfigDecodeErrorZPtr {
12220                         result: Box::into_raw(Box::new(o)),
12221                 },
12222                 result_ok: true,
12223         }
12224 }
12225 #[no_mangle]
12226 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
12227 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
12228         CResult_ChannelConfigDecodeErrorZ {
12229                 contents: CResult_ChannelConfigDecodeErrorZPtr {
12230                         err: Box::into_raw(Box::new(e)),
12231                 },
12232                 result_ok: false,
12233         }
12234 }
12235 /// Checks if the given object is currently in the success state
12236 #[no_mangle]
12237 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
12238         o.result_ok
12239 }
12240 #[no_mangle]
12241 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
12242 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
12243 impl Drop for CResult_ChannelConfigDecodeErrorZ {
12244         fn drop(&mut self) {
12245                 if self.result_ok {
12246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12248                         }
12249                 } else {
12250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12252                         }
12253                 }
12254         }
12255 }
12256 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
12257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
12258                 let contents = if o.result_ok {
12259                         let result = unsafe { o.contents.result };
12260                         unsafe { o.contents.result = core::ptr::null_mut() };
12261                         CResult_ChannelConfigDecodeErrorZPtr { result }
12262                 } else {
12263                         let err = unsafe { o.contents.err };
12264                         unsafe { o.contents.err = core::ptr::null_mut(); }
12265                         CResult_ChannelConfigDecodeErrorZPtr { err }
12266                 };
12267                 Self {
12268                         contents,
12269                         result_ok: o.result_ok,
12270                 }
12271         }
12272 }
12273 impl Clone for CResult_ChannelConfigDecodeErrorZ {
12274         fn clone(&self) -> Self {
12275                 if self.result_ok {
12276                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
12277                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
12278                         } }
12279                 } else {
12280                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
12281                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12282                         } }
12283                 }
12284         }
12285 }
12286 #[no_mangle]
12287 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
12288 /// but with all dynamically-allocated buffers duplicated in new buffers.
12289 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
12290 #[repr(C)]
12291 #[derive(Clone)]
12292 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
12293 pub enum COption_MaxDustHTLCExposureZ {
12294         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
12295         Some(crate::lightning::util::config::MaxDustHTLCExposure),
12296         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
12297         None
12298 }
12299 impl COption_MaxDustHTLCExposureZ {
12300         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12301                 if let Self::None = self { false } else { true }
12302         }
12303         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12304                 !self.is_some()
12305         }
12306         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
12307                 if let Self::Some(v) = self { v } else { unreachable!() }
12308         }
12309 }
12310 #[no_mangle]
12311 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
12312 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
12313         COption_MaxDustHTLCExposureZ::Some(o)
12314 }
12315 #[no_mangle]
12316 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
12317 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
12318         COption_MaxDustHTLCExposureZ::None
12319 }
12320 #[no_mangle]
12321 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
12322 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
12323 #[no_mangle]
12324 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
12325 /// but with all dynamically-allocated buffers duplicated in new buffers.
12326 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
12327 #[repr(C)]
12328 #[derive(Clone)]
12329 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
12330 pub enum COption_APIErrorZ {
12331         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
12332         Some(crate::lightning::util::errors::APIError),
12333         /// When we're in this state, this COption_APIErrorZ contains nothing
12334         None
12335 }
12336 impl COption_APIErrorZ {
12337         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12338                 if let Self::None = self { false } else { true }
12339         }
12340         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12341                 !self.is_some()
12342         }
12343         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
12344                 if let Self::Some(v) = self { v } else { unreachable!() }
12345         }
12346 }
12347 #[no_mangle]
12348 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
12349 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
12350         COption_APIErrorZ::Some(o)
12351 }
12352 #[no_mangle]
12353 /// Constructs a new COption_APIErrorZ containing nothing
12354 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
12355         COption_APIErrorZ::None
12356 }
12357 #[no_mangle]
12358 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
12359 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
12360 #[no_mangle]
12361 /// Creates a new COption_APIErrorZ which has the same data as `orig`
12362 /// but with all dynamically-allocated buffers duplicated in new buffers.
12363 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
12364 #[repr(C)]
12365 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
12366 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
12367         /// A pointer to the contents in the success state.
12368         /// Reading from this pointer when `result_ok` is not set is undefined.
12369         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
12370         /// A pointer to the contents in the error state.
12371         /// Reading from this pointer when `result_ok` is set is undefined.
12372         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12373 }
12374 #[repr(C)]
12375 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
12376 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12378 pub struct CResult_COption_APIErrorZDecodeErrorZ {
12379         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
12380         /// `err` or `result` depending on the state of `result_ok`.
12381         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
12382         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
12383         pub result_ok: bool,
12384 }
12385 #[no_mangle]
12386 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
12387 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
12388         CResult_COption_APIErrorZDecodeErrorZ {
12389                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12390                         result: Box::into_raw(Box::new(o)),
12391                 },
12392                 result_ok: true,
12393         }
12394 }
12395 #[no_mangle]
12396 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
12397 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
12398         CResult_COption_APIErrorZDecodeErrorZ {
12399                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12400                         err: Box::into_raw(Box::new(e)),
12401                 },
12402                 result_ok: false,
12403         }
12404 }
12405 /// Checks if the given object is currently in the success state
12406 #[no_mangle]
12407 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
12408         o.result_ok
12409 }
12410 #[no_mangle]
12411 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
12412 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
12413 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
12414         fn drop(&mut self) {
12415                 if self.result_ok {
12416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12418                         }
12419                 } else {
12420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12422                         }
12423                 }
12424         }
12425 }
12426 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
12427         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12428                 let contents = if o.result_ok {
12429                         let result = unsafe { o.contents.result };
12430                         unsafe { o.contents.result = core::ptr::null_mut() };
12431                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
12432                 } else {
12433                         let err = unsafe { o.contents.err };
12434                         unsafe { o.contents.err = core::ptr::null_mut(); }
12435                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
12436                 };
12437                 Self {
12438                         contents,
12439                         result_ok: o.result_ok,
12440                 }
12441         }
12442 }
12443 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
12444         fn clone(&self) -> Self {
12445                 if self.result_ok {
12446                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12447                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
12448                         } }
12449                 } else {
12450                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12451                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12452                         } }
12453                 }
12454         }
12455 }
12456 #[no_mangle]
12457 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
12458 /// but with all dynamically-allocated buffers duplicated in new buffers.
12459 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
12460 #[repr(C)]
12461 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12462 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12463         /// A pointer to the contents in the success state.
12464         /// Reading from this pointer when `result_ok` is not set is undefined.
12465         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
12466         /// A pointer to the contents in the error state.
12467         /// Reading from this pointer when `result_ok` is set is undefined.
12468         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12469 }
12470 #[repr(C)]
12471 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12472 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12474 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
12475         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12476         /// `err` or `result` depending on the state of `result_ok`.
12477         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
12478         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12479         pub result_ok: bool,
12480 }
12481 #[no_mangle]
12482 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12483 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12484         CResult_ChannelMonitorUpdateDecodeErrorZ {
12485                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12486                         result: Box::into_raw(Box::new(o)),
12487                 },
12488                 result_ok: true,
12489         }
12490 }
12491 #[no_mangle]
12492 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12493 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12494         CResult_ChannelMonitorUpdateDecodeErrorZ {
12495                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12496                         err: Box::into_raw(Box::new(e)),
12497                 },
12498                 result_ok: false,
12499         }
12500 }
12501 /// Checks if the given object is currently in the success state
12502 #[no_mangle]
12503 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
12504         o.result_ok
12505 }
12506 #[no_mangle]
12507 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12508 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
12509 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
12510         fn drop(&mut self) {
12511                 if self.result_ok {
12512                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12513                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12514                         }
12515                 } else {
12516                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12517                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12518                         }
12519                 }
12520         }
12521 }
12522 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
12523         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12524                 let contents = if o.result_ok {
12525                         let result = unsafe { o.contents.result };
12526                         unsafe { o.contents.result = core::ptr::null_mut() };
12527                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
12528                 } else {
12529                         let err = unsafe { o.contents.err };
12530                         unsafe { o.contents.err = core::ptr::null_mut(); }
12531                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
12532                 };
12533                 Self {
12534                         contents,
12535                         result_ok: o.result_ok,
12536                 }
12537         }
12538 }
12539 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
12540         fn clone(&self) -> Self {
12541                 if self.result_ok {
12542                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12543                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
12544                         } }
12545                 } else {
12546                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12547                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12548                         } }
12549                 }
12550         }
12551 }
12552 #[no_mangle]
12553 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12554 /// but with all dynamically-allocated buffers duplicated in new buffers.
12555 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
12556 #[repr(C)]
12557 #[derive(Clone)]
12558 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12559 pub enum COption_MonitorEventZ {
12560         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12561         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
12562         /// When we're in this state, this COption_MonitorEventZ contains nothing
12563         None
12564 }
12565 impl COption_MonitorEventZ {
12566         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12567                 if let Self::None = self { false } else { true }
12568         }
12569         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12570                 !self.is_some()
12571         }
12572         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
12573                 if let Self::Some(v) = self { v } else { unreachable!() }
12574         }
12575 }
12576 #[no_mangle]
12577 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
12578 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
12579         COption_MonitorEventZ::Some(o)
12580 }
12581 #[no_mangle]
12582 /// Constructs a new COption_MonitorEventZ containing nothing
12583 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
12584         COption_MonitorEventZ::None
12585 }
12586 #[no_mangle]
12587 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
12588 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
12589 #[no_mangle]
12590 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
12591 /// but with all dynamically-allocated buffers duplicated in new buffers.
12592 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
12593 #[repr(C)]
12594 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
12595 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
12596         /// A pointer to the contents in the success state.
12597         /// Reading from this pointer when `result_ok` is not set is undefined.
12598         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
12599         /// A pointer to the contents in the error state.
12600         /// Reading from this pointer when `result_ok` is set is undefined.
12601         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12602 }
12603 #[repr(C)]
12604 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12605 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12607 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
12608         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12609         /// `err` or `result` depending on the state of `result_ok`.
12610         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
12611         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12612         pub result_ok: bool,
12613 }
12614 #[no_mangle]
12615 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
12616 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
12617         CResult_COption_MonitorEventZDecodeErrorZ {
12618                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12619                         result: Box::into_raw(Box::new(o)),
12620                 },
12621                 result_ok: true,
12622         }
12623 }
12624 #[no_mangle]
12625 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
12626 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
12627         CResult_COption_MonitorEventZDecodeErrorZ {
12628                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12629                         err: Box::into_raw(Box::new(e)),
12630                 },
12631                 result_ok: false,
12632         }
12633 }
12634 /// Checks if the given object is currently in the success state
12635 #[no_mangle]
12636 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
12637         o.result_ok
12638 }
12639 #[no_mangle]
12640 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
12641 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
12642 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
12643         fn drop(&mut self) {
12644                 if self.result_ok {
12645                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12646                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12647                         }
12648                 } else {
12649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12651                         }
12652                 }
12653         }
12654 }
12655 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
12656         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12657                 let contents = if o.result_ok {
12658                         let result = unsafe { o.contents.result };
12659                         unsafe { o.contents.result = core::ptr::null_mut() };
12660                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
12661                 } else {
12662                         let err = unsafe { o.contents.err };
12663                         unsafe { o.contents.err = core::ptr::null_mut(); }
12664                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
12665                 };
12666                 Self {
12667                         contents,
12668                         result_ok: o.result_ok,
12669                 }
12670         }
12671 }
12672 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
12673         fn clone(&self) -> Self {
12674                 if self.result_ok {
12675                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12676                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
12677                         } }
12678                 } else {
12679                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12680                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12681                         } }
12682                 }
12683         }
12684 }
12685 #[no_mangle]
12686 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
12687 /// but with all dynamically-allocated buffers duplicated in new buffers.
12688 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
12689 #[repr(C)]
12690 /// The contents of CResult_HTLCUpdateDecodeErrorZ
12691 pub union CResult_HTLCUpdateDecodeErrorZPtr {
12692         /// A pointer to the contents in the success state.
12693         /// Reading from this pointer when `result_ok` is not set is undefined.
12694         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
12695         /// A pointer to the contents in the error state.
12696         /// Reading from this pointer when `result_ok` is set is undefined.
12697         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12698 }
12699 #[repr(C)]
12700 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12701 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12703 pub struct CResult_HTLCUpdateDecodeErrorZ {
12704         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12705         /// `err` or `result` depending on the state of `result_ok`.
12706         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
12707         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12708         pub result_ok: bool,
12709 }
12710 #[no_mangle]
12711 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12712 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
12713         CResult_HTLCUpdateDecodeErrorZ {
12714                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12715                         result: Box::into_raw(Box::new(o)),
12716                 },
12717                 result_ok: true,
12718         }
12719 }
12720 #[no_mangle]
12721 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12722 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
12723         CResult_HTLCUpdateDecodeErrorZ {
12724                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12725                         err: Box::into_raw(Box::new(e)),
12726                 },
12727                 result_ok: false,
12728         }
12729 }
12730 /// Checks if the given object is currently in the success state
12731 #[no_mangle]
12732 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
12733         o.result_ok
12734 }
12735 #[no_mangle]
12736 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12737 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
12738 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
12739         fn drop(&mut self) {
12740                 if self.result_ok {
12741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12743                         }
12744                 } else {
12745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12747                         }
12748                 }
12749         }
12750 }
12751 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
12752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12753                 let contents = if o.result_ok {
12754                         let result = unsafe { o.contents.result };
12755                         unsafe { o.contents.result = core::ptr::null_mut() };
12756                         CResult_HTLCUpdateDecodeErrorZPtr { result }
12757                 } else {
12758                         let err = unsafe { o.contents.err };
12759                         unsafe { o.contents.err = core::ptr::null_mut(); }
12760                         CResult_HTLCUpdateDecodeErrorZPtr { err }
12761                 };
12762                 Self {
12763                         contents,
12764                         result_ok: o.result_ok,
12765                 }
12766         }
12767 }
12768 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
12769         fn clone(&self) -> Self {
12770                 if self.result_ok {
12771                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12772                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
12773                         } }
12774                 } else {
12775                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12777                         } }
12778                 }
12779         }
12780 }
12781 #[no_mangle]
12782 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12783 /// but with all dynamically-allocated buffers duplicated in new buffers.
12784 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
12785 #[repr(C)]
12786 /// A tuple of 2 elements. See the individual fields for the types contained.
12787 pub struct C2Tuple_OutPointCVec_u8ZZ {
12788         /// The element at position 0
12789         pub a: crate::lightning::chain::transaction::OutPoint,
12790         /// The element at position 1
12791         pub b: crate::c_types::derived::CVec_u8Z,
12792 }
12793 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
12794         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
12795                 Self {
12796                         a: tup.0,
12797                         b: tup.1,
12798                 }
12799         }
12800 }
12801 impl C2Tuple_OutPointCVec_u8ZZ {
12802         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
12803                 (self.a, self.b)
12804         }
12805 }
12806 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
12807         fn clone(&self) -> Self {
12808                 Self {
12809                         a: Clone::clone(&self.a),
12810                         b: Clone::clone(&self.b),
12811                 }
12812         }
12813 }
12814 #[no_mangle]
12815 /// Creates a new tuple which has the same data as `orig`
12816 /// but with all dynamically-allocated buffers duplicated in new buffers.
12817 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
12818 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
12819 #[no_mangle]
12820 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
12821         C2Tuple_OutPointCVec_u8ZZ { a, b, }
12822 }
12823
12824 #[no_mangle]
12825 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
12826 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
12827 #[repr(C)]
12828 /// A tuple of 2 elements. See the individual fields for the types contained.
12829 pub struct C2Tuple_u32CVec_u8ZZ {
12830         /// The element at position 0
12831         pub a: u32,
12832         /// The element at position 1
12833         pub b: crate::c_types::derived::CVec_u8Z,
12834 }
12835 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
12836         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
12837                 Self {
12838                         a: tup.0,
12839                         b: tup.1,
12840                 }
12841         }
12842 }
12843 impl C2Tuple_u32CVec_u8ZZ {
12844         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
12845                 (self.a, self.b)
12846         }
12847 }
12848 impl Clone for C2Tuple_u32CVec_u8ZZ {
12849         fn clone(&self) -> Self {
12850                 Self {
12851                         a: Clone::clone(&self.a),
12852                         b: Clone::clone(&self.b),
12853                 }
12854         }
12855 }
12856 #[no_mangle]
12857 /// Creates a new tuple which has the same data as `orig`
12858 /// but with all dynamically-allocated buffers duplicated in new buffers.
12859 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
12860 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
12861 #[no_mangle]
12862 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
12863         C2Tuple_u32CVec_u8ZZ { a, b, }
12864 }
12865
12866 #[no_mangle]
12867 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
12868 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
12869 #[repr(C)]
12870 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12871 /// This corresponds to std::vector in C++
12872 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
12873         /// The elements in the array.
12874         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12875         pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
12876         /// The number of elements pointed to by `data`.
12877         pub datalen: usize
12878 }
12879 impl CVec_C2Tuple_u32CVec_u8ZZZ {
12880         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
12881                 if self.datalen == 0 { return Vec::new(); }
12882                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12883                 self.data = core::ptr::null_mut();
12884                 self.datalen = 0;
12885                 ret
12886         }
12887         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
12888                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12889         }
12890 }
12891 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
12892         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
12893                 let datalen = v.len();
12894                 let data = Box::into_raw(v.into_boxed_slice());
12895                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12896         }
12897 }
12898 #[no_mangle]
12899 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12900 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
12901 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
12902         fn drop(&mut self) {
12903                 if self.datalen == 0 { return; }
12904                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12905         }
12906 }
12907 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
12908         fn clone(&self) -> Self {
12909                 let mut res = Vec::new();
12910                 if self.datalen == 0 { return Self::from(res); }
12911                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12912                 Self::from(res)
12913         }
12914 }
12915 #[repr(C)]
12916 /// A tuple of 2 elements. See the individual fields for the types contained.
12917 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12918         /// The element at position 0
12919         pub a: crate::c_types::ThirtyTwoBytes,
12920         /// The element at position 1
12921         pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
12922 }
12923 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12924         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
12925                 Self {
12926                         a: tup.0,
12927                         b: tup.1,
12928                 }
12929         }
12930 }
12931 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12932         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
12933                 (self.a, self.b)
12934         }
12935 }
12936 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12937         fn clone(&self) -> Self {
12938                 Self {
12939                         a: Clone::clone(&self.a),
12940                         b: Clone::clone(&self.b),
12941                 }
12942         }
12943 }
12944 #[no_mangle]
12945 /// Creates a new tuple which has the same data as `orig`
12946 /// but with all dynamically-allocated buffers duplicated in new buffers.
12947 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
12948 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
12949 #[no_mangle]
12950 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12951         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
12952 }
12953
12954 #[no_mangle]
12955 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
12956 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
12957 #[repr(C)]
12958 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12959 /// This corresponds to std::vector in C++
12960 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12961         /// The elements in the array.
12962         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12963         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
12964         /// The number of elements pointed to by `data`.
12965         pub datalen: usize
12966 }
12967 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12968         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
12969                 if self.datalen == 0 { return Vec::new(); }
12970                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12971                 self.data = core::ptr::null_mut();
12972                 self.datalen = 0;
12973                 ret
12974         }
12975         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
12976                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12977         }
12978 }
12979 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12980         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
12981                 let datalen = v.len();
12982                 let data = Box::into_raw(v.into_boxed_slice());
12983                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12984         }
12985 }
12986 #[no_mangle]
12987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12988 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
12989 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12990         fn drop(&mut self) {
12991                 if self.datalen == 0 { return; }
12992                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12993         }
12994 }
12995 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12996         fn clone(&self) -> Self {
12997                 let mut res = Vec::new();
12998                 if self.datalen == 0 { return Self::from(res); }
12999                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13000                 Self::from(res)
13001         }
13002 }
13003 #[repr(C)]
13004 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
13005 /// This corresponds to std::vector in C++
13006 pub struct CVec_CommitmentTransactionZ {
13007         /// The elements in the array.
13008         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13009         pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
13010         /// The number of elements pointed to by `data`.
13011         pub datalen: usize
13012 }
13013 impl CVec_CommitmentTransactionZ {
13014         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
13015                 if self.datalen == 0 { return Vec::new(); }
13016                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13017                 self.data = core::ptr::null_mut();
13018                 self.datalen = 0;
13019                 ret
13020         }
13021         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
13022                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13023         }
13024 }
13025 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
13026         fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
13027                 let datalen = v.len();
13028                 let data = Box::into_raw(v.into_boxed_slice());
13029                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13030         }
13031 }
13032 #[no_mangle]
13033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13034 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
13035 impl Drop for CVec_CommitmentTransactionZ {
13036         fn drop(&mut self) {
13037                 if self.datalen == 0 { return; }
13038                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13039         }
13040 }
13041 impl Clone for CVec_CommitmentTransactionZ {
13042         fn clone(&self) -> Self {
13043                 let mut res = Vec::new();
13044                 if self.datalen == 0 { return Self::from(res); }
13045                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13046                 Self::from(res)
13047         }
13048 }
13049 #[repr(C)]
13050 /// A tuple of 2 elements. See the individual fields for the types contained.
13051 pub struct C2Tuple_u32TxOutZ {
13052         /// The element at position 0
13053         pub a: u32,
13054         /// The element at position 1
13055         pub b: crate::c_types::TxOut,
13056 }
13057 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
13058         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
13059                 Self {
13060                         a: tup.0,
13061                         b: tup.1,
13062                 }
13063         }
13064 }
13065 impl C2Tuple_u32TxOutZ {
13066         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
13067                 (self.a, self.b)
13068         }
13069 }
13070 impl Clone for C2Tuple_u32TxOutZ {
13071         fn clone(&self) -> Self {
13072                 Self {
13073                         a: Clone::clone(&self.a),
13074                         b: Clone::clone(&self.b),
13075                 }
13076         }
13077 }
13078 #[no_mangle]
13079 /// Creates a new tuple which has the same data as `orig`
13080 /// but with all dynamically-allocated buffers duplicated in new buffers.
13081 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
13082 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
13083 #[no_mangle]
13084 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
13085         C2Tuple_u32TxOutZ { a, b, }
13086 }
13087
13088 #[no_mangle]
13089 /// Frees any resources used by the C2Tuple_u32TxOutZ.
13090 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
13091 #[repr(C)]
13092 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
13093 /// This corresponds to std::vector in C++
13094 pub struct CVec_C2Tuple_u32TxOutZZ {
13095         /// The elements in the array.
13096         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13097         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
13098         /// The number of elements pointed to by `data`.
13099         pub datalen: usize
13100 }
13101 impl CVec_C2Tuple_u32TxOutZZ {
13102         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
13103                 if self.datalen == 0 { return Vec::new(); }
13104                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13105                 self.data = core::ptr::null_mut();
13106                 self.datalen = 0;
13107                 ret
13108         }
13109         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
13110                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13111         }
13112 }
13113 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
13114         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
13115                 let datalen = v.len();
13116                 let data = Box::into_raw(v.into_boxed_slice());
13117                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13118         }
13119 }
13120 #[no_mangle]
13121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13122 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
13123 impl Drop for CVec_C2Tuple_u32TxOutZZ {
13124         fn drop(&mut self) {
13125                 if self.datalen == 0 { return; }
13126                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13127         }
13128 }
13129 impl Clone for CVec_C2Tuple_u32TxOutZZ {
13130         fn clone(&self) -> Self {
13131                 let mut res = Vec::new();
13132                 if self.datalen == 0 { return Self::from(res); }
13133                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13134                 Self::from(res)
13135         }
13136 }
13137 #[repr(C)]
13138 /// A tuple of 2 elements. See the individual fields for the types contained.
13139 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13140         /// The element at position 0
13141         pub a: crate::c_types::ThirtyTwoBytes,
13142         /// The element at position 1
13143         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
13144 }
13145 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13146         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
13147                 Self {
13148                         a: tup.0,
13149                         b: tup.1,
13150                 }
13151         }
13152 }
13153 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13154         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
13155                 (self.a, self.b)
13156         }
13157 }
13158 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13159         fn clone(&self) -> Self {
13160                 Self {
13161                         a: Clone::clone(&self.a),
13162                         b: Clone::clone(&self.b),
13163                 }
13164         }
13165 }
13166 #[no_mangle]
13167 /// Creates a new tuple which has the same data as `orig`
13168 /// but with all dynamically-allocated buffers duplicated in new buffers.
13169 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
13170 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
13171 #[no_mangle]
13172 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
13173         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
13174 }
13175
13176 #[no_mangle]
13177 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
13178 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
13179 #[repr(C)]
13180 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
13181 /// This corresponds to std::vector in C++
13182 pub struct CVec_TransactionOutputsZ {
13183         /// The elements in the array.
13184         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13185         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
13186         /// The number of elements pointed to by `data`.
13187         pub datalen: usize
13188 }
13189 impl CVec_TransactionOutputsZ {
13190         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
13191                 if self.datalen == 0 { return Vec::new(); }
13192                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13193                 self.data = core::ptr::null_mut();
13194                 self.datalen = 0;
13195                 ret
13196         }
13197         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
13198                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13199         }
13200 }
13201 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
13202         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
13203                 let datalen = v.len();
13204                 let data = Box::into_raw(v.into_boxed_slice());
13205                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13206         }
13207 }
13208 #[no_mangle]
13209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13210 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
13211 impl Drop for CVec_TransactionOutputsZ {
13212         fn drop(&mut self) {
13213                 if self.datalen == 0 { return; }
13214                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13215         }
13216 }
13217 impl Clone for CVec_TransactionOutputsZ {
13218         fn clone(&self) -> Self {
13219                 let mut res = Vec::new();
13220                 if self.datalen == 0 { return Self::from(res); }
13221                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13222                 Self::from(res)
13223         }
13224 }
13225 #[repr(C)]
13226 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
13227 /// This corresponds to std::vector in C++
13228 pub struct CVec_BalanceZ {
13229         /// The elements in the array.
13230         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13231         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
13232         /// The number of elements pointed to by `data`.
13233         pub datalen: usize
13234 }
13235 impl CVec_BalanceZ {
13236         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
13237                 if self.datalen == 0 { return Vec::new(); }
13238                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13239                 self.data = core::ptr::null_mut();
13240                 self.datalen = 0;
13241                 ret
13242         }
13243         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
13244                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13245         }
13246 }
13247 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
13248         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
13249                 let datalen = v.len();
13250                 let data = Box::into_raw(v.into_boxed_slice());
13251                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13252         }
13253 }
13254 #[no_mangle]
13255 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13256 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
13257 impl Drop for CVec_BalanceZ {
13258         fn drop(&mut self) {
13259                 if self.datalen == 0 { return; }
13260                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13261         }
13262 }
13263 impl Clone for CVec_BalanceZ {
13264         fn clone(&self) -> Self {
13265                 let mut res = Vec::new();
13266                 if self.datalen == 0 { return Self::from(res); }
13267                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13268                 Self::from(res)
13269         }
13270 }
13271 #[repr(C)]
13272 /// A tuple of 2 elements. See the individual fields for the types contained.
13273 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13274         /// The element at position 0
13275         pub a: crate::c_types::ThirtyTwoBytes,
13276         /// The element at position 1
13277         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
13278 }
13279 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13280         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
13281                 Self {
13282                         a: tup.0,
13283                         b: tup.1,
13284                 }
13285         }
13286 }
13287 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13288         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
13289                 (self.a, self.b)
13290         }
13291 }
13292 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13293         fn clone(&self) -> Self {
13294                 Self {
13295                         a: Clone::clone(&self.a),
13296                         b: Clone::clone(&self.b),
13297                 }
13298         }
13299 }
13300 #[no_mangle]
13301 /// Creates a new tuple which has the same data as `orig`
13302 /// but with all dynamically-allocated buffers duplicated in new buffers.
13303 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
13304 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
13305 #[no_mangle]
13306 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
13307         C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
13308 }
13309
13310 #[no_mangle]
13311 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
13312 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
13313 #[repr(C)]
13314 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
13315 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13316         /// A pointer to the contents in the success state.
13317         /// Reading from this pointer when `result_ok` is not set is undefined.
13318         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
13319         /// A pointer to the contents in the error state.
13320         /// Reading from this pointer when `result_ok` is set is undefined.
13321         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13322 }
13323 #[repr(C)]
13324 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
13325 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13327 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13328         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
13329         /// `err` or `result` depending on the state of `result_ok`.
13330         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
13331         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
13332         pub result_ok: bool,
13333 }
13334 #[no_mangle]
13335 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
13336 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13337         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13338                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13339                         result: Box::into_raw(Box::new(o)),
13340                 },
13341                 result_ok: true,
13342         }
13343 }
13344 #[no_mangle]
13345 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
13346 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13347         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13348                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13349                         err: Box::into_raw(Box::new(e)),
13350                 },
13351                 result_ok: false,
13352         }
13353 }
13354 /// Checks if the given object is currently in the success state
13355 #[no_mangle]
13356 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
13357         o.result_ok
13358 }
13359 #[no_mangle]
13360 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
13361 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
13362 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13363         fn drop(&mut self) {
13364                 if self.result_ok {
13365                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13366                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13367                         }
13368                 } else {
13369                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13370                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13371                         }
13372                 }
13373         }
13374 }
13375 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13376         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13377                 let contents = if o.result_ok {
13378                         let result = unsafe { o.contents.result };
13379                         unsafe { o.contents.result = core::ptr::null_mut() };
13380                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
13381                 } else {
13382                         let err = unsafe { o.contents.err };
13383                         unsafe { o.contents.err = core::ptr::null_mut(); }
13384                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
13385                 };
13386                 Self {
13387                         contents,
13388                         result_ok: o.result_ok,
13389                 }
13390         }
13391 }
13392 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
13393         fn clone(&self) -> Self {
13394                 if self.result_ok {
13395                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13396                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
13397                         } }
13398                 } else {
13399                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
13400                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13401                         } }
13402                 }
13403         }
13404 }
13405 #[no_mangle]
13406 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
13407 /// but with all dynamically-allocated buffers duplicated in new buffers.
13408 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
13409 #[repr(C)]
13410 /// A tuple of 2 elements. See the individual fields for the types contained.
13411 pub struct C2Tuple_PublicKeyTypeZ {
13412         /// The element at position 0
13413         pub a: crate::c_types::PublicKey,
13414         /// The element at position 1
13415         pub b: crate::lightning::ln::wire::Type,
13416 }
13417 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
13418         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
13419                 Self {
13420                         a: tup.0,
13421                         b: tup.1,
13422                 }
13423         }
13424 }
13425 impl C2Tuple_PublicKeyTypeZ {
13426         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
13427                 (self.a, self.b)
13428         }
13429 }
13430 impl Clone for C2Tuple_PublicKeyTypeZ {
13431         fn clone(&self) -> Self {
13432                 Self {
13433                         a: Clone::clone(&self.a),
13434                         b: Clone::clone(&self.b),
13435                 }
13436         }
13437 }
13438 #[no_mangle]
13439 /// Creates a new tuple which has the same data as `orig`
13440 /// but with all dynamically-allocated buffers duplicated in new buffers.
13441 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
13442 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13443 #[no_mangle]
13444 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
13445         C2Tuple_PublicKeyTypeZ { a, b, }
13446 }
13447
13448 #[no_mangle]
13449 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13450 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
13451 #[repr(C)]
13452 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13453 /// This corresponds to std::vector in C++
13454 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
13455         /// The elements in the array.
13456         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13457         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
13458         /// The number of elements pointed to by `data`.
13459         pub datalen: usize
13460 }
13461 impl CVec_C2Tuple_PublicKeyTypeZZ {
13462         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
13463                 if self.datalen == 0 { return Vec::new(); }
13464                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13465                 self.data = core::ptr::null_mut();
13466                 self.datalen = 0;
13467                 ret
13468         }
13469         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
13470                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13471         }
13472 }
13473 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
13474         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
13475                 let datalen = v.len();
13476                 let data = Box::into_raw(v.into_boxed_slice());
13477                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13478         }
13479 }
13480 #[no_mangle]
13481 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13482 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
13483 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
13484         fn drop(&mut self) {
13485                 if self.datalen == 0 { return; }
13486                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13487         }
13488 }
13489 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
13490         fn clone(&self) -> Self {
13491                 let mut res = Vec::new();
13492                 if self.datalen == 0 { return Self::from(res); }
13493                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13494                 Self::from(res)
13495         }
13496 }
13497 #[repr(C)]
13498 /// A tuple of 2 elements. See the individual fields for the types contained.
13499 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
13500         /// The element at position 0
13501         pub a: crate::c_types::PublicKey,
13502         /// The element at position 1
13503         pub b: crate::c_types::derived::CVec_SocketAddressZ,
13504 }
13505 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13506         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
13507                 Self {
13508                         a: tup.0,
13509                         b: tup.1,
13510                 }
13511         }
13512 }
13513 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
13514         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
13515                 (self.a, self.b)
13516         }
13517 }
13518 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13519         fn clone(&self) -> Self {
13520                 Self {
13521                         a: Clone::clone(&self.a),
13522                         b: Clone::clone(&self.b),
13523                 }
13524         }
13525 }
13526 #[no_mangle]
13527 /// Creates a new tuple which has the same data as `orig`
13528 /// but with all dynamically-allocated buffers duplicated in new buffers.
13529 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
13530 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
13531 #[no_mangle]
13532 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
13533         C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
13534 }
13535
13536 #[no_mangle]
13537 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
13538 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
13539 #[repr(C)]
13540 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13541 /// This corresponds to std::vector in C++
13542 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13543         /// The elements in the array.
13544         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13545         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
13546         /// The number of elements pointed to by `data`.
13547         pub datalen: usize
13548 }
13549 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13550         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
13551                 if self.datalen == 0 { return Vec::new(); }
13552                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13553                 self.data = core::ptr::null_mut();
13554                 self.datalen = 0;
13555                 ret
13556         }
13557         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
13558                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13559         }
13560 }
13561 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13562         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
13563                 let datalen = v.len();
13564                 let data = Box::into_raw(v.into_boxed_slice());
13565                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13566         }
13567 }
13568 #[no_mangle]
13569 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13570 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
13571 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13572         fn drop(&mut self) {
13573                 if self.datalen == 0 { return; }
13574                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13575         }
13576 }
13577 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13578         fn clone(&self) -> Self {
13579                 let mut res = Vec::new();
13580                 if self.datalen == 0 { return Self::from(res); }
13581                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13582                 Self::from(res)
13583         }
13584 }
13585 #[repr(C)]
13586 #[derive(Clone)]
13587 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13588 pub enum COption_OnionMessageContentsZ {
13589         /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13590         Some(crate::lightning::onion_message::packet::OnionMessageContents),
13591         /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
13592         None
13593 }
13594 impl COption_OnionMessageContentsZ {
13595         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13596                 if let Self::None = self { false } else { true }
13597         }
13598         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13599                 !self.is_some()
13600         }
13601         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
13602                 if let Self::Some(v) = self { v } else { unreachable!() }
13603         }
13604 }
13605 #[no_mangle]
13606 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
13607 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
13608         COption_OnionMessageContentsZ::Some(o)
13609 }
13610 #[no_mangle]
13611 /// Constructs a new COption_OnionMessageContentsZ containing nothing
13612 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
13613         COption_OnionMessageContentsZ::None
13614 }
13615 #[no_mangle]
13616 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
13617 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
13618 #[no_mangle]
13619 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
13620 /// but with all dynamically-allocated buffers duplicated in new buffers.
13621 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
13622 #[repr(C)]
13623 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13624 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13625         /// A pointer to the contents in the success state.
13626         /// Reading from this pointer when `result_ok` is not set is undefined.
13627         pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
13628         /// A pointer to the contents in the error state.
13629         /// Reading from this pointer when `result_ok` is set is undefined.
13630         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13631 }
13632 #[repr(C)]
13633 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13634 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13636 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
13637         /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13638         /// `err` or `result` depending on the state of `result_ok`.
13639         pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
13640         /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13641         pub result_ok: bool,
13642 }
13643 #[no_mangle]
13644 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
13645 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13646         CResult_COption_OnionMessageContentsZDecodeErrorZ {
13647                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13648                         result: Box::into_raw(Box::new(o)),
13649                 },
13650                 result_ok: true,
13651         }
13652 }
13653 #[no_mangle]
13654 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
13655 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13656         CResult_COption_OnionMessageContentsZDecodeErrorZ {
13657                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13658                         err: Box::into_raw(Box::new(e)),
13659                 },
13660                 result_ok: false,
13661         }
13662 }
13663 /// Checks if the given object is currently in the success state
13664 #[no_mangle]
13665 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
13666         o.result_ok
13667 }
13668 #[no_mangle]
13669 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
13670 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
13671 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13672         fn drop(&mut self) {
13673                 if self.result_ok {
13674                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13675                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13676                         }
13677                 } else {
13678                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13679                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13680                         }
13681                 }
13682         }
13683 }
13684 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13685         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13686                 let contents = if o.result_ok {
13687                         let result = unsafe { o.contents.result };
13688                         unsafe { o.contents.result = core::ptr::null_mut() };
13689                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
13690                 } else {
13691                         let err = unsafe { o.contents.err };
13692                         unsafe { o.contents.err = core::ptr::null_mut(); }
13693                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
13694                 };
13695                 Self {
13696                         contents,
13697                         result_ok: o.result_ok,
13698                 }
13699         }
13700 }
13701 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13702         fn clone(&self) -> Self {
13703                 if self.result_ok {
13704                         Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13705                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
13706                         } }
13707                 } else {
13708                         Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13709                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13710                         } }
13711                 }
13712         }
13713 }
13714 #[no_mangle]
13715 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
13716 /// but with all dynamically-allocated buffers duplicated in new buffers.
13717 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
13718 #[repr(C)]
13719 /// A tuple of 3 elements. See the individual fields for the types contained.
13720 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13721         /// The element at position 0
13722         pub a: crate::lightning::onion_message::packet::OnionMessageContents,
13723         /// The element at position 1
13724         pub b: crate::lightning::onion_message::messenger::Destination,
13725         /// The element at position 2
13726         pub c: crate::lightning::blinded_path::BlindedPath,
13727 }
13728 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13729         fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
13730                 Self {
13731                         a: tup.0,
13732                         b: tup.1,
13733                         c: tup.2,
13734                 }
13735         }
13736 }
13737 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13738         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) {
13739                 (self.a, self.b, self.c)
13740         }
13741 }
13742 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13743         fn clone(&self) -> Self {
13744                 Self {
13745                         a: Clone::clone(&self.a),
13746                         b: Clone::clone(&self.b),
13747                         c: Clone::clone(&self.c),
13748                 }
13749         }
13750 }
13751 #[no_mangle]
13752 /// Creates a new tuple which has the same data as `orig`
13753 /// but with all dynamically-allocated buffers duplicated in new buffers.
13754 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
13755 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
13756 #[no_mangle]
13757 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13758         C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
13759 }
13760
13761 #[no_mangle]
13762 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
13763 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
13764 #[repr(C)]
13765 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13766 /// This corresponds to std::vector in C++
13767 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13768         /// The elements in the array.
13769         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13770         pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
13771         /// The number of elements pointed to by `data`.
13772         pub datalen: usize
13773 }
13774 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13775         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
13776                 if self.datalen == 0 { return Vec::new(); }
13777                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13778                 self.data = core::ptr::null_mut();
13779                 self.datalen = 0;
13780                 ret
13781         }
13782         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
13783                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13784         }
13785 }
13786 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13787         fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
13788                 let datalen = v.len();
13789                 let data = Box::into_raw(v.into_boxed_slice());
13790                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13791         }
13792 }
13793 #[no_mangle]
13794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13795 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
13796 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13797         fn drop(&mut self) {
13798                 if self.datalen == 0 { return; }
13799                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13800         }
13801 }
13802 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13803         fn clone(&self) -> Self {
13804                 let mut res = Vec::new();
13805                 if self.datalen == 0 { return Self::from(res); }
13806                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13807                 Self::from(res)
13808         }
13809 }
13810 #[repr(C)]
13811 #[derive(Clone)]
13812 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
13813 pub enum COption_TypeZ {
13814         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13815         Some(crate::lightning::ln::wire::Type),
13816         /// When we're in this state, this COption_TypeZ contains nothing
13817         None
13818 }
13819 impl COption_TypeZ {
13820         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13821                 if let Self::None = self { false } else { true }
13822         }
13823         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13824                 !self.is_some()
13825         }
13826         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
13827                 if let Self::Some(v) = self { v } else { unreachable!() }
13828         }
13829 }
13830 #[no_mangle]
13831 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13832 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
13833         COption_TypeZ::Some(o)
13834 }
13835 #[no_mangle]
13836 /// Constructs a new COption_TypeZ containing nothing
13837 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
13838         COption_TypeZ::None
13839 }
13840 #[no_mangle]
13841 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13842 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
13843 #[no_mangle]
13844 /// Creates a new COption_TypeZ which has the same data as `orig`
13845 /// but with all dynamically-allocated buffers duplicated in new buffers.
13846 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
13847 #[repr(C)]
13848 /// The contents of CResult_COption_TypeZDecodeErrorZ
13849 pub union CResult_COption_TypeZDecodeErrorZPtr {
13850         /// A pointer to the contents in the success state.
13851         /// Reading from this pointer when `result_ok` is not set is undefined.
13852         pub result: *mut crate::c_types::derived::COption_TypeZ,
13853         /// A pointer to the contents in the error state.
13854         /// Reading from this pointer when `result_ok` is set is undefined.
13855         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13856 }
13857 #[repr(C)]
13858 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13859 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13861 pub struct CResult_COption_TypeZDecodeErrorZ {
13862         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13863         /// `err` or `result` depending on the state of `result_ok`.
13864         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
13865         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13866         pub result_ok: bool,
13867 }
13868 #[no_mangle]
13869 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13870 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
13871         CResult_COption_TypeZDecodeErrorZ {
13872                 contents: CResult_COption_TypeZDecodeErrorZPtr {
13873                         result: Box::into_raw(Box::new(o)),
13874                 },
13875                 result_ok: true,
13876         }
13877 }
13878 #[no_mangle]
13879 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13880 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
13881         CResult_COption_TypeZDecodeErrorZ {
13882                 contents: CResult_COption_TypeZDecodeErrorZPtr {
13883                         err: Box::into_raw(Box::new(e)),
13884                 },
13885                 result_ok: false,
13886         }
13887 }
13888 /// Checks if the given object is currently in the success state
13889 #[no_mangle]
13890 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
13891         o.result_ok
13892 }
13893 #[no_mangle]
13894 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13895 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
13896 impl Drop for CResult_COption_TypeZDecodeErrorZ {
13897         fn drop(&mut self) {
13898                 if self.result_ok {
13899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13901                         }
13902                 } else {
13903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13905                         }
13906                 }
13907         }
13908 }
13909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
13910         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13911                 let contents = if o.result_ok {
13912                         let result = unsafe { o.contents.result };
13913                         unsafe { o.contents.result = core::ptr::null_mut() };
13914                         CResult_COption_TypeZDecodeErrorZPtr { result }
13915                 } else {
13916                         let err = unsafe { o.contents.err };
13917                         unsafe { o.contents.err = core::ptr::null_mut(); }
13918                         CResult_COption_TypeZDecodeErrorZPtr { err }
13919                 };
13920                 Self {
13921                         contents,
13922                         result_ok: o.result_ok,
13923                 }
13924         }
13925 }
13926 impl Clone for CResult_COption_TypeZDecodeErrorZ {
13927         fn clone(&self) -> Self {
13928                 if self.result_ok {
13929                         Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
13930                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
13931                         } }
13932                 } else {
13933                         Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
13934                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13935                         } }
13936                 }
13937         }
13938 }
13939 #[no_mangle]
13940 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
13941 /// but with all dynamically-allocated buffers duplicated in new buffers.
13942 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
13943 #[repr(C)]
13944 #[derive(Clone)]
13945 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13946 pub enum COption_SocketAddressZ {
13947         /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13948         Some(crate::lightning::ln::msgs::SocketAddress),
13949         /// When we're in this state, this COption_SocketAddressZ contains nothing
13950         None
13951 }
13952 impl COption_SocketAddressZ {
13953         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13954                 if let Self::None = self { false } else { true }
13955         }
13956         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13957                 !self.is_some()
13958         }
13959         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
13960                 if let Self::Some(v) = self { v } else { unreachable!() }
13961         }
13962 }
13963 #[no_mangle]
13964 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
13965 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
13966         COption_SocketAddressZ::Some(o)
13967 }
13968 #[no_mangle]
13969 /// Constructs a new COption_SocketAddressZ containing nothing
13970 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
13971         COption_SocketAddressZ::None
13972 }
13973 #[no_mangle]
13974 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
13975 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
13976 #[no_mangle]
13977 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
13978 /// but with all dynamically-allocated buffers duplicated in new buffers.
13979 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
13980 #[repr(C)]
13981 /// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13982 /// This corresponds to std::vector in C++
13983 pub struct CVec_PeerDetailsZ {
13984         /// The elements in the array.
13985         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13986         pub data: *mut crate::lightning::ln::peer_handler::PeerDetails,
13987         /// The number of elements pointed to by `data`.
13988         pub datalen: usize
13989 }
13990 impl CVec_PeerDetailsZ {
13991         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::peer_handler::PeerDetails> {
13992                 if self.datalen == 0 { return Vec::new(); }
13993                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13994                 self.data = core::ptr::null_mut();
13995                 self.datalen = 0;
13996                 ret
13997         }
13998         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] {
13999                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14000         }
14001 }
14002 impl From<Vec<crate::lightning::ln::peer_handler::PeerDetails>> for CVec_PeerDetailsZ {
14003         fn from(v: Vec<crate::lightning::ln::peer_handler::PeerDetails>) -> Self {
14004                 let datalen = v.len();
14005                 let data = Box::into_raw(v.into_boxed_slice());
14006                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14007         }
14008 }
14009 #[no_mangle]
14010 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14011 pub extern "C" fn CVec_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { }
14012 impl Drop for CVec_PeerDetailsZ {
14013         fn drop(&mut self) {
14014                 if self.datalen == 0 { return; }
14015                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14016         }
14017 }
14018 #[repr(C)]
14019 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
14020 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
14021         /// A pointer to the contents in the success state.
14022         /// Reading from this pointer when `result_ok` is not set is undefined.
14023         pub result: *mut crate::c_types::derived::CVec_u8Z,
14024         /// A pointer to the contents in the error state.
14025         /// Reading from this pointer when `result_ok` is set is undefined.
14026         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
14027 }
14028 #[repr(C)]
14029 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
14030 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
14031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14032 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
14033         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
14034         /// `err` or `result` depending on the state of `result_ok`.
14035         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
14036         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
14037         pub result_ok: bool,
14038 }
14039 #[no_mangle]
14040 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
14041 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
14042         CResult_CVec_u8ZPeerHandleErrorZ {
14043                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14044                         result: Box::into_raw(Box::new(o)),
14045                 },
14046                 result_ok: true,
14047         }
14048 }
14049 #[no_mangle]
14050 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
14051 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
14052         CResult_CVec_u8ZPeerHandleErrorZ {
14053                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14054                         err: Box::into_raw(Box::new(e)),
14055                 },
14056                 result_ok: false,
14057         }
14058 }
14059 /// Checks if the given object is currently in the success state
14060 #[no_mangle]
14061 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
14062         o.result_ok
14063 }
14064 #[no_mangle]
14065 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
14066 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
14067 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
14068         fn drop(&mut self) {
14069                 if self.result_ok {
14070                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14071                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14072                         }
14073                 } else {
14074                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14075                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14076                         }
14077                 }
14078         }
14079 }
14080 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
14081         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14082                 let contents = if o.result_ok {
14083                         let result = unsafe { o.contents.result };
14084                         unsafe { o.contents.result = core::ptr::null_mut() };
14085                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
14086                 } else {
14087                         let err = unsafe { o.contents.err };
14088                         unsafe { o.contents.err = core::ptr::null_mut(); }
14089                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
14090                 };
14091                 Self {
14092                         contents,
14093                         result_ok: o.result_ok,
14094                 }
14095         }
14096 }
14097 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
14098         fn clone(&self) -> Self {
14099                 if self.result_ok {
14100                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14101                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14102                         } }
14103                 } else {
14104                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
14105                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14106                         } }
14107                 }
14108         }
14109 }
14110 #[no_mangle]
14111 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
14112 /// but with all dynamically-allocated buffers duplicated in new buffers.
14113 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
14114 #[repr(C)]
14115 /// The contents of CResult_NonePeerHandleErrorZ
14116 pub union CResult_NonePeerHandleErrorZPtr {
14117         /// Note that this value is always NULL, as there are no contents in the OK variant
14118         pub result: *mut core::ffi::c_void,
14119         /// A pointer to the contents in the error state.
14120         /// Reading from this pointer when `result_ok` is set is undefined.
14121         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
14122 }
14123 #[repr(C)]
14124 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
14125 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
14126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14127 pub struct CResult_NonePeerHandleErrorZ {
14128         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
14129         /// `err` or `result` depending on the state of `result_ok`.
14130         pub contents: CResult_NonePeerHandleErrorZPtr,
14131         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
14132         pub result_ok: bool,
14133 }
14134 #[no_mangle]
14135 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
14136 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
14137         CResult_NonePeerHandleErrorZ {
14138                 contents: CResult_NonePeerHandleErrorZPtr {
14139                         result: core::ptr::null_mut(),
14140                 },
14141                 result_ok: true,
14142         }
14143 }
14144 #[no_mangle]
14145 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
14146 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
14147         CResult_NonePeerHandleErrorZ {
14148                 contents: CResult_NonePeerHandleErrorZPtr {
14149                         err: Box::into_raw(Box::new(e)),
14150                 },
14151                 result_ok: false,
14152         }
14153 }
14154 /// Checks if the given object is currently in the success state
14155 #[no_mangle]
14156 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
14157         o.result_ok
14158 }
14159 #[no_mangle]
14160 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
14161 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
14162 impl Drop for CResult_NonePeerHandleErrorZ {
14163         fn drop(&mut self) {
14164                 if self.result_ok {
14165                 } else {
14166                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14167                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14168                         }
14169                 }
14170         }
14171 }
14172 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
14173         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14174                 let contents = if o.result_ok {
14175                         let _ = unsafe { Box::from_raw(o.contents.result) };
14176                         o.contents.result = core::ptr::null_mut();
14177                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
14178                 } else {
14179                         let err = unsafe { o.contents.err };
14180                         unsafe { o.contents.err = core::ptr::null_mut(); }
14181                         CResult_NonePeerHandleErrorZPtr { err }
14182                 };
14183                 Self {
14184                         contents,
14185                         result_ok: o.result_ok,
14186                 }
14187         }
14188 }
14189 impl Clone for CResult_NonePeerHandleErrorZ {
14190         fn clone(&self) -> Self {
14191                 if self.result_ok {
14192                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
14193                                 result: core::ptr::null_mut()
14194                         } }
14195                 } else {
14196                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
14197                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14198                         } }
14199                 }
14200         }
14201 }
14202 #[no_mangle]
14203 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
14204 /// but with all dynamically-allocated buffers duplicated in new buffers.
14205 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
14206 #[repr(C)]
14207 /// The contents of CResult_boolPeerHandleErrorZ
14208 pub union CResult_boolPeerHandleErrorZPtr {
14209         /// A pointer to the contents in the success state.
14210         /// Reading from this pointer when `result_ok` is not set is undefined.
14211         pub result: *mut bool,
14212         /// A pointer to the contents in the error state.
14213         /// Reading from this pointer when `result_ok` is set is undefined.
14214         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
14215 }
14216 #[repr(C)]
14217 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
14218 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
14219 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14220 pub struct CResult_boolPeerHandleErrorZ {
14221         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
14222         /// `err` or `result` depending on the state of `result_ok`.
14223         pub contents: CResult_boolPeerHandleErrorZPtr,
14224         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
14225         pub result_ok: bool,
14226 }
14227 #[no_mangle]
14228 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
14229 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
14230         CResult_boolPeerHandleErrorZ {
14231                 contents: CResult_boolPeerHandleErrorZPtr {
14232                         result: Box::into_raw(Box::new(o)),
14233                 },
14234                 result_ok: true,
14235         }
14236 }
14237 #[no_mangle]
14238 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
14239 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
14240         CResult_boolPeerHandleErrorZ {
14241                 contents: CResult_boolPeerHandleErrorZPtr {
14242                         err: Box::into_raw(Box::new(e)),
14243                 },
14244                 result_ok: false,
14245         }
14246 }
14247 /// Checks if the given object is currently in the success state
14248 #[no_mangle]
14249 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
14250         o.result_ok
14251 }
14252 #[no_mangle]
14253 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
14254 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
14255 impl Drop for CResult_boolPeerHandleErrorZ {
14256         fn drop(&mut self) {
14257                 if self.result_ok {
14258                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14259                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14260                         }
14261                 } else {
14262                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14263                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14264                         }
14265                 }
14266         }
14267 }
14268 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
14269         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
14270                 let contents = if o.result_ok {
14271                         let result = unsafe { o.contents.result };
14272                         unsafe { o.contents.result = core::ptr::null_mut() };
14273                         CResult_boolPeerHandleErrorZPtr { result }
14274                 } else {
14275                         let err = unsafe { o.contents.err };
14276                         unsafe { o.contents.err = core::ptr::null_mut(); }
14277                         CResult_boolPeerHandleErrorZPtr { err }
14278                 };
14279                 Self {
14280                         contents,
14281                         result_ok: o.result_ok,
14282                 }
14283         }
14284 }
14285 impl Clone for CResult_boolPeerHandleErrorZ {
14286         fn clone(&self) -> Self {
14287                 if self.result_ok {
14288                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
14289                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
14290                         } }
14291                 } else {
14292                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
14293                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
14294                         } }
14295                 }
14296         }
14297 }
14298 #[no_mangle]
14299 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
14300 /// but with all dynamically-allocated buffers duplicated in new buffers.
14301 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
14302 #[repr(C)]
14303 /// The contents of CResult_u32GraphSyncErrorZ
14304 pub union CResult_u32GraphSyncErrorZPtr {
14305         /// A pointer to the contents in the success state.
14306         /// Reading from this pointer when `result_ok` is not set is undefined.
14307         pub result: *mut u32,
14308         /// A pointer to the contents in the error state.
14309         /// Reading from this pointer when `result_ok` is set is undefined.
14310         pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
14311 }
14312 #[repr(C)]
14313 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
14314 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
14315 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14316 pub struct CResult_u32GraphSyncErrorZ {
14317         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
14318         /// `err` or `result` depending on the state of `result_ok`.
14319         pub contents: CResult_u32GraphSyncErrorZPtr,
14320         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
14321         pub result_ok: bool,
14322 }
14323 #[no_mangle]
14324 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
14325 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
14326         CResult_u32GraphSyncErrorZ {
14327                 contents: CResult_u32GraphSyncErrorZPtr {
14328                         result: Box::into_raw(Box::new(o)),
14329                 },
14330                 result_ok: true,
14331         }
14332 }
14333 #[no_mangle]
14334 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
14335 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
14336         CResult_u32GraphSyncErrorZ {
14337                 contents: CResult_u32GraphSyncErrorZPtr {
14338                         err: Box::into_raw(Box::new(e)),
14339                 },
14340                 result_ok: false,
14341         }
14342 }
14343 /// Checks if the given object is currently in the success state
14344 #[no_mangle]
14345 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
14346         o.result_ok
14347 }
14348 #[no_mangle]
14349 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
14350 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
14351 impl Drop for CResult_u32GraphSyncErrorZ {
14352         fn drop(&mut self) {
14353                 if self.result_ok {
14354                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14355                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14356                         }
14357                 } else {
14358                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14359                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14360                         }
14361                 }
14362         }
14363 }
14364 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
14365         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
14366                 let contents = if o.result_ok {
14367                         let result = unsafe { o.contents.result };
14368                         unsafe { o.contents.result = core::ptr::null_mut() };
14369                         CResult_u32GraphSyncErrorZPtr { result }
14370                 } else {
14371                         let err = unsafe { o.contents.err };
14372                         unsafe { o.contents.err = core::ptr::null_mut(); }
14373                         CResult_u32GraphSyncErrorZPtr { err }
14374                 };
14375                 Self {
14376                         contents,
14377                         result_ok: o.result_ok,
14378                 }
14379         }
14380 }
14381 #[repr(C)]
14382 /// The contents of CResult_CVec_u8ZIOErrorZ
14383 pub union CResult_CVec_u8ZIOErrorZPtr {
14384         /// A pointer to the contents in the success state.
14385         /// Reading from this pointer when `result_ok` is not set is undefined.
14386         pub result: *mut crate::c_types::derived::CVec_u8Z,
14387         /// A pointer to the contents in the error state.
14388         /// Reading from this pointer when `result_ok` is set is undefined.
14389         pub err: *mut crate::c_types::IOError,
14390 }
14391 #[repr(C)]
14392 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
14393 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
14394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14395 pub struct CResult_CVec_u8ZIOErrorZ {
14396         /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
14397         /// `err` or `result` depending on the state of `result_ok`.
14398         pub contents: CResult_CVec_u8ZIOErrorZPtr,
14399         /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
14400         pub result_ok: bool,
14401 }
14402 #[no_mangle]
14403 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
14404 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
14405         CResult_CVec_u8ZIOErrorZ {
14406                 contents: CResult_CVec_u8ZIOErrorZPtr {
14407                         result: Box::into_raw(Box::new(o)),
14408                 },
14409                 result_ok: true,
14410         }
14411 }
14412 #[no_mangle]
14413 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
14414 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
14415         CResult_CVec_u8ZIOErrorZ {
14416                 contents: CResult_CVec_u8ZIOErrorZPtr {
14417                         err: Box::into_raw(Box::new(e)),
14418                 },
14419                 result_ok: false,
14420         }
14421 }
14422 /// Checks if the given object is currently in the success state
14423 #[no_mangle]
14424 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
14425         o.result_ok
14426 }
14427 #[no_mangle]
14428 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
14429 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
14430 impl Drop for CResult_CVec_u8ZIOErrorZ {
14431         fn drop(&mut self) {
14432                 if self.result_ok {
14433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14435                         }
14436                 } else {
14437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14439                         }
14440                 }
14441         }
14442 }
14443 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
14444         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
14445                 let contents = if o.result_ok {
14446                         let result = unsafe { o.contents.result };
14447                         unsafe { o.contents.result = core::ptr::null_mut() };
14448                         CResult_CVec_u8ZIOErrorZPtr { result }
14449                 } else {
14450                         let err = unsafe { o.contents.err };
14451                         unsafe { o.contents.err = core::ptr::null_mut(); }
14452                         CResult_CVec_u8ZIOErrorZPtr { err }
14453                 };
14454                 Self {
14455                         contents,
14456                         result_ok: o.result_ok,
14457                 }
14458         }
14459 }
14460 impl Clone for CResult_CVec_u8ZIOErrorZ {
14461         fn clone(&self) -> Self {
14462                 if self.result_ok {
14463                         Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
14464                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14465                         } }
14466                 } else {
14467                         Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
14468                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14469                         } }
14470                 }
14471         }
14472 }
14473 #[no_mangle]
14474 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
14475 /// but with all dynamically-allocated buffers duplicated in new buffers.
14476 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
14477 #[repr(C)]
14478 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14479 /// This corresponds to std::vector in C++
14480 pub struct CVec_StrZ {
14481         /// The elements in the array.
14482         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14483         pub data: *mut crate::c_types::Str,
14484         /// The number of elements pointed to by `data`.
14485         pub datalen: usize
14486 }
14487 impl CVec_StrZ {
14488         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14489                 if self.datalen == 0 { return Vec::new(); }
14490                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14491                 self.data = core::ptr::null_mut();
14492                 self.datalen = 0;
14493                 ret
14494         }
14495         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14496                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14497         }
14498 }
14499 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
14500         fn from(v: Vec<crate::c_types::Str>) -> Self {
14501                 let datalen = v.len();
14502                 let data = Box::into_raw(v.into_boxed_slice());
14503                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14504         }
14505 }
14506 #[no_mangle]
14507 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14508 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
14509 impl Drop for CVec_StrZ {
14510         fn drop(&mut self) {
14511                 if self.datalen == 0 { return; }
14512                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14513         }
14514 }
14515 impl Clone for CVec_StrZ {
14516         fn clone(&self) -> Self {
14517                 let mut res = Vec::new();
14518                 if self.datalen == 0 { return Self::from(res); }
14519                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14520                 Self::from(res)
14521         }
14522 }
14523 #[repr(C)]
14524 /// The contents of CResult_CVec_StrZIOErrorZ
14525 pub union CResult_CVec_StrZIOErrorZPtr {
14526         /// A pointer to the contents in the success state.
14527         /// Reading from this pointer when `result_ok` is not set is undefined.
14528         pub result: *mut crate::c_types::derived::CVec_StrZ,
14529         /// A pointer to the contents in the error state.
14530         /// Reading from this pointer when `result_ok` is set is undefined.
14531         pub err: *mut crate::c_types::IOError,
14532 }
14533 #[repr(C)]
14534 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
14535 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
14536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14537 pub struct CResult_CVec_StrZIOErrorZ {
14538         /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
14539         /// `err` or `result` depending on the state of `result_ok`.
14540         pub contents: CResult_CVec_StrZIOErrorZPtr,
14541         /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
14542         pub result_ok: bool,
14543 }
14544 #[no_mangle]
14545 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
14546 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
14547         CResult_CVec_StrZIOErrorZ {
14548                 contents: CResult_CVec_StrZIOErrorZPtr {
14549                         result: Box::into_raw(Box::new(o)),
14550                 },
14551                 result_ok: true,
14552         }
14553 }
14554 #[no_mangle]
14555 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
14556 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
14557         CResult_CVec_StrZIOErrorZ {
14558                 contents: CResult_CVec_StrZIOErrorZPtr {
14559                         err: Box::into_raw(Box::new(e)),
14560                 },
14561                 result_ok: false,
14562         }
14563 }
14564 /// Checks if the given object is currently in the success state
14565 #[no_mangle]
14566 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
14567         o.result_ok
14568 }
14569 #[no_mangle]
14570 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
14571 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
14572 impl Drop for CResult_CVec_StrZIOErrorZ {
14573         fn drop(&mut self) {
14574                 if self.result_ok {
14575                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14576                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14577                         }
14578                 } else {
14579                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14580                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14581                         }
14582                 }
14583         }
14584 }
14585 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
14586         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
14587                 let contents = if o.result_ok {
14588                         let result = unsafe { o.contents.result };
14589                         unsafe { o.contents.result = core::ptr::null_mut() };
14590                         CResult_CVec_StrZIOErrorZPtr { result }
14591                 } else {
14592                         let err = unsafe { o.contents.err };
14593                         unsafe { o.contents.err = core::ptr::null_mut(); }
14594                         CResult_CVec_StrZIOErrorZPtr { err }
14595                 };
14596                 Self {
14597                         contents,
14598                         result_ok: o.result_ok,
14599                 }
14600         }
14601 }
14602 impl Clone for CResult_CVec_StrZIOErrorZ {
14603         fn clone(&self) -> Self {
14604                 if self.result_ok {
14605                         Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
14606                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
14607                         } }
14608                 } else {
14609                         Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
14610                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14611                         } }
14612                 }
14613         }
14614 }
14615 #[no_mangle]
14616 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
14617 /// but with all dynamically-allocated buffers duplicated in new buffers.
14618 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
14619 #[repr(C)]
14620 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
14621 /// This corresponds to std::vector in C++
14622 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14623         /// The elements in the array.
14624         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14625         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14626         /// The number of elements pointed to by `data`.
14627         pub datalen: usize
14628 }
14629 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14630         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
14631                 if self.datalen == 0 { return Vec::new(); }
14632                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14633                 self.data = core::ptr::null_mut();
14634                 self.datalen = 0;
14635                 ret
14636         }
14637         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
14638                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14639         }
14640 }
14641 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14642         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
14643                 let datalen = v.len();
14644                 let data = Box::into_raw(v.into_boxed_slice());
14645                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14646         }
14647 }
14648 #[no_mangle]
14649 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14650 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
14651 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14652         fn drop(&mut self) {
14653                 if self.datalen == 0 { return; }
14654                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14655         }
14656 }
14657 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14658         fn clone(&self) -> Self {
14659                 let mut res = Vec::new();
14660                 if self.datalen == 0 { return Self::from(res); }
14661                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14662                 Self::from(res)
14663         }
14664 }
14665 #[repr(C)]
14666 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
14667 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14668         /// A pointer to the contents in the success state.
14669         /// Reading from this pointer when `result_ok` is not set is undefined.
14670         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
14671         /// A pointer to the contents in the error state.
14672         /// Reading from this pointer when `result_ok` is set is undefined.
14673         pub err: *mut crate::c_types::IOError,
14674 }
14675 #[repr(C)]
14676 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
14677 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14679 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14680         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
14681         /// `err` or `result` depending on the state of `result_ok`.
14682         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
14683         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
14684         pub result_ok: bool,
14685 }
14686 #[no_mangle]
14687 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
14688 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14689         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14690                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14691                         result: Box::into_raw(Box::new(o)),
14692                 },
14693                 result_ok: true,
14694         }
14695 }
14696 #[no_mangle]
14697 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
14698 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14699         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14700                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14701                         err: Box::into_raw(Box::new(e)),
14702                 },
14703                 result_ok: false,
14704         }
14705 }
14706 /// Checks if the given object is currently in the success state
14707 #[no_mangle]
14708 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
14709         o.result_ok
14710 }
14711 #[no_mangle]
14712 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
14713 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
14714 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14715         fn drop(&mut self) {
14716                 if self.result_ok {
14717                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14718                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14719                         }
14720                 } else {
14721                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14722                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14723                         }
14724                 }
14725         }
14726 }
14727 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14728         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
14729                 let contents = if o.result_ok {
14730                         let result = unsafe { o.contents.result };
14731                         unsafe { o.contents.result = core::ptr::null_mut() };
14732                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
14733                 } else {
14734                         let err = unsafe { o.contents.err };
14735                         unsafe { o.contents.err = core::ptr::null_mut(); }
14736                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
14737                 };
14738                 Self {
14739                         contents,
14740                         result_ok: o.result_ok,
14741                 }
14742         }
14743 }
14744 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14745         fn clone(&self) -> Self {
14746                 if self.result_ok {
14747                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14748                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
14749                         } }
14750                 } else {
14751                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14752                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14753                         } }
14754                 }
14755         }
14756 }
14757 #[no_mangle]
14758 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
14759 /// but with all dynamically-allocated buffers duplicated in new buffers.
14760 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
14761 #[repr(C)]
14762 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
14763 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14764         /// A pointer to the contents in the success state.
14765         /// Reading from this pointer when `result_ok` is not set is undefined.
14766         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14767         /// A pointer to the contents in the error state.
14768         /// Reading from this pointer when `result_ok` is set is undefined.
14769         pub err: *mut crate::c_types::IOError,
14770 }
14771 #[repr(C)]
14772 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
14773 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
14774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14775 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14776         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
14777         /// `err` or `result` depending on the state of `result_ok`.
14778         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
14779         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
14780         pub result_ok: bool,
14781 }
14782 #[no_mangle]
14783 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
14784 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14785         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14786                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14787                         result: Box::into_raw(Box::new(o)),
14788                 },
14789                 result_ok: true,
14790         }
14791 }
14792 #[no_mangle]
14793 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
14794 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14795         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14796                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14797                         err: Box::into_raw(Box::new(e)),
14798                 },
14799                 result_ok: false,
14800         }
14801 }
14802 /// Checks if the given object is currently in the success state
14803 #[no_mangle]
14804 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
14805         o.result_ok
14806 }
14807 #[no_mangle]
14808 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
14809 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
14810 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14811         fn drop(&mut self) {
14812                 if self.result_ok {
14813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14815                         }
14816                 } else {
14817                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14818                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14819                         }
14820                 }
14821         }
14822 }
14823 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14824         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
14825                 let contents = if o.result_ok {
14826                         let result = unsafe { o.contents.result };
14827                         unsafe { o.contents.result = core::ptr::null_mut() };
14828                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
14829                 } else {
14830                         let err = unsafe { o.contents.err };
14831                         unsafe { o.contents.err = core::ptr::null_mut(); }
14832                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
14833                 };
14834                 Self {
14835                         contents,
14836                         result_ok: o.result_ok,
14837                 }
14838         }
14839 }
14840 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14841         fn clone(&self) -> Self {
14842                 if self.result_ok {
14843                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14844                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
14845                         } }
14846                 } else {
14847                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14848                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14849                         } }
14850                 }
14851         }
14852 }
14853 #[no_mangle]
14854 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
14855 /// but with all dynamically-allocated buffers duplicated in new buffers.
14856 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
14857 #[repr(C)]
14858 /// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
14859 pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14860         /// A pointer to the contents in the success state.
14861         /// Reading from this pointer when `result_ok` is not set is undefined.
14862         pub result: *mut crate::lightning::offers::invoice_request::UnsignedInvoiceRequest,
14863         /// A pointer to the contents in the error state.
14864         /// Reading from this pointer when `result_ok` is set is undefined.
14865         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14866 }
14867 #[repr(C)]
14868 /// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14869 /// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14871 pub struct CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14872         /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
14873         /// `err` or `result` depending on the state of `result_ok`.
14874         pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr,
14875         /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
14876         pub result_ok: bool,
14877 }
14878 #[no_mangle]
14879 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
14880 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14881         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14882                 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14883                         result: Box::into_raw(Box::new(o)),
14884                 },
14885                 result_ok: true,
14886         }
14887 }
14888 #[no_mangle]
14889 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
14890 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14891         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14892                 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14893                         err: Box::into_raw(Box::new(e)),
14894                 },
14895                 result_ok: false,
14896         }
14897 }
14898 /// Checks if the given object is currently in the success state
14899 #[no_mangle]
14900 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool {
14901         o.result_ok
14902 }
14903 #[no_mangle]
14904 /// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
14905 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { }
14906 impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14907         fn drop(&mut self) {
14908                 if self.result_ok {
14909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14911                         }
14912                 } else {
14913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14915                         }
14916                 }
14917         }
14918 }
14919 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14921                 let contents = if o.result_ok {
14922                         let result = unsafe { o.contents.result };
14923                         unsafe { o.contents.result = core::ptr::null_mut() };
14924                         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result }
14925                 } else {
14926                         let err = unsafe { o.contents.err };
14927                         unsafe { o.contents.err = core::ptr::null_mut(); }
14928                         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err }
14929                 };
14930                 Self {
14931                         contents,
14932                         result_ok: o.result_ok,
14933                 }
14934         }
14935 }
14936 impl Clone for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14937         fn clone(&self) -> Self {
14938                 if self.result_ok {
14939                         Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14940                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14941                         } }
14942                 } else {
14943                         Self { result_ok: false, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14944                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14945                         } }
14946                 }
14947         }
14948 }
14949 #[no_mangle]
14950 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14951 /// but with all dynamically-allocated buffers duplicated in new buffers.
14952 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14953 #[repr(C)]
14954 /// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
14955 pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14956         /// A pointer to the contents in the success state.
14957         /// Reading from this pointer when `result_ok` is not set is undefined.
14958         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest,
14959         /// A pointer to the contents in the error state.
14960         /// Reading from this pointer when `result_ok` is set is undefined.
14961         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14962 }
14963 #[repr(C)]
14964 /// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14965 /// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14967 pub struct CResult_InvoiceRequestBolt12SemanticErrorZ {
14968         /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
14969         /// `err` or `result` depending on the state of `result_ok`.
14970         pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr,
14971         /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
14972         pub result_ok: bool,
14973 }
14974 #[no_mangle]
14975 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
14976 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14977         CResult_InvoiceRequestBolt12SemanticErrorZ {
14978                 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14979                         result: Box::into_raw(Box::new(o)),
14980                 },
14981                 result_ok: true,
14982         }
14983 }
14984 #[no_mangle]
14985 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
14986 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14987         CResult_InvoiceRequestBolt12SemanticErrorZ {
14988                 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14989                         err: Box::into_raw(Box::new(e)),
14990                 },
14991                 result_ok: false,
14992         }
14993 }
14994 /// Checks if the given object is currently in the success state
14995 #[no_mangle]
14996 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool {
14997         o.result_ok
14998 }
14999 #[no_mangle]
15000 /// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
15001 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { }
15002 impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ {
15003         fn drop(&mut self) {
15004                 if self.result_ok {
15005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15007                         }
15008                 } else {
15009                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15010                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15011                         }
15012                 }
15013         }
15014 }
15015 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestBolt12SemanticErrorZ {
15016         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15017                 let contents = if o.result_ok {
15018                         let result = unsafe { o.contents.result };
15019                         unsafe { o.contents.result = core::ptr::null_mut() };
15020                         CResult_InvoiceRequestBolt12SemanticErrorZPtr { result }
15021                 } else {
15022                         let err = unsafe { o.contents.err };
15023                         unsafe { o.contents.err = core::ptr::null_mut(); }
15024                         CResult_InvoiceRequestBolt12SemanticErrorZPtr { err }
15025                 };
15026                 Self {
15027                         contents,
15028                         result_ok: o.result_ok,
15029                 }
15030         }
15031 }
15032 impl Clone for CResult_InvoiceRequestBolt12SemanticErrorZ {
15033         fn clone(&self) -> Self {
15034                 if self.result_ok {
15035                         Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
15036                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequest>::clone(unsafe { &*self.contents.result })))
15037                         } }
15038                 } else {
15039                         Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
15040                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
15041                         } }
15042                 }
15043         }
15044 }
15045 #[no_mangle]
15046 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
15047 /// but with all dynamically-allocated buffers duplicated in new buffers.
15048 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
15049 #[repr(C)]
15050 #[derive(Clone)]
15051 /// An enum which can either contain a crate::c_types::SecretKey or not
15052 pub enum COption_SecretKeyZ {
15053         /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
15054         Some(crate::c_types::SecretKey),
15055         /// When we're in this state, this COption_SecretKeyZ contains nothing
15056         None
15057 }
15058 impl COption_SecretKeyZ {
15059         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15060                 if let Self::None = self { false } else { true }
15061         }
15062         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15063                 !self.is_some()
15064         }
15065         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
15066                 if let Self::Some(v) = self { v } else { unreachable!() }
15067         }
15068 }
15069 #[no_mangle]
15070 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
15071 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
15072         COption_SecretKeyZ::Some(o)
15073 }
15074 #[no_mangle]
15075 /// Constructs a new COption_SecretKeyZ containing nothing
15076 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
15077         COption_SecretKeyZ::None
15078 }
15079 #[no_mangle]
15080 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
15081 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
15082 #[no_mangle]
15083 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
15084 /// but with all dynamically-allocated buffers duplicated in new buffers.
15085 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
15086 #[repr(C)]
15087 /// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
15088 pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15089         /// A pointer to the contents in the success state.
15090         /// Reading from this pointer when `result_ok` is not set is undefined.
15091         pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder,
15092         /// A pointer to the contents in the error state.
15093         /// Reading from this pointer when `result_ok` is set is undefined.
15094         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
15095 }
15096 #[repr(C)]
15097 /// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
15098 /// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
15099 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15100 pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15101         /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
15102         /// `err` or `result` depending on the state of `result_ok`.
15103         pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr,
15104         /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
15105         pub result_ok: bool,
15106 }
15107 #[no_mangle]
15108 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
15109 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15110         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15111                 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15112                         result: Box::into_raw(Box::new(o)),
15113                 },
15114                 result_ok: true,
15115         }
15116 }
15117 #[no_mangle]
15118 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
15119 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15120         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15121                 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15122                         err: Box::into_raw(Box::new(e)),
15123                 },
15124                 result_ok: false,
15125         }
15126 }
15127 /// Checks if the given object is currently in the success state
15128 #[no_mangle]
15129 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
15130         o.result_ok
15131 }
15132 #[no_mangle]
15133 /// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
15134 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { }
15135 impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15136         fn drop(&mut self) {
15137                 if self.result_ok {
15138                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15139                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15140                         }
15141                 } else {
15142                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15143                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15144                         }
15145                 }
15146         }
15147 }
15148 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
15149         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15150                 let contents = if o.result_ok {
15151                         let result = unsafe { o.contents.result };
15152                         unsafe { o.contents.result = core::ptr::null_mut() };
15153                         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
15154                 } else {
15155                         let err = unsafe { o.contents.err };
15156                         unsafe { o.contents.err = core::ptr::null_mut(); }
15157                         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
15158                 };
15159                 Self {
15160                         contents,
15161                         result_ok: o.result_ok,
15162                 }
15163         }
15164 }
15165 #[repr(C)]
15166 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
15167 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
15168         /// A pointer to the contents in the success state.
15169         /// Reading from this pointer when `result_ok` is not set is undefined.
15170         pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
15171         /// Note that this value is always NULL, as there are no contents in the Err variant
15172         pub err: *mut core::ffi::c_void,
15173 }
15174 #[repr(C)]
15175 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
15176 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
15177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15178 pub struct CResult_VerifiedInvoiceRequestNoneZ {
15179         /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
15180         /// `err` or `result` depending on the state of `result_ok`.
15181         pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
15182         /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
15183         pub result_ok: bool,
15184 }
15185 #[no_mangle]
15186 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
15187 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
15188         CResult_VerifiedInvoiceRequestNoneZ {
15189                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15190                         result: Box::into_raw(Box::new(o)),
15191                 },
15192                 result_ok: true,
15193         }
15194 }
15195 #[no_mangle]
15196 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
15197 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
15198         CResult_VerifiedInvoiceRequestNoneZ {
15199                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15200                         err: core::ptr::null_mut(),
15201                 },
15202                 result_ok: false,
15203         }
15204 }
15205 /// Checks if the given object is currently in the success state
15206 #[no_mangle]
15207 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
15208         o.result_ok
15209 }
15210 #[no_mangle]
15211 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
15212 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
15213 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
15214         fn drop(&mut self) {
15215                 if self.result_ok {
15216                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15217                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15218                         }
15219                 } else {
15220                 }
15221         }
15222 }
15223 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
15224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
15225                 let contents = if o.result_ok {
15226                         let result = unsafe { o.contents.result };
15227                         unsafe { o.contents.result = core::ptr::null_mut() };
15228                         CResult_VerifiedInvoiceRequestNoneZPtr { result }
15229                 } else {
15230                         let _ = unsafe { Box::from_raw(o.contents.err) };
15231                         o.contents.err = core::ptr::null_mut();
15232                         CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
15233                 };
15234                 Self {
15235                         contents,
15236                         result_ok: o.result_ok,
15237                 }
15238         }
15239 }
15240 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
15241         fn clone(&self) -> Self {
15242                 if self.result_ok {
15243                         Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15244                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
15245                         } }
15246                 } else {
15247                         Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
15248                                 err: core::ptr::null_mut()
15249                         } }
15250                 }
15251         }
15252 }
15253 #[no_mangle]
15254 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
15255 /// but with all dynamically-allocated buffers duplicated in new buffers.
15256 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
15257 #[repr(C)]
15258 /// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
15259 pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15260         /// A pointer to the contents in the success state.
15261         /// Reading from this pointer when `result_ok` is not set is undefined.
15262         pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder,
15263         /// A pointer to the contents in the error state.
15264         /// Reading from this pointer when `result_ok` is set is undefined.
15265         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
15266 }
15267 #[repr(C)]
15268 /// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
15269 /// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
15270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15271 pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15272         /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
15273         /// `err` or `result` depending on the state of `result_ok`.
15274         pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr,
15275         /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
15276         pub result_ok: bool,
15277 }
15278 #[no_mangle]
15279 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
15280 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15281         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15282                 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15283                         result: Box::into_raw(Box::new(o)),
15284                 },
15285                 result_ok: true,
15286         }
15287 }
15288 #[no_mangle]
15289 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
15290 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15291         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15292                 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
15293                         err: Box::into_raw(Box::new(e)),
15294                 },
15295                 result_ok: false,
15296         }
15297 }
15298 /// Checks if the given object is currently in the success state
15299 #[no_mangle]
15300 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
15301         o.result_ok
15302 }
15303 #[no_mangle]
15304 /// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
15305 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { }
15306 impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15307         fn drop(&mut self) {
15308                 if self.result_ok {
15309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15311                         }
15312                 } else {
15313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15315                         }
15316                 }
15317         }
15318 }
15319 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
15320         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
15321                 let contents = if o.result_ok {
15322                         let result = unsafe { o.contents.result };
15323                         unsafe { o.contents.result = core::ptr::null_mut() };
15324                         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
15325                 } else {
15326                         let err = unsafe { o.contents.err };
15327                         unsafe { o.contents.err = core::ptr::null_mut(); }
15328                         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
15329                 };
15330                 Self {
15331                         contents,
15332                         result_ok: o.result_ok,
15333                 }
15334         }
15335 }
15336 #[repr(C)]
15337 /// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
15338 pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15339         /// A pointer to the contents in the success state.
15340         /// Reading from this pointer when `result_ok` is not set is undefined.
15341         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields,
15342         /// A pointer to the contents in the error state.
15343         /// Reading from this pointer when `result_ok` is set is undefined.
15344         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15345 }
15346 #[repr(C)]
15347 /// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
15348 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
15349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15350 pub struct CResult_InvoiceRequestFieldsDecodeErrorZ {
15351         /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
15352         /// `err` or `result` depending on the state of `result_ok`.
15353         pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr,
15354         /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
15355         pub result_ok: bool,
15356 }
15357 #[no_mangle]
15358 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
15359 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15360         CResult_InvoiceRequestFieldsDecodeErrorZ {
15361                 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15362                         result: Box::into_raw(Box::new(o)),
15363                 },
15364                 result_ok: true,
15365         }
15366 }
15367 #[no_mangle]
15368 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
15369 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
15370         CResult_InvoiceRequestFieldsDecodeErrorZ {
15371                 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15372                         err: Box::into_raw(Box::new(e)),
15373                 },
15374                 result_ok: false,
15375         }
15376 }
15377 /// Checks if the given object is currently in the success state
15378 #[no_mangle]
15379 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool {
15380         o.result_ok
15381 }
15382 #[no_mangle]
15383 /// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
15384 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { }
15385 impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ {
15386         fn drop(&mut self) {
15387                 if self.result_ok {
15388                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15389                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15390                         }
15391                 } else {
15392                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15393                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15394                         }
15395                 }
15396         }
15397 }
15398 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFieldsDecodeErrorZ {
15399         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
15400                 let contents = if o.result_ok {
15401                         let result = unsafe { o.contents.result };
15402                         unsafe { o.contents.result = core::ptr::null_mut() };
15403                         CResult_InvoiceRequestFieldsDecodeErrorZPtr { result }
15404                 } else {
15405                         let err = unsafe { o.contents.err };
15406                         unsafe { o.contents.err = core::ptr::null_mut(); }
15407                         CResult_InvoiceRequestFieldsDecodeErrorZPtr { err }
15408                 };
15409                 Self {
15410                         contents,
15411                         result_ok: o.result_ok,
15412                 }
15413         }
15414 }
15415 impl Clone for CResult_InvoiceRequestFieldsDecodeErrorZ {
15416         fn clone(&self) -> Self {
15417                 if self.result_ok {
15418                         Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15419                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequestFields>::clone(unsafe { &*self.contents.result })))
15420                         } }
15421                 } else {
15422                         Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15423                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15424                         } }
15425                 }
15426         }
15427 }
15428 #[no_mangle]
15429 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
15430 /// but with all dynamically-allocated buffers duplicated in new buffers.
15431 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) }
15432 #[repr(C)]
15433 /// An enum which can either contain a  or not
15434 pub enum COption_NoneZ {
15435         /// When we're in this state, this COption_NoneZ contains a 
15436         Some,
15437         /// When we're in this state, this COption_NoneZ contains nothing
15438         None
15439 }
15440 impl COption_NoneZ {
15441         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15442                 if let Self::None = self { false } else { true }
15443         }
15444         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15445                 !self.is_some()
15446         }
15447 }
15448 #[no_mangle]
15449 /// Constructs a new COption_NoneZ containing a 
15450 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
15451         COption_NoneZ::Some
15452 }
15453 #[no_mangle]
15454 /// Constructs a new COption_NoneZ containing nothing
15455 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
15456         COption_NoneZ::None
15457 }
15458 #[no_mangle]
15459 /// Frees any resources associated with the , if we are in the Some state
15460 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
15461 #[repr(C)]
15462 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
15463 /// This corresponds to std::vector in C++
15464 pub struct CVec_WitnessZ {
15465         /// The elements in the array.
15466         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15467         pub data: *mut crate::c_types::Witness,
15468         /// The number of elements pointed to by `data`.
15469         pub datalen: usize
15470 }
15471 impl CVec_WitnessZ {
15472         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
15473                 if self.datalen == 0 { return Vec::new(); }
15474                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15475                 self.data = core::ptr::null_mut();
15476                 self.datalen = 0;
15477                 ret
15478         }
15479         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
15480                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15481         }
15482 }
15483 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
15484         fn from(v: Vec<crate::c_types::Witness>) -> Self {
15485                 let datalen = v.len();
15486                 let data = Box::into_raw(v.into_boxed_slice());
15487                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15488         }
15489 }
15490 #[no_mangle]
15491 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15492 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
15493 impl Drop for CVec_WitnessZ {
15494         fn drop(&mut self) {
15495                 if self.datalen == 0 { return; }
15496                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15497         }
15498 }
15499 impl Clone for CVec_WitnessZ {
15500         fn clone(&self) -> Self {
15501                 let mut res = Vec::new();
15502                 if self.datalen == 0 { return Self::from(res); }
15503                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15504                 Self::from(res)
15505         }
15506 }
15507 #[repr(C)]
15508 #[derive(Clone)]
15509 /// An enum which can either contain a crate::c_types::ECDSASignature or not
15510 pub enum COption_ECDSASignatureZ {
15511         /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
15512         Some(crate::c_types::ECDSASignature),
15513         /// When we're in this state, this COption_ECDSASignatureZ contains nothing
15514         None
15515 }
15516 impl COption_ECDSASignatureZ {
15517         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15518                 if let Self::None = self { false } else { true }
15519         }
15520         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15521                 !self.is_some()
15522         }
15523         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature {
15524                 if let Self::Some(v) = self { v } else { unreachable!() }
15525         }
15526 }
15527 #[no_mangle]
15528 /// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
15529 pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ {
15530         COption_ECDSASignatureZ::Some(o)
15531 }
15532 #[no_mangle]
15533 /// Constructs a new COption_ECDSASignatureZ containing nothing
15534 pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ {
15535         COption_ECDSASignatureZ::None
15536 }
15537 #[no_mangle]
15538 /// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
15539 pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { }
15540 #[no_mangle]
15541 /// Creates a new COption_ECDSASignatureZ which has the same data as `orig`
15542 /// but with all dynamically-allocated buffers duplicated in new buffers.
15543 pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) }
15544 #[repr(C)]
15545 #[derive(Clone)]
15546 /// An enum which can either contain a i64 or not
15547 pub enum COption_i64Z {
15548         /// When we're in this state, this COption_i64Z contains a i64
15549         Some(i64),
15550         /// When we're in this state, this COption_i64Z contains nothing
15551         None
15552 }
15553 impl COption_i64Z {
15554         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15555                 if let Self::None = self { false } else { true }
15556         }
15557         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15558                 !self.is_some()
15559         }
15560         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
15561                 if let Self::Some(v) = self { v } else { unreachable!() }
15562         }
15563 }
15564 #[no_mangle]
15565 /// Constructs a new COption_i64Z containing a i64
15566 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
15567         COption_i64Z::Some(o)
15568 }
15569 #[no_mangle]
15570 /// Constructs a new COption_i64Z containing nothing
15571 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
15572         COption_i64Z::None
15573 }
15574 #[no_mangle]
15575 /// Frees any resources associated with the i64, if we are in the Some state
15576 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
15577 #[no_mangle]
15578 /// Creates a new COption_i64Z which has the same data as `orig`
15579 /// but with all dynamically-allocated buffers duplicated in new buffers.
15580 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
15581 #[repr(C)]
15582 /// The contents of CResult_SocketAddressDecodeErrorZ
15583 pub union CResult_SocketAddressDecodeErrorZPtr {
15584         /// A pointer to the contents in the success state.
15585         /// Reading from this pointer when `result_ok` is not set is undefined.
15586         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15587         /// A pointer to the contents in the error state.
15588         /// Reading from this pointer when `result_ok` is set is undefined.
15589         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15590 }
15591 #[repr(C)]
15592 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
15593 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
15594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15595 pub struct CResult_SocketAddressDecodeErrorZ {
15596         /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
15597         /// `err` or `result` depending on the state of `result_ok`.
15598         pub contents: CResult_SocketAddressDecodeErrorZPtr,
15599         /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
15600         pub result_ok: bool,
15601 }
15602 #[no_mangle]
15603 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
15604 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
15605         CResult_SocketAddressDecodeErrorZ {
15606                 contents: CResult_SocketAddressDecodeErrorZPtr {
15607                         result: Box::into_raw(Box::new(o)),
15608                 },
15609                 result_ok: true,
15610         }
15611 }
15612 #[no_mangle]
15613 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
15614 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
15615         CResult_SocketAddressDecodeErrorZ {
15616                 contents: CResult_SocketAddressDecodeErrorZPtr {
15617                         err: Box::into_raw(Box::new(e)),
15618                 },
15619                 result_ok: false,
15620         }
15621 }
15622 /// Checks if the given object is currently in the success state
15623 #[no_mangle]
15624 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
15625         o.result_ok
15626 }
15627 #[no_mangle]
15628 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
15629 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
15630 impl Drop for CResult_SocketAddressDecodeErrorZ {
15631         fn drop(&mut self) {
15632                 if self.result_ok {
15633                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15634                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15635                         }
15636                 } else {
15637                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15638                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15639                         }
15640                 }
15641         }
15642 }
15643 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
15644         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
15645                 let contents = if o.result_ok {
15646                         let result = unsafe { o.contents.result };
15647                         unsafe { o.contents.result = core::ptr::null_mut() };
15648                         CResult_SocketAddressDecodeErrorZPtr { result }
15649                 } else {
15650                         let err = unsafe { o.contents.err };
15651                         unsafe { o.contents.err = core::ptr::null_mut(); }
15652                         CResult_SocketAddressDecodeErrorZPtr { err }
15653                 };
15654                 Self {
15655                         contents,
15656                         result_ok: o.result_ok,
15657                 }
15658         }
15659 }
15660 impl Clone for CResult_SocketAddressDecodeErrorZ {
15661         fn clone(&self) -> Self {
15662                 if self.result_ok {
15663                         Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
15664                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15665                         } }
15666                 } else {
15667                         Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
15668                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15669                         } }
15670                 }
15671         }
15672 }
15673 #[no_mangle]
15674 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
15675 /// but with all dynamically-allocated buffers duplicated in new buffers.
15676 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
15677 #[repr(C)]
15678 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
15679 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
15680         /// A pointer to the contents in the success state.
15681         /// Reading from this pointer when `result_ok` is not set is undefined.
15682         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15683         /// A pointer to the contents in the error state.
15684         /// Reading from this pointer when `result_ok` is set is undefined.
15685         pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
15686 }
15687 #[repr(C)]
15688 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
15689 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
15690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15691 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
15692         /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
15693         /// `err` or `result` depending on the state of `result_ok`.
15694         pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
15695         /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
15696         pub result_ok: bool,
15697 }
15698 #[no_mangle]
15699 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
15700 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
15701         CResult_SocketAddressSocketAddressParseErrorZ {
15702                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15703                         result: Box::into_raw(Box::new(o)),
15704                 },
15705                 result_ok: true,
15706         }
15707 }
15708 #[no_mangle]
15709 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
15710 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
15711         CResult_SocketAddressSocketAddressParseErrorZ {
15712                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15713                         err: Box::into_raw(Box::new(e)),
15714                 },
15715                 result_ok: false,
15716         }
15717 }
15718 /// Checks if the given object is currently in the success state
15719 #[no_mangle]
15720 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
15721         o.result_ok
15722 }
15723 #[no_mangle]
15724 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
15725 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
15726 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
15727         fn drop(&mut self) {
15728                 if self.result_ok {
15729                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15730                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15731                         }
15732                 } else {
15733                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15734                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15735                         }
15736                 }
15737         }
15738 }
15739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
15740         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
15741                 let contents = if o.result_ok {
15742                         let result = unsafe { o.contents.result };
15743                         unsafe { o.contents.result = core::ptr::null_mut() };
15744                         CResult_SocketAddressSocketAddressParseErrorZPtr { result }
15745                 } else {
15746                         let err = unsafe { o.contents.err };
15747                         unsafe { o.contents.err = core::ptr::null_mut(); }
15748                         CResult_SocketAddressSocketAddressParseErrorZPtr { err }
15749                 };
15750                 Self {
15751                         contents,
15752                         result_ok: o.result_ok,
15753                 }
15754         }
15755 }
15756 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
15757         fn clone(&self) -> Self {
15758                 if self.result_ok {
15759                         Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15760                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15761                         } }
15762                 } else {
15763                         Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15764                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
15765                         } }
15766                 }
15767         }
15768 }
15769 #[no_mangle]
15770 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
15771 /// but with all dynamically-allocated buffers duplicated in new buffers.
15772 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
15773 #[repr(C)]
15774 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
15775 /// This corresponds to std::vector in C++
15776 pub struct CVec_UpdateAddHTLCZ {
15777         /// The elements in the array.
15778         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15779         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15780         /// The number of elements pointed to by `data`.
15781         pub datalen: usize
15782 }
15783 impl CVec_UpdateAddHTLCZ {
15784         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
15785                 if self.datalen == 0 { return Vec::new(); }
15786                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15787                 self.data = core::ptr::null_mut();
15788                 self.datalen = 0;
15789                 ret
15790         }
15791         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
15792                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15793         }
15794 }
15795 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
15796         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
15797                 let datalen = v.len();
15798                 let data = Box::into_raw(v.into_boxed_slice());
15799                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15800         }
15801 }
15802 #[no_mangle]
15803 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15804 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
15805 impl Drop for CVec_UpdateAddHTLCZ {
15806         fn drop(&mut self) {
15807                 if self.datalen == 0 { return; }
15808                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15809         }
15810 }
15811 impl Clone for CVec_UpdateAddHTLCZ {
15812         fn clone(&self) -> Self {
15813                 let mut res = Vec::new();
15814                 if self.datalen == 0 { return Self::from(res); }
15815                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15816                 Self::from(res)
15817         }
15818 }
15819 #[repr(C)]
15820 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
15821 /// This corresponds to std::vector in C++
15822 pub struct CVec_UpdateFulfillHTLCZ {
15823         /// The elements in the array.
15824         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15825         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15826         /// The number of elements pointed to by `data`.
15827         pub datalen: usize
15828 }
15829 impl CVec_UpdateFulfillHTLCZ {
15830         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
15831                 if self.datalen == 0 { return Vec::new(); }
15832                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15833                 self.data = core::ptr::null_mut();
15834                 self.datalen = 0;
15835                 ret
15836         }
15837         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
15838                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15839         }
15840 }
15841 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
15842         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
15843                 let datalen = v.len();
15844                 let data = Box::into_raw(v.into_boxed_slice());
15845                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15846         }
15847 }
15848 #[no_mangle]
15849 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15850 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
15851 impl Drop for CVec_UpdateFulfillHTLCZ {
15852         fn drop(&mut self) {
15853                 if self.datalen == 0 { return; }
15854                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15855         }
15856 }
15857 impl Clone for CVec_UpdateFulfillHTLCZ {
15858         fn clone(&self) -> Self {
15859                 let mut res = Vec::new();
15860                 if self.datalen == 0 { return Self::from(res); }
15861                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15862                 Self::from(res)
15863         }
15864 }
15865 #[repr(C)]
15866 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
15867 /// This corresponds to std::vector in C++
15868 pub struct CVec_UpdateFailHTLCZ {
15869         /// The elements in the array.
15870         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15871         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15872         /// The number of elements pointed to by `data`.
15873         pub datalen: usize
15874 }
15875 impl CVec_UpdateFailHTLCZ {
15876         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
15877                 if self.datalen == 0 { return Vec::new(); }
15878                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15879                 self.data = core::ptr::null_mut();
15880                 self.datalen = 0;
15881                 ret
15882         }
15883         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
15884                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15885         }
15886 }
15887 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
15888         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
15889                 let datalen = v.len();
15890                 let data = Box::into_raw(v.into_boxed_slice());
15891                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15892         }
15893 }
15894 #[no_mangle]
15895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15896 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
15897 impl Drop for CVec_UpdateFailHTLCZ {
15898         fn drop(&mut self) {
15899                 if self.datalen == 0 { return; }
15900                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15901         }
15902 }
15903 impl Clone for CVec_UpdateFailHTLCZ {
15904         fn clone(&self) -> Self {
15905                 let mut res = Vec::new();
15906                 if self.datalen == 0 { return Self::from(res); }
15907                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15908                 Self::from(res)
15909         }
15910 }
15911 #[repr(C)]
15912 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
15913 /// This corresponds to std::vector in C++
15914 pub struct CVec_UpdateFailMalformedHTLCZ {
15915         /// The elements in the array.
15916         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15917         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15918         /// The number of elements pointed to by `data`.
15919         pub datalen: usize
15920 }
15921 impl CVec_UpdateFailMalformedHTLCZ {
15922         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
15923                 if self.datalen == 0 { return Vec::new(); }
15924                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15925                 self.data = core::ptr::null_mut();
15926                 self.datalen = 0;
15927                 ret
15928         }
15929         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
15930                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15931         }
15932 }
15933 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
15934         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
15935                 let datalen = v.len();
15936                 let data = Box::into_raw(v.into_boxed_slice());
15937                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15938         }
15939 }
15940 #[no_mangle]
15941 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15942 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
15943 impl Drop for CVec_UpdateFailMalformedHTLCZ {
15944         fn drop(&mut self) {
15945                 if self.datalen == 0 { return; }
15946                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15947         }
15948 }
15949 impl Clone for CVec_UpdateFailMalformedHTLCZ {
15950         fn clone(&self) -> Self {
15951                 let mut res = Vec::new();
15952                 if self.datalen == 0 { return Self::from(res); }
15953                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15954                 Self::from(res)
15955         }
15956 }
15957 #[repr(C)]
15958 /// The contents of CResult_AcceptChannelDecodeErrorZ
15959 pub union CResult_AcceptChannelDecodeErrorZPtr {
15960         /// A pointer to the contents in the success state.
15961         /// Reading from this pointer when `result_ok` is not set is undefined.
15962         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
15963         /// A pointer to the contents in the error state.
15964         /// Reading from this pointer when `result_ok` is set is undefined.
15965         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15966 }
15967 #[repr(C)]
15968 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
15969 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15970 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15971 pub struct CResult_AcceptChannelDecodeErrorZ {
15972         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
15973         /// `err` or `result` depending on the state of `result_ok`.
15974         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
15975         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
15976         pub result_ok: bool,
15977 }
15978 #[no_mangle]
15979 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15980 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
15981         CResult_AcceptChannelDecodeErrorZ {
15982                 contents: CResult_AcceptChannelDecodeErrorZPtr {
15983                         result: Box::into_raw(Box::new(o)),
15984                 },
15985                 result_ok: true,
15986         }
15987 }
15988 #[no_mangle]
15989 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15990 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
15991         CResult_AcceptChannelDecodeErrorZ {
15992                 contents: CResult_AcceptChannelDecodeErrorZPtr {
15993                         err: Box::into_raw(Box::new(e)),
15994                 },
15995                 result_ok: false,
15996         }
15997 }
15998 /// Checks if the given object is currently in the success state
15999 #[no_mangle]
16000 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
16001         o.result_ok
16002 }
16003 #[no_mangle]
16004 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
16005 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
16006 impl Drop for CResult_AcceptChannelDecodeErrorZ {
16007         fn drop(&mut self) {
16008                 if self.result_ok {
16009                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16010                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16011                         }
16012                 } else {
16013                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16014                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16015                         }
16016                 }
16017         }
16018 }
16019 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
16020         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
16021                 let contents = if o.result_ok {
16022                         let result = unsafe { o.contents.result };
16023                         unsafe { o.contents.result = core::ptr::null_mut() };
16024                         CResult_AcceptChannelDecodeErrorZPtr { result }
16025                 } else {
16026                         let err = unsafe { o.contents.err };
16027                         unsafe { o.contents.err = core::ptr::null_mut(); }
16028                         CResult_AcceptChannelDecodeErrorZPtr { err }
16029                 };
16030                 Self {
16031                         contents,
16032                         result_ok: o.result_ok,
16033                 }
16034         }
16035 }
16036 impl Clone for CResult_AcceptChannelDecodeErrorZ {
16037         fn clone(&self) -> Self {
16038                 if self.result_ok {
16039                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
16040                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
16041                         } }
16042                 } else {
16043                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
16044                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16045                         } }
16046                 }
16047         }
16048 }
16049 #[no_mangle]
16050 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
16051 /// but with all dynamically-allocated buffers duplicated in new buffers.
16052 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
16053 #[repr(C)]
16054 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
16055 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
16056         /// A pointer to the contents in the success state.
16057         /// Reading from this pointer when `result_ok` is not set is undefined.
16058         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
16059         /// A pointer to the contents in the error state.
16060         /// Reading from this pointer when `result_ok` is set is undefined.
16061         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16062 }
16063 #[repr(C)]
16064 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
16065 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
16066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16067 pub struct CResult_AcceptChannelV2DecodeErrorZ {
16068         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
16069         /// `err` or `result` depending on the state of `result_ok`.
16070         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
16071         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
16072         pub result_ok: bool,
16073 }
16074 #[no_mangle]
16075 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
16076 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
16077         CResult_AcceptChannelV2DecodeErrorZ {
16078                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16079                         result: Box::into_raw(Box::new(o)),
16080                 },
16081                 result_ok: true,
16082         }
16083 }
16084 #[no_mangle]
16085 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
16086 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
16087         CResult_AcceptChannelV2DecodeErrorZ {
16088                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16089                         err: Box::into_raw(Box::new(e)),
16090                 },
16091                 result_ok: false,
16092         }
16093 }
16094 /// Checks if the given object is currently in the success state
16095 #[no_mangle]
16096 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
16097         o.result_ok
16098 }
16099 #[no_mangle]
16100 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
16101 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
16102 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
16103         fn drop(&mut self) {
16104                 if self.result_ok {
16105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16107                         }
16108                 } else {
16109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16111                         }
16112                 }
16113         }
16114 }
16115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
16116         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
16117                 let contents = if o.result_ok {
16118                         let result = unsafe { o.contents.result };
16119                         unsafe { o.contents.result = core::ptr::null_mut() };
16120                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
16121                 } else {
16122                         let err = unsafe { o.contents.err };
16123                         unsafe { o.contents.err = core::ptr::null_mut(); }
16124                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
16125                 };
16126                 Self {
16127                         contents,
16128                         result_ok: o.result_ok,
16129                 }
16130         }
16131 }
16132 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
16133         fn clone(&self) -> Self {
16134                 if self.result_ok {
16135                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16136                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
16137                         } }
16138                 } else {
16139                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
16140                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16141                         } }
16142                 }
16143         }
16144 }
16145 #[no_mangle]
16146 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
16147 /// but with all dynamically-allocated buffers duplicated in new buffers.
16148 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
16149 #[repr(C)]
16150 /// The contents of CResult_StfuDecodeErrorZ
16151 pub union CResult_StfuDecodeErrorZPtr {
16152         /// A pointer to the contents in the success state.
16153         /// Reading from this pointer when `result_ok` is not set is undefined.
16154         pub result: *mut crate::lightning::ln::msgs::Stfu,
16155         /// A pointer to the contents in the error state.
16156         /// Reading from this pointer when `result_ok` is set is undefined.
16157         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16158 }
16159 #[repr(C)]
16160 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
16161 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
16162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16163 pub struct CResult_StfuDecodeErrorZ {
16164         /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
16165         /// `err` or `result` depending on the state of `result_ok`.
16166         pub contents: CResult_StfuDecodeErrorZPtr,
16167         /// Whether this CResult_StfuDecodeErrorZ represents a success state.
16168         pub result_ok: bool,
16169 }
16170 #[no_mangle]
16171 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
16172 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
16173         CResult_StfuDecodeErrorZ {
16174                 contents: CResult_StfuDecodeErrorZPtr {
16175                         result: Box::into_raw(Box::new(o)),
16176                 },
16177                 result_ok: true,
16178         }
16179 }
16180 #[no_mangle]
16181 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
16182 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
16183         CResult_StfuDecodeErrorZ {
16184                 contents: CResult_StfuDecodeErrorZPtr {
16185                         err: Box::into_raw(Box::new(e)),
16186                 },
16187                 result_ok: false,
16188         }
16189 }
16190 /// Checks if the given object is currently in the success state
16191 #[no_mangle]
16192 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
16193         o.result_ok
16194 }
16195 #[no_mangle]
16196 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
16197 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
16198 impl Drop for CResult_StfuDecodeErrorZ {
16199         fn drop(&mut self) {
16200                 if self.result_ok {
16201                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16202                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16203                         }
16204                 } else {
16205                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16206                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16207                         }
16208                 }
16209         }
16210 }
16211 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
16212         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
16213                 let contents = if o.result_ok {
16214                         let result = unsafe { o.contents.result };
16215                         unsafe { o.contents.result = core::ptr::null_mut() };
16216                         CResult_StfuDecodeErrorZPtr { result }
16217                 } else {
16218                         let err = unsafe { o.contents.err };
16219                         unsafe { o.contents.err = core::ptr::null_mut(); }
16220                         CResult_StfuDecodeErrorZPtr { err }
16221                 };
16222                 Self {
16223                         contents,
16224                         result_ok: o.result_ok,
16225                 }
16226         }
16227 }
16228 impl Clone for CResult_StfuDecodeErrorZ {
16229         fn clone(&self) -> Self {
16230                 if self.result_ok {
16231                         Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
16232                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
16233                         } }
16234                 } else {
16235                         Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
16236                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16237                         } }
16238                 }
16239         }
16240 }
16241 #[no_mangle]
16242 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
16243 /// but with all dynamically-allocated buffers duplicated in new buffers.
16244 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
16245 #[repr(C)]
16246 /// The contents of CResult_SpliceDecodeErrorZ
16247 pub union CResult_SpliceDecodeErrorZPtr {
16248         /// A pointer to the contents in the success state.
16249         /// Reading from this pointer when `result_ok` is not set is undefined.
16250         pub result: *mut crate::lightning::ln::msgs::Splice,
16251         /// A pointer to the contents in the error state.
16252         /// Reading from this pointer when `result_ok` is set is undefined.
16253         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16254 }
16255 #[repr(C)]
16256 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
16257 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
16258 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16259 pub struct CResult_SpliceDecodeErrorZ {
16260         /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
16261         /// `err` or `result` depending on the state of `result_ok`.
16262         pub contents: CResult_SpliceDecodeErrorZPtr,
16263         /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
16264         pub result_ok: bool,
16265 }
16266 #[no_mangle]
16267 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
16268 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
16269         CResult_SpliceDecodeErrorZ {
16270                 contents: CResult_SpliceDecodeErrorZPtr {
16271                         result: Box::into_raw(Box::new(o)),
16272                 },
16273                 result_ok: true,
16274         }
16275 }
16276 #[no_mangle]
16277 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
16278 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
16279         CResult_SpliceDecodeErrorZ {
16280                 contents: CResult_SpliceDecodeErrorZPtr {
16281                         err: Box::into_raw(Box::new(e)),
16282                 },
16283                 result_ok: false,
16284         }
16285 }
16286 /// Checks if the given object is currently in the success state
16287 #[no_mangle]
16288 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
16289         o.result_ok
16290 }
16291 #[no_mangle]
16292 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
16293 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
16294 impl Drop for CResult_SpliceDecodeErrorZ {
16295         fn drop(&mut self) {
16296                 if self.result_ok {
16297                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16298                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16299                         }
16300                 } else {
16301                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16302                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16303                         }
16304                 }
16305         }
16306 }
16307 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
16308         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
16309                 let contents = if o.result_ok {
16310                         let result = unsafe { o.contents.result };
16311                         unsafe { o.contents.result = core::ptr::null_mut() };
16312                         CResult_SpliceDecodeErrorZPtr { result }
16313                 } else {
16314                         let err = unsafe { o.contents.err };
16315                         unsafe { o.contents.err = core::ptr::null_mut(); }
16316                         CResult_SpliceDecodeErrorZPtr { err }
16317                 };
16318                 Self {
16319                         contents,
16320                         result_ok: o.result_ok,
16321                 }
16322         }
16323 }
16324 impl Clone for CResult_SpliceDecodeErrorZ {
16325         fn clone(&self) -> Self {
16326                 if self.result_ok {
16327                         Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
16328                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
16329                         } }
16330                 } else {
16331                         Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
16332                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16333                         } }
16334                 }
16335         }
16336 }
16337 #[no_mangle]
16338 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
16339 /// but with all dynamically-allocated buffers duplicated in new buffers.
16340 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
16341 #[repr(C)]
16342 /// The contents of CResult_SpliceAckDecodeErrorZ
16343 pub union CResult_SpliceAckDecodeErrorZPtr {
16344         /// A pointer to the contents in the success state.
16345         /// Reading from this pointer when `result_ok` is not set is undefined.
16346         pub result: *mut crate::lightning::ln::msgs::SpliceAck,
16347         /// A pointer to the contents in the error state.
16348         /// Reading from this pointer when `result_ok` is set is undefined.
16349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16350 }
16351 #[repr(C)]
16352 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
16353 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
16354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16355 pub struct CResult_SpliceAckDecodeErrorZ {
16356         /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
16357         /// `err` or `result` depending on the state of `result_ok`.
16358         pub contents: CResult_SpliceAckDecodeErrorZPtr,
16359         /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
16360         pub result_ok: bool,
16361 }
16362 #[no_mangle]
16363 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
16364 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
16365         CResult_SpliceAckDecodeErrorZ {
16366                 contents: CResult_SpliceAckDecodeErrorZPtr {
16367                         result: Box::into_raw(Box::new(o)),
16368                 },
16369                 result_ok: true,
16370         }
16371 }
16372 #[no_mangle]
16373 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
16374 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
16375         CResult_SpliceAckDecodeErrorZ {
16376                 contents: CResult_SpliceAckDecodeErrorZPtr {
16377                         err: Box::into_raw(Box::new(e)),
16378                 },
16379                 result_ok: false,
16380         }
16381 }
16382 /// Checks if the given object is currently in the success state
16383 #[no_mangle]
16384 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
16385         o.result_ok
16386 }
16387 #[no_mangle]
16388 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
16389 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
16390 impl Drop for CResult_SpliceAckDecodeErrorZ {
16391         fn drop(&mut self) {
16392                 if self.result_ok {
16393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16395                         }
16396                 } else {
16397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16399                         }
16400                 }
16401         }
16402 }
16403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
16404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
16405                 let contents = if o.result_ok {
16406                         let result = unsafe { o.contents.result };
16407                         unsafe { o.contents.result = core::ptr::null_mut() };
16408                         CResult_SpliceAckDecodeErrorZPtr { result }
16409                 } else {
16410                         let err = unsafe { o.contents.err };
16411                         unsafe { o.contents.err = core::ptr::null_mut(); }
16412                         CResult_SpliceAckDecodeErrorZPtr { err }
16413                 };
16414                 Self {
16415                         contents,
16416                         result_ok: o.result_ok,
16417                 }
16418         }
16419 }
16420 impl Clone for CResult_SpliceAckDecodeErrorZ {
16421         fn clone(&self) -> Self {
16422                 if self.result_ok {
16423                         Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
16424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
16425                         } }
16426                 } else {
16427                         Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
16428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16429                         } }
16430                 }
16431         }
16432 }
16433 #[no_mangle]
16434 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
16435 /// but with all dynamically-allocated buffers duplicated in new buffers.
16436 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
16437 #[repr(C)]
16438 /// The contents of CResult_SpliceLockedDecodeErrorZ
16439 pub union CResult_SpliceLockedDecodeErrorZPtr {
16440         /// A pointer to the contents in the success state.
16441         /// Reading from this pointer when `result_ok` is not set is undefined.
16442         pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
16443         /// A pointer to the contents in the error state.
16444         /// Reading from this pointer when `result_ok` is set is undefined.
16445         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16446 }
16447 #[repr(C)]
16448 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
16449 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
16450 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16451 pub struct CResult_SpliceLockedDecodeErrorZ {
16452         /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
16453         /// `err` or `result` depending on the state of `result_ok`.
16454         pub contents: CResult_SpliceLockedDecodeErrorZPtr,
16455         /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
16456         pub result_ok: bool,
16457 }
16458 #[no_mangle]
16459 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
16460 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
16461         CResult_SpliceLockedDecodeErrorZ {
16462                 contents: CResult_SpliceLockedDecodeErrorZPtr {
16463                         result: Box::into_raw(Box::new(o)),
16464                 },
16465                 result_ok: true,
16466         }
16467 }
16468 #[no_mangle]
16469 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
16470 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
16471         CResult_SpliceLockedDecodeErrorZ {
16472                 contents: CResult_SpliceLockedDecodeErrorZPtr {
16473                         err: Box::into_raw(Box::new(e)),
16474                 },
16475                 result_ok: false,
16476         }
16477 }
16478 /// Checks if the given object is currently in the success state
16479 #[no_mangle]
16480 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
16481         o.result_ok
16482 }
16483 #[no_mangle]
16484 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
16485 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
16486 impl Drop for CResult_SpliceLockedDecodeErrorZ {
16487         fn drop(&mut self) {
16488                 if self.result_ok {
16489                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16490                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16491                         }
16492                 } else {
16493                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16494                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16495                         }
16496                 }
16497         }
16498 }
16499 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
16500         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
16501                 let contents = if o.result_ok {
16502                         let result = unsafe { o.contents.result };
16503                         unsafe { o.contents.result = core::ptr::null_mut() };
16504                         CResult_SpliceLockedDecodeErrorZPtr { result }
16505                 } else {
16506                         let err = unsafe { o.contents.err };
16507                         unsafe { o.contents.err = core::ptr::null_mut(); }
16508                         CResult_SpliceLockedDecodeErrorZPtr { err }
16509                 };
16510                 Self {
16511                         contents,
16512                         result_ok: o.result_ok,
16513                 }
16514         }
16515 }
16516 impl Clone for CResult_SpliceLockedDecodeErrorZ {
16517         fn clone(&self) -> Self {
16518                 if self.result_ok {
16519                         Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
16520                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
16521                         } }
16522                 } else {
16523                         Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
16524                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16525                         } }
16526                 }
16527         }
16528 }
16529 #[no_mangle]
16530 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
16531 /// but with all dynamically-allocated buffers duplicated in new buffers.
16532 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
16533 #[repr(C)]
16534 /// The contents of CResult_TxAddInputDecodeErrorZ
16535 pub union CResult_TxAddInputDecodeErrorZPtr {
16536         /// A pointer to the contents in the success state.
16537         /// Reading from this pointer when `result_ok` is not set is undefined.
16538         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
16539         /// A pointer to the contents in the error state.
16540         /// Reading from this pointer when `result_ok` is set is undefined.
16541         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16542 }
16543 #[repr(C)]
16544 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
16545 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16546 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16547 pub struct CResult_TxAddInputDecodeErrorZ {
16548         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
16549         /// `err` or `result` depending on the state of `result_ok`.
16550         pub contents: CResult_TxAddInputDecodeErrorZPtr,
16551         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
16552         pub result_ok: bool,
16553 }
16554 #[no_mangle]
16555 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
16556 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
16557         CResult_TxAddInputDecodeErrorZ {
16558                 contents: CResult_TxAddInputDecodeErrorZPtr {
16559                         result: Box::into_raw(Box::new(o)),
16560                 },
16561                 result_ok: true,
16562         }
16563 }
16564 #[no_mangle]
16565 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
16566 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
16567         CResult_TxAddInputDecodeErrorZ {
16568                 contents: CResult_TxAddInputDecodeErrorZPtr {
16569                         err: Box::into_raw(Box::new(e)),
16570                 },
16571                 result_ok: false,
16572         }
16573 }
16574 /// Checks if the given object is currently in the success state
16575 #[no_mangle]
16576 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
16577         o.result_ok
16578 }
16579 #[no_mangle]
16580 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
16581 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
16582 impl Drop for CResult_TxAddInputDecodeErrorZ {
16583         fn drop(&mut self) {
16584                 if self.result_ok {
16585                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16586                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16587                         }
16588                 } else {
16589                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16590                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16591                         }
16592                 }
16593         }
16594 }
16595 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
16596         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16597                 let contents = if o.result_ok {
16598                         let result = unsafe { o.contents.result };
16599                         unsafe { o.contents.result = core::ptr::null_mut() };
16600                         CResult_TxAddInputDecodeErrorZPtr { result }
16601                 } else {
16602                         let err = unsafe { o.contents.err };
16603                         unsafe { o.contents.err = core::ptr::null_mut(); }
16604                         CResult_TxAddInputDecodeErrorZPtr { err }
16605                 };
16606                 Self {
16607                         contents,
16608                         result_ok: o.result_ok,
16609                 }
16610         }
16611 }
16612 impl Clone for CResult_TxAddInputDecodeErrorZ {
16613         fn clone(&self) -> Self {
16614                 if self.result_ok {
16615                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
16616                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
16617                         } }
16618                 } else {
16619                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
16620                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16621                         } }
16622                 }
16623         }
16624 }
16625 #[no_mangle]
16626 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
16627 /// but with all dynamically-allocated buffers duplicated in new buffers.
16628 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
16629 #[repr(C)]
16630 /// The contents of CResult_TxAddOutputDecodeErrorZ
16631 pub union CResult_TxAddOutputDecodeErrorZPtr {
16632         /// A pointer to the contents in the success state.
16633         /// Reading from this pointer when `result_ok` is not set is undefined.
16634         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
16635         /// A pointer to the contents in the error state.
16636         /// Reading from this pointer when `result_ok` is set is undefined.
16637         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16638 }
16639 #[repr(C)]
16640 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
16641 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16643 pub struct CResult_TxAddOutputDecodeErrorZ {
16644         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
16645         /// `err` or `result` depending on the state of `result_ok`.
16646         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
16647         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
16648         pub result_ok: bool,
16649 }
16650 #[no_mangle]
16651 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
16652 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
16653         CResult_TxAddOutputDecodeErrorZ {
16654                 contents: CResult_TxAddOutputDecodeErrorZPtr {
16655                         result: Box::into_raw(Box::new(o)),
16656                 },
16657                 result_ok: true,
16658         }
16659 }
16660 #[no_mangle]
16661 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
16662 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
16663         CResult_TxAddOutputDecodeErrorZ {
16664                 contents: CResult_TxAddOutputDecodeErrorZPtr {
16665                         err: Box::into_raw(Box::new(e)),
16666                 },
16667                 result_ok: false,
16668         }
16669 }
16670 /// Checks if the given object is currently in the success state
16671 #[no_mangle]
16672 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
16673         o.result_ok
16674 }
16675 #[no_mangle]
16676 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
16677 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
16678 impl Drop for CResult_TxAddOutputDecodeErrorZ {
16679         fn drop(&mut self) {
16680                 if self.result_ok {
16681                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16682                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16683                         }
16684                 } else {
16685                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16686                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16687                         }
16688                 }
16689         }
16690 }
16691 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
16692         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16693                 let contents = if o.result_ok {
16694                         let result = unsafe { o.contents.result };
16695                         unsafe { o.contents.result = core::ptr::null_mut() };
16696                         CResult_TxAddOutputDecodeErrorZPtr { result }
16697                 } else {
16698                         let err = unsafe { o.contents.err };
16699                         unsafe { o.contents.err = core::ptr::null_mut(); }
16700                         CResult_TxAddOutputDecodeErrorZPtr { err }
16701                 };
16702                 Self {
16703                         contents,
16704                         result_ok: o.result_ok,
16705                 }
16706         }
16707 }
16708 impl Clone for CResult_TxAddOutputDecodeErrorZ {
16709         fn clone(&self) -> Self {
16710                 if self.result_ok {
16711                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
16712                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
16713                         } }
16714                 } else {
16715                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
16716                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16717                         } }
16718                 }
16719         }
16720 }
16721 #[no_mangle]
16722 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
16723 /// but with all dynamically-allocated buffers duplicated in new buffers.
16724 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
16725 #[repr(C)]
16726 /// The contents of CResult_TxRemoveInputDecodeErrorZ
16727 pub union CResult_TxRemoveInputDecodeErrorZPtr {
16728         /// A pointer to the contents in the success state.
16729         /// Reading from this pointer when `result_ok` is not set is undefined.
16730         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
16731         /// A pointer to the contents in the error state.
16732         /// Reading from this pointer when `result_ok` is set is undefined.
16733         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16734 }
16735 #[repr(C)]
16736 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
16737 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16738 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16739 pub struct CResult_TxRemoveInputDecodeErrorZ {
16740         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
16741         /// `err` or `result` depending on the state of `result_ok`.
16742         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
16743         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
16744         pub result_ok: bool,
16745 }
16746 #[no_mangle]
16747 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
16748 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
16749         CResult_TxRemoveInputDecodeErrorZ {
16750                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16751                         result: Box::into_raw(Box::new(o)),
16752                 },
16753                 result_ok: true,
16754         }
16755 }
16756 #[no_mangle]
16757 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
16758 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
16759         CResult_TxRemoveInputDecodeErrorZ {
16760                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16761                         err: Box::into_raw(Box::new(e)),
16762                 },
16763                 result_ok: false,
16764         }
16765 }
16766 /// Checks if the given object is currently in the success state
16767 #[no_mangle]
16768 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
16769         o.result_ok
16770 }
16771 #[no_mangle]
16772 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
16773 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
16774 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
16775         fn drop(&mut self) {
16776                 if self.result_ok {
16777                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16778                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16779                         }
16780                 } else {
16781                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16782                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16783                         }
16784                 }
16785         }
16786 }
16787 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
16788         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16789                 let contents = if o.result_ok {
16790                         let result = unsafe { o.contents.result };
16791                         unsafe { o.contents.result = core::ptr::null_mut() };
16792                         CResult_TxRemoveInputDecodeErrorZPtr { result }
16793                 } else {
16794                         let err = unsafe { o.contents.err };
16795                         unsafe { o.contents.err = core::ptr::null_mut(); }
16796                         CResult_TxRemoveInputDecodeErrorZPtr { err }
16797                 };
16798                 Self {
16799                         contents,
16800                         result_ok: o.result_ok,
16801                 }
16802         }
16803 }
16804 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
16805         fn clone(&self) -> Self {
16806                 if self.result_ok {
16807                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16808                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
16809                         } }
16810                 } else {
16811                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16812                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16813                         } }
16814                 }
16815         }
16816 }
16817 #[no_mangle]
16818 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
16819 /// but with all dynamically-allocated buffers duplicated in new buffers.
16820 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
16821 #[repr(C)]
16822 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
16823 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
16824         /// A pointer to the contents in the success state.
16825         /// Reading from this pointer when `result_ok` is not set is undefined.
16826         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
16827         /// A pointer to the contents in the error state.
16828         /// Reading from this pointer when `result_ok` is set is undefined.
16829         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16830 }
16831 #[repr(C)]
16832 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
16833 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16835 pub struct CResult_TxRemoveOutputDecodeErrorZ {
16836         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
16837         /// `err` or `result` depending on the state of `result_ok`.
16838         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
16839         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
16840         pub result_ok: bool,
16841 }
16842 #[no_mangle]
16843 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
16844 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
16845         CResult_TxRemoveOutputDecodeErrorZ {
16846                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16847                         result: Box::into_raw(Box::new(o)),
16848                 },
16849                 result_ok: true,
16850         }
16851 }
16852 #[no_mangle]
16853 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
16854 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
16855         CResult_TxRemoveOutputDecodeErrorZ {
16856                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16857                         err: Box::into_raw(Box::new(e)),
16858                 },
16859                 result_ok: false,
16860         }
16861 }
16862 /// Checks if the given object is currently in the success state
16863 #[no_mangle]
16864 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
16865         o.result_ok
16866 }
16867 #[no_mangle]
16868 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
16869 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
16870 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
16871         fn drop(&mut self) {
16872                 if self.result_ok {
16873                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16874                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16875                         }
16876                 } else {
16877                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16878                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16879                         }
16880                 }
16881         }
16882 }
16883 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
16884         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16885                 let contents = if o.result_ok {
16886                         let result = unsafe { o.contents.result };
16887                         unsafe { o.contents.result = core::ptr::null_mut() };
16888                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
16889                 } else {
16890                         let err = unsafe { o.contents.err };
16891                         unsafe { o.contents.err = core::ptr::null_mut(); }
16892                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
16893                 };
16894                 Self {
16895                         contents,
16896                         result_ok: o.result_ok,
16897                 }
16898         }
16899 }
16900 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
16901         fn clone(&self) -> Self {
16902                 if self.result_ok {
16903                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16904                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
16905                         } }
16906                 } else {
16907                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16908                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16909                         } }
16910                 }
16911         }
16912 }
16913 #[no_mangle]
16914 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
16915 /// but with all dynamically-allocated buffers duplicated in new buffers.
16916 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
16917 #[repr(C)]
16918 /// The contents of CResult_TxCompleteDecodeErrorZ
16919 pub union CResult_TxCompleteDecodeErrorZPtr {
16920         /// A pointer to the contents in the success state.
16921         /// Reading from this pointer when `result_ok` is not set is undefined.
16922         pub result: *mut crate::lightning::ln::msgs::TxComplete,
16923         /// A pointer to the contents in the error state.
16924         /// Reading from this pointer when `result_ok` is set is undefined.
16925         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16926 }
16927 #[repr(C)]
16928 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
16929 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
16930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16931 pub struct CResult_TxCompleteDecodeErrorZ {
16932         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
16933         /// `err` or `result` depending on the state of `result_ok`.
16934         pub contents: CResult_TxCompleteDecodeErrorZPtr,
16935         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
16936         pub result_ok: bool,
16937 }
16938 #[no_mangle]
16939 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
16940 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
16941         CResult_TxCompleteDecodeErrorZ {
16942                 contents: CResult_TxCompleteDecodeErrorZPtr {
16943                         result: Box::into_raw(Box::new(o)),
16944                 },
16945                 result_ok: true,
16946         }
16947 }
16948 #[no_mangle]
16949 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
16950 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
16951         CResult_TxCompleteDecodeErrorZ {
16952                 contents: CResult_TxCompleteDecodeErrorZPtr {
16953                         err: Box::into_raw(Box::new(e)),
16954                 },
16955                 result_ok: false,
16956         }
16957 }
16958 /// Checks if the given object is currently in the success state
16959 #[no_mangle]
16960 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
16961         o.result_ok
16962 }
16963 #[no_mangle]
16964 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
16965 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
16966 impl Drop for CResult_TxCompleteDecodeErrorZ {
16967         fn drop(&mut self) {
16968                 if self.result_ok {
16969                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16970                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16971                         }
16972                 } else {
16973                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16974                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16975                         }
16976                 }
16977         }
16978 }
16979 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
16980         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
16981                 let contents = if o.result_ok {
16982                         let result = unsafe { o.contents.result };
16983                         unsafe { o.contents.result = core::ptr::null_mut() };
16984                         CResult_TxCompleteDecodeErrorZPtr { result }
16985                 } else {
16986                         let err = unsafe { o.contents.err };
16987                         unsafe { o.contents.err = core::ptr::null_mut(); }
16988                         CResult_TxCompleteDecodeErrorZPtr { err }
16989                 };
16990                 Self {
16991                         contents,
16992                         result_ok: o.result_ok,
16993                 }
16994         }
16995 }
16996 impl Clone for CResult_TxCompleteDecodeErrorZ {
16997         fn clone(&self) -> Self {
16998                 if self.result_ok {
16999                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
17000                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
17001                         } }
17002                 } else {
17003                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
17004                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17005                         } }
17006                 }
17007         }
17008 }
17009 #[no_mangle]
17010 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
17011 /// but with all dynamically-allocated buffers duplicated in new buffers.
17012 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
17013 #[repr(C)]
17014 /// The contents of CResult_TxSignaturesDecodeErrorZ
17015 pub union CResult_TxSignaturesDecodeErrorZPtr {
17016         /// A pointer to the contents in the success state.
17017         /// Reading from this pointer when `result_ok` is not set is undefined.
17018         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
17019         /// A pointer to the contents in the error state.
17020         /// Reading from this pointer when `result_ok` is set is undefined.
17021         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17022 }
17023 #[repr(C)]
17024 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
17025 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
17026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17027 pub struct CResult_TxSignaturesDecodeErrorZ {
17028         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
17029         /// `err` or `result` depending on the state of `result_ok`.
17030         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
17031         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
17032         pub result_ok: bool,
17033 }
17034 #[no_mangle]
17035 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
17036 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
17037         CResult_TxSignaturesDecodeErrorZ {
17038                 contents: CResult_TxSignaturesDecodeErrorZPtr {
17039                         result: Box::into_raw(Box::new(o)),
17040                 },
17041                 result_ok: true,
17042         }
17043 }
17044 #[no_mangle]
17045 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
17046 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
17047         CResult_TxSignaturesDecodeErrorZ {
17048                 contents: CResult_TxSignaturesDecodeErrorZPtr {
17049                         err: Box::into_raw(Box::new(e)),
17050                 },
17051                 result_ok: false,
17052         }
17053 }
17054 /// Checks if the given object is currently in the success state
17055 #[no_mangle]
17056 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
17057         o.result_ok
17058 }
17059 #[no_mangle]
17060 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
17061 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
17062 impl Drop for CResult_TxSignaturesDecodeErrorZ {
17063         fn drop(&mut self) {
17064                 if self.result_ok {
17065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17067                         }
17068                 } else {
17069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17071                         }
17072                 }
17073         }
17074 }
17075 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
17076         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17077                 let contents = if o.result_ok {
17078                         let result = unsafe { o.contents.result };
17079                         unsafe { o.contents.result = core::ptr::null_mut() };
17080                         CResult_TxSignaturesDecodeErrorZPtr { result }
17081                 } else {
17082                         let err = unsafe { o.contents.err };
17083                         unsafe { o.contents.err = core::ptr::null_mut(); }
17084                         CResult_TxSignaturesDecodeErrorZPtr { err }
17085                 };
17086                 Self {
17087                         contents,
17088                         result_ok: o.result_ok,
17089                 }
17090         }
17091 }
17092 impl Clone for CResult_TxSignaturesDecodeErrorZ {
17093         fn clone(&self) -> Self {
17094                 if self.result_ok {
17095                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
17096                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
17097                         } }
17098                 } else {
17099                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
17100                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17101                         } }
17102                 }
17103         }
17104 }
17105 #[no_mangle]
17106 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
17107 /// but with all dynamically-allocated buffers duplicated in new buffers.
17108 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
17109 #[repr(C)]
17110 /// The contents of CResult_TxInitRbfDecodeErrorZ
17111 pub union CResult_TxInitRbfDecodeErrorZPtr {
17112         /// A pointer to the contents in the success state.
17113         /// Reading from this pointer when `result_ok` is not set is undefined.
17114         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
17115         /// A pointer to the contents in the error state.
17116         /// Reading from this pointer when `result_ok` is set is undefined.
17117         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17118 }
17119 #[repr(C)]
17120 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
17121 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
17122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17123 pub struct CResult_TxInitRbfDecodeErrorZ {
17124         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
17125         /// `err` or `result` depending on the state of `result_ok`.
17126         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
17127         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
17128         pub result_ok: bool,
17129 }
17130 #[no_mangle]
17131 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
17132 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
17133         CResult_TxInitRbfDecodeErrorZ {
17134                 contents: CResult_TxInitRbfDecodeErrorZPtr {
17135                         result: Box::into_raw(Box::new(o)),
17136                 },
17137                 result_ok: true,
17138         }
17139 }
17140 #[no_mangle]
17141 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
17142 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
17143         CResult_TxInitRbfDecodeErrorZ {
17144                 contents: CResult_TxInitRbfDecodeErrorZPtr {
17145                         err: Box::into_raw(Box::new(e)),
17146                 },
17147                 result_ok: false,
17148         }
17149 }
17150 /// Checks if the given object is currently in the success state
17151 #[no_mangle]
17152 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
17153         o.result_ok
17154 }
17155 #[no_mangle]
17156 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
17157 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
17158 impl Drop for CResult_TxInitRbfDecodeErrorZ {
17159         fn drop(&mut self) {
17160                 if self.result_ok {
17161                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17162                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17163                         }
17164                 } else {
17165                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17166                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17167                         }
17168                 }
17169         }
17170 }
17171 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
17172         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
17173                 let contents = if o.result_ok {
17174                         let result = unsafe { o.contents.result };
17175                         unsafe { o.contents.result = core::ptr::null_mut() };
17176                         CResult_TxInitRbfDecodeErrorZPtr { result }
17177                 } else {
17178                         let err = unsafe { o.contents.err };
17179                         unsafe { o.contents.err = core::ptr::null_mut(); }
17180                         CResult_TxInitRbfDecodeErrorZPtr { err }
17181                 };
17182                 Self {
17183                         contents,
17184                         result_ok: o.result_ok,
17185                 }
17186         }
17187 }
17188 impl Clone for CResult_TxInitRbfDecodeErrorZ {
17189         fn clone(&self) -> Self {
17190                 if self.result_ok {
17191                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
17192                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
17193                         } }
17194                 } else {
17195                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
17196                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17197                         } }
17198                 }
17199         }
17200 }
17201 #[no_mangle]
17202 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
17203 /// but with all dynamically-allocated buffers duplicated in new buffers.
17204 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
17205 #[repr(C)]
17206 /// The contents of CResult_TxAckRbfDecodeErrorZ
17207 pub union CResult_TxAckRbfDecodeErrorZPtr {
17208         /// A pointer to the contents in the success state.
17209         /// Reading from this pointer when `result_ok` is not set is undefined.
17210         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
17211         /// A pointer to the contents in the error state.
17212         /// Reading from this pointer when `result_ok` is set is undefined.
17213         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17214 }
17215 #[repr(C)]
17216 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
17217 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
17218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17219 pub struct CResult_TxAckRbfDecodeErrorZ {
17220         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
17221         /// `err` or `result` depending on the state of `result_ok`.
17222         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
17223         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
17224         pub result_ok: bool,
17225 }
17226 #[no_mangle]
17227 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
17228 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
17229         CResult_TxAckRbfDecodeErrorZ {
17230                 contents: CResult_TxAckRbfDecodeErrorZPtr {
17231                         result: Box::into_raw(Box::new(o)),
17232                 },
17233                 result_ok: true,
17234         }
17235 }
17236 #[no_mangle]
17237 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
17238 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
17239         CResult_TxAckRbfDecodeErrorZ {
17240                 contents: CResult_TxAckRbfDecodeErrorZPtr {
17241                         err: Box::into_raw(Box::new(e)),
17242                 },
17243                 result_ok: false,
17244         }
17245 }
17246 /// Checks if the given object is currently in the success state
17247 #[no_mangle]
17248 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
17249         o.result_ok
17250 }
17251 #[no_mangle]
17252 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
17253 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
17254 impl Drop for CResult_TxAckRbfDecodeErrorZ {
17255         fn drop(&mut self) {
17256                 if self.result_ok {
17257                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17258                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17259                         }
17260                 } else {
17261                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17262                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17263                         }
17264                 }
17265         }
17266 }
17267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
17268         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
17269                 let contents = if o.result_ok {
17270                         let result = unsafe { o.contents.result };
17271                         unsafe { o.contents.result = core::ptr::null_mut() };
17272                         CResult_TxAckRbfDecodeErrorZPtr { result }
17273                 } else {
17274                         let err = unsafe { o.contents.err };
17275                         unsafe { o.contents.err = core::ptr::null_mut(); }
17276                         CResult_TxAckRbfDecodeErrorZPtr { err }
17277                 };
17278                 Self {
17279                         contents,
17280                         result_ok: o.result_ok,
17281                 }
17282         }
17283 }
17284 impl Clone for CResult_TxAckRbfDecodeErrorZ {
17285         fn clone(&self) -> Self {
17286                 if self.result_ok {
17287                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
17288                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
17289                         } }
17290                 } else {
17291                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
17292                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17293                         } }
17294                 }
17295         }
17296 }
17297 #[no_mangle]
17298 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
17299 /// but with all dynamically-allocated buffers duplicated in new buffers.
17300 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
17301 #[repr(C)]
17302 /// The contents of CResult_TxAbortDecodeErrorZ
17303 pub union CResult_TxAbortDecodeErrorZPtr {
17304         /// A pointer to the contents in the success state.
17305         /// Reading from this pointer when `result_ok` is not set is undefined.
17306         pub result: *mut crate::lightning::ln::msgs::TxAbort,
17307         /// A pointer to the contents in the error state.
17308         /// Reading from this pointer when `result_ok` is set is undefined.
17309         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17310 }
17311 #[repr(C)]
17312 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
17313 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
17314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17315 pub struct CResult_TxAbortDecodeErrorZ {
17316         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
17317         /// `err` or `result` depending on the state of `result_ok`.
17318         pub contents: CResult_TxAbortDecodeErrorZPtr,
17319         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
17320         pub result_ok: bool,
17321 }
17322 #[no_mangle]
17323 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
17324 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
17325         CResult_TxAbortDecodeErrorZ {
17326                 contents: CResult_TxAbortDecodeErrorZPtr {
17327                         result: Box::into_raw(Box::new(o)),
17328                 },
17329                 result_ok: true,
17330         }
17331 }
17332 #[no_mangle]
17333 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
17334 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
17335         CResult_TxAbortDecodeErrorZ {
17336                 contents: CResult_TxAbortDecodeErrorZPtr {
17337                         err: Box::into_raw(Box::new(e)),
17338                 },
17339                 result_ok: false,
17340         }
17341 }
17342 /// Checks if the given object is currently in the success state
17343 #[no_mangle]
17344 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
17345         o.result_ok
17346 }
17347 #[no_mangle]
17348 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
17349 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
17350 impl Drop for CResult_TxAbortDecodeErrorZ {
17351         fn drop(&mut self) {
17352                 if self.result_ok {
17353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17355                         }
17356                 } else {
17357                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17358                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17359                         }
17360                 }
17361         }
17362 }
17363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
17364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
17365                 let contents = if o.result_ok {
17366                         let result = unsafe { o.contents.result };
17367                         unsafe { o.contents.result = core::ptr::null_mut() };
17368                         CResult_TxAbortDecodeErrorZPtr { result }
17369                 } else {
17370                         let err = unsafe { o.contents.err };
17371                         unsafe { o.contents.err = core::ptr::null_mut(); }
17372                         CResult_TxAbortDecodeErrorZPtr { err }
17373                 };
17374                 Self {
17375                         contents,
17376                         result_ok: o.result_ok,
17377                 }
17378         }
17379 }
17380 impl Clone for CResult_TxAbortDecodeErrorZ {
17381         fn clone(&self) -> Self {
17382                 if self.result_ok {
17383                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
17384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
17385                         } }
17386                 } else {
17387                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
17388                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17389                         } }
17390                 }
17391         }
17392 }
17393 #[no_mangle]
17394 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
17395 /// but with all dynamically-allocated buffers duplicated in new buffers.
17396 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
17397 #[repr(C)]
17398 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
17399 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
17400         /// A pointer to the contents in the success state.
17401         /// Reading from this pointer when `result_ok` is not set is undefined.
17402         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
17403         /// A pointer to the contents in the error state.
17404         /// Reading from this pointer when `result_ok` is set is undefined.
17405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17406 }
17407 #[repr(C)]
17408 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
17409 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
17410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17411 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
17412         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
17413         /// `err` or `result` depending on the state of `result_ok`.
17414         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
17415         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
17416         pub result_ok: bool,
17417 }
17418 #[no_mangle]
17419 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
17420 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17421         CResult_AnnouncementSignaturesDecodeErrorZ {
17422                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17423                         result: Box::into_raw(Box::new(o)),
17424                 },
17425                 result_ok: true,
17426         }
17427 }
17428 #[no_mangle]
17429 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17430 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17431         CResult_AnnouncementSignaturesDecodeErrorZ {
17432                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17433                         err: Box::into_raw(Box::new(e)),
17434                 },
17435                 result_ok: false,
17436         }
17437 }
17438 /// Checks if the given object is currently in the success state
17439 #[no_mangle]
17440 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
17441         o.result_ok
17442 }
17443 #[no_mangle]
17444 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17445 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
17446 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
17447         fn drop(&mut self) {
17448                 if self.result_ok {
17449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17451                         }
17452                 } else {
17453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17455                         }
17456                 }
17457         }
17458 }
17459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
17460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17461                 let contents = if o.result_ok {
17462                         let result = unsafe { o.contents.result };
17463                         unsafe { o.contents.result = core::ptr::null_mut() };
17464                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
17465                 } else {
17466                         let err = unsafe { o.contents.err };
17467                         unsafe { o.contents.err = core::ptr::null_mut(); }
17468                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
17469                 };
17470                 Self {
17471                         contents,
17472                         result_ok: o.result_ok,
17473                 }
17474         }
17475 }
17476 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
17477         fn clone(&self) -> Self {
17478                 if self.result_ok {
17479                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17480                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
17481                         } }
17482                 } else {
17483                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17485                         } }
17486                 }
17487         }
17488 }
17489 #[no_mangle]
17490 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17491 /// but with all dynamically-allocated buffers duplicated in new buffers.
17492 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
17493 #[repr(C)]
17494 /// The contents of CResult_ChannelReestablishDecodeErrorZ
17495 pub union CResult_ChannelReestablishDecodeErrorZPtr {
17496         /// A pointer to the contents in the success state.
17497         /// Reading from this pointer when `result_ok` is not set is undefined.
17498         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
17499         /// A pointer to the contents in the error state.
17500         /// Reading from this pointer when `result_ok` is set is undefined.
17501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17502 }
17503 #[repr(C)]
17504 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
17505 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
17506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17507 pub struct CResult_ChannelReestablishDecodeErrorZ {
17508         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
17509         /// `err` or `result` depending on the state of `result_ok`.
17510         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
17511         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
17512         pub result_ok: bool,
17513 }
17514 #[no_mangle]
17515 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17516 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
17517         CResult_ChannelReestablishDecodeErrorZ {
17518                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17519                         result: Box::into_raw(Box::new(o)),
17520                 },
17521                 result_ok: true,
17522         }
17523 }
17524 #[no_mangle]
17525 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17526 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
17527         CResult_ChannelReestablishDecodeErrorZ {
17528                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17529                         err: Box::into_raw(Box::new(e)),
17530                 },
17531                 result_ok: false,
17532         }
17533 }
17534 /// Checks if the given object is currently in the success state
17535 #[no_mangle]
17536 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
17537         o.result_ok
17538 }
17539 #[no_mangle]
17540 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17541 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
17542 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
17543         fn drop(&mut self) {
17544                 if self.result_ok {
17545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17547                         }
17548                 } else {
17549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17551                         }
17552                 }
17553         }
17554 }
17555 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
17556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
17557                 let contents = if o.result_ok {
17558                         let result = unsafe { o.contents.result };
17559                         unsafe { o.contents.result = core::ptr::null_mut() };
17560                         CResult_ChannelReestablishDecodeErrorZPtr { result }
17561                 } else {
17562                         let err = unsafe { o.contents.err };
17563                         unsafe { o.contents.err = core::ptr::null_mut(); }
17564                         CResult_ChannelReestablishDecodeErrorZPtr { err }
17565                 };
17566                 Self {
17567                         contents,
17568                         result_ok: o.result_ok,
17569                 }
17570         }
17571 }
17572 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
17573         fn clone(&self) -> Self {
17574                 if self.result_ok {
17575                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17576                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
17577                         } }
17578                 } else {
17579                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17581                         } }
17582                 }
17583         }
17584 }
17585 #[no_mangle]
17586 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17587 /// but with all dynamically-allocated buffers duplicated in new buffers.
17588 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
17589 #[repr(C)]
17590 /// The contents of CResult_ClosingSignedDecodeErrorZ
17591 pub union CResult_ClosingSignedDecodeErrorZPtr {
17592         /// A pointer to the contents in the success state.
17593         /// Reading from this pointer when `result_ok` is not set is undefined.
17594         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
17595         /// A pointer to the contents in the error state.
17596         /// Reading from this pointer when `result_ok` is set is undefined.
17597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17598 }
17599 #[repr(C)]
17600 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
17601 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17603 pub struct CResult_ClosingSignedDecodeErrorZ {
17604         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
17605         /// `err` or `result` depending on the state of `result_ok`.
17606         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
17607         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
17608         pub result_ok: bool,
17609 }
17610 #[no_mangle]
17611 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17612 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
17613         CResult_ClosingSignedDecodeErrorZ {
17614                 contents: CResult_ClosingSignedDecodeErrorZPtr {
17615                         result: Box::into_raw(Box::new(o)),
17616                 },
17617                 result_ok: true,
17618         }
17619 }
17620 #[no_mangle]
17621 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17622 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
17623         CResult_ClosingSignedDecodeErrorZ {
17624                 contents: CResult_ClosingSignedDecodeErrorZPtr {
17625                         err: Box::into_raw(Box::new(e)),
17626                 },
17627                 result_ok: false,
17628         }
17629 }
17630 /// Checks if the given object is currently in the success state
17631 #[no_mangle]
17632 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
17633         o.result_ok
17634 }
17635 #[no_mangle]
17636 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17637 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
17638 impl Drop for CResult_ClosingSignedDecodeErrorZ {
17639         fn drop(&mut self) {
17640                 if self.result_ok {
17641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17643                         }
17644                 } else {
17645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17647                         }
17648                 }
17649         }
17650 }
17651 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
17652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17653                 let contents = if o.result_ok {
17654                         let result = unsafe { o.contents.result };
17655                         unsafe { o.contents.result = core::ptr::null_mut() };
17656                         CResult_ClosingSignedDecodeErrorZPtr { result }
17657                 } else {
17658                         let err = unsafe { o.contents.err };
17659                         unsafe { o.contents.err = core::ptr::null_mut(); }
17660                         CResult_ClosingSignedDecodeErrorZPtr { err }
17661                 };
17662                 Self {
17663                         contents,
17664                         result_ok: o.result_ok,
17665                 }
17666         }
17667 }
17668 impl Clone for CResult_ClosingSignedDecodeErrorZ {
17669         fn clone(&self) -> Self {
17670                 if self.result_ok {
17671                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
17672                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
17673                         } }
17674                 } else {
17675                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
17676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17677                         } }
17678                 }
17679         }
17680 }
17681 #[no_mangle]
17682 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17683 /// but with all dynamically-allocated buffers duplicated in new buffers.
17684 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
17685 #[repr(C)]
17686 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
17687 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17688         /// A pointer to the contents in the success state.
17689         /// Reading from this pointer when `result_ok` is not set is undefined.
17690         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
17691         /// A pointer to the contents in the error state.
17692         /// Reading from this pointer when `result_ok` is set is undefined.
17693         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17694 }
17695 #[repr(C)]
17696 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
17697 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17699 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
17700         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
17701         /// `err` or `result` depending on the state of `result_ok`.
17702         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
17703         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
17704         pub result_ok: bool,
17705 }
17706 #[no_mangle]
17707 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17708 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17709         CResult_ClosingSignedFeeRangeDecodeErrorZ {
17710                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17711                         result: Box::into_raw(Box::new(o)),
17712                 },
17713                 result_ok: true,
17714         }
17715 }
17716 #[no_mangle]
17717 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17718 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17719         CResult_ClosingSignedFeeRangeDecodeErrorZ {
17720                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17721                         err: Box::into_raw(Box::new(e)),
17722                 },
17723                 result_ok: false,
17724         }
17725 }
17726 /// Checks if the given object is currently in the success state
17727 #[no_mangle]
17728 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
17729         o.result_ok
17730 }
17731 #[no_mangle]
17732 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17733 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
17734 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17735         fn drop(&mut self) {
17736                 if self.result_ok {
17737                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17738                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17739                         }
17740                 } else {
17741                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17742                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17743                         }
17744                 }
17745         }
17746 }
17747 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17748         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17749                 let contents = if o.result_ok {
17750                         let result = unsafe { o.contents.result };
17751                         unsafe { o.contents.result = core::ptr::null_mut() };
17752                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
17753                 } else {
17754                         let err = unsafe { o.contents.err };
17755                         unsafe { o.contents.err = core::ptr::null_mut(); }
17756                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
17757                 };
17758                 Self {
17759                         contents,
17760                         result_ok: o.result_ok,
17761                 }
17762         }
17763 }
17764 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17765         fn clone(&self) -> Self {
17766                 if self.result_ok {
17767                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17768                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
17769                         } }
17770                 } else {
17771                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17772                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17773                         } }
17774                 }
17775         }
17776 }
17777 #[no_mangle]
17778 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17779 /// but with all dynamically-allocated buffers duplicated in new buffers.
17780 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
17781 #[repr(C)]
17782 /// The contents of CResult_CommitmentSignedDecodeErrorZ
17783 pub union CResult_CommitmentSignedDecodeErrorZPtr {
17784         /// A pointer to the contents in the success state.
17785         /// Reading from this pointer when `result_ok` is not set is undefined.
17786         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
17787         /// A pointer to the contents in the error state.
17788         /// Reading from this pointer when `result_ok` is set is undefined.
17789         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17790 }
17791 #[repr(C)]
17792 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
17793 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17795 pub struct CResult_CommitmentSignedDecodeErrorZ {
17796         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
17797         /// `err` or `result` depending on the state of `result_ok`.
17798         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
17799         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
17800         pub result_ok: bool,
17801 }
17802 #[no_mangle]
17803 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17804 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
17805         CResult_CommitmentSignedDecodeErrorZ {
17806                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17807                         result: Box::into_raw(Box::new(o)),
17808                 },
17809                 result_ok: true,
17810         }
17811 }
17812 #[no_mangle]
17813 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17814 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
17815         CResult_CommitmentSignedDecodeErrorZ {
17816                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17817                         err: Box::into_raw(Box::new(e)),
17818                 },
17819                 result_ok: false,
17820         }
17821 }
17822 /// Checks if the given object is currently in the success state
17823 #[no_mangle]
17824 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
17825         o.result_ok
17826 }
17827 #[no_mangle]
17828 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17829 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
17830 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
17831         fn drop(&mut self) {
17832                 if self.result_ok {
17833                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17834                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17835                         }
17836                 } else {
17837                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17838                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17839                         }
17840                 }
17841         }
17842 }
17843 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
17844         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17845                 let contents = if o.result_ok {
17846                         let result = unsafe { o.contents.result };
17847                         unsafe { o.contents.result = core::ptr::null_mut() };
17848                         CResult_CommitmentSignedDecodeErrorZPtr { result }
17849                 } else {
17850                         let err = unsafe { o.contents.err };
17851                         unsafe { o.contents.err = core::ptr::null_mut(); }
17852                         CResult_CommitmentSignedDecodeErrorZPtr { err }
17853                 };
17854                 Self {
17855                         contents,
17856                         result_ok: o.result_ok,
17857                 }
17858         }
17859 }
17860 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
17861         fn clone(&self) -> Self {
17862                 if self.result_ok {
17863                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17864                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
17865                         } }
17866                 } else {
17867                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17868                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17869                         } }
17870                 }
17871         }
17872 }
17873 #[no_mangle]
17874 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17875 /// but with all dynamically-allocated buffers duplicated in new buffers.
17876 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
17877 #[repr(C)]
17878 /// The contents of CResult_FundingCreatedDecodeErrorZ
17879 pub union CResult_FundingCreatedDecodeErrorZPtr {
17880         /// A pointer to the contents in the success state.
17881         /// Reading from this pointer when `result_ok` is not set is undefined.
17882         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
17883         /// A pointer to the contents in the error state.
17884         /// Reading from this pointer when `result_ok` is set is undefined.
17885         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17886 }
17887 #[repr(C)]
17888 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
17889 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
17890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17891 pub struct CResult_FundingCreatedDecodeErrorZ {
17892         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
17893         /// `err` or `result` depending on the state of `result_ok`.
17894         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
17895         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
17896         pub result_ok: bool,
17897 }
17898 #[no_mangle]
17899 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17900 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
17901         CResult_FundingCreatedDecodeErrorZ {
17902                 contents: CResult_FundingCreatedDecodeErrorZPtr {
17903                         result: Box::into_raw(Box::new(o)),
17904                 },
17905                 result_ok: true,
17906         }
17907 }
17908 #[no_mangle]
17909 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17910 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
17911         CResult_FundingCreatedDecodeErrorZ {
17912                 contents: CResult_FundingCreatedDecodeErrorZPtr {
17913                         err: Box::into_raw(Box::new(e)),
17914                 },
17915                 result_ok: false,
17916         }
17917 }
17918 /// Checks if the given object is currently in the success state
17919 #[no_mangle]
17920 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
17921         o.result_ok
17922 }
17923 #[no_mangle]
17924 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17925 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
17926 impl Drop for CResult_FundingCreatedDecodeErrorZ {
17927         fn drop(&mut self) {
17928                 if self.result_ok {
17929                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17930                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17931                         }
17932                 } else {
17933                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17934                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17935                         }
17936                 }
17937         }
17938 }
17939 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
17940         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
17941                 let contents = if o.result_ok {
17942                         let result = unsafe { o.contents.result };
17943                         unsafe { o.contents.result = core::ptr::null_mut() };
17944                         CResult_FundingCreatedDecodeErrorZPtr { result }
17945                 } else {
17946                         let err = unsafe { o.contents.err };
17947                         unsafe { o.contents.err = core::ptr::null_mut(); }
17948                         CResult_FundingCreatedDecodeErrorZPtr { err }
17949                 };
17950                 Self {
17951                         contents,
17952                         result_ok: o.result_ok,
17953                 }
17954         }
17955 }
17956 impl Clone for CResult_FundingCreatedDecodeErrorZ {
17957         fn clone(&self) -> Self {
17958                 if self.result_ok {
17959                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
17960                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
17961                         } }
17962                 } else {
17963                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
17964                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17965                         } }
17966                 }
17967         }
17968 }
17969 #[no_mangle]
17970 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17971 /// but with all dynamically-allocated buffers duplicated in new buffers.
17972 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
17973 #[repr(C)]
17974 /// The contents of CResult_FundingSignedDecodeErrorZ
17975 pub union CResult_FundingSignedDecodeErrorZPtr {
17976         /// A pointer to the contents in the success state.
17977         /// Reading from this pointer when `result_ok` is not set is undefined.
17978         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
17979         /// A pointer to the contents in the error state.
17980         /// Reading from this pointer when `result_ok` is set is undefined.
17981         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17982 }
17983 #[repr(C)]
17984 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
17985 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17987 pub struct CResult_FundingSignedDecodeErrorZ {
17988         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
17989         /// `err` or `result` depending on the state of `result_ok`.
17990         pub contents: CResult_FundingSignedDecodeErrorZPtr,
17991         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
17992         pub result_ok: bool,
17993 }
17994 #[no_mangle]
17995 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17996 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
17997         CResult_FundingSignedDecodeErrorZ {
17998                 contents: CResult_FundingSignedDecodeErrorZPtr {
17999                         result: Box::into_raw(Box::new(o)),
18000                 },
18001                 result_ok: true,
18002         }
18003 }
18004 #[no_mangle]
18005 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
18006 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
18007         CResult_FundingSignedDecodeErrorZ {
18008                 contents: CResult_FundingSignedDecodeErrorZPtr {
18009                         err: Box::into_raw(Box::new(e)),
18010                 },
18011                 result_ok: false,
18012         }
18013 }
18014 /// Checks if the given object is currently in the success state
18015 #[no_mangle]
18016 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
18017         o.result_ok
18018 }
18019 #[no_mangle]
18020 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
18021 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
18022 impl Drop for CResult_FundingSignedDecodeErrorZ {
18023         fn drop(&mut self) {
18024                 if self.result_ok {
18025                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18026                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18027                         }
18028                 } else {
18029                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18030                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18031                         }
18032                 }
18033         }
18034 }
18035 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
18036         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
18037                 let contents = if o.result_ok {
18038                         let result = unsafe { o.contents.result };
18039                         unsafe { o.contents.result = core::ptr::null_mut() };
18040                         CResult_FundingSignedDecodeErrorZPtr { result }
18041                 } else {
18042                         let err = unsafe { o.contents.err };
18043                         unsafe { o.contents.err = core::ptr::null_mut(); }
18044                         CResult_FundingSignedDecodeErrorZPtr { err }
18045                 };
18046                 Self {
18047                         contents,
18048                         result_ok: o.result_ok,
18049                 }
18050         }
18051 }
18052 impl Clone for CResult_FundingSignedDecodeErrorZ {
18053         fn clone(&self) -> Self {
18054                 if self.result_ok {
18055                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
18056                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
18057                         } }
18058                 } else {
18059                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
18060                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18061                         } }
18062                 }
18063         }
18064 }
18065 #[no_mangle]
18066 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
18067 /// but with all dynamically-allocated buffers duplicated in new buffers.
18068 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
18069 #[repr(C)]
18070 /// The contents of CResult_ChannelReadyDecodeErrorZ
18071 pub union CResult_ChannelReadyDecodeErrorZPtr {
18072         /// A pointer to the contents in the success state.
18073         /// Reading from this pointer when `result_ok` is not set is undefined.
18074         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
18075         /// A pointer to the contents in the error state.
18076         /// Reading from this pointer when `result_ok` is set is undefined.
18077         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18078 }
18079 #[repr(C)]
18080 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
18081 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
18082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18083 pub struct CResult_ChannelReadyDecodeErrorZ {
18084         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
18085         /// `err` or `result` depending on the state of `result_ok`.
18086         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
18087         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
18088         pub result_ok: bool,
18089 }
18090 #[no_mangle]
18091 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
18092 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
18093         CResult_ChannelReadyDecodeErrorZ {
18094                 contents: CResult_ChannelReadyDecodeErrorZPtr {
18095                         result: Box::into_raw(Box::new(o)),
18096                 },
18097                 result_ok: true,
18098         }
18099 }
18100 #[no_mangle]
18101 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
18102 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
18103         CResult_ChannelReadyDecodeErrorZ {
18104                 contents: CResult_ChannelReadyDecodeErrorZPtr {
18105                         err: Box::into_raw(Box::new(e)),
18106                 },
18107                 result_ok: false,
18108         }
18109 }
18110 /// Checks if the given object is currently in the success state
18111 #[no_mangle]
18112 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
18113         o.result_ok
18114 }
18115 #[no_mangle]
18116 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
18117 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
18118 impl Drop for CResult_ChannelReadyDecodeErrorZ {
18119         fn drop(&mut self) {
18120                 if self.result_ok {
18121                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18122                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18123                         }
18124                 } else {
18125                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18126                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18127                         }
18128                 }
18129         }
18130 }
18131 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
18132         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
18133                 let contents = if o.result_ok {
18134                         let result = unsafe { o.contents.result };
18135                         unsafe { o.contents.result = core::ptr::null_mut() };
18136                         CResult_ChannelReadyDecodeErrorZPtr { result }
18137                 } else {
18138                         let err = unsafe { o.contents.err };
18139                         unsafe { o.contents.err = core::ptr::null_mut(); }
18140                         CResult_ChannelReadyDecodeErrorZPtr { err }
18141                 };
18142                 Self {
18143                         contents,
18144                         result_ok: o.result_ok,
18145                 }
18146         }
18147 }
18148 impl Clone for CResult_ChannelReadyDecodeErrorZ {
18149         fn clone(&self) -> Self {
18150                 if self.result_ok {
18151                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
18152                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
18153                         } }
18154                 } else {
18155                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
18156                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18157                         } }
18158                 }
18159         }
18160 }
18161 #[no_mangle]
18162 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
18163 /// but with all dynamically-allocated buffers duplicated in new buffers.
18164 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
18165 #[repr(C)]
18166 /// The contents of CResult_InitDecodeErrorZ
18167 pub union CResult_InitDecodeErrorZPtr {
18168         /// A pointer to the contents in the success state.
18169         /// Reading from this pointer when `result_ok` is not set is undefined.
18170         pub result: *mut crate::lightning::ln::msgs::Init,
18171         /// A pointer to the contents in the error state.
18172         /// Reading from this pointer when `result_ok` is set is undefined.
18173         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18174 }
18175 #[repr(C)]
18176 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
18177 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
18178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18179 pub struct CResult_InitDecodeErrorZ {
18180         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
18181         /// `err` or `result` depending on the state of `result_ok`.
18182         pub contents: CResult_InitDecodeErrorZPtr,
18183         /// Whether this CResult_InitDecodeErrorZ represents a success state.
18184         pub result_ok: bool,
18185 }
18186 #[no_mangle]
18187 /// Creates a new CResult_InitDecodeErrorZ in the success state.
18188 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
18189         CResult_InitDecodeErrorZ {
18190                 contents: CResult_InitDecodeErrorZPtr {
18191                         result: Box::into_raw(Box::new(o)),
18192                 },
18193                 result_ok: true,
18194         }
18195 }
18196 #[no_mangle]
18197 /// Creates a new CResult_InitDecodeErrorZ in the error state.
18198 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
18199         CResult_InitDecodeErrorZ {
18200                 contents: CResult_InitDecodeErrorZPtr {
18201                         err: Box::into_raw(Box::new(e)),
18202                 },
18203                 result_ok: false,
18204         }
18205 }
18206 /// Checks if the given object is currently in the success state
18207 #[no_mangle]
18208 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
18209         o.result_ok
18210 }
18211 #[no_mangle]
18212 /// Frees any resources used by the CResult_InitDecodeErrorZ.
18213 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
18214 impl Drop for CResult_InitDecodeErrorZ {
18215         fn drop(&mut self) {
18216                 if self.result_ok {
18217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18219                         }
18220                 } else {
18221                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18222                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18223                         }
18224                 }
18225         }
18226 }
18227 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
18228         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
18229                 let contents = if o.result_ok {
18230                         let result = unsafe { o.contents.result };
18231                         unsafe { o.contents.result = core::ptr::null_mut() };
18232                         CResult_InitDecodeErrorZPtr { result }
18233                 } else {
18234                         let err = unsafe { o.contents.err };
18235                         unsafe { o.contents.err = core::ptr::null_mut(); }
18236                         CResult_InitDecodeErrorZPtr { err }
18237                 };
18238                 Self {
18239                         contents,
18240                         result_ok: o.result_ok,
18241                 }
18242         }
18243 }
18244 impl Clone for CResult_InitDecodeErrorZ {
18245         fn clone(&self) -> Self {
18246                 if self.result_ok {
18247                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
18248                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
18249                         } }
18250                 } else {
18251                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
18252                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18253                         } }
18254                 }
18255         }
18256 }
18257 #[no_mangle]
18258 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
18259 /// but with all dynamically-allocated buffers duplicated in new buffers.
18260 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
18261 #[repr(C)]
18262 /// The contents of CResult_OpenChannelDecodeErrorZ
18263 pub union CResult_OpenChannelDecodeErrorZPtr {
18264         /// A pointer to the contents in the success state.
18265         /// Reading from this pointer when `result_ok` is not set is undefined.
18266         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
18267         /// A pointer to the contents in the error state.
18268         /// Reading from this pointer when `result_ok` is set is undefined.
18269         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18270 }
18271 #[repr(C)]
18272 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
18273 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
18274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18275 pub struct CResult_OpenChannelDecodeErrorZ {
18276         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
18277         /// `err` or `result` depending on the state of `result_ok`.
18278         pub contents: CResult_OpenChannelDecodeErrorZPtr,
18279         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
18280         pub result_ok: bool,
18281 }
18282 #[no_mangle]
18283 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
18284 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
18285         CResult_OpenChannelDecodeErrorZ {
18286                 contents: CResult_OpenChannelDecodeErrorZPtr {
18287                         result: Box::into_raw(Box::new(o)),
18288                 },
18289                 result_ok: true,
18290         }
18291 }
18292 #[no_mangle]
18293 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
18294 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
18295         CResult_OpenChannelDecodeErrorZ {
18296                 contents: CResult_OpenChannelDecodeErrorZPtr {
18297                         err: Box::into_raw(Box::new(e)),
18298                 },
18299                 result_ok: false,
18300         }
18301 }
18302 /// Checks if the given object is currently in the success state
18303 #[no_mangle]
18304 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
18305         o.result_ok
18306 }
18307 #[no_mangle]
18308 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
18309 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
18310 impl Drop for CResult_OpenChannelDecodeErrorZ {
18311         fn drop(&mut self) {
18312                 if self.result_ok {
18313                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18314                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18315                         }
18316                 } else {
18317                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18318                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18319                         }
18320                 }
18321         }
18322 }
18323 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
18324         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
18325                 let contents = if o.result_ok {
18326                         let result = unsafe { o.contents.result };
18327                         unsafe { o.contents.result = core::ptr::null_mut() };
18328                         CResult_OpenChannelDecodeErrorZPtr { result }
18329                 } else {
18330                         let err = unsafe { o.contents.err };
18331                         unsafe { o.contents.err = core::ptr::null_mut(); }
18332                         CResult_OpenChannelDecodeErrorZPtr { err }
18333                 };
18334                 Self {
18335                         contents,
18336                         result_ok: o.result_ok,
18337                 }
18338         }
18339 }
18340 impl Clone for CResult_OpenChannelDecodeErrorZ {
18341         fn clone(&self) -> Self {
18342                 if self.result_ok {
18343                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
18344                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
18345                         } }
18346                 } else {
18347                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
18348                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18349                         } }
18350                 }
18351         }
18352 }
18353 #[no_mangle]
18354 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
18355 /// but with all dynamically-allocated buffers duplicated in new buffers.
18356 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
18357 #[repr(C)]
18358 /// The contents of CResult_OpenChannelV2DecodeErrorZ
18359 pub union CResult_OpenChannelV2DecodeErrorZPtr {
18360         /// A pointer to the contents in the success state.
18361         /// Reading from this pointer when `result_ok` is not set is undefined.
18362         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
18363         /// A pointer to the contents in the error state.
18364         /// Reading from this pointer when `result_ok` is set is undefined.
18365         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18366 }
18367 #[repr(C)]
18368 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
18369 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
18370 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18371 pub struct CResult_OpenChannelV2DecodeErrorZ {
18372         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
18373         /// `err` or `result` depending on the state of `result_ok`.
18374         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
18375         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
18376         pub result_ok: bool,
18377 }
18378 #[no_mangle]
18379 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
18380 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
18381         CResult_OpenChannelV2DecodeErrorZ {
18382                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18383                         result: Box::into_raw(Box::new(o)),
18384                 },
18385                 result_ok: true,
18386         }
18387 }
18388 #[no_mangle]
18389 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
18390 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
18391         CResult_OpenChannelV2DecodeErrorZ {
18392                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
18393                         err: Box::into_raw(Box::new(e)),
18394                 },
18395                 result_ok: false,
18396         }
18397 }
18398 /// Checks if the given object is currently in the success state
18399 #[no_mangle]
18400 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
18401         o.result_ok
18402 }
18403 #[no_mangle]
18404 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
18405 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
18406 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
18407         fn drop(&mut self) {
18408                 if self.result_ok {
18409                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18410                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18411                         }
18412                 } else {
18413                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18414                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18415                         }
18416                 }
18417         }
18418 }
18419 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
18420         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
18421                 let contents = if o.result_ok {
18422                         let result = unsafe { o.contents.result };
18423                         unsafe { o.contents.result = core::ptr::null_mut() };
18424                         CResult_OpenChannelV2DecodeErrorZPtr { result }
18425                 } else {
18426                         let err = unsafe { o.contents.err };
18427                         unsafe { o.contents.err = core::ptr::null_mut(); }
18428                         CResult_OpenChannelV2DecodeErrorZPtr { err }
18429                 };
18430                 Self {
18431                         contents,
18432                         result_ok: o.result_ok,
18433                 }
18434         }
18435 }
18436 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
18437         fn clone(&self) -> Self {
18438                 if self.result_ok {
18439                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18440                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
18441                         } }
18442                 } else {
18443                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18444                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18445                         } }
18446                 }
18447         }
18448 }
18449 #[no_mangle]
18450 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
18451 /// but with all dynamically-allocated buffers duplicated in new buffers.
18452 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
18453 #[repr(C)]
18454 /// The contents of CResult_RevokeAndACKDecodeErrorZ
18455 pub union CResult_RevokeAndACKDecodeErrorZPtr {
18456         /// A pointer to the contents in the success state.
18457         /// Reading from this pointer when `result_ok` is not set is undefined.
18458         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
18459         /// A pointer to the contents in the error state.
18460         /// Reading from this pointer when `result_ok` is set is undefined.
18461         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18462 }
18463 #[repr(C)]
18464 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
18465 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
18466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18467 pub struct CResult_RevokeAndACKDecodeErrorZ {
18468         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
18469         /// `err` or `result` depending on the state of `result_ok`.
18470         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
18471         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
18472         pub result_ok: bool,
18473 }
18474 #[no_mangle]
18475 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18476 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
18477         CResult_RevokeAndACKDecodeErrorZ {
18478                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18479                         result: Box::into_raw(Box::new(o)),
18480                 },
18481                 result_ok: true,
18482         }
18483 }
18484 #[no_mangle]
18485 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18486 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
18487         CResult_RevokeAndACKDecodeErrorZ {
18488                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18489                         err: Box::into_raw(Box::new(e)),
18490                 },
18491                 result_ok: false,
18492         }
18493 }
18494 /// Checks if the given object is currently in the success state
18495 #[no_mangle]
18496 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
18497         o.result_ok
18498 }
18499 #[no_mangle]
18500 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18501 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
18502 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
18503         fn drop(&mut self) {
18504                 if self.result_ok {
18505                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18506                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18507                         }
18508                 } else {
18509                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18510                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18511                         }
18512                 }
18513         }
18514 }
18515 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
18516         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
18517                 let contents = if o.result_ok {
18518                         let result = unsafe { o.contents.result };
18519                         unsafe { o.contents.result = core::ptr::null_mut() };
18520                         CResult_RevokeAndACKDecodeErrorZPtr { result }
18521                 } else {
18522                         let err = unsafe { o.contents.err };
18523                         unsafe { o.contents.err = core::ptr::null_mut(); }
18524                         CResult_RevokeAndACKDecodeErrorZPtr { err }
18525                 };
18526                 Self {
18527                         contents,
18528                         result_ok: o.result_ok,
18529                 }
18530         }
18531 }
18532 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
18533         fn clone(&self) -> Self {
18534                 if self.result_ok {
18535                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18536                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
18537                         } }
18538                 } else {
18539                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18540                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18541                         } }
18542                 }
18543         }
18544 }
18545 #[no_mangle]
18546 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18547 /// but with all dynamically-allocated buffers duplicated in new buffers.
18548 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
18549 #[repr(C)]
18550 /// The contents of CResult_ShutdownDecodeErrorZ
18551 pub union CResult_ShutdownDecodeErrorZPtr {
18552         /// A pointer to the contents in the success state.
18553         /// Reading from this pointer when `result_ok` is not set is undefined.
18554         pub result: *mut crate::lightning::ln::msgs::Shutdown,
18555         /// A pointer to the contents in the error state.
18556         /// Reading from this pointer when `result_ok` is set is undefined.
18557         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18558 }
18559 #[repr(C)]
18560 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
18561 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
18562 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18563 pub struct CResult_ShutdownDecodeErrorZ {
18564         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
18565         /// `err` or `result` depending on the state of `result_ok`.
18566         pub contents: CResult_ShutdownDecodeErrorZPtr,
18567         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
18568         pub result_ok: bool,
18569 }
18570 #[no_mangle]
18571 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18572 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
18573         CResult_ShutdownDecodeErrorZ {
18574                 contents: CResult_ShutdownDecodeErrorZPtr {
18575                         result: Box::into_raw(Box::new(o)),
18576                 },
18577                 result_ok: true,
18578         }
18579 }
18580 #[no_mangle]
18581 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18582 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
18583         CResult_ShutdownDecodeErrorZ {
18584                 contents: CResult_ShutdownDecodeErrorZPtr {
18585                         err: Box::into_raw(Box::new(e)),
18586                 },
18587                 result_ok: false,
18588         }
18589 }
18590 /// Checks if the given object is currently in the success state
18591 #[no_mangle]
18592 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
18593         o.result_ok
18594 }
18595 #[no_mangle]
18596 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18597 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
18598 impl Drop for CResult_ShutdownDecodeErrorZ {
18599         fn drop(&mut self) {
18600                 if self.result_ok {
18601                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18602                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18603                         }
18604                 } else {
18605                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18606                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18607                         }
18608                 }
18609         }
18610 }
18611 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
18612         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
18613                 let contents = if o.result_ok {
18614                         let result = unsafe { o.contents.result };
18615                         unsafe { o.contents.result = core::ptr::null_mut() };
18616                         CResult_ShutdownDecodeErrorZPtr { result }
18617                 } else {
18618                         let err = unsafe { o.contents.err };
18619                         unsafe { o.contents.err = core::ptr::null_mut(); }
18620                         CResult_ShutdownDecodeErrorZPtr { err }
18621                 };
18622                 Self {
18623                         contents,
18624                         result_ok: o.result_ok,
18625                 }
18626         }
18627 }
18628 impl Clone for CResult_ShutdownDecodeErrorZ {
18629         fn clone(&self) -> Self {
18630                 if self.result_ok {
18631                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
18632                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
18633                         } }
18634                 } else {
18635                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
18636                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18637                         } }
18638                 }
18639         }
18640 }
18641 #[no_mangle]
18642 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18643 /// but with all dynamically-allocated buffers duplicated in new buffers.
18644 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
18645 #[repr(C)]
18646 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
18647 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
18648         /// A pointer to the contents in the success state.
18649         /// Reading from this pointer when `result_ok` is not set is undefined.
18650         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
18651         /// A pointer to the contents in the error state.
18652         /// Reading from this pointer when `result_ok` is set is undefined.
18653         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18654 }
18655 #[repr(C)]
18656 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
18657 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18658 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18659 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
18660         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
18661         /// `err` or `result` depending on the state of `result_ok`.
18662         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
18663         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
18664         pub result_ok: bool,
18665 }
18666 #[no_mangle]
18667 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18668 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
18669         CResult_UpdateFailHTLCDecodeErrorZ {
18670                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18671                         result: Box::into_raw(Box::new(o)),
18672                 },
18673                 result_ok: true,
18674         }
18675 }
18676 #[no_mangle]
18677 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18678 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
18679         CResult_UpdateFailHTLCDecodeErrorZ {
18680                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18681                         err: Box::into_raw(Box::new(e)),
18682                 },
18683                 result_ok: false,
18684         }
18685 }
18686 /// Checks if the given object is currently in the success state
18687 #[no_mangle]
18688 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
18689         o.result_ok
18690 }
18691 #[no_mangle]
18692 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18693 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
18694 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
18695         fn drop(&mut self) {
18696                 if self.result_ok {
18697                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18698                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18699                         }
18700                 } else {
18701                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18702                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18703                         }
18704                 }
18705         }
18706 }
18707 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
18708         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18709                 let contents = if o.result_ok {
18710                         let result = unsafe { o.contents.result };
18711                         unsafe { o.contents.result = core::ptr::null_mut() };
18712                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
18713                 } else {
18714                         let err = unsafe { o.contents.err };
18715                         unsafe { o.contents.err = core::ptr::null_mut(); }
18716                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
18717                 };
18718                 Self {
18719                         contents,
18720                         result_ok: o.result_ok,
18721                 }
18722         }
18723 }
18724 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
18725         fn clone(&self) -> Self {
18726                 if self.result_ok {
18727                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18728                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
18729                         } }
18730                 } else {
18731                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18732                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18733                         } }
18734                 }
18735         }
18736 }
18737 #[no_mangle]
18738 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18739 /// but with all dynamically-allocated buffers duplicated in new buffers.
18740 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
18741 #[repr(C)]
18742 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
18743 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18744         /// A pointer to the contents in the success state.
18745         /// Reading from this pointer when `result_ok` is not set is undefined.
18746         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
18747         /// A pointer to the contents in the error state.
18748         /// Reading from this pointer when `result_ok` is set is undefined.
18749         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18750 }
18751 #[repr(C)]
18752 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
18753 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18755 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18756         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
18757         /// `err` or `result` depending on the state of `result_ok`.
18758         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
18759         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
18760         pub result_ok: bool,
18761 }
18762 #[no_mangle]
18763 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18764 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18765         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18766                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18767                         result: Box::into_raw(Box::new(o)),
18768                 },
18769                 result_ok: true,
18770         }
18771 }
18772 #[no_mangle]
18773 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18774 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18775         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18776                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18777                         err: Box::into_raw(Box::new(e)),
18778                 },
18779                 result_ok: false,
18780         }
18781 }
18782 /// Checks if the given object is currently in the success state
18783 #[no_mangle]
18784 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
18785         o.result_ok
18786 }
18787 #[no_mangle]
18788 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18789 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
18790 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18791         fn drop(&mut self) {
18792                 if self.result_ok {
18793                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18794                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18795                         }
18796                 } else {
18797                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18798                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18799                         }
18800                 }
18801         }
18802 }
18803 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18804         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18805                 let contents = if o.result_ok {
18806                         let result = unsafe { o.contents.result };
18807                         unsafe { o.contents.result = core::ptr::null_mut() };
18808                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
18809                 } else {
18810                         let err = unsafe { o.contents.err };
18811                         unsafe { o.contents.err = core::ptr::null_mut(); }
18812                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
18813                 };
18814                 Self {
18815                         contents,
18816                         result_ok: o.result_ok,
18817                 }
18818         }
18819 }
18820 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18821         fn clone(&self) -> Self {
18822                 if self.result_ok {
18823                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18824                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
18825                         } }
18826                 } else {
18827                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18828                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18829                         } }
18830                 }
18831         }
18832 }
18833 #[no_mangle]
18834 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18835 /// but with all dynamically-allocated buffers duplicated in new buffers.
18836 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
18837 #[repr(C)]
18838 /// The contents of CResult_UpdateFeeDecodeErrorZ
18839 pub union CResult_UpdateFeeDecodeErrorZPtr {
18840         /// A pointer to the contents in the success state.
18841         /// Reading from this pointer when `result_ok` is not set is undefined.
18842         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
18843         /// A pointer to the contents in the error state.
18844         /// Reading from this pointer when `result_ok` is set is undefined.
18845         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18846 }
18847 #[repr(C)]
18848 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
18849 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
18850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18851 pub struct CResult_UpdateFeeDecodeErrorZ {
18852         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
18853         /// `err` or `result` depending on the state of `result_ok`.
18854         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
18855         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
18856         pub result_ok: bool,
18857 }
18858 #[no_mangle]
18859 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18860 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
18861         CResult_UpdateFeeDecodeErrorZ {
18862                 contents: CResult_UpdateFeeDecodeErrorZPtr {
18863                         result: Box::into_raw(Box::new(o)),
18864                 },
18865                 result_ok: true,
18866         }
18867 }
18868 #[no_mangle]
18869 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18870 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
18871         CResult_UpdateFeeDecodeErrorZ {
18872                 contents: CResult_UpdateFeeDecodeErrorZPtr {
18873                         err: Box::into_raw(Box::new(e)),
18874                 },
18875                 result_ok: false,
18876         }
18877 }
18878 /// Checks if the given object is currently in the success state
18879 #[no_mangle]
18880 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
18881         o.result_ok
18882 }
18883 #[no_mangle]
18884 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18885 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
18886 impl Drop for CResult_UpdateFeeDecodeErrorZ {
18887         fn drop(&mut self) {
18888                 if self.result_ok {
18889                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18890                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18891                         }
18892                 } else {
18893                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18894                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18895                         }
18896                 }
18897         }
18898 }
18899 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
18900         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
18901                 let contents = if o.result_ok {
18902                         let result = unsafe { o.contents.result };
18903                         unsafe { o.contents.result = core::ptr::null_mut() };
18904                         CResult_UpdateFeeDecodeErrorZPtr { result }
18905                 } else {
18906                         let err = unsafe { o.contents.err };
18907                         unsafe { o.contents.err = core::ptr::null_mut(); }
18908                         CResult_UpdateFeeDecodeErrorZPtr { err }
18909                 };
18910                 Self {
18911                         contents,
18912                         result_ok: o.result_ok,
18913                 }
18914         }
18915 }
18916 impl Clone for CResult_UpdateFeeDecodeErrorZ {
18917         fn clone(&self) -> Self {
18918                 if self.result_ok {
18919                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
18920                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
18921                         } }
18922                 } else {
18923                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
18924                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18925                         } }
18926                 }
18927         }
18928 }
18929 #[no_mangle]
18930 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18931 /// but with all dynamically-allocated buffers duplicated in new buffers.
18932 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
18933 #[repr(C)]
18934 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
18935 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18936         /// A pointer to the contents in the success state.
18937         /// Reading from this pointer when `result_ok` is not set is undefined.
18938         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
18939         /// A pointer to the contents in the error state.
18940         /// Reading from this pointer when `result_ok` is set is undefined.
18941         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18942 }
18943 #[repr(C)]
18944 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
18945 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18946 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18947 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
18948         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
18949         /// `err` or `result` depending on the state of `result_ok`.
18950         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
18951         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
18952         pub result_ok: bool,
18953 }
18954 #[no_mangle]
18955 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18956 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18957         CResult_UpdateFulfillHTLCDecodeErrorZ {
18958                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18959                         result: Box::into_raw(Box::new(o)),
18960                 },
18961                 result_ok: true,
18962         }
18963 }
18964 #[no_mangle]
18965 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18966 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18967         CResult_UpdateFulfillHTLCDecodeErrorZ {
18968                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18969                         err: Box::into_raw(Box::new(e)),
18970                 },
18971                 result_ok: false,
18972         }
18973 }
18974 /// Checks if the given object is currently in the success state
18975 #[no_mangle]
18976 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
18977         o.result_ok
18978 }
18979 #[no_mangle]
18980 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18981 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
18982 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
18983         fn drop(&mut self) {
18984                 if self.result_ok {
18985                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18986                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18987                         }
18988                 } else {
18989                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18990                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18991                         }
18992                 }
18993         }
18994 }
18995 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
18996         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18997                 let contents = if o.result_ok {
18998                         let result = unsafe { o.contents.result };
18999                         unsafe { o.contents.result = core::ptr::null_mut() };
19000                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
19001                 } else {
19002                         let err = unsafe { o.contents.err };
19003                         unsafe { o.contents.err = core::ptr::null_mut(); }
19004                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
19005                 };
19006                 Self {
19007                         contents,
19008                         result_ok: o.result_ok,
19009                 }
19010         }
19011 }
19012 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
19013         fn clone(&self) -> Self {
19014                 if self.result_ok {
19015                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
19016                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
19017                         } }
19018                 } else {
19019                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
19020                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19021                         } }
19022                 }
19023         }
19024 }
19025 #[no_mangle]
19026 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
19027 /// but with all dynamically-allocated buffers duplicated in new buffers.
19028 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
19029 #[repr(C)]
19030 /// The contents of CResult_OnionPacketDecodeErrorZ
19031 pub union CResult_OnionPacketDecodeErrorZPtr {
19032         /// A pointer to the contents in the success state.
19033         /// Reading from this pointer when `result_ok` is not set is undefined.
19034         pub result: *mut crate::lightning::ln::msgs::OnionPacket,
19035         /// A pointer to the contents in the error state.
19036         /// Reading from this pointer when `result_ok` is set is undefined.
19037         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19038 }
19039 #[repr(C)]
19040 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
19041 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
19042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19043 pub struct CResult_OnionPacketDecodeErrorZ {
19044         /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
19045         /// `err` or `result` depending on the state of `result_ok`.
19046         pub contents: CResult_OnionPacketDecodeErrorZPtr,
19047         /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
19048         pub result_ok: bool,
19049 }
19050 #[no_mangle]
19051 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
19052 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
19053         CResult_OnionPacketDecodeErrorZ {
19054                 contents: CResult_OnionPacketDecodeErrorZPtr {
19055                         result: Box::into_raw(Box::new(o)),
19056                 },
19057                 result_ok: true,
19058         }
19059 }
19060 #[no_mangle]
19061 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
19062 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
19063         CResult_OnionPacketDecodeErrorZ {
19064                 contents: CResult_OnionPacketDecodeErrorZPtr {
19065                         err: Box::into_raw(Box::new(e)),
19066                 },
19067                 result_ok: false,
19068         }
19069 }
19070 /// Checks if the given object is currently in the success state
19071 #[no_mangle]
19072 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
19073         o.result_ok
19074 }
19075 #[no_mangle]
19076 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
19077 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
19078 impl Drop for CResult_OnionPacketDecodeErrorZ {
19079         fn drop(&mut self) {
19080                 if self.result_ok {
19081                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19082                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19083                         }
19084                 } else {
19085                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19086                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19087                         }
19088                 }
19089         }
19090 }
19091 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
19092         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
19093                 let contents = if o.result_ok {
19094                         let result = unsafe { o.contents.result };
19095                         unsafe { o.contents.result = core::ptr::null_mut() };
19096                         CResult_OnionPacketDecodeErrorZPtr { result }
19097                 } else {
19098                         let err = unsafe { o.contents.err };
19099                         unsafe { o.contents.err = core::ptr::null_mut(); }
19100                         CResult_OnionPacketDecodeErrorZPtr { err }
19101                 };
19102                 Self {
19103                         contents,
19104                         result_ok: o.result_ok,
19105                 }
19106         }
19107 }
19108 impl Clone for CResult_OnionPacketDecodeErrorZ {
19109         fn clone(&self) -> Self {
19110                 if self.result_ok {
19111                         Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
19112                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
19113                         } }
19114                 } else {
19115                         Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
19116                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19117                         } }
19118                 }
19119         }
19120 }
19121 #[no_mangle]
19122 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
19123 /// but with all dynamically-allocated buffers duplicated in new buffers.
19124 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
19125 #[repr(C)]
19126 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
19127 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
19128         /// A pointer to the contents in the success state.
19129         /// Reading from this pointer when `result_ok` is not set is undefined.
19130         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
19131         /// A pointer to the contents in the error state.
19132         /// Reading from this pointer when `result_ok` is set is undefined.
19133         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19134 }
19135 #[repr(C)]
19136 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
19137 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
19138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19139 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
19140         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
19141         /// `err` or `result` depending on the state of `result_ok`.
19142         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
19143         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
19144         pub result_ok: bool,
19145 }
19146 #[no_mangle]
19147 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
19148 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
19149         CResult_UpdateAddHTLCDecodeErrorZ {
19150                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19151                         result: Box::into_raw(Box::new(o)),
19152                 },
19153                 result_ok: true,
19154         }
19155 }
19156 #[no_mangle]
19157 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
19158 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
19159         CResult_UpdateAddHTLCDecodeErrorZ {
19160                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19161                         err: Box::into_raw(Box::new(e)),
19162                 },
19163                 result_ok: false,
19164         }
19165 }
19166 /// Checks if the given object is currently in the success state
19167 #[no_mangle]
19168 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
19169         o.result_ok
19170 }
19171 #[no_mangle]
19172 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
19173 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
19174 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
19175         fn drop(&mut self) {
19176                 if self.result_ok {
19177                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19178                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19179                         }
19180                 } else {
19181                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19182                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19183                         }
19184                 }
19185         }
19186 }
19187 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
19188         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
19189                 let contents = if o.result_ok {
19190                         let result = unsafe { o.contents.result };
19191                         unsafe { o.contents.result = core::ptr::null_mut() };
19192                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
19193                 } else {
19194                         let err = unsafe { o.contents.err };
19195                         unsafe { o.contents.err = core::ptr::null_mut(); }
19196                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
19197                 };
19198                 Self {
19199                         contents,
19200                         result_ok: o.result_ok,
19201                 }
19202         }
19203 }
19204 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
19205         fn clone(&self) -> Self {
19206                 if self.result_ok {
19207                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19208                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
19209                         } }
19210                 } else {
19211                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
19212                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19213                         } }
19214                 }
19215         }
19216 }
19217 #[no_mangle]
19218 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
19219 /// but with all dynamically-allocated buffers duplicated in new buffers.
19220 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
19221 #[repr(C)]
19222 /// The contents of CResult_OnionMessageDecodeErrorZ
19223 pub union CResult_OnionMessageDecodeErrorZPtr {
19224         /// A pointer to the contents in the success state.
19225         /// Reading from this pointer when `result_ok` is not set is undefined.
19226         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
19227         /// A pointer to the contents in the error state.
19228         /// Reading from this pointer when `result_ok` is set is undefined.
19229         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19230 }
19231 #[repr(C)]
19232 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
19233 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19234 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19235 pub struct CResult_OnionMessageDecodeErrorZ {
19236         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
19237         /// `err` or `result` depending on the state of `result_ok`.
19238         pub contents: CResult_OnionMessageDecodeErrorZPtr,
19239         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
19240         pub result_ok: bool,
19241 }
19242 #[no_mangle]
19243 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
19244 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
19245         CResult_OnionMessageDecodeErrorZ {
19246                 contents: CResult_OnionMessageDecodeErrorZPtr {
19247                         result: Box::into_raw(Box::new(o)),
19248                 },
19249                 result_ok: true,
19250         }
19251 }
19252 #[no_mangle]
19253 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
19254 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
19255         CResult_OnionMessageDecodeErrorZ {
19256                 contents: CResult_OnionMessageDecodeErrorZPtr {
19257                         err: Box::into_raw(Box::new(e)),
19258                 },
19259                 result_ok: false,
19260         }
19261 }
19262 /// Checks if the given object is currently in the success state
19263 #[no_mangle]
19264 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
19265         o.result_ok
19266 }
19267 #[no_mangle]
19268 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
19269 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
19270 impl Drop for CResult_OnionMessageDecodeErrorZ {
19271         fn drop(&mut self) {
19272                 if self.result_ok {
19273                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19274                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19275                         }
19276                 } else {
19277                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19278                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19279                         }
19280                 }
19281         }
19282 }
19283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
19284         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19285                 let contents = if o.result_ok {
19286                         let result = unsafe { o.contents.result };
19287                         unsafe { o.contents.result = core::ptr::null_mut() };
19288                         CResult_OnionMessageDecodeErrorZPtr { result }
19289                 } else {
19290                         let err = unsafe { o.contents.err };
19291                         unsafe { o.contents.err = core::ptr::null_mut(); }
19292                         CResult_OnionMessageDecodeErrorZPtr { err }
19293                 };
19294                 Self {
19295                         contents,
19296                         result_ok: o.result_ok,
19297                 }
19298         }
19299 }
19300 impl Clone for CResult_OnionMessageDecodeErrorZ {
19301         fn clone(&self) -> Self {
19302                 if self.result_ok {
19303                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
19304                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
19305                         } }
19306                 } else {
19307                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
19308                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19309                         } }
19310                 }
19311         }
19312 }
19313 #[no_mangle]
19314 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
19315 /// but with all dynamically-allocated buffers duplicated in new buffers.
19316 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
19317 #[repr(C)]
19318 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
19319 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
19320         /// A pointer to the contents in the success state.
19321         /// Reading from this pointer when `result_ok` is not set is undefined.
19322         pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
19323         /// A pointer to the contents in the error state.
19324         /// Reading from this pointer when `result_ok` is set is undefined.
19325         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19326 }
19327 #[repr(C)]
19328 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
19329 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
19330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19331 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
19332         /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
19333         /// `err` or `result` depending on the state of `result_ok`.
19334         pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
19335         /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
19336         pub result_ok: bool,
19337 }
19338 #[no_mangle]
19339 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
19340 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
19341         CResult_FinalOnionHopDataDecodeErrorZ {
19342                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19343                         result: Box::into_raw(Box::new(o)),
19344                 },
19345                 result_ok: true,
19346         }
19347 }
19348 #[no_mangle]
19349 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
19350 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
19351         CResult_FinalOnionHopDataDecodeErrorZ {
19352                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19353                         err: Box::into_raw(Box::new(e)),
19354                 },
19355                 result_ok: false,
19356         }
19357 }
19358 /// Checks if the given object is currently in the success state
19359 #[no_mangle]
19360 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
19361         o.result_ok
19362 }
19363 #[no_mangle]
19364 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
19365 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
19366 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
19367         fn drop(&mut self) {
19368                 if self.result_ok {
19369                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19370                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19371                         }
19372                 } else {
19373                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19374                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19375                         }
19376                 }
19377         }
19378 }
19379 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
19380         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
19381                 let contents = if o.result_ok {
19382                         let result = unsafe { o.contents.result };
19383                         unsafe { o.contents.result = core::ptr::null_mut() };
19384                         CResult_FinalOnionHopDataDecodeErrorZPtr { result }
19385                 } else {
19386                         let err = unsafe { o.contents.err };
19387                         unsafe { o.contents.err = core::ptr::null_mut(); }
19388                         CResult_FinalOnionHopDataDecodeErrorZPtr { err }
19389                 };
19390                 Self {
19391                         contents,
19392                         result_ok: o.result_ok,
19393                 }
19394         }
19395 }
19396 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
19397         fn clone(&self) -> Self {
19398                 if self.result_ok {
19399                         Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19400                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
19401                         } }
19402                 } else {
19403                         Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
19404                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19405                         } }
19406                 }
19407         }
19408 }
19409 #[no_mangle]
19410 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
19411 /// but with all dynamically-allocated buffers duplicated in new buffers.
19412 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
19413 #[repr(C)]
19414 /// The contents of CResult_PingDecodeErrorZ
19415 pub union CResult_PingDecodeErrorZPtr {
19416         /// A pointer to the contents in the success state.
19417         /// Reading from this pointer when `result_ok` is not set is undefined.
19418         pub result: *mut crate::lightning::ln::msgs::Ping,
19419         /// A pointer to the contents in the error state.
19420         /// Reading from this pointer when `result_ok` is set is undefined.
19421         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19422 }
19423 #[repr(C)]
19424 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
19425 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
19426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19427 pub struct CResult_PingDecodeErrorZ {
19428         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
19429         /// `err` or `result` depending on the state of `result_ok`.
19430         pub contents: CResult_PingDecodeErrorZPtr,
19431         /// Whether this CResult_PingDecodeErrorZ represents a success state.
19432         pub result_ok: bool,
19433 }
19434 #[no_mangle]
19435 /// Creates a new CResult_PingDecodeErrorZ in the success state.
19436 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
19437         CResult_PingDecodeErrorZ {
19438                 contents: CResult_PingDecodeErrorZPtr {
19439                         result: Box::into_raw(Box::new(o)),
19440                 },
19441                 result_ok: true,
19442         }
19443 }
19444 #[no_mangle]
19445 /// Creates a new CResult_PingDecodeErrorZ in the error state.
19446 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
19447         CResult_PingDecodeErrorZ {
19448                 contents: CResult_PingDecodeErrorZPtr {
19449                         err: Box::into_raw(Box::new(e)),
19450                 },
19451                 result_ok: false,
19452         }
19453 }
19454 /// Checks if the given object is currently in the success state
19455 #[no_mangle]
19456 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
19457         o.result_ok
19458 }
19459 #[no_mangle]
19460 /// Frees any resources used by the CResult_PingDecodeErrorZ.
19461 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
19462 impl Drop for CResult_PingDecodeErrorZ {
19463         fn drop(&mut self) {
19464                 if self.result_ok {
19465                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19466                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19467                         }
19468                 } else {
19469                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19470                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19471                         }
19472                 }
19473         }
19474 }
19475 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
19476         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
19477                 let contents = if o.result_ok {
19478                         let result = unsafe { o.contents.result };
19479                         unsafe { o.contents.result = core::ptr::null_mut() };
19480                         CResult_PingDecodeErrorZPtr { result }
19481                 } else {
19482                         let err = unsafe { o.contents.err };
19483                         unsafe { o.contents.err = core::ptr::null_mut(); }
19484                         CResult_PingDecodeErrorZPtr { err }
19485                 };
19486                 Self {
19487                         contents,
19488                         result_ok: o.result_ok,
19489                 }
19490         }
19491 }
19492 impl Clone for CResult_PingDecodeErrorZ {
19493         fn clone(&self) -> Self {
19494                 if self.result_ok {
19495                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
19496                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
19497                         } }
19498                 } else {
19499                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
19500                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19501                         } }
19502                 }
19503         }
19504 }
19505 #[no_mangle]
19506 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19507 /// but with all dynamically-allocated buffers duplicated in new buffers.
19508 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
19509 #[repr(C)]
19510 /// The contents of CResult_PongDecodeErrorZ
19511 pub union CResult_PongDecodeErrorZPtr {
19512         /// A pointer to the contents in the success state.
19513         /// Reading from this pointer when `result_ok` is not set is undefined.
19514         pub result: *mut crate::lightning::ln::msgs::Pong,
19515         /// A pointer to the contents in the error state.
19516         /// Reading from this pointer when `result_ok` is set is undefined.
19517         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19518 }
19519 #[repr(C)]
19520 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
19521 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
19522 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19523 pub struct CResult_PongDecodeErrorZ {
19524         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
19525         /// `err` or `result` depending on the state of `result_ok`.
19526         pub contents: CResult_PongDecodeErrorZPtr,
19527         /// Whether this CResult_PongDecodeErrorZ represents a success state.
19528         pub result_ok: bool,
19529 }
19530 #[no_mangle]
19531 /// Creates a new CResult_PongDecodeErrorZ in the success state.
19532 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
19533         CResult_PongDecodeErrorZ {
19534                 contents: CResult_PongDecodeErrorZPtr {
19535                         result: Box::into_raw(Box::new(o)),
19536                 },
19537                 result_ok: true,
19538         }
19539 }
19540 #[no_mangle]
19541 /// Creates a new CResult_PongDecodeErrorZ in the error state.
19542 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
19543         CResult_PongDecodeErrorZ {
19544                 contents: CResult_PongDecodeErrorZPtr {
19545                         err: Box::into_raw(Box::new(e)),
19546                 },
19547                 result_ok: false,
19548         }
19549 }
19550 /// Checks if the given object is currently in the success state
19551 #[no_mangle]
19552 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
19553         o.result_ok
19554 }
19555 #[no_mangle]
19556 /// Frees any resources used by the CResult_PongDecodeErrorZ.
19557 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
19558 impl Drop for CResult_PongDecodeErrorZ {
19559         fn drop(&mut self) {
19560                 if self.result_ok {
19561                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19562                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19563                         }
19564                 } else {
19565                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19566                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19567                         }
19568                 }
19569         }
19570 }
19571 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
19572         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
19573                 let contents = if o.result_ok {
19574                         let result = unsafe { o.contents.result };
19575                         unsafe { o.contents.result = core::ptr::null_mut() };
19576                         CResult_PongDecodeErrorZPtr { result }
19577                 } else {
19578                         let err = unsafe { o.contents.err };
19579                         unsafe { o.contents.err = core::ptr::null_mut(); }
19580                         CResult_PongDecodeErrorZPtr { err }
19581                 };
19582                 Self {
19583                         contents,
19584                         result_ok: o.result_ok,
19585                 }
19586         }
19587 }
19588 impl Clone for CResult_PongDecodeErrorZ {
19589         fn clone(&self) -> Self {
19590                 if self.result_ok {
19591                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
19592                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
19593                         } }
19594                 } else {
19595                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
19596                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19597                         } }
19598                 }
19599         }
19600 }
19601 #[no_mangle]
19602 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19603 /// but with all dynamically-allocated buffers duplicated in new buffers.
19604 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
19605 #[repr(C)]
19606 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
19607 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19608         /// A pointer to the contents in the success state.
19609         /// Reading from this pointer when `result_ok` is not set is undefined.
19610         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
19611         /// A pointer to the contents in the error state.
19612         /// Reading from this pointer when `result_ok` is set is undefined.
19613         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19614 }
19615 #[repr(C)]
19616 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19617 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19619 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19620         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
19621         /// `err` or `result` depending on the state of `result_ok`.
19622         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
19623         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
19624         pub result_ok: bool,
19625 }
19626 #[no_mangle]
19627 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19628 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19629         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19630                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19631                         result: Box::into_raw(Box::new(o)),
19632                 },
19633                 result_ok: true,
19634         }
19635 }
19636 #[no_mangle]
19637 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19638 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19639         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19640                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19641                         err: Box::into_raw(Box::new(e)),
19642                 },
19643                 result_ok: false,
19644         }
19645 }
19646 /// Checks if the given object is currently in the success state
19647 #[no_mangle]
19648 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
19649         o.result_ok
19650 }
19651 #[no_mangle]
19652 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19653 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
19654 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19655         fn drop(&mut self) {
19656                 if self.result_ok {
19657                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19658                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19659                         }
19660                 } else {
19661                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19662                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19663                         }
19664                 }
19665         }
19666 }
19667 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19668         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19669                 let contents = if o.result_ok {
19670                         let result = unsafe { o.contents.result };
19671                         unsafe { o.contents.result = core::ptr::null_mut() };
19672                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
19673                 } else {
19674                         let err = unsafe { o.contents.err };
19675                         unsafe { o.contents.err = core::ptr::null_mut(); }
19676                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
19677                 };
19678                 Self {
19679                         contents,
19680                         result_ok: o.result_ok,
19681                 }
19682         }
19683 }
19684 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19685         fn clone(&self) -> Self {
19686                 if self.result_ok {
19687                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19688                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19689                         } }
19690                 } else {
19691                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19692                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19693                         } }
19694                 }
19695         }
19696 }
19697 #[no_mangle]
19698 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19699 /// but with all dynamically-allocated buffers duplicated in new buffers.
19700 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19701 #[repr(C)]
19702 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
19703 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
19704         /// A pointer to the contents in the success state.
19705         /// Reading from this pointer when `result_ok` is not set is undefined.
19706         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
19707         /// A pointer to the contents in the error state.
19708         /// Reading from this pointer when `result_ok` is set is undefined.
19709         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19710 }
19711 #[repr(C)]
19712 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19713 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19715 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
19716         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
19717         /// `err` or `result` depending on the state of `result_ok`.
19718         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
19719         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
19720         pub result_ok: bool,
19721 }
19722 #[no_mangle]
19723 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19724 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
19725         CResult_ChannelAnnouncementDecodeErrorZ {
19726                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19727                         result: Box::into_raw(Box::new(o)),
19728                 },
19729                 result_ok: true,
19730         }
19731 }
19732 #[no_mangle]
19733 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19734 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
19735         CResult_ChannelAnnouncementDecodeErrorZ {
19736                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19737                         err: Box::into_raw(Box::new(e)),
19738                 },
19739                 result_ok: false,
19740         }
19741 }
19742 /// Checks if the given object is currently in the success state
19743 #[no_mangle]
19744 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
19745         o.result_ok
19746 }
19747 #[no_mangle]
19748 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19749 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
19750 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
19751         fn drop(&mut self) {
19752                 if self.result_ok {
19753                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19754                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19755                         }
19756                 } else {
19757                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19758                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19759                         }
19760                 }
19761         }
19762 }
19763 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
19764         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19765                 let contents = if o.result_ok {
19766                         let result = unsafe { o.contents.result };
19767                         unsafe { o.contents.result = core::ptr::null_mut() };
19768                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
19769                 } else {
19770                         let err = unsafe { o.contents.err };
19771                         unsafe { o.contents.err = core::ptr::null_mut(); }
19772                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
19773                 };
19774                 Self {
19775                         contents,
19776                         result_ok: o.result_ok,
19777                 }
19778         }
19779 }
19780 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
19781         fn clone(&self) -> Self {
19782                 if self.result_ok {
19783                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19784                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19785                         } }
19786                 } else {
19787                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19788                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19789                         } }
19790                 }
19791         }
19792 }
19793 #[no_mangle]
19794 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19795 /// but with all dynamically-allocated buffers duplicated in new buffers.
19796 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19797 #[repr(C)]
19798 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
19799 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19800         /// A pointer to the contents in the success state.
19801         /// Reading from this pointer when `result_ok` is not set is undefined.
19802         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
19803         /// A pointer to the contents in the error state.
19804         /// Reading from this pointer when `result_ok` is set is undefined.
19805         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19806 }
19807 #[repr(C)]
19808 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19809 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19811 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
19812         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
19813         /// `err` or `result` depending on the state of `result_ok`.
19814         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
19815         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
19816         pub result_ok: bool,
19817 }
19818 #[no_mangle]
19819 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19820 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19821         CResult_UnsignedChannelUpdateDecodeErrorZ {
19822                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19823                         result: Box::into_raw(Box::new(o)),
19824                 },
19825                 result_ok: true,
19826         }
19827 }
19828 #[no_mangle]
19829 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19830 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19831         CResult_UnsignedChannelUpdateDecodeErrorZ {
19832                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19833                         err: Box::into_raw(Box::new(e)),
19834                 },
19835                 result_ok: false,
19836         }
19837 }
19838 /// Checks if the given object is currently in the success state
19839 #[no_mangle]
19840 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
19841         o.result_ok
19842 }
19843 #[no_mangle]
19844 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19845 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
19846 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
19847         fn drop(&mut self) {
19848                 if self.result_ok {
19849                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19850                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19851                         }
19852                 } else {
19853                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19854                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19855                         }
19856                 }
19857         }
19858 }
19859 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
19860         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19861                 let contents = if o.result_ok {
19862                         let result = unsafe { o.contents.result };
19863                         unsafe { o.contents.result = core::ptr::null_mut() };
19864                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
19865                 } else {
19866                         let err = unsafe { o.contents.err };
19867                         unsafe { o.contents.err = core::ptr::null_mut(); }
19868                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
19869                 };
19870                 Self {
19871                         contents,
19872                         result_ok: o.result_ok,
19873                 }
19874         }
19875 }
19876 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
19877         fn clone(&self) -> Self {
19878                 if self.result_ok {
19879                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19880                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
19881                         } }
19882                 } else {
19883                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19884                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19885                         } }
19886                 }
19887         }
19888 }
19889 #[no_mangle]
19890 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19891 /// but with all dynamically-allocated buffers duplicated in new buffers.
19892 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19893 #[repr(C)]
19894 /// The contents of CResult_ChannelUpdateDecodeErrorZ
19895 pub union CResult_ChannelUpdateDecodeErrorZPtr {
19896         /// A pointer to the contents in the success state.
19897         /// Reading from this pointer when `result_ok` is not set is undefined.
19898         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
19899         /// A pointer to the contents in the error state.
19900         /// Reading from this pointer when `result_ok` is set is undefined.
19901         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19902 }
19903 #[repr(C)]
19904 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19905 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19907 pub struct CResult_ChannelUpdateDecodeErrorZ {
19908         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
19909         /// `err` or `result` depending on the state of `result_ok`.
19910         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
19911         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
19912         pub result_ok: bool,
19913 }
19914 #[no_mangle]
19915 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19916 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
19917         CResult_ChannelUpdateDecodeErrorZ {
19918                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19919                         result: Box::into_raw(Box::new(o)),
19920                 },
19921                 result_ok: true,
19922         }
19923 }
19924 #[no_mangle]
19925 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19926 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
19927         CResult_ChannelUpdateDecodeErrorZ {
19928                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19929                         err: Box::into_raw(Box::new(e)),
19930                 },
19931                 result_ok: false,
19932         }
19933 }
19934 /// Checks if the given object is currently in the success state
19935 #[no_mangle]
19936 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
19937         o.result_ok
19938 }
19939 #[no_mangle]
19940 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19941 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
19942 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
19943         fn drop(&mut self) {
19944                 if self.result_ok {
19945                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19946                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19947                         }
19948                 } else {
19949                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19950                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19951                         }
19952                 }
19953         }
19954 }
19955 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
19956         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19957                 let contents = if o.result_ok {
19958                         let result = unsafe { o.contents.result };
19959                         unsafe { o.contents.result = core::ptr::null_mut() };
19960                         CResult_ChannelUpdateDecodeErrorZPtr { result }
19961                 } else {
19962                         let err = unsafe { o.contents.err };
19963                         unsafe { o.contents.err = core::ptr::null_mut(); }
19964                         CResult_ChannelUpdateDecodeErrorZPtr { err }
19965                 };
19966                 Self {
19967                         contents,
19968                         result_ok: o.result_ok,
19969                 }
19970         }
19971 }
19972 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
19973         fn clone(&self) -> Self {
19974                 if self.result_ok {
19975                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19976                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
19977                         } }
19978                 } else {
19979                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19980                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19981                         } }
19982                 }
19983         }
19984 }
19985 #[no_mangle]
19986 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19987 /// but with all dynamically-allocated buffers duplicated in new buffers.
19988 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19989 #[repr(C)]
19990 /// The contents of CResult_ErrorMessageDecodeErrorZ
19991 pub union CResult_ErrorMessageDecodeErrorZPtr {
19992         /// A pointer to the contents in the success state.
19993         /// Reading from this pointer when `result_ok` is not set is undefined.
19994         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
19995         /// A pointer to the contents in the error state.
19996         /// Reading from this pointer when `result_ok` is set is undefined.
19997         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19998 }
19999 #[repr(C)]
20000 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
20001 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
20002 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20003 pub struct CResult_ErrorMessageDecodeErrorZ {
20004         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
20005         /// `err` or `result` depending on the state of `result_ok`.
20006         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
20007         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
20008         pub result_ok: bool,
20009 }
20010 #[no_mangle]
20011 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
20012 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
20013         CResult_ErrorMessageDecodeErrorZ {
20014                 contents: CResult_ErrorMessageDecodeErrorZPtr {
20015                         result: Box::into_raw(Box::new(o)),
20016                 },
20017                 result_ok: true,
20018         }
20019 }
20020 #[no_mangle]
20021 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
20022 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
20023         CResult_ErrorMessageDecodeErrorZ {
20024                 contents: CResult_ErrorMessageDecodeErrorZPtr {
20025                         err: Box::into_raw(Box::new(e)),
20026                 },
20027                 result_ok: false,
20028         }
20029 }
20030 /// Checks if the given object is currently in the success state
20031 #[no_mangle]
20032 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
20033         o.result_ok
20034 }
20035 #[no_mangle]
20036 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
20037 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
20038 impl Drop for CResult_ErrorMessageDecodeErrorZ {
20039         fn drop(&mut self) {
20040                 if self.result_ok {
20041                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20042                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20043                         }
20044                 } else {
20045                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20046                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20047                         }
20048                 }
20049         }
20050 }
20051 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
20052         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
20053                 let contents = if o.result_ok {
20054                         let result = unsafe { o.contents.result };
20055                         unsafe { o.contents.result = core::ptr::null_mut() };
20056                         CResult_ErrorMessageDecodeErrorZPtr { result }
20057                 } else {
20058                         let err = unsafe { o.contents.err };
20059                         unsafe { o.contents.err = core::ptr::null_mut(); }
20060                         CResult_ErrorMessageDecodeErrorZPtr { err }
20061                 };
20062                 Self {
20063                         contents,
20064                         result_ok: o.result_ok,
20065                 }
20066         }
20067 }
20068 impl Clone for CResult_ErrorMessageDecodeErrorZ {
20069         fn clone(&self) -> Self {
20070                 if self.result_ok {
20071                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
20072                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
20073                         } }
20074                 } else {
20075                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
20076                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20077                         } }
20078                 }
20079         }
20080 }
20081 #[no_mangle]
20082 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
20083 /// but with all dynamically-allocated buffers duplicated in new buffers.
20084 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
20085 #[repr(C)]
20086 /// The contents of CResult_WarningMessageDecodeErrorZ
20087 pub union CResult_WarningMessageDecodeErrorZPtr {
20088         /// A pointer to the contents in the success state.
20089         /// Reading from this pointer when `result_ok` is not set is undefined.
20090         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
20091         /// A pointer to the contents in the error state.
20092         /// Reading from this pointer when `result_ok` is set is undefined.
20093         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20094 }
20095 #[repr(C)]
20096 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
20097 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
20098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20099 pub struct CResult_WarningMessageDecodeErrorZ {
20100         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
20101         /// `err` or `result` depending on the state of `result_ok`.
20102         pub contents: CResult_WarningMessageDecodeErrorZPtr,
20103         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
20104         pub result_ok: bool,
20105 }
20106 #[no_mangle]
20107 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
20108 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
20109         CResult_WarningMessageDecodeErrorZ {
20110                 contents: CResult_WarningMessageDecodeErrorZPtr {
20111                         result: Box::into_raw(Box::new(o)),
20112                 },
20113                 result_ok: true,
20114         }
20115 }
20116 #[no_mangle]
20117 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
20118 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
20119         CResult_WarningMessageDecodeErrorZ {
20120                 contents: CResult_WarningMessageDecodeErrorZPtr {
20121                         err: Box::into_raw(Box::new(e)),
20122                 },
20123                 result_ok: false,
20124         }
20125 }
20126 /// Checks if the given object is currently in the success state
20127 #[no_mangle]
20128 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
20129         o.result_ok
20130 }
20131 #[no_mangle]
20132 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
20133 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
20134 impl Drop for CResult_WarningMessageDecodeErrorZ {
20135         fn drop(&mut self) {
20136                 if self.result_ok {
20137                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20138                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20139                         }
20140                 } else {
20141                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20142                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20143                         }
20144                 }
20145         }
20146 }
20147 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
20148         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
20149                 let contents = if o.result_ok {
20150                         let result = unsafe { o.contents.result };
20151                         unsafe { o.contents.result = core::ptr::null_mut() };
20152                         CResult_WarningMessageDecodeErrorZPtr { result }
20153                 } else {
20154                         let err = unsafe { o.contents.err };
20155                         unsafe { o.contents.err = core::ptr::null_mut(); }
20156                         CResult_WarningMessageDecodeErrorZPtr { err }
20157                 };
20158                 Self {
20159                         contents,
20160                         result_ok: o.result_ok,
20161                 }
20162         }
20163 }
20164 impl Clone for CResult_WarningMessageDecodeErrorZ {
20165         fn clone(&self) -> Self {
20166                 if self.result_ok {
20167                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
20168                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
20169                         } }
20170                 } else {
20171                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
20172                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20173                         } }
20174                 }
20175         }
20176 }
20177 #[no_mangle]
20178 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
20179 /// but with all dynamically-allocated buffers duplicated in new buffers.
20180 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
20181 #[repr(C)]
20182 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
20183 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20184         /// A pointer to the contents in the success state.
20185         /// Reading from this pointer when `result_ok` is not set is undefined.
20186         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
20187         /// A pointer to the contents in the error state.
20188         /// Reading from this pointer when `result_ok` is set is undefined.
20189         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20190 }
20191 #[repr(C)]
20192 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
20193 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
20194 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20195 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20196         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
20197         /// `err` or `result` depending on the state of `result_ok`.
20198         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
20199         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
20200         pub result_ok: bool,
20201 }
20202 #[no_mangle]
20203 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
20204 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20205         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20206                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20207                         result: Box::into_raw(Box::new(o)),
20208                 },
20209                 result_ok: true,
20210         }
20211 }
20212 #[no_mangle]
20213 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
20214 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20215         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20216                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20217                         err: Box::into_raw(Box::new(e)),
20218                 },
20219                 result_ok: false,
20220         }
20221 }
20222 /// Checks if the given object is currently in the success state
20223 #[no_mangle]
20224 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
20225         o.result_ok
20226 }
20227 #[no_mangle]
20228 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
20229 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
20230 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20231         fn drop(&mut self) {
20232                 if self.result_ok {
20233                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20234                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20235                         }
20236                 } else {
20237                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20238                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20239                         }
20240                 }
20241         }
20242 }
20243 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20244         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
20245                 let contents = if o.result_ok {
20246                         let result = unsafe { o.contents.result };
20247                         unsafe { o.contents.result = core::ptr::null_mut() };
20248                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
20249                 } else {
20250                         let err = unsafe { o.contents.err };
20251                         unsafe { o.contents.err = core::ptr::null_mut(); }
20252                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
20253                 };
20254                 Self {
20255                         contents,
20256                         result_ok: o.result_ok,
20257                 }
20258         }
20259 }
20260 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
20261         fn clone(&self) -> Self {
20262                 if self.result_ok {
20263                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20264                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20265                         } }
20266                 } else {
20267                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
20268                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20269                         } }
20270                 }
20271         }
20272 }
20273 #[no_mangle]
20274 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
20275 /// but with all dynamically-allocated buffers duplicated in new buffers.
20276 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20277 #[repr(C)]
20278 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
20279 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
20280         /// A pointer to the contents in the success state.
20281         /// Reading from this pointer when `result_ok` is not set is undefined.
20282         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
20283         /// A pointer to the contents in the error state.
20284         /// Reading from this pointer when `result_ok` is set is undefined.
20285         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20286 }
20287 #[repr(C)]
20288 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
20289 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
20290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20291 pub struct CResult_NodeAnnouncementDecodeErrorZ {
20292         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
20293         /// `err` or `result` depending on the state of `result_ok`.
20294         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
20295         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
20296         pub result_ok: bool,
20297 }
20298 #[no_mangle]
20299 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
20300 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
20301         CResult_NodeAnnouncementDecodeErrorZ {
20302                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20303                         result: Box::into_raw(Box::new(o)),
20304                 },
20305                 result_ok: true,
20306         }
20307 }
20308 #[no_mangle]
20309 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
20310 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
20311         CResult_NodeAnnouncementDecodeErrorZ {
20312                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20313                         err: Box::into_raw(Box::new(e)),
20314                 },
20315                 result_ok: false,
20316         }
20317 }
20318 /// Checks if the given object is currently in the success state
20319 #[no_mangle]
20320 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
20321         o.result_ok
20322 }
20323 #[no_mangle]
20324 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
20325 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
20326 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
20327         fn drop(&mut self) {
20328                 if self.result_ok {
20329                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20330                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20331                         }
20332                 } else {
20333                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20334                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20335                         }
20336                 }
20337         }
20338 }
20339 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
20340         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
20341                 let contents = if o.result_ok {
20342                         let result = unsafe { o.contents.result };
20343                         unsafe { o.contents.result = core::ptr::null_mut() };
20344                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
20345                 } else {
20346                         let err = unsafe { o.contents.err };
20347                         unsafe { o.contents.err = core::ptr::null_mut(); }
20348                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
20349                 };
20350                 Self {
20351                         contents,
20352                         result_ok: o.result_ok,
20353                 }
20354         }
20355 }
20356 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
20357         fn clone(&self) -> Self {
20358                 if self.result_ok {
20359                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20360                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
20361                         } }
20362                 } else {
20363                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
20364                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20365                         } }
20366                 }
20367         }
20368 }
20369 #[no_mangle]
20370 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
20371 /// but with all dynamically-allocated buffers duplicated in new buffers.
20372 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
20373 #[repr(C)]
20374 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
20375 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
20376         /// A pointer to the contents in the success state.
20377         /// Reading from this pointer when `result_ok` is not set is undefined.
20378         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
20379         /// A pointer to the contents in the error state.
20380         /// Reading from this pointer when `result_ok` is set is undefined.
20381         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20382 }
20383 #[repr(C)]
20384 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
20385 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
20386 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20387 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
20388         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
20389         /// `err` or `result` depending on the state of `result_ok`.
20390         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
20391         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
20392         pub result_ok: bool,
20393 }
20394 #[no_mangle]
20395 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
20396 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20397         CResult_QueryShortChannelIdsDecodeErrorZ {
20398                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20399                         result: Box::into_raw(Box::new(o)),
20400                 },
20401                 result_ok: true,
20402         }
20403 }
20404 #[no_mangle]
20405 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
20406 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
20407         CResult_QueryShortChannelIdsDecodeErrorZ {
20408                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20409                         err: Box::into_raw(Box::new(e)),
20410                 },
20411                 result_ok: false,
20412         }
20413 }
20414 /// Checks if the given object is currently in the success state
20415 #[no_mangle]
20416 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
20417         o.result_ok
20418 }
20419 #[no_mangle]
20420 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20421 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
20422 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
20423         fn drop(&mut self) {
20424                 if self.result_ok {
20425                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20426                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20427                         }
20428                 } else {
20429                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20430                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20431                         }
20432                 }
20433         }
20434 }
20435 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
20436         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
20437                 let contents = if o.result_ok {
20438                         let result = unsafe { o.contents.result };
20439                         unsafe { o.contents.result = core::ptr::null_mut() };
20440                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
20441                 } else {
20442                         let err = unsafe { o.contents.err };
20443                         unsafe { o.contents.err = core::ptr::null_mut(); }
20444                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
20445                 };
20446                 Self {
20447                         contents,
20448                         result_ok: o.result_ok,
20449                 }
20450         }
20451 }
20452 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
20453         fn clone(&self) -> Self {
20454                 if self.result_ok {
20455                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20456                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
20457                         } }
20458                 } else {
20459                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20460                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20461                         } }
20462                 }
20463         }
20464 }
20465 #[no_mangle]
20466 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20467 /// but with all dynamically-allocated buffers duplicated in new buffers.
20468 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
20469 #[repr(C)]
20470 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
20471 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20472         /// A pointer to the contents in the success state.
20473         /// Reading from this pointer when `result_ok` is not set is undefined.
20474         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
20475         /// A pointer to the contents in the error state.
20476         /// Reading from this pointer when `result_ok` is set is undefined.
20477         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20478 }
20479 #[repr(C)]
20480 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
20481 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
20482 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20483 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20484         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
20485         /// `err` or `result` depending on the state of `result_ok`.
20486         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
20487         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
20488         pub result_ok: bool,
20489 }
20490 #[no_mangle]
20491 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20492 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20493         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20494                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20495                         result: Box::into_raw(Box::new(o)),
20496                 },
20497                 result_ok: true,
20498         }
20499 }
20500 #[no_mangle]
20501 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20502 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20503         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20504                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20505                         err: Box::into_raw(Box::new(e)),
20506                 },
20507                 result_ok: false,
20508         }
20509 }
20510 /// Checks if the given object is currently in the success state
20511 #[no_mangle]
20512 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
20513         o.result_ok
20514 }
20515 #[no_mangle]
20516 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20517 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
20518 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20519         fn drop(&mut self) {
20520                 if self.result_ok {
20521                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20522                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20523                         }
20524                 } else {
20525                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20526                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20527                         }
20528                 }
20529         }
20530 }
20531 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20532         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
20533                 let contents = if o.result_ok {
20534                         let result = unsafe { o.contents.result };
20535                         unsafe { o.contents.result = core::ptr::null_mut() };
20536                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
20537                 } else {
20538                         let err = unsafe { o.contents.err };
20539                         unsafe { o.contents.err = core::ptr::null_mut(); }
20540                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
20541                 };
20542                 Self {
20543                         contents,
20544                         result_ok: o.result_ok,
20545                 }
20546         }
20547 }
20548 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20549         fn clone(&self) -> Self {
20550                 if self.result_ok {
20551                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20552                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
20553                         } }
20554                 } else {
20555                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20556                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20557                         } }
20558                 }
20559         }
20560 }
20561 #[no_mangle]
20562 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20563 /// but with all dynamically-allocated buffers duplicated in new buffers.
20564 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
20565 #[repr(C)]
20566 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
20567 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
20568         /// A pointer to the contents in the success state.
20569         /// Reading from this pointer when `result_ok` is not set is undefined.
20570         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
20571         /// A pointer to the contents in the error state.
20572         /// Reading from this pointer when `result_ok` is set is undefined.
20573         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20574 }
20575 #[repr(C)]
20576 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
20577 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20579 pub struct CResult_QueryChannelRangeDecodeErrorZ {
20580         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
20581         /// `err` or `result` depending on the state of `result_ok`.
20582         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
20583         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
20584         pub result_ok: bool,
20585 }
20586 #[no_mangle]
20587 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20588 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
20589         CResult_QueryChannelRangeDecodeErrorZ {
20590                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20591                         result: Box::into_raw(Box::new(o)),
20592                 },
20593                 result_ok: true,
20594         }
20595 }
20596 #[no_mangle]
20597 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20598 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
20599         CResult_QueryChannelRangeDecodeErrorZ {
20600                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20601                         err: Box::into_raw(Box::new(e)),
20602                 },
20603                 result_ok: false,
20604         }
20605 }
20606 /// Checks if the given object is currently in the success state
20607 #[no_mangle]
20608 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
20609         o.result_ok
20610 }
20611 #[no_mangle]
20612 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20613 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
20614 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
20615         fn drop(&mut self) {
20616                 if self.result_ok {
20617                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20618                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20619                         }
20620                 } else {
20621                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20622                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20623                         }
20624                 }
20625         }
20626 }
20627 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
20628         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20629                 let contents = if o.result_ok {
20630                         let result = unsafe { o.contents.result };
20631                         unsafe { o.contents.result = core::ptr::null_mut() };
20632                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
20633                 } else {
20634                         let err = unsafe { o.contents.err };
20635                         unsafe { o.contents.err = core::ptr::null_mut(); }
20636                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
20637                 };
20638                 Self {
20639                         contents,
20640                         result_ok: o.result_ok,
20641                 }
20642         }
20643 }
20644 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
20645         fn clone(&self) -> Self {
20646                 if self.result_ok {
20647                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20648                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
20649                         } }
20650                 } else {
20651                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20652                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20653                         } }
20654                 }
20655         }
20656 }
20657 #[no_mangle]
20658 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20659 /// but with all dynamically-allocated buffers duplicated in new buffers.
20660 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20661 #[repr(C)]
20662 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
20663 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
20664         /// A pointer to the contents in the success state.
20665         /// Reading from this pointer when `result_ok` is not set is undefined.
20666         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
20667         /// A pointer to the contents in the error state.
20668         /// Reading from this pointer when `result_ok` is set is undefined.
20669         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20670 }
20671 #[repr(C)]
20672 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
20673 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20674 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20675 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
20676         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
20677         /// `err` or `result` depending on the state of `result_ok`.
20678         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
20679         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
20680         pub result_ok: bool,
20681 }
20682 #[no_mangle]
20683 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20684 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
20685         CResult_ReplyChannelRangeDecodeErrorZ {
20686                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20687                         result: Box::into_raw(Box::new(o)),
20688                 },
20689                 result_ok: true,
20690         }
20691 }
20692 #[no_mangle]
20693 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20694 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
20695         CResult_ReplyChannelRangeDecodeErrorZ {
20696                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20697                         err: Box::into_raw(Box::new(e)),
20698                 },
20699                 result_ok: false,
20700         }
20701 }
20702 /// Checks if the given object is currently in the success state
20703 #[no_mangle]
20704 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
20705         o.result_ok
20706 }
20707 #[no_mangle]
20708 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20709 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
20710 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
20711         fn drop(&mut self) {
20712                 if self.result_ok {
20713                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20714                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20715                         }
20716                 } else {
20717                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20718                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20719                         }
20720                 }
20721         }
20722 }
20723 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
20724         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20725                 let contents = if o.result_ok {
20726                         let result = unsafe { o.contents.result };
20727                         unsafe { o.contents.result = core::ptr::null_mut() };
20728                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
20729                 } else {
20730                         let err = unsafe { o.contents.err };
20731                         unsafe { o.contents.err = core::ptr::null_mut(); }
20732                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
20733                 };
20734                 Self {
20735                         contents,
20736                         result_ok: o.result_ok,
20737                 }
20738         }
20739 }
20740 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
20741         fn clone(&self) -> Self {
20742                 if self.result_ok {
20743                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20744                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
20745                         } }
20746                 } else {
20747                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20748                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20749                         } }
20750                 }
20751         }
20752 }
20753 #[no_mangle]
20754 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20755 /// but with all dynamically-allocated buffers duplicated in new buffers.
20756 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20757 #[repr(C)]
20758 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
20759 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
20760         /// A pointer to the contents in the success state.
20761         /// Reading from this pointer when `result_ok` is not set is undefined.
20762         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
20763         /// A pointer to the contents in the error state.
20764         /// Reading from this pointer when `result_ok` is set is undefined.
20765         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20766 }
20767 #[repr(C)]
20768 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
20769 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
20770 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20771 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
20772         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
20773         /// `err` or `result` depending on the state of `result_ok`.
20774         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
20775         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
20776         pub result_ok: bool,
20777 }
20778 #[no_mangle]
20779 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20780 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
20781         CResult_GossipTimestampFilterDecodeErrorZ {
20782                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20783                         result: Box::into_raw(Box::new(o)),
20784                 },
20785                 result_ok: true,
20786         }
20787 }
20788 #[no_mangle]
20789 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20790 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
20791         CResult_GossipTimestampFilterDecodeErrorZ {
20792                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20793                         err: Box::into_raw(Box::new(e)),
20794                 },
20795                 result_ok: false,
20796         }
20797 }
20798 /// Checks if the given object is currently in the success state
20799 #[no_mangle]
20800 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
20801         o.result_ok
20802 }
20803 #[no_mangle]
20804 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20805 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
20806 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
20807         fn drop(&mut self) {
20808                 if self.result_ok {
20809                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20810                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20811                         }
20812                 } else {
20813                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20814                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20815                         }
20816                 }
20817         }
20818 }
20819 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
20820         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
20821                 let contents = if o.result_ok {
20822                         let result = unsafe { o.contents.result };
20823                         unsafe { o.contents.result = core::ptr::null_mut() };
20824                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
20825                 } else {
20826                         let err = unsafe { o.contents.err };
20827                         unsafe { o.contents.err = core::ptr::null_mut(); }
20828                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
20829                 };
20830                 Self {
20831                         contents,
20832                         result_ok: o.result_ok,
20833                 }
20834         }
20835 }
20836 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
20837         fn clone(&self) -> Self {
20838                 if self.result_ok {
20839                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20840                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
20841                         } }
20842                 } else {
20843                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20844                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20845                         } }
20846                 }
20847         }
20848 }
20849 #[no_mangle]
20850 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20851 /// but with all dynamically-allocated buffers duplicated in new buffers.
20852 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
20853 #[repr(C)]
20854 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
20855 /// This corresponds to std::vector in C++
20856 pub struct CVec_PhantomRouteHintsZ {
20857         /// The elements in the array.
20858         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20859         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
20860         /// The number of elements pointed to by `data`.
20861         pub datalen: usize
20862 }
20863 impl CVec_PhantomRouteHintsZ {
20864         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
20865                 if self.datalen == 0 { return Vec::new(); }
20866                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20867                 self.data = core::ptr::null_mut();
20868                 self.datalen = 0;
20869                 ret
20870         }
20871         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
20872                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20873         }
20874 }
20875 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
20876         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
20877                 let datalen = v.len();
20878                 let data = Box::into_raw(v.into_boxed_slice());
20879                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20880         }
20881 }
20882 #[no_mangle]
20883 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20884 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
20885 impl Drop for CVec_PhantomRouteHintsZ {
20886         fn drop(&mut self) {
20887                 if self.datalen == 0 { return; }
20888                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20889         }
20890 }
20891 impl Clone for CVec_PhantomRouteHintsZ {
20892         fn clone(&self) -> Self {
20893                 let mut res = Vec::new();
20894                 if self.datalen == 0 { return Self::from(res); }
20895                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20896                 Self::from(res)
20897         }
20898 }
20899 #[repr(C)]
20900 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
20901 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20902         /// A pointer to the contents in the success state.
20903         /// Reading from this pointer when `result_ok` is not set is undefined.
20904         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20905         /// A pointer to the contents in the error state.
20906         /// Reading from this pointer when `result_ok` is set is undefined.
20907         pub err: *mut crate::lightning_invoice::SignOrCreationError,
20908 }
20909 #[repr(C)]
20910 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
20911 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
20912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20913 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
20914         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
20915         /// `err` or `result` depending on the state of `result_ok`.
20916         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
20917         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
20918         pub result_ok: bool,
20919 }
20920 #[no_mangle]
20921 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
20922 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20923         CResult_Bolt11InvoiceSignOrCreationErrorZ {
20924                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20925                         result: Box::into_raw(Box::new(o)),
20926                 },
20927                 result_ok: true,
20928         }
20929 }
20930 #[no_mangle]
20931 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
20932 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20933         CResult_Bolt11InvoiceSignOrCreationErrorZ {
20934                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20935                         err: Box::into_raw(Box::new(e)),
20936                 },
20937                 result_ok: false,
20938         }
20939 }
20940 /// Checks if the given object is currently in the success state
20941 #[no_mangle]
20942 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
20943         o.result_ok
20944 }
20945 #[no_mangle]
20946 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
20947 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
20948 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20949         fn drop(&mut self) {
20950                 if self.result_ok {
20951                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20952                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20953                         }
20954                 } else {
20955                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20956                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20957                         }
20958                 }
20959         }
20960 }
20961 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20962         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
20963                 let contents = if o.result_ok {
20964                         let result = unsafe { o.contents.result };
20965                         unsafe { o.contents.result = core::ptr::null_mut() };
20966                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
20967                 } else {
20968                         let err = unsafe { o.contents.err };
20969                         unsafe { o.contents.err = core::ptr::null_mut(); }
20970                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
20971                 };
20972                 Self {
20973                         contents,
20974                         result_ok: o.result_ok,
20975                 }
20976         }
20977 }
20978 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20979         fn clone(&self) -> Self {
20980                 if self.result_ok {
20981                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20982                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20983                         } }
20984                 } else {
20985                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20986                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
20987                         } }
20988                 }
20989         }
20990 }
20991 #[no_mangle]
20992 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
20993 /// but with all dynamically-allocated buffers duplicated in new buffers.
20994 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
20995 #[repr(C)]
20996 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
20997 /// This corresponds to std::vector in C++
20998 pub struct CVec_FutureZ {
20999         /// The elements in the array.
21000         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21001         pub data: *mut crate::lightning::util::wakers::Future,
21002         /// The number of elements pointed to by `data`.
21003         pub datalen: usize
21004 }
21005 impl CVec_FutureZ {
21006         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
21007                 if self.datalen == 0 { return Vec::new(); }
21008                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21009                 self.data = core::ptr::null_mut();
21010                 self.datalen = 0;
21011                 ret
21012         }
21013         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
21014                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21015         }
21016 }
21017 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
21018         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
21019                 let datalen = v.len();
21020                 let data = Box::into_raw(v.into_boxed_slice());
21021                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21022         }
21023 }
21024 #[no_mangle]
21025 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21026 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
21027 impl Drop for CVec_FutureZ {
21028         fn drop(&mut self) {
21029                 if self.datalen == 0 { return; }
21030                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21031         }
21032 }
21033 #[repr(C)]
21034 /// The contents of CResult_OffersMessageDecodeErrorZ
21035 pub union CResult_OffersMessageDecodeErrorZPtr {
21036         /// A pointer to the contents in the success state.
21037         /// Reading from this pointer when `result_ok` is not set is undefined.
21038         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
21039         /// A pointer to the contents in the error state.
21040         /// Reading from this pointer when `result_ok` is set is undefined.
21041         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21042 }
21043 #[repr(C)]
21044 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
21045 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
21046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21047 pub struct CResult_OffersMessageDecodeErrorZ {
21048         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
21049         /// `err` or `result` depending on the state of `result_ok`.
21050         pub contents: CResult_OffersMessageDecodeErrorZPtr,
21051         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
21052         pub result_ok: bool,
21053 }
21054 #[no_mangle]
21055 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
21056 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
21057         CResult_OffersMessageDecodeErrorZ {
21058                 contents: CResult_OffersMessageDecodeErrorZPtr {
21059                         result: Box::into_raw(Box::new(o)),
21060                 },
21061                 result_ok: true,
21062         }
21063 }
21064 #[no_mangle]
21065 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
21066 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
21067         CResult_OffersMessageDecodeErrorZ {
21068                 contents: CResult_OffersMessageDecodeErrorZPtr {
21069                         err: Box::into_raw(Box::new(e)),
21070                 },
21071                 result_ok: false,
21072         }
21073 }
21074 /// Checks if the given object is currently in the success state
21075 #[no_mangle]
21076 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
21077         o.result_ok
21078 }
21079 #[no_mangle]
21080 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
21081 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
21082 impl Drop for CResult_OffersMessageDecodeErrorZ {
21083         fn drop(&mut self) {
21084                 if self.result_ok {
21085                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21086                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21087                         }
21088                 } else {
21089                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21090                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21091                         }
21092                 }
21093         }
21094 }
21095 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
21096         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
21097                 let contents = if o.result_ok {
21098                         let result = unsafe { o.contents.result };
21099                         unsafe { o.contents.result = core::ptr::null_mut() };
21100                         CResult_OffersMessageDecodeErrorZPtr { result }
21101                 } else {
21102                         let err = unsafe { o.contents.err };
21103                         unsafe { o.contents.err = core::ptr::null_mut(); }
21104                         CResult_OffersMessageDecodeErrorZPtr { err }
21105                 };
21106                 Self {
21107                         contents,
21108                         result_ok: o.result_ok,
21109                 }
21110         }
21111 }
21112 impl Clone for CResult_OffersMessageDecodeErrorZ {
21113         fn clone(&self) -> Self {
21114                 if self.result_ok {
21115                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
21116                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
21117                         } }
21118                 } else {
21119                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
21120                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21121                         } }
21122                 }
21123         }
21124 }
21125 #[no_mangle]
21126 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
21127 /// but with all dynamically-allocated buffers duplicated in new buffers.
21128 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
21129 #[repr(C)]
21130 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
21131 pub enum COption_HTLCClaimZ {
21132         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
21133         Some(crate::lightning::ln::chan_utils::HTLCClaim),
21134         /// When we're in this state, this COption_HTLCClaimZ contains nothing
21135         None
21136 }
21137 impl COption_HTLCClaimZ {
21138         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21139                 if let Self::None = self { false } else { true }
21140         }
21141         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21142                 !self.is_some()
21143         }
21144         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
21145                 if let Self::Some(v) = self { v } else { unreachable!() }
21146         }
21147 }
21148 #[no_mangle]
21149 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
21150 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
21151         COption_HTLCClaimZ::Some(o)
21152 }
21153 #[no_mangle]
21154 /// Constructs a new COption_HTLCClaimZ containing nothing
21155 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
21156         COption_HTLCClaimZ::None
21157 }
21158 #[no_mangle]
21159 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
21160 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
21161 #[repr(C)]
21162 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
21163 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21164         /// A pointer to the contents in the success state.
21165         /// Reading from this pointer when `result_ok` is not set is undefined.
21166         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
21167         /// A pointer to the contents in the error state.
21168         /// Reading from this pointer when `result_ok` is set is undefined.
21169         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21170 }
21171 #[repr(C)]
21172 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
21173 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
21174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21175 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21176         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
21177         /// `err` or `result` depending on the state of `result_ok`.
21178         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
21179         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
21180         pub result_ok: bool,
21181 }
21182 #[no_mangle]
21183 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
21184 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21185         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21186                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21187                         result: Box::into_raw(Box::new(o)),
21188                 },
21189                 result_ok: true,
21190         }
21191 }
21192 #[no_mangle]
21193 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
21194 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21195         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21196                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21197                         err: Box::into_raw(Box::new(e)),
21198                 },
21199                 result_ok: false,
21200         }
21201 }
21202 /// Checks if the given object is currently in the success state
21203 #[no_mangle]
21204 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
21205         o.result_ok
21206 }
21207 #[no_mangle]
21208 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
21209 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
21210 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21211         fn drop(&mut self) {
21212                 if self.result_ok {
21213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21215                         }
21216                 } else {
21217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21219                         }
21220                 }
21221         }
21222 }
21223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
21225                 let contents = if o.result_ok {
21226                         let result = unsafe { o.contents.result };
21227                         unsafe { o.contents.result = core::ptr::null_mut() };
21228                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
21229                 } else {
21230                         let err = unsafe { o.contents.err };
21231                         unsafe { o.contents.err = core::ptr::null_mut(); }
21232                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
21233                 };
21234                 Self {
21235                         contents,
21236                         result_ok: o.result_ok,
21237                 }
21238         }
21239 }
21240 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21241         fn clone(&self) -> Self {
21242                 if self.result_ok {
21243                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
21245                         } }
21246                 } else {
21247                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21249                         } }
21250                 }
21251         }
21252 }
21253 #[no_mangle]
21254 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
21255 /// but with all dynamically-allocated buffers duplicated in new buffers.
21256 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
21257 #[repr(C)]
21258 /// The contents of CResult_TxCreationKeysDecodeErrorZ
21259 pub union CResult_TxCreationKeysDecodeErrorZPtr {
21260         /// A pointer to the contents in the success state.
21261         /// Reading from this pointer when `result_ok` is not set is undefined.
21262         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
21263         /// A pointer to the contents in the error state.
21264         /// Reading from this pointer when `result_ok` is set is undefined.
21265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21266 }
21267 #[repr(C)]
21268 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
21269 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21271 pub struct CResult_TxCreationKeysDecodeErrorZ {
21272         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
21273         /// `err` or `result` depending on the state of `result_ok`.
21274         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
21275         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
21276         pub result_ok: bool,
21277 }
21278 #[no_mangle]
21279 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
21280 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
21281         CResult_TxCreationKeysDecodeErrorZ {
21282                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21283                         result: Box::into_raw(Box::new(o)),
21284                 },
21285                 result_ok: true,
21286         }
21287 }
21288 #[no_mangle]
21289 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
21290 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
21291         CResult_TxCreationKeysDecodeErrorZ {
21292                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21293                         err: Box::into_raw(Box::new(e)),
21294                 },
21295                 result_ok: false,
21296         }
21297 }
21298 /// Checks if the given object is currently in the success state
21299 #[no_mangle]
21300 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
21301         o.result_ok
21302 }
21303 #[no_mangle]
21304 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
21305 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
21306 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
21307         fn drop(&mut self) {
21308                 if self.result_ok {
21309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21311                         }
21312                 } else {
21313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21315                         }
21316                 }
21317         }
21318 }
21319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
21320         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21321                 let contents = if o.result_ok {
21322                         let result = unsafe { o.contents.result };
21323                         unsafe { o.contents.result = core::ptr::null_mut() };
21324                         CResult_TxCreationKeysDecodeErrorZPtr { result }
21325                 } else {
21326                         let err = unsafe { o.contents.err };
21327                         unsafe { o.contents.err = core::ptr::null_mut(); }
21328                         CResult_TxCreationKeysDecodeErrorZPtr { err }
21329                 };
21330                 Self {
21331                         contents,
21332                         result_ok: o.result_ok,
21333                 }
21334         }
21335 }
21336 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
21337         fn clone(&self) -> Self {
21338                 if self.result_ok {
21339                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21340                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
21341                         } }
21342                 } else {
21343                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21345                         } }
21346                 }
21347         }
21348 }
21349 #[no_mangle]
21350 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
21351 /// but with all dynamically-allocated buffers duplicated in new buffers.
21352 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
21353 #[repr(C)]
21354 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
21355 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
21356         /// A pointer to the contents in the success state.
21357         /// Reading from this pointer when `result_ok` is not set is undefined.
21358         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
21359         /// A pointer to the contents in the error state.
21360         /// Reading from this pointer when `result_ok` is set is undefined.
21361         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21362 }
21363 #[repr(C)]
21364 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
21365 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21367 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
21368         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
21369         /// `err` or `result` depending on the state of `result_ok`.
21370         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
21371         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
21372         pub result_ok: bool,
21373 }
21374 #[no_mangle]
21375 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
21376 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
21377         CResult_ChannelPublicKeysDecodeErrorZ {
21378                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21379                         result: Box::into_raw(Box::new(o)),
21380                 },
21381                 result_ok: true,
21382         }
21383 }
21384 #[no_mangle]
21385 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
21386 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
21387         CResult_ChannelPublicKeysDecodeErrorZ {
21388                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21389                         err: Box::into_raw(Box::new(e)),
21390                 },
21391                 result_ok: false,
21392         }
21393 }
21394 /// Checks if the given object is currently in the success state
21395 #[no_mangle]
21396 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
21397         o.result_ok
21398 }
21399 #[no_mangle]
21400 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
21401 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
21402 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
21403         fn drop(&mut self) {
21404                 if self.result_ok {
21405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21407                         }
21408                 } else {
21409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21411                         }
21412                 }
21413         }
21414 }
21415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
21416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21417                 let contents = if o.result_ok {
21418                         let result = unsafe { o.contents.result };
21419                         unsafe { o.contents.result = core::ptr::null_mut() };
21420                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
21421                 } else {
21422                         let err = unsafe { o.contents.err };
21423                         unsafe { o.contents.err = core::ptr::null_mut(); }
21424                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
21425                 };
21426                 Self {
21427                         contents,
21428                         result_ok: o.result_ok,
21429                 }
21430         }
21431 }
21432 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
21433         fn clone(&self) -> Self {
21434                 if self.result_ok {
21435                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21436                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
21437                         } }
21438                 } else {
21439                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21440                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21441                         } }
21442                 }
21443         }
21444 }
21445 #[no_mangle]
21446 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
21447 /// but with all dynamically-allocated buffers duplicated in new buffers.
21448 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
21449 #[repr(C)]
21450 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
21451 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21452         /// A pointer to the contents in the success state.
21453         /// Reading from this pointer when `result_ok` is not set is undefined.
21454         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
21455         /// A pointer to the contents in the error state.
21456         /// Reading from this pointer when `result_ok` is set is undefined.
21457         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21458 }
21459 #[repr(C)]
21460 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
21461 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
21462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21463 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
21464         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
21465         /// `err` or `result` depending on the state of `result_ok`.
21466         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
21467         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
21468         pub result_ok: bool,
21469 }
21470 #[no_mangle]
21471 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
21472 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21473         CResult_HTLCOutputInCommitmentDecodeErrorZ {
21474                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21475                         result: Box::into_raw(Box::new(o)),
21476                 },
21477                 result_ok: true,
21478         }
21479 }
21480 #[no_mangle]
21481 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
21482 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
21483         CResult_HTLCOutputInCommitmentDecodeErrorZ {
21484                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21485                         err: Box::into_raw(Box::new(e)),
21486                 },
21487                 result_ok: false,
21488         }
21489 }
21490 /// Checks if the given object is currently in the success state
21491 #[no_mangle]
21492 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
21493         o.result_ok
21494 }
21495 #[no_mangle]
21496 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
21497 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
21498 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21499         fn drop(&mut self) {
21500                 if self.result_ok {
21501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21503                         }
21504                 } else {
21505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21507                         }
21508                 }
21509         }
21510 }
21511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
21513                 let contents = if o.result_ok {
21514                         let result = unsafe { o.contents.result };
21515                         unsafe { o.contents.result = core::ptr::null_mut() };
21516                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
21517                 } else {
21518                         let err = unsafe { o.contents.err };
21519                         unsafe { o.contents.err = core::ptr::null_mut(); }
21520                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
21521                 };
21522                 Self {
21523                         contents,
21524                         result_ok: o.result_ok,
21525                 }
21526         }
21527 }
21528 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
21529         fn clone(&self) -> Self {
21530                 if self.result_ok {
21531                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21532                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
21533                         } }
21534                 } else {
21535                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
21536                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21537                         } }
21538                 }
21539         }
21540 }
21541 #[no_mangle]
21542 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
21543 /// but with all dynamically-allocated buffers duplicated in new buffers.
21544 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
21545 #[repr(C)]
21546 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
21547 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21548         /// A pointer to the contents in the success state.
21549         /// Reading from this pointer when `result_ok` is not set is undefined.
21550         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
21551         /// A pointer to the contents in the error state.
21552         /// Reading from this pointer when `result_ok` is set is undefined.
21553         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21554 }
21555 #[repr(C)]
21556 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21557 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21559 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21560         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
21561         /// `err` or `result` depending on the state of `result_ok`.
21562         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
21563         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
21564         pub result_ok: bool,
21565 }
21566 #[no_mangle]
21567 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
21568 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21569         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21570                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21571                         result: Box::into_raw(Box::new(o)),
21572                 },
21573                 result_ok: true,
21574         }
21575 }
21576 #[no_mangle]
21577 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
21578 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21579         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21580                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21581                         err: Box::into_raw(Box::new(e)),
21582                 },
21583                 result_ok: false,
21584         }
21585 }
21586 /// Checks if the given object is currently in the success state
21587 #[no_mangle]
21588 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
21589         o.result_ok
21590 }
21591 #[no_mangle]
21592 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
21593 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
21594 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21595         fn drop(&mut self) {
21596                 if self.result_ok {
21597                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21598                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21599                         }
21600                 } else {
21601                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21602                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21603                         }
21604                 }
21605         }
21606 }
21607 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21608         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21609                 let contents = if o.result_ok {
21610                         let result = unsafe { o.contents.result };
21611                         unsafe { o.contents.result = core::ptr::null_mut() };
21612                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
21613                 } else {
21614                         let err = unsafe { o.contents.err };
21615                         unsafe { o.contents.err = core::ptr::null_mut(); }
21616                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
21617                 };
21618                 Self {
21619                         contents,
21620                         result_ok: o.result_ok,
21621                 }
21622         }
21623 }
21624 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
21625         fn clone(&self) -> Self {
21626                 if self.result_ok {
21627                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21628                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21629                         } }
21630                 } else {
21631                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
21632                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21633                         } }
21634                 }
21635         }
21636 }
21637 #[no_mangle]
21638 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21639 /// but with all dynamically-allocated buffers duplicated in new buffers.
21640 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21641 #[repr(C)]
21642 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
21643 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
21644         /// A pointer to the contents in the success state.
21645         /// Reading from this pointer when `result_ok` is not set is undefined.
21646         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
21647         /// A pointer to the contents in the error state.
21648         /// Reading from this pointer when `result_ok` is set is undefined.
21649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21650 }
21651 #[repr(C)]
21652 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
21653 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
21654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21655 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
21656         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
21657         /// `err` or `result` depending on the state of `result_ok`.
21658         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
21659         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
21660         pub result_ok: bool,
21661 }
21662 #[no_mangle]
21663 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
21664 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21665         CResult_ChannelTransactionParametersDecodeErrorZ {
21666                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21667                         result: Box::into_raw(Box::new(o)),
21668                 },
21669                 result_ok: true,
21670         }
21671 }
21672 #[no_mangle]
21673 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
21674 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
21675         CResult_ChannelTransactionParametersDecodeErrorZ {
21676                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21677                         err: Box::into_raw(Box::new(e)),
21678                 },
21679                 result_ok: false,
21680         }
21681 }
21682 /// Checks if the given object is currently in the success state
21683 #[no_mangle]
21684 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
21685         o.result_ok
21686 }
21687 #[no_mangle]
21688 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
21689 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
21690 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
21691         fn drop(&mut self) {
21692                 if self.result_ok {
21693                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21694                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21695                         }
21696                 } else {
21697                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21698                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21699                         }
21700                 }
21701         }
21702 }
21703 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
21704         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
21705                 let contents = if o.result_ok {
21706                         let result = unsafe { o.contents.result };
21707                         unsafe { o.contents.result = core::ptr::null_mut() };
21708                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
21709                 } else {
21710                         let err = unsafe { o.contents.err };
21711                         unsafe { o.contents.err = core::ptr::null_mut(); }
21712                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
21713                 };
21714                 Self {
21715                         contents,
21716                         result_ok: o.result_ok,
21717                 }
21718         }
21719 }
21720 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
21721         fn clone(&self) -> Self {
21722                 if self.result_ok {
21723                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21724                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
21725                         } }
21726                 } else {
21727                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
21728                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21729                         } }
21730                 }
21731         }
21732 }
21733 #[no_mangle]
21734 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
21735 /// but with all dynamically-allocated buffers duplicated in new buffers.
21736 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
21737 #[repr(C)]
21738 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
21739 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21740         /// A pointer to the contents in the success state.
21741         /// Reading from this pointer when `result_ok` is not set is undefined.
21742         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
21743         /// A pointer to the contents in the error state.
21744         /// Reading from this pointer when `result_ok` is set is undefined.
21745         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21746 }
21747 #[repr(C)]
21748 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21749 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21751 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
21752         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
21753         /// `err` or `result` depending on the state of `result_ok`.
21754         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
21755         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
21756         pub result_ok: bool,
21757 }
21758 #[no_mangle]
21759 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
21760 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21761         CResult_HolderCommitmentTransactionDecodeErrorZ {
21762                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21763                         result: Box::into_raw(Box::new(o)),
21764                 },
21765                 result_ok: true,
21766         }
21767 }
21768 #[no_mangle]
21769 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
21770 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
21771         CResult_HolderCommitmentTransactionDecodeErrorZ {
21772                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21773                         err: Box::into_raw(Box::new(e)),
21774                 },
21775                 result_ok: false,
21776         }
21777 }
21778 /// Checks if the given object is currently in the success state
21779 #[no_mangle]
21780 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
21781         o.result_ok
21782 }
21783 #[no_mangle]
21784 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
21785 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
21786 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
21787         fn drop(&mut self) {
21788                 if self.result_ok {
21789                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21790                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21791                         }
21792                 } else {
21793                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21794                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21795                         }
21796                 }
21797         }
21798 }
21799 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
21800         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21801                 let contents = if o.result_ok {
21802                         let result = unsafe { o.contents.result };
21803                         unsafe { o.contents.result = core::ptr::null_mut() };
21804                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
21805                 } else {
21806                         let err = unsafe { o.contents.err };
21807                         unsafe { o.contents.err = core::ptr::null_mut(); }
21808                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
21809                 };
21810                 Self {
21811                         contents,
21812                         result_ok: o.result_ok,
21813                 }
21814         }
21815 }
21816 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
21817         fn clone(&self) -> Self {
21818                 if self.result_ok {
21819                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21820                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21821                         } }
21822                 } else {
21823                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
21824                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21825                         } }
21826                 }
21827         }
21828 }
21829 #[no_mangle]
21830 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21831 /// but with all dynamically-allocated buffers duplicated in new buffers.
21832 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21833 #[repr(C)]
21834 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
21835 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21836         /// A pointer to the contents in the success state.
21837         /// Reading from this pointer when `result_ok` is not set is undefined.
21838         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
21839         /// A pointer to the contents in the error state.
21840         /// Reading from this pointer when `result_ok` is set is undefined.
21841         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21842 }
21843 #[repr(C)]
21844 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
21845 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
21846 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21847 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
21848         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
21849         /// `err` or `result` depending on the state of `result_ok`.
21850         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
21851         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
21852         pub result_ok: bool,
21853 }
21854 #[no_mangle]
21855 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
21856 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21857         CResult_BuiltCommitmentTransactionDecodeErrorZ {
21858                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21859                         result: Box::into_raw(Box::new(o)),
21860                 },
21861                 result_ok: true,
21862         }
21863 }
21864 #[no_mangle]
21865 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
21866 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
21867         CResult_BuiltCommitmentTransactionDecodeErrorZ {
21868                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21869                         err: Box::into_raw(Box::new(e)),
21870                 },
21871                 result_ok: false,
21872         }
21873 }
21874 /// Checks if the given object is currently in the success state
21875 #[no_mangle]
21876 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
21877         o.result_ok
21878 }
21879 #[no_mangle]
21880 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
21881 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
21882 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21883         fn drop(&mut self) {
21884                 if self.result_ok {
21885                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21886                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21887                         }
21888                 } else {
21889                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21890                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21891                         }
21892                 }
21893         }
21894 }
21895 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21896         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
21897                 let contents = if o.result_ok {
21898                         let result = unsafe { o.contents.result };
21899                         unsafe { o.contents.result = core::ptr::null_mut() };
21900                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
21901                 } else {
21902                         let err = unsafe { o.contents.err };
21903                         unsafe { o.contents.err = core::ptr::null_mut(); }
21904                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
21905                 };
21906                 Self {
21907                         contents,
21908                         result_ok: o.result_ok,
21909                 }
21910         }
21911 }
21912 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
21913         fn clone(&self) -> Self {
21914                 if self.result_ok {
21915                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21916                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
21917                         } }
21918                 } else {
21919                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
21920                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21921                         } }
21922                 }
21923         }
21924 }
21925 #[no_mangle]
21926 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
21927 /// but with all dynamically-allocated buffers duplicated in new buffers.
21928 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
21929 #[repr(C)]
21930 /// The contents of CResult_TrustedClosingTransactionNoneZ
21931 pub union CResult_TrustedClosingTransactionNoneZPtr {
21932         /// A pointer to the contents in the success state.
21933         /// Reading from this pointer when `result_ok` is not set is undefined.
21934         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
21935         /// Note that this value is always NULL, as there are no contents in the Err variant
21936         pub err: *mut core::ffi::c_void,
21937 }
21938 #[repr(C)]
21939 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
21940 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
21941 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21942 pub struct CResult_TrustedClosingTransactionNoneZ {
21943         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
21944         /// `err` or `result` depending on the state of `result_ok`.
21945         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
21946         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
21947         pub result_ok: bool,
21948 }
21949 #[no_mangle]
21950 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
21951 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
21952         CResult_TrustedClosingTransactionNoneZ {
21953                 contents: CResult_TrustedClosingTransactionNoneZPtr {
21954                         result: Box::into_raw(Box::new(o)),
21955                 },
21956                 result_ok: true,
21957         }
21958 }
21959 #[no_mangle]
21960 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
21961 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
21962         CResult_TrustedClosingTransactionNoneZ {
21963                 contents: CResult_TrustedClosingTransactionNoneZPtr {
21964                         err: core::ptr::null_mut(),
21965                 },
21966                 result_ok: false,
21967         }
21968 }
21969 /// Checks if the given object is currently in the success state
21970 #[no_mangle]
21971 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
21972         o.result_ok
21973 }
21974 #[no_mangle]
21975 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
21976 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
21977 impl Drop for CResult_TrustedClosingTransactionNoneZ {
21978         fn drop(&mut self) {
21979                 if self.result_ok {
21980                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21981                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21982                         }
21983                 } else {
21984                 }
21985         }
21986 }
21987 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
21988         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
21989                 let contents = if o.result_ok {
21990                         let result = unsafe { o.contents.result };
21991                         unsafe { o.contents.result = core::ptr::null_mut() };
21992                         CResult_TrustedClosingTransactionNoneZPtr { result }
21993                 } else {
21994                         let _ = unsafe { Box::from_raw(o.contents.err) };
21995                         o.contents.err = core::ptr::null_mut();
21996                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
21997                 };
21998                 Self {
21999                         contents,
22000                         result_ok: o.result_ok,
22001                 }
22002         }
22003 }
22004 #[repr(C)]
22005 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
22006 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
22007         /// A pointer to the contents in the success state.
22008         /// Reading from this pointer when `result_ok` is not set is undefined.
22009         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
22010         /// A pointer to the contents in the error state.
22011         /// Reading from this pointer when `result_ok` is set is undefined.
22012         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22013 }
22014 #[repr(C)]
22015 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22016 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22017 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22018 pub struct CResult_CommitmentTransactionDecodeErrorZ {
22019         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
22020         /// `err` or `result` depending on the state of `result_ok`.
22021         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
22022         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
22023         pub result_ok: bool,
22024 }
22025 #[no_mangle]
22026 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
22027 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
22028         CResult_CommitmentTransactionDecodeErrorZ {
22029                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22030                         result: Box::into_raw(Box::new(o)),
22031                 },
22032                 result_ok: true,
22033         }
22034 }
22035 #[no_mangle]
22036 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
22037 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
22038         CResult_CommitmentTransactionDecodeErrorZ {
22039                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22040                         err: Box::into_raw(Box::new(e)),
22041                 },
22042                 result_ok: false,
22043         }
22044 }
22045 /// Checks if the given object is currently in the success state
22046 #[no_mangle]
22047 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
22048         o.result_ok
22049 }
22050 #[no_mangle]
22051 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
22052 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
22053 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
22054         fn drop(&mut self) {
22055                 if self.result_ok {
22056                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22057                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22058                         }
22059                 } else {
22060                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22061                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22062                         }
22063                 }
22064         }
22065 }
22066 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
22067         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22068                 let contents = if o.result_ok {
22069                         let result = unsafe { o.contents.result };
22070                         unsafe { o.contents.result = core::ptr::null_mut() };
22071                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
22072                 } else {
22073                         let err = unsafe { o.contents.err };
22074                         unsafe { o.contents.err = core::ptr::null_mut(); }
22075                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
22076                 };
22077                 Self {
22078                         contents,
22079                         result_ok: o.result_ok,
22080                 }
22081         }
22082 }
22083 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
22084         fn clone(&self) -> Self {
22085                 if self.result_ok {
22086                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22087                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22088                         } }
22089                 } else {
22090                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22091                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22092                         } }
22093                 }
22094         }
22095 }
22096 #[no_mangle]
22097 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
22098 /// but with all dynamically-allocated buffers duplicated in new buffers.
22099 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22100 #[repr(C)]
22101 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
22102 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
22103         /// A pointer to the contents in the success state.
22104         /// Reading from this pointer when `result_ok` is not set is undefined.
22105         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
22106         /// Note that this value is always NULL, as there are no contents in the Err variant
22107         pub err: *mut core::ffi::c_void,
22108 }
22109 #[repr(C)]
22110 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
22111 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
22112 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22113 pub struct CResult_TrustedCommitmentTransactionNoneZ {
22114         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
22115         /// `err` or `result` depending on the state of `result_ok`.
22116         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
22117         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
22118         pub result_ok: bool,
22119 }
22120 #[no_mangle]
22121 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
22122 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
22123         CResult_TrustedCommitmentTransactionNoneZ {
22124                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22125                         result: Box::into_raw(Box::new(o)),
22126                 },
22127                 result_ok: true,
22128         }
22129 }
22130 #[no_mangle]
22131 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
22132 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
22133         CResult_TrustedCommitmentTransactionNoneZ {
22134                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22135                         err: core::ptr::null_mut(),
22136                 },
22137                 result_ok: false,
22138         }
22139 }
22140 /// Checks if the given object is currently in the success state
22141 #[no_mangle]
22142 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
22143         o.result_ok
22144 }
22145 #[no_mangle]
22146 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
22147 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
22148 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
22149         fn drop(&mut self) {
22150                 if self.result_ok {
22151                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22152                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22153                         }
22154                 } else {
22155                 }
22156         }
22157 }
22158 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
22159         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
22160                 let contents = if o.result_ok {
22161                         let result = unsafe { o.contents.result };
22162                         unsafe { o.contents.result = core::ptr::null_mut() };
22163                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
22164                 } else {
22165                         let _ = unsafe { Box::from_raw(o.contents.err) };
22166                         o.contents.err = core::ptr::null_mut();
22167                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
22168                 };
22169                 Self {
22170                         contents,
22171                         result_ok: o.result_ok,
22172                 }
22173         }
22174 }
22175 #[repr(C)]
22176 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
22177 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
22178         /// A pointer to the contents in the success state.
22179         /// Reading from this pointer when `result_ok` is not set is undefined.
22180         pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
22181         /// Note that this value is always NULL, as there are no contents in the Err variant
22182         pub err: *mut core::ffi::c_void,
22183 }
22184 #[repr(C)]
22185 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
22186 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
22187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22188 pub struct CResult_CVec_ECDSASignatureZNoneZ {
22189         /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
22190         /// `err` or `result` depending on the state of `result_ok`.
22191         pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
22192         /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
22193         pub result_ok: bool,
22194 }
22195 #[no_mangle]
22196 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
22197 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
22198         CResult_CVec_ECDSASignatureZNoneZ {
22199                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22200                         result: Box::into_raw(Box::new(o)),
22201                 },
22202                 result_ok: true,
22203         }
22204 }
22205 #[no_mangle]
22206 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
22207 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
22208         CResult_CVec_ECDSASignatureZNoneZ {
22209                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22210                         err: core::ptr::null_mut(),
22211                 },
22212                 result_ok: false,
22213         }
22214 }
22215 /// Checks if the given object is currently in the success state
22216 #[no_mangle]
22217 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
22218         o.result_ok
22219 }
22220 #[no_mangle]
22221 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
22222 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
22223 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
22224         fn drop(&mut self) {
22225                 if self.result_ok {
22226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22228                         }
22229                 } else {
22230                 }
22231         }
22232 }
22233 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
22234         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
22235                 let contents = if o.result_ok {
22236                         let result = unsafe { o.contents.result };
22237                         unsafe { o.contents.result = core::ptr::null_mut() };
22238                         CResult_CVec_ECDSASignatureZNoneZPtr { result }
22239                 } else {
22240                         let _ = unsafe { Box::from_raw(o.contents.err) };
22241                         o.contents.err = core::ptr::null_mut();
22242                         CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
22243                 };
22244                 Self {
22245                         contents,
22246                         result_ok: o.result_ok,
22247                 }
22248         }
22249 }
22250 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
22251         fn clone(&self) -> Self {
22252                 if self.result_ok {
22253                         Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22254                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
22255                         } }
22256                 } else {
22257                         Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22258                                 err: core::ptr::null_mut()
22259                         } }
22260                 }
22261         }
22262 }
22263 #[no_mangle]
22264 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
22265 /// but with all dynamically-allocated buffers duplicated in new buffers.
22266 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
22267 #[repr(C)]
22268 #[derive(Clone)]
22269 /// An enum which can either contain a usize or not
22270 pub enum COption_usizeZ {
22271         /// When we're in this state, this COption_usizeZ contains a usize
22272         Some(usize),
22273         /// When we're in this state, this COption_usizeZ contains nothing
22274         None
22275 }
22276 impl COption_usizeZ {
22277         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22278                 if let Self::None = self { false } else { true }
22279         }
22280         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22281                 !self.is_some()
22282         }
22283         #[allow(unused)] pub(crate) fn take(mut self) -> usize {
22284                 if let Self::Some(v) = self { v } else { unreachable!() }
22285         }
22286 }
22287 #[no_mangle]
22288 /// Constructs a new COption_usizeZ containing a usize
22289 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
22290         COption_usizeZ::Some(o)
22291 }
22292 #[no_mangle]
22293 /// Constructs a new COption_usizeZ containing nothing
22294 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
22295         COption_usizeZ::None
22296 }
22297 #[no_mangle]
22298 /// Frees any resources associated with the usize, if we are in the Some state
22299 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
22300 #[no_mangle]
22301 /// Creates a new COption_usizeZ which has the same data as `orig`
22302 /// but with all dynamically-allocated buffers duplicated in new buffers.
22303 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
22304 #[repr(C)]
22305 /// The contents of CResult_ShutdownScriptDecodeErrorZ
22306 pub union CResult_ShutdownScriptDecodeErrorZPtr {
22307         /// A pointer to the contents in the success state.
22308         /// Reading from this pointer when `result_ok` is not set is undefined.
22309         pub result: *mut crate::lightning::ln::script::ShutdownScript,
22310         /// A pointer to the contents in the error state.
22311         /// Reading from this pointer when `result_ok` is set is undefined.
22312         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22313 }
22314 #[repr(C)]
22315 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
22316 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
22317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22318 pub struct CResult_ShutdownScriptDecodeErrorZ {
22319         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
22320         /// `err` or `result` depending on the state of `result_ok`.
22321         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
22322         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
22323         pub result_ok: bool,
22324 }
22325 #[no_mangle]
22326 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
22327 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
22328         CResult_ShutdownScriptDecodeErrorZ {
22329                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22330                         result: Box::into_raw(Box::new(o)),
22331                 },
22332                 result_ok: true,
22333         }
22334 }
22335 #[no_mangle]
22336 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
22337 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
22338         CResult_ShutdownScriptDecodeErrorZ {
22339                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22340                         err: Box::into_raw(Box::new(e)),
22341                 },
22342                 result_ok: false,
22343         }
22344 }
22345 /// Checks if the given object is currently in the success state
22346 #[no_mangle]
22347 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
22348         o.result_ok
22349 }
22350 #[no_mangle]
22351 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
22352 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
22353 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
22354         fn drop(&mut self) {
22355                 if self.result_ok {
22356                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22357                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22358                         }
22359                 } else {
22360                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22361                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22362                         }
22363                 }
22364         }
22365 }
22366 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
22367         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
22368                 let contents = if o.result_ok {
22369                         let result = unsafe { o.contents.result };
22370                         unsafe { o.contents.result = core::ptr::null_mut() };
22371                         CResult_ShutdownScriptDecodeErrorZPtr { result }
22372                 } else {
22373                         let err = unsafe { o.contents.err };
22374                         unsafe { o.contents.err = core::ptr::null_mut(); }
22375                         CResult_ShutdownScriptDecodeErrorZPtr { err }
22376                 };
22377                 Self {
22378                         contents,
22379                         result_ok: o.result_ok,
22380                 }
22381         }
22382 }
22383 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
22384         fn clone(&self) -> Self {
22385                 if self.result_ok {
22386                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22387                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22388                         } }
22389                 } else {
22390                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22391                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22392                         } }
22393                 }
22394         }
22395 }
22396 #[no_mangle]
22397 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
22398 /// but with all dynamically-allocated buffers duplicated in new buffers.
22399 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
22400 #[repr(C)]
22401 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
22402 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22403         /// A pointer to the contents in the success state.
22404         /// Reading from this pointer when `result_ok` is not set is undefined.
22405         pub result: *mut crate::lightning::ln::script::ShutdownScript,
22406         /// A pointer to the contents in the error state.
22407         /// Reading from this pointer when `result_ok` is set is undefined.
22408         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
22409 }
22410 #[repr(C)]
22411 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
22412 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
22413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22414 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
22415         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
22416         /// `err` or `result` depending on the state of `result_ok`.
22417         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
22418         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
22419         pub result_ok: bool,
22420 }
22421 #[no_mangle]
22422 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
22423 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22424         CResult_ShutdownScriptInvalidShutdownScriptZ {
22425                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22426                         result: Box::into_raw(Box::new(o)),
22427                 },
22428                 result_ok: true,
22429         }
22430 }
22431 #[no_mangle]
22432 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
22433 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22434         CResult_ShutdownScriptInvalidShutdownScriptZ {
22435                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22436                         err: Box::into_raw(Box::new(e)),
22437                 },
22438                 result_ok: false,
22439         }
22440 }
22441 /// Checks if the given object is currently in the success state
22442 #[no_mangle]
22443 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
22444         o.result_ok
22445 }
22446 #[no_mangle]
22447 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
22448 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
22449 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
22450         fn drop(&mut self) {
22451                 if self.result_ok {
22452                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22453                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22454                         }
22455                 } else {
22456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22458                         }
22459                 }
22460         }
22461 }
22462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
22463         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
22464                 let contents = if o.result_ok {
22465                         let result = unsafe { o.contents.result };
22466                         unsafe { o.contents.result = core::ptr::null_mut() };
22467                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
22468                 } else {
22469                         let err = unsafe { o.contents.err };
22470                         unsafe { o.contents.err = core::ptr::null_mut(); }
22471                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
22472                 };
22473                 Self {
22474                         contents,
22475                         result_ok: o.result_ok,
22476                 }
22477         }
22478 }
22479 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
22480         fn clone(&self) -> Self {
22481                 if self.result_ok {
22482                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22483                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22484                         } }
22485                 } else {
22486                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22487                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
22488                         } }
22489                 }
22490         }
22491 }
22492 #[no_mangle]
22493 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
22494 /// but with all dynamically-allocated buffers duplicated in new buffers.
22495 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
22496 #[repr(C)]
22497 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
22498 /// This corresponds to std::vector in C++
22499 pub struct CVec_TransactionZ {
22500         /// The elements in the array.
22501         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
22502         pub data: *mut crate::c_types::Transaction,
22503         /// The number of elements pointed to by `data`.
22504         pub datalen: usize
22505 }
22506 impl CVec_TransactionZ {
22507         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
22508                 if self.datalen == 0 { return Vec::new(); }
22509                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
22510                 self.data = core::ptr::null_mut();
22511                 self.datalen = 0;
22512                 ret
22513         }
22514         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
22515                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
22516         }
22517 }
22518 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
22519         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
22520                 let datalen = v.len();
22521                 let data = Box::into_raw(v.into_boxed_slice());
22522                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
22523         }
22524 }
22525 #[no_mangle]
22526 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
22527 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
22528 impl Drop for CVec_TransactionZ {
22529         fn drop(&mut self) {
22530                 if self.datalen == 0 { return; }
22531                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
22532         }
22533 }
22534 impl Clone for CVec_TransactionZ {
22535         fn clone(&self) -> Self {
22536                 let mut res = Vec::new();
22537                 if self.datalen == 0 { return Self::from(res); }
22538                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
22539                 Self::from(res)
22540         }
22541 }
22542 #[repr(C)]
22543 /// The contents of CResult_PaymentPurposeDecodeErrorZ
22544 pub union CResult_PaymentPurposeDecodeErrorZPtr {
22545         /// A pointer to the contents in the success state.
22546         /// Reading from this pointer when `result_ok` is not set is undefined.
22547         pub result: *mut crate::lightning::events::PaymentPurpose,
22548         /// A pointer to the contents in the error state.
22549         /// Reading from this pointer when `result_ok` is set is undefined.
22550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22551 }
22552 #[repr(C)]
22553 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
22554 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
22555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22556 pub struct CResult_PaymentPurposeDecodeErrorZ {
22557         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
22558         /// `err` or `result` depending on the state of `result_ok`.
22559         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
22560         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
22561         pub result_ok: bool,
22562 }
22563 #[no_mangle]
22564 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
22565 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
22566         CResult_PaymentPurposeDecodeErrorZ {
22567                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22568                         result: Box::into_raw(Box::new(o)),
22569                 },
22570                 result_ok: true,
22571         }
22572 }
22573 #[no_mangle]
22574 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
22575 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
22576         CResult_PaymentPurposeDecodeErrorZ {
22577                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
22578                         err: Box::into_raw(Box::new(e)),
22579                 },
22580                 result_ok: false,
22581         }
22582 }
22583 /// Checks if the given object is currently in the success state
22584 #[no_mangle]
22585 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
22586         o.result_ok
22587 }
22588 #[no_mangle]
22589 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
22590 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
22591 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
22592         fn drop(&mut self) {
22593                 if self.result_ok {
22594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22596                         }
22597                 } else {
22598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22600                         }
22601                 }
22602         }
22603 }
22604 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
22605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
22606                 let contents = if o.result_ok {
22607                         let result = unsafe { o.contents.result };
22608                         unsafe { o.contents.result = core::ptr::null_mut() };
22609                         CResult_PaymentPurposeDecodeErrorZPtr { result }
22610                 } else {
22611                         let err = unsafe { o.contents.err };
22612                         unsafe { o.contents.err = core::ptr::null_mut(); }
22613                         CResult_PaymentPurposeDecodeErrorZPtr { err }
22614                 };
22615                 Self {
22616                         contents,
22617                         result_ok: o.result_ok,
22618                 }
22619         }
22620 }
22621 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
22622         fn clone(&self) -> Self {
22623                 if self.result_ok {
22624                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22625                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
22626                         } }
22627                 } else {
22628                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
22629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22630                         } }
22631                 }
22632         }
22633 }
22634 #[no_mangle]
22635 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
22636 /// but with all dynamically-allocated buffers duplicated in new buffers.
22637 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
22638 #[repr(C)]
22639 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
22640 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
22641         /// A pointer to the contents in the success state.
22642         /// Reading from this pointer when `result_ok` is not set is undefined.
22643         pub result: *mut crate::lightning::events::ClaimedHTLC,
22644         /// A pointer to the contents in the error state.
22645         /// Reading from this pointer when `result_ok` is set is undefined.
22646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22647 }
22648 #[repr(C)]
22649 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
22650 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
22651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22652 pub struct CResult_ClaimedHTLCDecodeErrorZ {
22653         /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
22654         /// `err` or `result` depending on the state of `result_ok`.
22655         pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
22656         /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
22657         pub result_ok: bool,
22658 }
22659 #[no_mangle]
22660 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
22661 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
22662         CResult_ClaimedHTLCDecodeErrorZ {
22663                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22664                         result: Box::into_raw(Box::new(o)),
22665                 },
22666                 result_ok: true,
22667         }
22668 }
22669 #[no_mangle]
22670 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
22671 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
22672         CResult_ClaimedHTLCDecodeErrorZ {
22673                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22674                         err: Box::into_raw(Box::new(e)),
22675                 },
22676                 result_ok: false,
22677         }
22678 }
22679 /// Checks if the given object is currently in the success state
22680 #[no_mangle]
22681 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
22682         o.result_ok
22683 }
22684 #[no_mangle]
22685 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
22686 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
22687 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
22688         fn drop(&mut self) {
22689                 if self.result_ok {
22690                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22691                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22692                         }
22693                 } else {
22694                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22695                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22696                         }
22697                 }
22698         }
22699 }
22700 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
22701         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
22702                 let contents = if o.result_ok {
22703                         let result = unsafe { o.contents.result };
22704                         unsafe { o.contents.result = core::ptr::null_mut() };
22705                         CResult_ClaimedHTLCDecodeErrorZPtr { result }
22706                 } else {
22707                         let err = unsafe { o.contents.err };
22708                         unsafe { o.contents.err = core::ptr::null_mut(); }
22709                         CResult_ClaimedHTLCDecodeErrorZPtr { err }
22710                 };
22711                 Self {
22712                         contents,
22713                         result_ok: o.result_ok,
22714                 }
22715         }
22716 }
22717 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
22718         fn clone(&self) -> Self {
22719                 if self.result_ok {
22720                         Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22721                                 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
22722                         } }
22723                 } else {
22724                         Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
22725                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22726                         } }
22727                 }
22728         }
22729 }
22730 #[no_mangle]
22731 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
22732 /// but with all dynamically-allocated buffers duplicated in new buffers.
22733 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
22734 #[repr(C)]
22735 #[derive(Clone)]
22736 /// An enum which can either contain a crate::lightning::events::PathFailure or not
22737 pub enum COption_PathFailureZ {
22738         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
22739         Some(crate::lightning::events::PathFailure),
22740         /// When we're in this state, this COption_PathFailureZ contains nothing
22741         None
22742 }
22743 impl COption_PathFailureZ {
22744         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22745                 if let Self::None = self { false } else { true }
22746         }
22747         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22748                 !self.is_some()
22749         }
22750         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
22751                 if let Self::Some(v) = self { v } else { unreachable!() }
22752         }
22753 }
22754 #[no_mangle]
22755 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
22756 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
22757         COption_PathFailureZ::Some(o)
22758 }
22759 #[no_mangle]
22760 /// Constructs a new COption_PathFailureZ containing nothing
22761 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
22762         COption_PathFailureZ::None
22763 }
22764 #[no_mangle]
22765 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
22766 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
22767 #[no_mangle]
22768 /// Creates a new COption_PathFailureZ which has the same data as `orig`
22769 /// but with all dynamically-allocated buffers duplicated in new buffers.
22770 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
22771 #[repr(C)]
22772 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
22773 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
22774         /// A pointer to the contents in the success state.
22775         /// Reading from this pointer when `result_ok` is not set is undefined.
22776         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
22777         /// A pointer to the contents in the error state.
22778         /// Reading from this pointer when `result_ok` is set is undefined.
22779         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22780 }
22781 #[repr(C)]
22782 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
22783 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22785 pub struct CResult_COption_PathFailureZDecodeErrorZ {
22786         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
22787         /// `err` or `result` depending on the state of `result_ok`.
22788         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
22789         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
22790         pub result_ok: bool,
22791 }
22792 #[no_mangle]
22793 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
22794 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
22795         CResult_COption_PathFailureZDecodeErrorZ {
22796                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22797                         result: Box::into_raw(Box::new(o)),
22798                 },
22799                 result_ok: true,
22800         }
22801 }
22802 #[no_mangle]
22803 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
22804 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
22805         CResult_COption_PathFailureZDecodeErrorZ {
22806                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22807                         err: Box::into_raw(Box::new(e)),
22808                 },
22809                 result_ok: false,
22810         }
22811 }
22812 /// Checks if the given object is currently in the success state
22813 #[no_mangle]
22814 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
22815         o.result_ok
22816 }
22817 #[no_mangle]
22818 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
22819 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
22820 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
22821         fn drop(&mut self) {
22822                 if self.result_ok {
22823                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22824                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22825                         }
22826                 } else {
22827                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22828                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22829                         }
22830                 }
22831         }
22832 }
22833 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
22834         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22835                 let contents = if o.result_ok {
22836                         let result = unsafe { o.contents.result };
22837                         unsafe { o.contents.result = core::ptr::null_mut() };
22838                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
22839                 } else {
22840                         let err = unsafe { o.contents.err };
22841                         unsafe { o.contents.err = core::ptr::null_mut(); }
22842                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
22843                 };
22844                 Self {
22845                         contents,
22846                         result_ok: o.result_ok,
22847                 }
22848         }
22849 }
22850 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
22851         fn clone(&self) -> Self {
22852                 if self.result_ok {
22853                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22854                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
22855                         } }
22856                 } else {
22857                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
22858                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22859                         } }
22860                 }
22861         }
22862 }
22863 #[no_mangle]
22864 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
22865 /// but with all dynamically-allocated buffers duplicated in new buffers.
22866 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
22867 #[repr(C)]
22868 #[derive(Clone)]
22869 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
22870 pub enum COption_ClosureReasonZ {
22871         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
22872         Some(crate::lightning::events::ClosureReason),
22873         /// When we're in this state, this COption_ClosureReasonZ contains nothing
22874         None
22875 }
22876 impl COption_ClosureReasonZ {
22877         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22878                 if let Self::None = self { false } else { true }
22879         }
22880         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22881                 !self.is_some()
22882         }
22883         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
22884                 if let Self::Some(v) = self { v } else { unreachable!() }
22885         }
22886 }
22887 #[no_mangle]
22888 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
22889 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
22890         COption_ClosureReasonZ::Some(o)
22891 }
22892 #[no_mangle]
22893 /// Constructs a new COption_ClosureReasonZ containing nothing
22894 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
22895         COption_ClosureReasonZ::None
22896 }
22897 #[no_mangle]
22898 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
22899 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
22900 #[no_mangle]
22901 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
22902 /// but with all dynamically-allocated buffers duplicated in new buffers.
22903 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
22904 #[repr(C)]
22905 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
22906 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
22907         /// A pointer to the contents in the success state.
22908         /// Reading from this pointer when `result_ok` is not set is undefined.
22909         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
22910         /// A pointer to the contents in the error state.
22911         /// Reading from this pointer when `result_ok` is set is undefined.
22912         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22913 }
22914 #[repr(C)]
22915 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
22916 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
22917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22918 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
22919         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
22920         /// `err` or `result` depending on the state of `result_ok`.
22921         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
22922         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
22923         pub result_ok: bool,
22924 }
22925 #[no_mangle]
22926 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
22927 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22928         CResult_COption_ClosureReasonZDecodeErrorZ {
22929                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22930                         result: Box::into_raw(Box::new(o)),
22931                 },
22932                 result_ok: true,
22933         }
22934 }
22935 #[no_mangle]
22936 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
22937 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
22938         CResult_COption_ClosureReasonZDecodeErrorZ {
22939                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22940                         err: Box::into_raw(Box::new(e)),
22941                 },
22942                 result_ok: false,
22943         }
22944 }
22945 /// Checks if the given object is currently in the success state
22946 #[no_mangle]
22947 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
22948         o.result_ok
22949 }
22950 #[no_mangle]
22951 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
22952 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
22953 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
22954         fn drop(&mut self) {
22955                 if self.result_ok {
22956                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22957                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22958                         }
22959                 } else {
22960                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22961                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22962                         }
22963                 }
22964         }
22965 }
22966 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
22967         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
22968                 let contents = if o.result_ok {
22969                         let result = unsafe { o.contents.result };
22970                         unsafe { o.contents.result = core::ptr::null_mut() };
22971                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
22972                 } else {
22973                         let err = unsafe { o.contents.err };
22974                         unsafe { o.contents.err = core::ptr::null_mut(); }
22975                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
22976                 };
22977                 Self {
22978                         contents,
22979                         result_ok: o.result_ok,
22980                 }
22981         }
22982 }
22983 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
22984         fn clone(&self) -> Self {
22985                 if self.result_ok {
22986                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22987                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
22988                         } }
22989                 } else {
22990                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
22991                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22992                         } }
22993                 }
22994         }
22995 }
22996 #[no_mangle]
22997 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
22998 /// but with all dynamically-allocated buffers duplicated in new buffers.
22999 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
23000 #[repr(C)]
23001 #[derive(Clone)]
23002 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
23003 pub enum COption_HTLCDestinationZ {
23004         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
23005         Some(crate::lightning::events::HTLCDestination),
23006         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
23007         None
23008 }
23009 impl COption_HTLCDestinationZ {
23010         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23011                 if let Self::None = self { false } else { true }
23012         }
23013         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23014                 !self.is_some()
23015         }
23016         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
23017                 if let Self::Some(v) = self { v } else { unreachable!() }
23018         }
23019 }
23020 #[no_mangle]
23021 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
23022 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
23023         COption_HTLCDestinationZ::Some(o)
23024 }
23025 #[no_mangle]
23026 /// Constructs a new COption_HTLCDestinationZ containing nothing
23027 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
23028         COption_HTLCDestinationZ::None
23029 }
23030 #[no_mangle]
23031 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
23032 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
23033 #[no_mangle]
23034 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
23035 /// but with all dynamically-allocated buffers duplicated in new buffers.
23036 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
23037 #[repr(C)]
23038 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
23039 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23040         /// A pointer to the contents in the success state.
23041         /// Reading from this pointer when `result_ok` is not set is undefined.
23042         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
23043         /// A pointer to the contents in the error state.
23044         /// Reading from this pointer when `result_ok` is set is undefined.
23045         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23046 }
23047 #[repr(C)]
23048 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
23049 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23051 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
23052         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
23053         /// `err` or `result` depending on the state of `result_ok`.
23054         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
23055         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
23056         pub result_ok: bool,
23057 }
23058 #[no_mangle]
23059 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
23060 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23061         CResult_COption_HTLCDestinationZDecodeErrorZ {
23062                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23063                         result: Box::into_raw(Box::new(o)),
23064                 },
23065                 result_ok: true,
23066         }
23067 }
23068 #[no_mangle]
23069 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
23070 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23071         CResult_COption_HTLCDestinationZDecodeErrorZ {
23072                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23073                         err: Box::into_raw(Box::new(e)),
23074                 },
23075                 result_ok: false,
23076         }
23077 }
23078 /// Checks if the given object is currently in the success state
23079 #[no_mangle]
23080 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
23081         o.result_ok
23082 }
23083 #[no_mangle]
23084 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
23085 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
23086 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
23087         fn drop(&mut self) {
23088                 if self.result_ok {
23089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23091                         }
23092                 } else {
23093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23095                         }
23096                 }
23097         }
23098 }
23099 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
23100         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23101                 let contents = if o.result_ok {
23102                         let result = unsafe { o.contents.result };
23103                         unsafe { o.contents.result = core::ptr::null_mut() };
23104                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
23105                 } else {
23106                         let err = unsafe { o.contents.err };
23107                         unsafe { o.contents.err = core::ptr::null_mut(); }
23108                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
23109                 };
23110                 Self {
23111                         contents,
23112                         result_ok: o.result_ok,
23113                 }
23114         }
23115 }
23116 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
23117         fn clone(&self) -> Self {
23118                 if self.result_ok {
23119                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23120                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
23121                         } }
23122                 } else {
23123                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23124                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23125                         } }
23126                 }
23127         }
23128 }
23129 #[no_mangle]
23130 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
23131 /// but with all dynamically-allocated buffers duplicated in new buffers.
23132 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
23133 #[repr(C)]
23134 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
23135 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
23136         /// A pointer to the contents in the success state.
23137         /// Reading from this pointer when `result_ok` is not set is undefined.
23138         pub result: *mut crate::lightning::events::PaymentFailureReason,
23139         /// A pointer to the contents in the error state.
23140         /// Reading from this pointer when `result_ok` is set is undefined.
23141         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23142 }
23143 #[repr(C)]
23144 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
23145 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
23146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23147 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
23148         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
23149         /// `err` or `result` depending on the state of `result_ok`.
23150         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
23151         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
23152         pub result_ok: bool,
23153 }
23154 #[no_mangle]
23155 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
23156 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
23157         CResult_PaymentFailureReasonDecodeErrorZ {
23158                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23159                         result: Box::into_raw(Box::new(o)),
23160                 },
23161                 result_ok: true,
23162         }
23163 }
23164 #[no_mangle]
23165 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
23166 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
23167         CResult_PaymentFailureReasonDecodeErrorZ {
23168                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23169                         err: Box::into_raw(Box::new(e)),
23170                 },
23171                 result_ok: false,
23172         }
23173 }
23174 /// Checks if the given object is currently in the success state
23175 #[no_mangle]
23176 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
23177         o.result_ok
23178 }
23179 #[no_mangle]
23180 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
23181 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
23182 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
23183         fn drop(&mut self) {
23184                 if self.result_ok {
23185                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23186                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23187                         }
23188                 } else {
23189                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23190                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23191                         }
23192                 }
23193         }
23194 }
23195 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
23196         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
23197                 let contents = if o.result_ok {
23198                         let result = unsafe { o.contents.result };
23199                         unsafe { o.contents.result = core::ptr::null_mut() };
23200                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
23201                 } else {
23202                         let err = unsafe { o.contents.err };
23203                         unsafe { o.contents.err = core::ptr::null_mut(); }
23204                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
23205                 };
23206                 Self {
23207                         contents,
23208                         result_ok: o.result_ok,
23209                 }
23210         }
23211 }
23212 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
23213         fn clone(&self) -> Self {
23214                 if self.result_ok {
23215                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23216                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
23217                         } }
23218                 } else {
23219                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23220                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23221                         } }
23222                 }
23223         }
23224 }
23225 #[no_mangle]
23226 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
23227 /// but with all dynamically-allocated buffers duplicated in new buffers.
23228 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
23229 #[repr(C)]
23230 #[derive(Clone)]
23231 /// An enum which can either contain a crate::c_types::U128 or not
23232 pub enum COption_U128Z {
23233         /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
23234         Some(crate::c_types::U128),
23235         /// When we're in this state, this COption_U128Z contains nothing
23236         None
23237 }
23238 impl COption_U128Z {
23239         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23240                 if let Self::None = self { false } else { true }
23241         }
23242         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23243                 !self.is_some()
23244         }
23245         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
23246                 if let Self::Some(v) = self { v } else { unreachable!() }
23247         }
23248 }
23249 #[no_mangle]
23250 /// Constructs a new COption_U128Z containing a crate::c_types::U128
23251 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
23252         COption_U128Z::Some(o)
23253 }
23254 #[no_mangle]
23255 /// Constructs a new COption_U128Z containing nothing
23256 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
23257         COption_U128Z::None
23258 }
23259 #[no_mangle]
23260 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
23261 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
23262 #[no_mangle]
23263 /// Creates a new COption_U128Z which has the same data as `orig`
23264 /// but with all dynamically-allocated buffers duplicated in new buffers.
23265 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
23266 #[repr(C)]
23267 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
23268 /// This corresponds to std::vector in C++
23269 pub struct CVec_ClaimedHTLCZ {
23270         /// The elements in the array.
23271         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23272         pub data: *mut crate::lightning::events::ClaimedHTLC,
23273         /// The number of elements pointed to by `data`.
23274         pub datalen: usize
23275 }
23276 impl CVec_ClaimedHTLCZ {
23277         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
23278                 if self.datalen == 0 { return Vec::new(); }
23279                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23280                 self.data = core::ptr::null_mut();
23281                 self.datalen = 0;
23282                 ret
23283         }
23284         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
23285                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23286         }
23287 }
23288 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
23289         fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
23290                 let datalen = v.len();
23291                 let data = Box::into_raw(v.into_boxed_slice());
23292                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23293         }
23294 }
23295 #[no_mangle]
23296 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23297 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
23298 impl Drop for CVec_ClaimedHTLCZ {
23299         fn drop(&mut self) {
23300                 if self.datalen == 0 { return; }
23301                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23302         }
23303 }
23304 impl Clone for CVec_ClaimedHTLCZ {
23305         fn clone(&self) -> Self {
23306                 let mut res = Vec::new();
23307                 if self.datalen == 0 { return Self::from(res); }
23308                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23309                 Self::from(res)
23310         }
23311 }
23312 #[repr(C)]
23313 #[derive(Clone)]
23314 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
23315 pub enum COption_PaymentFailureReasonZ {
23316         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
23317         Some(crate::lightning::events::PaymentFailureReason),
23318         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
23319         None
23320 }
23321 impl COption_PaymentFailureReasonZ {
23322         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23323                 if let Self::None = self { false } else { true }
23324         }
23325         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23326                 !self.is_some()
23327         }
23328         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
23329                 if let Self::Some(v) = self { v } else { unreachable!() }
23330         }
23331 }
23332 #[no_mangle]
23333 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
23334 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
23335         COption_PaymentFailureReasonZ::Some(o)
23336 }
23337 #[no_mangle]
23338 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
23339 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
23340         COption_PaymentFailureReasonZ::None
23341 }
23342 #[no_mangle]
23343 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
23344 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
23345 #[no_mangle]
23346 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
23347 /// but with all dynamically-allocated buffers duplicated in new buffers.
23348 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
23349 #[repr(C)]
23350 #[derive(Clone)]
23351 /// An enum which can either contain a crate::lightning::events::Event or not
23352 pub enum COption_EventZ {
23353         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
23354         Some(crate::lightning::events::Event),
23355         /// When we're in this state, this COption_EventZ contains nothing
23356         None
23357 }
23358 impl COption_EventZ {
23359         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23360                 if let Self::None = self { false } else { true }
23361         }
23362         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23363                 !self.is_some()
23364         }
23365         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
23366                 if let Self::Some(v) = self { v } else { unreachable!() }
23367         }
23368 }
23369 #[no_mangle]
23370 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
23371 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
23372         COption_EventZ::Some(o)
23373 }
23374 #[no_mangle]
23375 /// Constructs a new COption_EventZ containing nothing
23376 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
23377         COption_EventZ::None
23378 }
23379 #[no_mangle]
23380 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
23381 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
23382 #[no_mangle]
23383 /// Creates a new COption_EventZ which has the same data as `orig`
23384 /// but with all dynamically-allocated buffers duplicated in new buffers.
23385 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
23386 #[repr(C)]
23387 /// The contents of CResult_COption_EventZDecodeErrorZ
23388 pub union CResult_COption_EventZDecodeErrorZPtr {
23389         /// A pointer to the contents in the success state.
23390         /// Reading from this pointer when `result_ok` is not set is undefined.
23391         pub result: *mut crate::c_types::derived::COption_EventZ,
23392         /// A pointer to the contents in the error state.
23393         /// Reading from this pointer when `result_ok` is set is undefined.
23394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23395 }
23396 #[repr(C)]
23397 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
23398 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23400 pub struct CResult_COption_EventZDecodeErrorZ {
23401         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
23402         /// `err` or `result` depending on the state of `result_ok`.
23403         pub contents: CResult_COption_EventZDecodeErrorZPtr,
23404         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
23405         pub result_ok: bool,
23406 }
23407 #[no_mangle]
23408 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
23409 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
23410         CResult_COption_EventZDecodeErrorZ {
23411                 contents: CResult_COption_EventZDecodeErrorZPtr {
23412                         result: Box::into_raw(Box::new(o)),
23413                 },
23414                 result_ok: true,
23415         }
23416 }
23417 #[no_mangle]
23418 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
23419 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
23420         CResult_COption_EventZDecodeErrorZ {
23421                 contents: CResult_COption_EventZDecodeErrorZPtr {
23422                         err: Box::into_raw(Box::new(e)),
23423                 },
23424                 result_ok: false,
23425         }
23426 }
23427 /// Checks if the given object is currently in the success state
23428 #[no_mangle]
23429 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
23430         o.result_ok
23431 }
23432 #[no_mangle]
23433 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
23434 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
23435 impl Drop for CResult_COption_EventZDecodeErrorZ {
23436         fn drop(&mut self) {
23437                 if self.result_ok {
23438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23440                         }
23441                 } else {
23442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23444                         }
23445                 }
23446         }
23447 }
23448 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
23449         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23450                 let contents = if o.result_ok {
23451                         let result = unsafe { o.contents.result };
23452                         unsafe { o.contents.result = core::ptr::null_mut() };
23453                         CResult_COption_EventZDecodeErrorZPtr { result }
23454                 } else {
23455                         let err = unsafe { o.contents.err };
23456                         unsafe { o.contents.err = core::ptr::null_mut(); }
23457                         CResult_COption_EventZDecodeErrorZPtr { err }
23458                 };
23459                 Self {
23460                         contents,
23461                         result_ok: o.result_ok,
23462                 }
23463         }
23464 }
23465 impl Clone for CResult_COption_EventZDecodeErrorZ {
23466         fn clone(&self) -> Self {
23467                 if self.result_ok {
23468                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
23469                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
23470                         } }
23471                 } else {
23472                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
23473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23474                         } }
23475                 }
23476         }
23477 }
23478 #[no_mangle]
23479 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
23480 /// but with all dynamically-allocated buffers duplicated in new buffers.
23481 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
23482 #[repr(C)]
23483 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
23484 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
23485         /// A pointer to the contents in the success state.
23486         /// Reading from this pointer when `result_ok` is not set is undefined.
23487         pub result: *mut crate::lightning_invoice::SiPrefix,
23488         /// A pointer to the contents in the error state.
23489         /// Reading from this pointer when `result_ok` is set is undefined.
23490         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23491 }
23492 #[repr(C)]
23493 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
23494 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23496 pub struct CResult_SiPrefixBolt11ParseErrorZ {
23497         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
23498         /// `err` or `result` depending on the state of `result_ok`.
23499         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
23500         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
23501         pub result_ok: bool,
23502 }
23503 #[no_mangle]
23504 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
23505 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
23506         CResult_SiPrefixBolt11ParseErrorZ {
23507                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23508                         result: Box::into_raw(Box::new(o)),
23509                 },
23510                 result_ok: true,
23511         }
23512 }
23513 #[no_mangle]
23514 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
23515 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
23516         CResult_SiPrefixBolt11ParseErrorZ {
23517                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23518                         err: Box::into_raw(Box::new(e)),
23519                 },
23520                 result_ok: false,
23521         }
23522 }
23523 /// Checks if the given object is currently in the success state
23524 #[no_mangle]
23525 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
23526         o.result_ok
23527 }
23528 #[no_mangle]
23529 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
23530 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
23531 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
23532         fn drop(&mut self) {
23533                 if self.result_ok {
23534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23536                         }
23537                 } else {
23538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23540                         }
23541                 }
23542         }
23543 }
23544 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
23545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23546                 let contents = if o.result_ok {
23547                         let result = unsafe { o.contents.result };
23548                         unsafe { o.contents.result = core::ptr::null_mut() };
23549                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
23550                 } else {
23551                         let err = unsafe { o.contents.err };
23552                         unsafe { o.contents.err = core::ptr::null_mut(); }
23553                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
23554                 };
23555                 Self {
23556                         contents,
23557                         result_ok: o.result_ok,
23558                 }
23559         }
23560 }
23561 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
23562         fn clone(&self) -> Self {
23563                 if self.result_ok {
23564                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23565                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
23566                         } }
23567                 } else {
23568                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
23569                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23570                         } }
23571                 }
23572         }
23573 }
23574 #[no_mangle]
23575 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
23576 /// but with all dynamically-allocated buffers duplicated in new buffers.
23577 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
23578 #[repr(C)]
23579 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
23580 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23581         /// A pointer to the contents in the success state.
23582         /// Reading from this pointer when `result_ok` is not set is undefined.
23583         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
23584         /// A pointer to the contents in the error state.
23585         /// Reading from this pointer when `result_ok` is set is undefined.
23586         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
23587 }
23588 #[repr(C)]
23589 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
23590 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
23591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23592 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23593         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
23594         /// `err` or `result` depending on the state of `result_ok`.
23595         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
23596         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
23597         pub result_ok: bool,
23598 }
23599 #[no_mangle]
23600 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
23601 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23602         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23603                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23604                         result: Box::into_raw(Box::new(o)),
23605                 },
23606                 result_ok: true,
23607         }
23608 }
23609 #[no_mangle]
23610 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
23611 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23612         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23613                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23614                         err: Box::into_raw(Box::new(e)),
23615                 },
23616                 result_ok: false,
23617         }
23618 }
23619 /// Checks if the given object is currently in the success state
23620 #[no_mangle]
23621 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
23622         o.result_ok
23623 }
23624 #[no_mangle]
23625 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
23626 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
23627 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23628         fn drop(&mut self) {
23629                 if self.result_ok {
23630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23632                         }
23633                 } else {
23634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23636                         }
23637                 }
23638         }
23639 }
23640 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
23642                 let contents = if o.result_ok {
23643                         let result = unsafe { o.contents.result };
23644                         unsafe { o.contents.result = core::ptr::null_mut() };
23645                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
23646                 } else {
23647                         let err = unsafe { o.contents.err };
23648                         unsafe { o.contents.err = core::ptr::null_mut(); }
23649                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
23650                 };
23651                 Self {
23652                         contents,
23653                         result_ok: o.result_ok,
23654                 }
23655         }
23656 }
23657 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
23658         fn clone(&self) -> Self {
23659                 if self.result_ok {
23660                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23661                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
23662                         } }
23663                 } else {
23664                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
23665                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
23666                         } }
23667                 }
23668         }
23669 }
23670 #[no_mangle]
23671 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
23672 /// but with all dynamically-allocated buffers duplicated in new buffers.
23673 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
23674 #[repr(C)]
23675 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
23676 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23677         /// A pointer to the contents in the success state.
23678         /// Reading from this pointer when `result_ok` is not set is undefined.
23679         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
23680         /// A pointer to the contents in the error state.
23681         /// Reading from this pointer when `result_ok` is set is undefined.
23682         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
23683 }
23684 #[repr(C)]
23685 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
23686 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
23687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23688 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23689         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
23690         /// `err` or `result` depending on the state of `result_ok`.
23691         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
23692         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
23693         pub result_ok: bool,
23694 }
23695 #[no_mangle]
23696 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
23697 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23698         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23699                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23700                         result: Box::into_raw(Box::new(o)),
23701                 },
23702                 result_ok: true,
23703         }
23704 }
23705 #[no_mangle]
23706 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
23707 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23708         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23709                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23710                         err: Box::into_raw(Box::new(e)),
23711                 },
23712                 result_ok: false,
23713         }
23714 }
23715 /// Checks if the given object is currently in the success state
23716 #[no_mangle]
23717 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
23718         o.result_ok
23719 }
23720 #[no_mangle]
23721 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
23722 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
23723 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23724         fn drop(&mut self) {
23725                 if self.result_ok {
23726                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23727                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23728                         }
23729                 } else {
23730                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23731                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23732                         }
23733                 }
23734         }
23735 }
23736 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23737         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
23738                 let contents = if o.result_ok {
23739                         let result = unsafe { o.contents.result };
23740                         unsafe { o.contents.result = core::ptr::null_mut() };
23741                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
23742                 } else {
23743                         let err = unsafe { o.contents.err };
23744                         unsafe { o.contents.err = core::ptr::null_mut(); }
23745                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
23746                 };
23747                 Self {
23748                         contents,
23749                         result_ok: o.result_ok,
23750                 }
23751         }
23752 }
23753 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
23754         fn clone(&self) -> Self {
23755                 if self.result_ok {
23756                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23757                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
23758                         } }
23759                 } else {
23760                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
23761                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
23762                         } }
23763                 }
23764         }
23765 }
23766 #[no_mangle]
23767 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
23768 /// but with all dynamically-allocated buffers duplicated in new buffers.
23769 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
23770 #[repr(C)]
23771 /// A tuple of 3 elements. See the individual fields for the types contained.
23772 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23773         /// The element at position 0
23774         pub a: crate::lightning_invoice::RawBolt11Invoice,
23775         /// The element at position 1
23776         pub b: crate::c_types::ThirtyTwoBytes,
23777         /// The element at position 2
23778         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
23779 }
23780 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23781         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
23782                 Self {
23783                         a: tup.0,
23784                         b: tup.1,
23785                         c: tup.2,
23786                 }
23787         }
23788 }
23789 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23790         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
23791                 (self.a, self.b, self.c)
23792         }
23793 }
23794 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23795         fn clone(&self) -> Self {
23796                 Self {
23797                         a: Clone::clone(&self.a),
23798                         b: Clone::clone(&self.b),
23799                         c: Clone::clone(&self.c),
23800                 }
23801         }
23802 }
23803 #[no_mangle]
23804 /// Creates a new tuple which has the same data as `orig`
23805 /// but with all dynamically-allocated buffers duplicated in new buffers.
23806 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
23807 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
23808 #[no_mangle]
23809 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
23810         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
23811 }
23812
23813 #[no_mangle]
23814 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
23815 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
23816 #[repr(C)]
23817 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
23818 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
23819         /// A pointer to the contents in the success state.
23820         /// Reading from this pointer when `result_ok` is not set is undefined.
23821         pub result: *mut crate::lightning_invoice::PayeePubKey,
23822         /// A pointer to the contents in the error state.
23823         /// Reading from this pointer when `result_ok` is set is undefined.
23824         pub err: *mut crate::c_types::Secp256k1Error,
23825 }
23826 #[repr(C)]
23827 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
23828 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
23829 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23830 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
23831         /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
23832         /// `err` or `result` depending on the state of `result_ok`.
23833         pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
23834         /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
23835         pub result_ok: bool,
23836 }
23837 #[no_mangle]
23838 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
23839 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
23840         CResult_PayeePubKeySecp256k1ErrorZ {
23841                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23842                         result: Box::into_raw(Box::new(o)),
23843                 },
23844                 result_ok: true,
23845         }
23846 }
23847 #[no_mangle]
23848 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
23849 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
23850         CResult_PayeePubKeySecp256k1ErrorZ {
23851                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23852                         err: Box::into_raw(Box::new(e)),
23853                 },
23854                 result_ok: false,
23855         }
23856 }
23857 /// Checks if the given object is currently in the success state
23858 #[no_mangle]
23859 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
23860         o.result_ok
23861 }
23862 #[no_mangle]
23863 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
23864 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
23865 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
23866         fn drop(&mut self) {
23867                 if self.result_ok {
23868                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23869                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23870                         }
23871                 } else {
23872                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23873                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23874                         }
23875                 }
23876         }
23877 }
23878 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
23879         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
23880                 let contents = if o.result_ok {
23881                         let result = unsafe { o.contents.result };
23882                         unsafe { o.contents.result = core::ptr::null_mut() };
23883                         CResult_PayeePubKeySecp256k1ErrorZPtr { result }
23884                 } else {
23885                         let err = unsafe { o.contents.err };
23886                         unsafe { o.contents.err = core::ptr::null_mut(); }
23887                         CResult_PayeePubKeySecp256k1ErrorZPtr { err }
23888                 };
23889                 Self {
23890                         contents,
23891                         result_ok: o.result_ok,
23892                 }
23893         }
23894 }
23895 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
23896         fn clone(&self) -> Self {
23897                 if self.result_ok {
23898                         Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23899                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
23900                         } }
23901                 } else {
23902                         Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
23903                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
23904                         } }
23905                 }
23906         }
23907 }
23908 #[no_mangle]
23909 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
23910 /// but with all dynamically-allocated buffers duplicated in new buffers.
23911 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
23912 #[repr(C)]
23913 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
23914 /// This corresponds to std::vector in C++
23915 pub struct CVec_PrivateRouteZ {
23916         /// The elements in the array.
23917         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23918         pub data: *mut crate::lightning_invoice::PrivateRoute,
23919         /// The number of elements pointed to by `data`.
23920         pub datalen: usize
23921 }
23922 impl CVec_PrivateRouteZ {
23923         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
23924                 if self.datalen == 0 { return Vec::new(); }
23925                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23926                 self.data = core::ptr::null_mut();
23927                 self.datalen = 0;
23928                 ret
23929         }
23930         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
23931                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23932         }
23933 }
23934 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
23935         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
23936                 let datalen = v.len();
23937                 let data = Box::into_raw(v.into_boxed_slice());
23938                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23939         }
23940 }
23941 #[no_mangle]
23942 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23943 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
23944 impl Drop for CVec_PrivateRouteZ {
23945         fn drop(&mut self) {
23946                 if self.datalen == 0 { return; }
23947                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23948         }
23949 }
23950 impl Clone for CVec_PrivateRouteZ {
23951         fn clone(&self) -> Self {
23952                 let mut res = Vec::new();
23953                 if self.datalen == 0 { return Self::from(res); }
23954                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23955                 Self::from(res)
23956         }
23957 }
23958 #[repr(C)]
23959 /// The contents of CResult_PositiveTimestampCreationErrorZ
23960 pub union CResult_PositiveTimestampCreationErrorZPtr {
23961         /// A pointer to the contents in the success state.
23962         /// Reading from this pointer when `result_ok` is not set is undefined.
23963         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
23964         /// A pointer to the contents in the error state.
23965         /// Reading from this pointer when `result_ok` is set is undefined.
23966         pub err: *mut crate::lightning_invoice::CreationError,
23967 }
23968 #[repr(C)]
23969 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
23970 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
23971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23972 pub struct CResult_PositiveTimestampCreationErrorZ {
23973         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
23974         /// `err` or `result` depending on the state of `result_ok`.
23975         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
23976         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
23977         pub result_ok: bool,
23978 }
23979 #[no_mangle]
23980 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
23981 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
23982         CResult_PositiveTimestampCreationErrorZ {
23983                 contents: CResult_PositiveTimestampCreationErrorZPtr {
23984                         result: Box::into_raw(Box::new(o)),
23985                 },
23986                 result_ok: true,
23987         }
23988 }
23989 #[no_mangle]
23990 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
23991 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
23992         CResult_PositiveTimestampCreationErrorZ {
23993                 contents: CResult_PositiveTimestampCreationErrorZPtr {
23994                         err: Box::into_raw(Box::new(e)),
23995                 },
23996                 result_ok: false,
23997         }
23998 }
23999 /// Checks if the given object is currently in the success state
24000 #[no_mangle]
24001 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
24002         o.result_ok
24003 }
24004 #[no_mangle]
24005 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
24006 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
24007 impl Drop for CResult_PositiveTimestampCreationErrorZ {
24008         fn drop(&mut self) {
24009                 if self.result_ok {
24010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24012                         }
24013                 } else {
24014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24016                         }
24017                 }
24018         }
24019 }
24020 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
24021         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
24022                 let contents = if o.result_ok {
24023                         let result = unsafe { o.contents.result };
24024                         unsafe { o.contents.result = core::ptr::null_mut() };
24025                         CResult_PositiveTimestampCreationErrorZPtr { result }
24026                 } else {
24027                         let err = unsafe { o.contents.err };
24028                         unsafe { o.contents.err = core::ptr::null_mut(); }
24029                         CResult_PositiveTimestampCreationErrorZPtr { err }
24030                 };
24031                 Self {
24032                         contents,
24033                         result_ok: o.result_ok,
24034                 }
24035         }
24036 }
24037 impl Clone for CResult_PositiveTimestampCreationErrorZ {
24038         fn clone(&self) -> Self {
24039                 if self.result_ok {
24040                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
24041                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
24042                         } }
24043                 } else {
24044                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
24045                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24046                         } }
24047                 }
24048         }
24049 }
24050 #[no_mangle]
24051 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
24052 /// but with all dynamically-allocated buffers duplicated in new buffers.
24053 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
24054 #[repr(C)]
24055 /// The contents of CResult_NoneBolt11SemanticErrorZ
24056 pub union CResult_NoneBolt11SemanticErrorZPtr {
24057         /// Note that this value is always NULL, as there are no contents in the OK variant
24058         pub result: *mut core::ffi::c_void,
24059         /// A pointer to the contents in the error state.
24060         /// Reading from this pointer when `result_ok` is set is undefined.
24061         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24062 }
24063 #[repr(C)]
24064 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
24065 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24067 pub struct CResult_NoneBolt11SemanticErrorZ {
24068         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
24069         /// `err` or `result` depending on the state of `result_ok`.
24070         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
24071         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
24072         pub result_ok: bool,
24073 }
24074 #[no_mangle]
24075 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
24076 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
24077         CResult_NoneBolt11SemanticErrorZ {
24078                 contents: CResult_NoneBolt11SemanticErrorZPtr {
24079                         result: core::ptr::null_mut(),
24080                 },
24081                 result_ok: true,
24082         }
24083 }
24084 #[no_mangle]
24085 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
24086 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
24087         CResult_NoneBolt11SemanticErrorZ {
24088                 contents: CResult_NoneBolt11SemanticErrorZPtr {
24089                         err: Box::into_raw(Box::new(e)),
24090                 },
24091                 result_ok: false,
24092         }
24093 }
24094 /// Checks if the given object is currently in the success state
24095 #[no_mangle]
24096 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
24097         o.result_ok
24098 }
24099 #[no_mangle]
24100 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
24101 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
24102 impl Drop for CResult_NoneBolt11SemanticErrorZ {
24103         fn drop(&mut self) {
24104                 if self.result_ok {
24105                 } else {
24106                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24107                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24108                         }
24109                 }
24110         }
24111 }
24112 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
24113         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24114                 let contents = if o.result_ok {
24115                         let _ = unsafe { Box::from_raw(o.contents.result) };
24116                         o.contents.result = core::ptr::null_mut();
24117                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
24118                 } else {
24119                         let err = unsafe { o.contents.err };
24120                         unsafe { o.contents.err = core::ptr::null_mut(); }
24121                         CResult_NoneBolt11SemanticErrorZPtr { err }
24122                 };
24123                 Self {
24124                         contents,
24125                         result_ok: o.result_ok,
24126                 }
24127         }
24128 }
24129 impl Clone for CResult_NoneBolt11SemanticErrorZ {
24130         fn clone(&self) -> Self {
24131                 if self.result_ok {
24132                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
24133                                 result: core::ptr::null_mut()
24134                         } }
24135                 } else {
24136                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
24137                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24138                         } }
24139                 }
24140         }
24141 }
24142 #[no_mangle]
24143 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
24144 /// but with all dynamically-allocated buffers duplicated in new buffers.
24145 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
24146 #[repr(C)]
24147 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
24148 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24149         /// A pointer to the contents in the success state.
24150         /// Reading from this pointer when `result_ok` is not set is undefined.
24151         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
24152         /// A pointer to the contents in the error state.
24153         /// Reading from this pointer when `result_ok` is set is undefined.
24154         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24155 }
24156 #[repr(C)]
24157 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
24158 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24160 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24161         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
24162         /// `err` or `result` depending on the state of `result_ok`.
24163         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
24164         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
24165         pub result_ok: bool,
24166 }
24167 #[no_mangle]
24168 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
24169 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24170         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24171                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24172                         result: Box::into_raw(Box::new(o)),
24173                 },
24174                 result_ok: true,
24175         }
24176 }
24177 #[no_mangle]
24178 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
24179 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24180         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24181                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24182                         err: Box::into_raw(Box::new(e)),
24183                 },
24184                 result_ok: false,
24185         }
24186 }
24187 /// Checks if the given object is currently in the success state
24188 #[no_mangle]
24189 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
24190         o.result_ok
24191 }
24192 #[no_mangle]
24193 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
24194 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
24195 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24196         fn drop(&mut self) {
24197                 if self.result_ok {
24198                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24199                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24200                         }
24201                 } else {
24202                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24203                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24204                         }
24205                 }
24206         }
24207 }
24208 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24209         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24210                 let contents = if o.result_ok {
24211                         let result = unsafe { o.contents.result };
24212                         unsafe { o.contents.result = core::ptr::null_mut() };
24213                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
24214                 } else {
24215                         let err = unsafe { o.contents.err };
24216                         unsafe { o.contents.err = core::ptr::null_mut(); }
24217                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
24218                 };
24219                 Self {
24220                         contents,
24221                         result_ok: o.result_ok,
24222                 }
24223         }
24224 }
24225 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24226         fn clone(&self) -> Self {
24227                 if self.result_ok {
24228                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24229                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
24230                         } }
24231                 } else {
24232                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24233                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24234                         } }
24235                 }
24236         }
24237 }
24238 #[no_mangle]
24239 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
24240 /// but with all dynamically-allocated buffers duplicated in new buffers.
24241 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
24242 #[repr(C)]
24243 /// The contents of CResult_DescriptionCreationErrorZ
24244 pub union CResult_DescriptionCreationErrorZPtr {
24245         /// A pointer to the contents in the success state.
24246         /// Reading from this pointer when `result_ok` is not set is undefined.
24247         pub result: *mut crate::lightning_invoice::Description,
24248         /// A pointer to the contents in the error state.
24249         /// Reading from this pointer when `result_ok` is set is undefined.
24250         pub err: *mut crate::lightning_invoice::CreationError,
24251 }
24252 #[repr(C)]
24253 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
24254 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
24255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24256 pub struct CResult_DescriptionCreationErrorZ {
24257         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
24258         /// `err` or `result` depending on the state of `result_ok`.
24259         pub contents: CResult_DescriptionCreationErrorZPtr,
24260         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
24261         pub result_ok: bool,
24262 }
24263 #[no_mangle]
24264 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
24265 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
24266         CResult_DescriptionCreationErrorZ {
24267                 contents: CResult_DescriptionCreationErrorZPtr {
24268                         result: Box::into_raw(Box::new(o)),
24269                 },
24270                 result_ok: true,
24271         }
24272 }
24273 #[no_mangle]
24274 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
24275 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
24276         CResult_DescriptionCreationErrorZ {
24277                 contents: CResult_DescriptionCreationErrorZPtr {
24278                         err: Box::into_raw(Box::new(e)),
24279                 },
24280                 result_ok: false,
24281         }
24282 }
24283 /// Checks if the given object is currently in the success state
24284 #[no_mangle]
24285 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
24286         o.result_ok
24287 }
24288 #[no_mangle]
24289 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
24290 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
24291 impl Drop for CResult_DescriptionCreationErrorZ {
24292         fn drop(&mut self) {
24293                 if self.result_ok {
24294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24296                         }
24297                 } else {
24298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24300                         }
24301                 }
24302         }
24303 }
24304 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
24305         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
24306                 let contents = if o.result_ok {
24307                         let result = unsafe { o.contents.result };
24308                         unsafe { o.contents.result = core::ptr::null_mut() };
24309                         CResult_DescriptionCreationErrorZPtr { result }
24310                 } else {
24311                         let err = unsafe { o.contents.err };
24312                         unsafe { o.contents.err = core::ptr::null_mut(); }
24313                         CResult_DescriptionCreationErrorZPtr { err }
24314                 };
24315                 Self {
24316                         contents,
24317                         result_ok: o.result_ok,
24318                 }
24319         }
24320 }
24321 impl Clone for CResult_DescriptionCreationErrorZ {
24322         fn clone(&self) -> Self {
24323                 if self.result_ok {
24324                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
24325                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
24326                         } }
24327                 } else {
24328                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
24329                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24330                         } }
24331                 }
24332         }
24333 }
24334 #[no_mangle]
24335 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
24336 /// but with all dynamically-allocated buffers duplicated in new buffers.
24337 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
24338 #[repr(C)]
24339 /// The contents of CResult_PrivateRouteCreationErrorZ
24340 pub union CResult_PrivateRouteCreationErrorZPtr {
24341         /// A pointer to the contents in the success state.
24342         /// Reading from this pointer when `result_ok` is not set is undefined.
24343         pub result: *mut crate::lightning_invoice::PrivateRoute,
24344         /// A pointer to the contents in the error state.
24345         /// Reading from this pointer when `result_ok` is set is undefined.
24346         pub err: *mut crate::lightning_invoice::CreationError,
24347 }
24348 #[repr(C)]
24349 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
24350 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
24351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24352 pub struct CResult_PrivateRouteCreationErrorZ {
24353         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
24354         /// `err` or `result` depending on the state of `result_ok`.
24355         pub contents: CResult_PrivateRouteCreationErrorZPtr,
24356         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
24357         pub result_ok: bool,
24358 }
24359 #[no_mangle]
24360 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
24361 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
24362         CResult_PrivateRouteCreationErrorZ {
24363                 contents: CResult_PrivateRouteCreationErrorZPtr {
24364                         result: Box::into_raw(Box::new(o)),
24365                 },
24366                 result_ok: true,
24367         }
24368 }
24369 #[no_mangle]
24370 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
24371 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
24372         CResult_PrivateRouteCreationErrorZ {
24373                 contents: CResult_PrivateRouteCreationErrorZPtr {
24374                         err: Box::into_raw(Box::new(e)),
24375                 },
24376                 result_ok: false,
24377         }
24378 }
24379 /// Checks if the given object is currently in the success state
24380 #[no_mangle]
24381 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
24382         o.result_ok
24383 }
24384 #[no_mangle]
24385 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
24386 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
24387 impl Drop for CResult_PrivateRouteCreationErrorZ {
24388         fn drop(&mut self) {
24389                 if self.result_ok {
24390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24392                         }
24393                 } else {
24394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24396                         }
24397                 }
24398         }
24399 }
24400 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
24401         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
24402                 let contents = if o.result_ok {
24403                         let result = unsafe { o.contents.result };
24404                         unsafe { o.contents.result = core::ptr::null_mut() };
24405                         CResult_PrivateRouteCreationErrorZPtr { result }
24406                 } else {
24407                         let err = unsafe { o.contents.err };
24408                         unsafe { o.contents.err = core::ptr::null_mut(); }
24409                         CResult_PrivateRouteCreationErrorZPtr { err }
24410                 };
24411                 Self {
24412                         contents,
24413                         result_ok: o.result_ok,
24414                 }
24415         }
24416 }
24417 impl Clone for CResult_PrivateRouteCreationErrorZ {
24418         fn clone(&self) -> Self {
24419                 if self.result_ok {
24420                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
24421                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
24422                         } }
24423                 } else {
24424                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
24425                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24426                         } }
24427                 }
24428         }
24429 }
24430 #[no_mangle]
24431 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
24432 /// but with all dynamically-allocated buffers duplicated in new buffers.
24433 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
24434 #[repr(C)]
24435 /// The contents of CResult_OutPointDecodeErrorZ
24436 pub union CResult_OutPointDecodeErrorZPtr {
24437         /// A pointer to the contents in the success state.
24438         /// Reading from this pointer when `result_ok` is not set is undefined.
24439         pub result: *mut crate::lightning::chain::transaction::OutPoint,
24440         /// A pointer to the contents in the error state.
24441         /// Reading from this pointer when `result_ok` is set is undefined.
24442         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24443 }
24444 #[repr(C)]
24445 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
24446 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
24447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24448 pub struct CResult_OutPointDecodeErrorZ {
24449         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
24450         /// `err` or `result` depending on the state of `result_ok`.
24451         pub contents: CResult_OutPointDecodeErrorZPtr,
24452         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
24453         pub result_ok: bool,
24454 }
24455 #[no_mangle]
24456 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
24457 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
24458         CResult_OutPointDecodeErrorZ {
24459                 contents: CResult_OutPointDecodeErrorZPtr {
24460                         result: Box::into_raw(Box::new(o)),
24461                 },
24462                 result_ok: true,
24463         }
24464 }
24465 #[no_mangle]
24466 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
24467 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
24468         CResult_OutPointDecodeErrorZ {
24469                 contents: CResult_OutPointDecodeErrorZPtr {
24470                         err: Box::into_raw(Box::new(e)),
24471                 },
24472                 result_ok: false,
24473         }
24474 }
24475 /// Checks if the given object is currently in the success state
24476 #[no_mangle]
24477 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
24478         o.result_ok
24479 }
24480 #[no_mangle]
24481 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
24482 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
24483 impl Drop for CResult_OutPointDecodeErrorZ {
24484         fn drop(&mut self) {
24485                 if self.result_ok {
24486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24488                         }
24489                 } else {
24490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24492                         }
24493                 }
24494         }
24495 }
24496 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
24497         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
24498                 let contents = if o.result_ok {
24499                         let result = unsafe { o.contents.result };
24500                         unsafe { o.contents.result = core::ptr::null_mut() };
24501                         CResult_OutPointDecodeErrorZPtr { result }
24502                 } else {
24503                         let err = unsafe { o.contents.err };
24504                         unsafe { o.contents.err = core::ptr::null_mut(); }
24505                         CResult_OutPointDecodeErrorZPtr { err }
24506                 };
24507                 Self {
24508                         contents,
24509                         result_ok: o.result_ok,
24510                 }
24511         }
24512 }
24513 impl Clone for CResult_OutPointDecodeErrorZ {
24514         fn clone(&self) -> Self {
24515                 if self.result_ok {
24516                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
24517                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
24518                         } }
24519                 } else {
24520                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
24521                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24522                         } }
24523                 }
24524         }
24525 }
24526 #[no_mangle]
24527 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
24528 /// but with all dynamically-allocated buffers duplicated in new buffers.
24529 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
24530 #[repr(C)]
24531 /// The contents of CResult_BigSizeDecodeErrorZ
24532 pub union CResult_BigSizeDecodeErrorZPtr {
24533         /// A pointer to the contents in the success state.
24534         /// Reading from this pointer when `result_ok` is not set is undefined.
24535         pub result: *mut crate::lightning::util::ser::BigSize,
24536         /// A pointer to the contents in the error state.
24537         /// Reading from this pointer when `result_ok` is set is undefined.
24538         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24539 }
24540 #[repr(C)]
24541 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
24542 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
24543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24544 pub struct CResult_BigSizeDecodeErrorZ {
24545         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
24546         /// `err` or `result` depending on the state of `result_ok`.
24547         pub contents: CResult_BigSizeDecodeErrorZPtr,
24548         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
24549         pub result_ok: bool,
24550 }
24551 #[no_mangle]
24552 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
24553 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
24554         CResult_BigSizeDecodeErrorZ {
24555                 contents: CResult_BigSizeDecodeErrorZPtr {
24556                         result: Box::into_raw(Box::new(o)),
24557                 },
24558                 result_ok: true,
24559         }
24560 }
24561 #[no_mangle]
24562 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
24563 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
24564         CResult_BigSizeDecodeErrorZ {
24565                 contents: CResult_BigSizeDecodeErrorZPtr {
24566                         err: Box::into_raw(Box::new(e)),
24567                 },
24568                 result_ok: false,
24569         }
24570 }
24571 /// Checks if the given object is currently in the success state
24572 #[no_mangle]
24573 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
24574         o.result_ok
24575 }
24576 #[no_mangle]
24577 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
24578 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
24579 impl Drop for CResult_BigSizeDecodeErrorZ {
24580         fn drop(&mut self) {
24581                 if self.result_ok {
24582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24584                         }
24585                 } else {
24586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24588                         }
24589                 }
24590         }
24591 }
24592 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
24593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
24594                 let contents = if o.result_ok {
24595                         let result = unsafe { o.contents.result };
24596                         unsafe { o.contents.result = core::ptr::null_mut() };
24597                         CResult_BigSizeDecodeErrorZPtr { result }
24598                 } else {
24599                         let err = unsafe { o.contents.err };
24600                         unsafe { o.contents.err = core::ptr::null_mut(); }
24601                         CResult_BigSizeDecodeErrorZPtr { err }
24602                 };
24603                 Self {
24604                         contents,
24605                         result_ok: o.result_ok,
24606                 }
24607         }
24608 }
24609 impl Clone for CResult_BigSizeDecodeErrorZ {
24610         fn clone(&self) -> Self {
24611                 if self.result_ok {
24612                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
24613                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
24614                         } }
24615                 } else {
24616                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
24617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24618                         } }
24619                 }
24620         }
24621 }
24622 #[no_mangle]
24623 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
24624 /// but with all dynamically-allocated buffers duplicated in new buffers.
24625 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
24626 #[repr(C)]
24627 /// The contents of CResult_HostnameDecodeErrorZ
24628 pub union CResult_HostnameDecodeErrorZPtr {
24629         /// A pointer to the contents in the success state.
24630         /// Reading from this pointer when `result_ok` is not set is undefined.
24631         pub result: *mut crate::lightning::util::ser::Hostname,
24632         /// A pointer to the contents in the error state.
24633         /// Reading from this pointer when `result_ok` is set is undefined.
24634         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24635 }
24636 #[repr(C)]
24637 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
24638 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
24639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24640 pub struct CResult_HostnameDecodeErrorZ {
24641         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
24642         /// `err` or `result` depending on the state of `result_ok`.
24643         pub contents: CResult_HostnameDecodeErrorZPtr,
24644         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
24645         pub result_ok: bool,
24646 }
24647 #[no_mangle]
24648 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
24649 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
24650         CResult_HostnameDecodeErrorZ {
24651                 contents: CResult_HostnameDecodeErrorZPtr {
24652                         result: Box::into_raw(Box::new(o)),
24653                 },
24654                 result_ok: true,
24655         }
24656 }
24657 #[no_mangle]
24658 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
24659 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
24660         CResult_HostnameDecodeErrorZ {
24661                 contents: CResult_HostnameDecodeErrorZPtr {
24662                         err: Box::into_raw(Box::new(e)),
24663                 },
24664                 result_ok: false,
24665         }
24666 }
24667 /// Checks if the given object is currently in the success state
24668 #[no_mangle]
24669 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
24670         o.result_ok
24671 }
24672 #[no_mangle]
24673 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
24674 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
24675 impl Drop for CResult_HostnameDecodeErrorZ {
24676         fn drop(&mut self) {
24677                 if self.result_ok {
24678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24680                         }
24681                 } else {
24682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24684                         }
24685                 }
24686         }
24687 }
24688 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
24689         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
24690                 let contents = if o.result_ok {
24691                         let result = unsafe { o.contents.result };
24692                         unsafe { o.contents.result = core::ptr::null_mut() };
24693                         CResult_HostnameDecodeErrorZPtr { result }
24694                 } else {
24695                         let err = unsafe { o.contents.err };
24696                         unsafe { o.contents.err = core::ptr::null_mut(); }
24697                         CResult_HostnameDecodeErrorZPtr { err }
24698                 };
24699                 Self {
24700                         contents,
24701                         result_ok: o.result_ok,
24702                 }
24703         }
24704 }
24705 impl Clone for CResult_HostnameDecodeErrorZ {
24706         fn clone(&self) -> Self {
24707                 if self.result_ok {
24708                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
24709                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
24710                         } }
24711                 } else {
24712                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
24713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24714                         } }
24715                 }
24716         }
24717 }
24718 #[no_mangle]
24719 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
24720 /// but with all dynamically-allocated buffers duplicated in new buffers.
24721 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
24722 #[repr(C)]
24723 /// The contents of CResult_TransactionU16LenLimitedNoneZ
24724 pub union CResult_TransactionU16LenLimitedNoneZPtr {
24725         /// A pointer to the contents in the success state.
24726         /// Reading from this pointer when `result_ok` is not set is undefined.
24727         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24728         /// Note that this value is always NULL, as there are no contents in the Err variant
24729         pub err: *mut core::ffi::c_void,
24730 }
24731 #[repr(C)]
24732 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
24733 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
24734 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24735 pub struct CResult_TransactionU16LenLimitedNoneZ {
24736         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
24737         /// `err` or `result` depending on the state of `result_ok`.
24738         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
24739         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
24740         pub result_ok: bool,
24741 }
24742 #[no_mangle]
24743 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
24744 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
24745         CResult_TransactionU16LenLimitedNoneZ {
24746                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24747                         result: Box::into_raw(Box::new(o)),
24748                 },
24749                 result_ok: true,
24750         }
24751 }
24752 #[no_mangle]
24753 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
24754 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
24755         CResult_TransactionU16LenLimitedNoneZ {
24756                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
24757                         err: core::ptr::null_mut(),
24758                 },
24759                 result_ok: false,
24760         }
24761 }
24762 /// Checks if the given object is currently in the success state
24763 #[no_mangle]
24764 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
24765         o.result_ok
24766 }
24767 #[no_mangle]
24768 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
24769 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
24770 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
24771         fn drop(&mut self) {
24772                 if self.result_ok {
24773                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24774                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24775                         }
24776                 } else {
24777                 }
24778         }
24779 }
24780 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
24781         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
24782                 let contents = if o.result_ok {
24783                         let result = unsafe { o.contents.result };
24784                         unsafe { o.contents.result = core::ptr::null_mut() };
24785                         CResult_TransactionU16LenLimitedNoneZPtr { result }
24786                 } else {
24787                         let _ = unsafe { Box::from_raw(o.contents.err) };
24788                         o.contents.err = core::ptr::null_mut();
24789                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
24790                 };
24791                 Self {
24792                         contents,
24793                         result_ok: o.result_ok,
24794                 }
24795         }
24796 }
24797 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
24798         fn clone(&self) -> Self {
24799                 if self.result_ok {
24800                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24801                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24802                         } }
24803                 } else {
24804                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
24805                                 err: core::ptr::null_mut()
24806                         } }
24807                 }
24808         }
24809 }
24810 #[no_mangle]
24811 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
24812 /// but with all dynamically-allocated buffers duplicated in new buffers.
24813 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
24814 #[repr(C)]
24815 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
24816 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24817         /// A pointer to the contents in the success state.
24818         /// Reading from this pointer when `result_ok` is not set is undefined.
24819         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
24820         /// A pointer to the contents in the error state.
24821         /// Reading from this pointer when `result_ok` is set is undefined.
24822         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24823 }
24824 #[repr(C)]
24825 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
24826 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
24827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24828 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
24829         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
24830         /// `err` or `result` depending on the state of `result_ok`.
24831         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
24832         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
24833         pub result_ok: bool,
24834 }
24835 #[no_mangle]
24836 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
24837 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24838         CResult_TransactionU16LenLimitedDecodeErrorZ {
24839                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24840                         result: Box::into_raw(Box::new(o)),
24841                 },
24842                 result_ok: true,
24843         }
24844 }
24845 #[no_mangle]
24846 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
24847 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
24848         CResult_TransactionU16LenLimitedDecodeErrorZ {
24849                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24850                         err: Box::into_raw(Box::new(e)),
24851                 },
24852                 result_ok: false,
24853         }
24854 }
24855 /// Checks if the given object is currently in the success state
24856 #[no_mangle]
24857 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
24858         o.result_ok
24859 }
24860 #[no_mangle]
24861 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
24862 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
24863 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
24864         fn drop(&mut self) {
24865                 if self.result_ok {
24866                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24867                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24868                         }
24869                 } else {
24870                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24871                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24872                         }
24873                 }
24874         }
24875 }
24876 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
24877         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
24878                 let contents = if o.result_ok {
24879                         let result = unsafe { o.contents.result };
24880                         unsafe { o.contents.result = core::ptr::null_mut() };
24881                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
24882                 } else {
24883                         let err = unsafe { o.contents.err };
24884                         unsafe { o.contents.err = core::ptr::null_mut(); }
24885                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
24886                 };
24887                 Self {
24888                         contents,
24889                         result_ok: o.result_ok,
24890                 }
24891         }
24892 }
24893 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
24894         fn clone(&self) -> Self {
24895                 if self.result_ok {
24896                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24897                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
24898                         } }
24899                 } else {
24900                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
24901                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24902                         } }
24903                 }
24904         }
24905 }
24906 #[no_mangle]
24907 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
24908 /// but with all dynamically-allocated buffers duplicated in new buffers.
24909 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
24910 #[repr(C)]
24911 /// The contents of CResult_UntrustedStringDecodeErrorZ
24912 pub union CResult_UntrustedStringDecodeErrorZPtr {
24913         /// A pointer to the contents in the success state.
24914         /// Reading from this pointer when `result_ok` is not set is undefined.
24915         pub result: *mut crate::lightning::util::string::UntrustedString,
24916         /// A pointer to the contents in the error state.
24917         /// Reading from this pointer when `result_ok` is set is undefined.
24918         pub err: *mut crate::lightning::ln::msgs::DecodeError,
24919 }
24920 #[repr(C)]
24921 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
24922 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
24923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24924 pub struct CResult_UntrustedStringDecodeErrorZ {
24925         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
24926         /// `err` or `result` depending on the state of `result_ok`.
24927         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
24928         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
24929         pub result_ok: bool,
24930 }
24931 #[no_mangle]
24932 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
24933 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
24934         CResult_UntrustedStringDecodeErrorZ {
24935                 contents: CResult_UntrustedStringDecodeErrorZPtr {
24936                         result: Box::into_raw(Box::new(o)),
24937                 },
24938                 result_ok: true,
24939         }
24940 }
24941 #[no_mangle]
24942 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
24943 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
24944         CResult_UntrustedStringDecodeErrorZ {
24945                 contents: CResult_UntrustedStringDecodeErrorZPtr {
24946                         err: Box::into_raw(Box::new(e)),
24947                 },
24948                 result_ok: false,
24949         }
24950 }
24951 /// Checks if the given object is currently in the success state
24952 #[no_mangle]
24953 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
24954         o.result_ok
24955 }
24956 #[no_mangle]
24957 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
24958 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
24959 impl Drop for CResult_UntrustedStringDecodeErrorZ {
24960         fn drop(&mut self) {
24961                 if self.result_ok {
24962                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24963                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24964                         }
24965                 } else {
24966                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24967                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24968                         }
24969                 }
24970         }
24971 }
24972 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
24973         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
24974                 let contents = if o.result_ok {
24975                         let result = unsafe { o.contents.result };
24976                         unsafe { o.contents.result = core::ptr::null_mut() };
24977                         CResult_UntrustedStringDecodeErrorZPtr { result }
24978                 } else {
24979                         let err = unsafe { o.contents.err };
24980                         unsafe { o.contents.err = core::ptr::null_mut(); }
24981                         CResult_UntrustedStringDecodeErrorZPtr { err }
24982                 };
24983                 Self {
24984                         contents,
24985                         result_ok: o.result_ok,
24986                 }
24987         }
24988 }
24989 impl Clone for CResult_UntrustedStringDecodeErrorZ {
24990         fn clone(&self) -> Self {
24991                 if self.result_ok {
24992                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
24993                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
24994                         } }
24995                 } else {
24996                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
24997                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24998                         } }
24999                 }
25000         }
25001 }
25002 #[no_mangle]
25003 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
25004 /// but with all dynamically-allocated buffers duplicated in new buffers.
25005 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
25006 #[repr(C)]
25007 /// The contents of CResult_ChannelIdDecodeErrorZ
25008 pub union CResult_ChannelIdDecodeErrorZPtr {
25009         /// A pointer to the contents in the success state.
25010         /// Reading from this pointer when `result_ok` is not set is undefined.
25011         pub result: *mut crate::lightning::ln::types::ChannelId,
25012         /// A pointer to the contents in the error state.
25013         /// Reading from this pointer when `result_ok` is set is undefined.
25014         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25015 }
25016 #[repr(C)]
25017 /// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
25018 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
25019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25020 pub struct CResult_ChannelIdDecodeErrorZ {
25021         /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
25022         /// `err` or `result` depending on the state of `result_ok`.
25023         pub contents: CResult_ChannelIdDecodeErrorZPtr,
25024         /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
25025         pub result_ok: bool,
25026 }
25027 #[no_mangle]
25028 /// Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
25029 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ {
25030         CResult_ChannelIdDecodeErrorZ {
25031                 contents: CResult_ChannelIdDecodeErrorZPtr {
25032                         result: Box::into_raw(Box::new(o)),
25033                 },
25034                 result_ok: true,
25035         }
25036 }
25037 #[no_mangle]
25038 /// Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
25039 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ {
25040         CResult_ChannelIdDecodeErrorZ {
25041                 contents: CResult_ChannelIdDecodeErrorZPtr {
25042                         err: Box::into_raw(Box::new(e)),
25043                 },
25044                 result_ok: false,
25045         }
25046 }
25047 /// Checks if the given object is currently in the success state
25048 #[no_mangle]
25049 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool {
25050         o.result_ok
25051 }
25052 #[no_mangle]
25053 /// Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
25054 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { }
25055 impl Drop for CResult_ChannelIdDecodeErrorZ {
25056         fn drop(&mut self) {
25057                 if self.result_ok {
25058                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25059                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25060                         }
25061                 } else {
25062                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25063                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25064                         }
25065                 }
25066         }
25067 }
25068 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelIdDecodeErrorZ {
25069         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>) -> Self {
25070                 let contents = if o.result_ok {
25071                         let result = unsafe { o.contents.result };
25072                         unsafe { o.contents.result = core::ptr::null_mut() };
25073                         CResult_ChannelIdDecodeErrorZPtr { result }
25074                 } else {
25075                         let err = unsafe { o.contents.err };
25076                         unsafe { o.contents.err = core::ptr::null_mut(); }
25077                         CResult_ChannelIdDecodeErrorZPtr { err }
25078                 };
25079                 Self {
25080                         contents,
25081                         result_ok: o.result_ok,
25082                 }
25083         }
25084 }
25085 impl Clone for CResult_ChannelIdDecodeErrorZ {
25086         fn clone(&self) -> Self {
25087                 if self.result_ok {
25088                         Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr {
25089                                 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
25090                         } }
25091                 } else {
25092                         Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr {
25093                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25094                         } }
25095                 }
25096         }
25097 }
25098 #[no_mangle]
25099 /// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
25100 /// but with all dynamically-allocated buffers duplicated in new buffers.
25101 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) }
25102 #[repr(C)]
25103 /// A tuple of 2 elements. See the individual fields for the types contained.
25104 pub struct C2Tuple__u832u16Z {
25105         /// The element at position 0
25106         pub a: crate::c_types::ThirtyTwoBytes,
25107         /// The element at position 1
25108         pub b: u16,
25109 }
25110 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
25111         fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
25112                 Self {
25113                         a: tup.0,
25114                         b: tup.1,
25115                 }
25116         }
25117 }
25118 impl C2Tuple__u832u16Z {
25119         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
25120                 (self.a, self.b)
25121         }
25122 }
25123 impl Clone for C2Tuple__u832u16Z {
25124         fn clone(&self) -> Self {
25125                 Self {
25126                         a: Clone::clone(&self.a),
25127                         b: Clone::clone(&self.b),
25128                 }
25129         }
25130 }
25131 #[no_mangle]
25132 /// Creates a new tuple which has the same data as `orig`
25133 /// but with all dynamically-allocated buffers duplicated in new buffers.
25134 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
25135 /// Creates a new C2Tuple__u832u16Z from the contained elements.
25136 #[no_mangle]
25137 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
25138         C2Tuple__u832u16Z { a, b, }
25139 }
25140
25141 #[no_mangle]
25142 /// Frees any resources used by the C2Tuple__u832u16Z.
25143 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
25144 #[repr(C)]
25145 /// The contents of CResult_PaymentRelayDecodeErrorZ
25146 pub union CResult_PaymentRelayDecodeErrorZPtr {
25147         /// A pointer to the contents in the success state.
25148         /// Reading from this pointer when `result_ok` is not set is undefined.
25149         pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
25150         /// A pointer to the contents in the error state.
25151         /// Reading from this pointer when `result_ok` is set is undefined.
25152         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25153 }
25154 #[repr(C)]
25155 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
25156 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
25157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25158 pub struct CResult_PaymentRelayDecodeErrorZ {
25159         /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
25160         /// `err` or `result` depending on the state of `result_ok`.
25161         pub contents: CResult_PaymentRelayDecodeErrorZPtr,
25162         /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
25163         pub result_ok: bool,
25164 }
25165 #[no_mangle]
25166 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
25167 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
25168         CResult_PaymentRelayDecodeErrorZ {
25169                 contents: CResult_PaymentRelayDecodeErrorZPtr {
25170                         result: Box::into_raw(Box::new(o)),
25171                 },
25172                 result_ok: true,
25173         }
25174 }
25175 #[no_mangle]
25176 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
25177 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
25178         CResult_PaymentRelayDecodeErrorZ {
25179                 contents: CResult_PaymentRelayDecodeErrorZPtr {
25180                         err: Box::into_raw(Box::new(e)),
25181                 },
25182                 result_ok: false,
25183         }
25184 }
25185 /// Checks if the given object is currently in the success state
25186 #[no_mangle]
25187 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
25188         o.result_ok
25189 }
25190 #[no_mangle]
25191 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
25192 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
25193 impl Drop for CResult_PaymentRelayDecodeErrorZ {
25194         fn drop(&mut self) {
25195                 if self.result_ok {
25196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25198                         }
25199                 } else {
25200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25202                         }
25203                 }
25204         }
25205 }
25206 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
25207         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
25208                 let contents = if o.result_ok {
25209                         let result = unsafe { o.contents.result };
25210                         unsafe { o.contents.result = core::ptr::null_mut() };
25211                         CResult_PaymentRelayDecodeErrorZPtr { result }
25212                 } else {
25213                         let err = unsafe { o.contents.err };
25214                         unsafe { o.contents.err = core::ptr::null_mut(); }
25215                         CResult_PaymentRelayDecodeErrorZPtr { err }
25216                 };
25217                 Self {
25218                         contents,
25219                         result_ok: o.result_ok,
25220                 }
25221         }
25222 }
25223 impl Clone for CResult_PaymentRelayDecodeErrorZ {
25224         fn clone(&self) -> Self {
25225                 if self.result_ok {
25226                         Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
25227                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
25228                         } }
25229                 } else {
25230                         Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
25231                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25232                         } }
25233                 }
25234         }
25235 }
25236 #[no_mangle]
25237 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
25238 /// but with all dynamically-allocated buffers duplicated in new buffers.
25239 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
25240 #[repr(C)]
25241 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
25242 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
25243         /// A pointer to the contents in the success state.
25244         /// Reading from this pointer when `result_ok` is not set is undefined.
25245         pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
25246         /// A pointer to the contents in the error state.
25247         /// Reading from this pointer when `result_ok` is set is undefined.
25248         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25249 }
25250 #[repr(C)]
25251 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
25252 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
25253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25254 pub struct CResult_PaymentConstraintsDecodeErrorZ {
25255         /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
25256         /// `err` or `result` depending on the state of `result_ok`.
25257         pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
25258         /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
25259         pub result_ok: bool,
25260 }
25261 #[no_mangle]
25262 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
25263 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
25264         CResult_PaymentConstraintsDecodeErrorZ {
25265                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25266                         result: Box::into_raw(Box::new(o)),
25267                 },
25268                 result_ok: true,
25269         }
25270 }
25271 #[no_mangle]
25272 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
25273 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
25274         CResult_PaymentConstraintsDecodeErrorZ {
25275                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25276                         err: Box::into_raw(Box::new(e)),
25277                 },
25278                 result_ok: false,
25279         }
25280 }
25281 /// Checks if the given object is currently in the success state
25282 #[no_mangle]
25283 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
25284         o.result_ok
25285 }
25286 #[no_mangle]
25287 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
25288 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
25289 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
25290         fn drop(&mut self) {
25291                 if self.result_ok {
25292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25294                         }
25295                 } else {
25296                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25297                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25298                         }
25299                 }
25300         }
25301 }
25302 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
25303         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
25304                 let contents = if o.result_ok {
25305                         let result = unsafe { o.contents.result };
25306                         unsafe { o.contents.result = core::ptr::null_mut() };
25307                         CResult_PaymentConstraintsDecodeErrorZPtr { result }
25308                 } else {
25309                         let err = unsafe { o.contents.err };
25310                         unsafe { o.contents.err = core::ptr::null_mut(); }
25311                         CResult_PaymentConstraintsDecodeErrorZPtr { err }
25312                 };
25313                 Self {
25314                         contents,
25315                         result_ok: o.result_ok,
25316                 }
25317         }
25318 }
25319 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
25320         fn clone(&self) -> Self {
25321                 if self.result_ok {
25322                         Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25323                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
25324                         } }
25325                 } else {
25326                         Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
25327                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25328                         } }
25329                 }
25330         }
25331 }
25332 #[no_mangle]
25333 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
25334 /// but with all dynamically-allocated buffers duplicated in new buffers.
25335 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
25336 #[repr(C)]
25337 /// The contents of CResult_PaymentContextDecodeErrorZ
25338 pub union CResult_PaymentContextDecodeErrorZPtr {
25339         /// A pointer to the contents in the success state.
25340         /// Reading from this pointer when `result_ok` is not set is undefined.
25341         pub result: *mut crate::lightning::blinded_path::payment::PaymentContext,
25342         /// A pointer to the contents in the error state.
25343         /// Reading from this pointer when `result_ok` is set is undefined.
25344         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25345 }
25346 #[repr(C)]
25347 /// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
25348 /// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25350 pub struct CResult_PaymentContextDecodeErrorZ {
25351         /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
25352         /// `err` or `result` depending on the state of `result_ok`.
25353         pub contents: CResult_PaymentContextDecodeErrorZPtr,
25354         /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
25355         pub result_ok: bool,
25356 }
25357 #[no_mangle]
25358 /// Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
25359 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ {
25360         CResult_PaymentContextDecodeErrorZ {
25361                 contents: CResult_PaymentContextDecodeErrorZPtr {
25362                         result: Box::into_raw(Box::new(o)),
25363                 },
25364                 result_ok: true,
25365         }
25366 }
25367 #[no_mangle]
25368 /// Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
25369 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ {
25370         CResult_PaymentContextDecodeErrorZ {
25371                 contents: CResult_PaymentContextDecodeErrorZPtr {
25372                         err: Box::into_raw(Box::new(e)),
25373                 },
25374                 result_ok: false,
25375         }
25376 }
25377 /// Checks if the given object is currently in the success state
25378 #[no_mangle]
25379 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool {
25380         o.result_ok
25381 }
25382 #[no_mangle]
25383 /// Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
25384 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { }
25385 impl Drop for CResult_PaymentContextDecodeErrorZ {
25386         fn drop(&mut self) {
25387                 if self.result_ok {
25388                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25389                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25390                         }
25391                 } else {
25392                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25393                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25394                         }
25395                 }
25396         }
25397 }
25398 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentContextDecodeErrorZ {
25399         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25400                 let contents = if o.result_ok {
25401                         let result = unsafe { o.contents.result };
25402                         unsafe { o.contents.result = core::ptr::null_mut() };
25403                         CResult_PaymentContextDecodeErrorZPtr { result }
25404                 } else {
25405                         let err = unsafe { o.contents.err };
25406                         unsafe { o.contents.err = core::ptr::null_mut(); }
25407                         CResult_PaymentContextDecodeErrorZPtr { err }
25408                 };
25409                 Self {
25410                         contents,
25411                         result_ok: o.result_ok,
25412                 }
25413         }
25414 }
25415 impl Clone for CResult_PaymentContextDecodeErrorZ {
25416         fn clone(&self) -> Self {
25417                 if self.result_ok {
25418                         Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr {
25419                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentContext>::clone(unsafe { &*self.contents.result })))
25420                         } }
25421                 } else {
25422                         Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr {
25423                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25424                         } }
25425                 }
25426         }
25427 }
25428 #[no_mangle]
25429 /// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
25430 /// but with all dynamically-allocated buffers duplicated in new buffers.
25431 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) }
25432 #[repr(C)]
25433 /// The contents of CResult_UnknownPaymentContextDecodeErrorZ
25434 pub union CResult_UnknownPaymentContextDecodeErrorZPtr {
25435         /// A pointer to the contents in the success state.
25436         /// Reading from this pointer when `result_ok` is not set is undefined.
25437         pub result: *mut crate::lightning::blinded_path::payment::UnknownPaymentContext,
25438         /// A pointer to the contents in the error state.
25439         /// Reading from this pointer when `result_ok` is set is undefined.
25440         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25441 }
25442 #[repr(C)]
25443 /// A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
25444 /// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25446 pub struct CResult_UnknownPaymentContextDecodeErrorZ {
25447         /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
25448         /// `err` or `result` depending on the state of `result_ok`.
25449         pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr,
25450         /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
25451         pub result_ok: bool,
25452 }
25453 #[no_mangle]
25454 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
25455 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ {
25456         CResult_UnknownPaymentContextDecodeErrorZ {
25457                 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25458                         result: Box::into_raw(Box::new(o)),
25459                 },
25460                 result_ok: true,
25461         }
25462 }
25463 #[no_mangle]
25464 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
25465 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ {
25466         CResult_UnknownPaymentContextDecodeErrorZ {
25467                 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25468                         err: Box::into_raw(Box::new(e)),
25469                 },
25470                 result_ok: false,
25471         }
25472 }
25473 /// Checks if the given object is currently in the success state
25474 #[no_mangle]
25475 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool {
25476         o.result_ok
25477 }
25478 #[no_mangle]
25479 /// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
25480 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { }
25481 impl Drop for CResult_UnknownPaymentContextDecodeErrorZ {
25482         fn drop(&mut self) {
25483                 if self.result_ok {
25484                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25485                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25486                         }
25487                 } else {
25488                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25489                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25490                         }
25491                 }
25492         }
25493 }
25494 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_UnknownPaymentContextDecodeErrorZ {
25495         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25496                 let contents = if o.result_ok {
25497                         let result = unsafe { o.contents.result };
25498                         unsafe { o.contents.result = core::ptr::null_mut() };
25499                         CResult_UnknownPaymentContextDecodeErrorZPtr { result }
25500                 } else {
25501                         let err = unsafe { o.contents.err };
25502                         unsafe { o.contents.err = core::ptr::null_mut(); }
25503                         CResult_UnknownPaymentContextDecodeErrorZPtr { err }
25504                 };
25505                 Self {
25506                         contents,
25507                         result_ok: o.result_ok,
25508                 }
25509         }
25510 }
25511 impl Clone for CResult_UnknownPaymentContextDecodeErrorZ {
25512         fn clone(&self) -> Self {
25513                 if self.result_ok {
25514                         Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25515                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::UnknownPaymentContext>::clone(unsafe { &*self.contents.result })))
25516                         } }
25517                 } else {
25518                         Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
25519                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25520                         } }
25521                 }
25522         }
25523 }
25524 #[no_mangle]
25525 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
25526 /// but with all dynamically-allocated buffers duplicated in new buffers.
25527 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) }
25528 #[repr(C)]
25529 /// The contents of CResult_Bolt12OfferContextDecodeErrorZ
25530 pub union CResult_Bolt12OfferContextDecodeErrorZPtr {
25531         /// A pointer to the contents in the success state.
25532         /// Reading from this pointer when `result_ok` is not set is undefined.
25533         pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext,
25534         /// A pointer to the contents in the error state.
25535         /// Reading from this pointer when `result_ok` is set is undefined.
25536         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25537 }
25538 #[repr(C)]
25539 /// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
25540 /// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25541 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25542 pub struct CResult_Bolt12OfferContextDecodeErrorZ {
25543         /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
25544         /// `err` or `result` depending on the state of `result_ok`.
25545         pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr,
25546         /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
25547         pub result_ok: bool,
25548 }
25549 #[no_mangle]
25550 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
25551 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ {
25552         CResult_Bolt12OfferContextDecodeErrorZ {
25553                 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25554                         result: Box::into_raw(Box::new(o)),
25555                 },
25556                 result_ok: true,
25557         }
25558 }
25559 #[no_mangle]
25560 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
25561 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ {
25562         CResult_Bolt12OfferContextDecodeErrorZ {
25563                 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25564                         err: Box::into_raw(Box::new(e)),
25565                 },
25566                 result_ok: false,
25567         }
25568 }
25569 /// Checks if the given object is currently in the success state
25570 #[no_mangle]
25571 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool {
25572         o.result_ok
25573 }
25574 #[no_mangle]
25575 /// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
25576 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { }
25577 impl Drop for CResult_Bolt12OfferContextDecodeErrorZ {
25578         fn drop(&mut self) {
25579                 if self.result_ok {
25580                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25581                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25582                         }
25583                 } else {
25584                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25585                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25586                         }
25587                 }
25588         }
25589 }
25590 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12OfferContextDecodeErrorZ {
25591         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25592                 let contents = if o.result_ok {
25593                         let result = unsafe { o.contents.result };
25594                         unsafe { o.contents.result = core::ptr::null_mut() };
25595                         CResult_Bolt12OfferContextDecodeErrorZPtr { result }
25596                 } else {
25597                         let err = unsafe { o.contents.err };
25598                         unsafe { o.contents.err = core::ptr::null_mut(); }
25599                         CResult_Bolt12OfferContextDecodeErrorZPtr { err }
25600                 };
25601                 Self {
25602                         contents,
25603                         result_ok: o.result_ok,
25604                 }
25605         }
25606 }
25607 impl Clone for CResult_Bolt12OfferContextDecodeErrorZ {
25608         fn clone(&self) -> Self {
25609                 if self.result_ok {
25610                         Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25611                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12OfferContext>::clone(unsafe { &*self.contents.result })))
25612                         } }
25613                 } else {
25614                         Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
25615                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25616                         } }
25617                 }
25618         }
25619 }
25620 #[no_mangle]
25621 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
25622 /// but with all dynamically-allocated buffers duplicated in new buffers.
25623 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) }
25624 #[repr(C)]
25625 /// The contents of CResult_Bolt12RefundContextDecodeErrorZ
25626 pub union CResult_Bolt12RefundContextDecodeErrorZPtr {
25627         /// A pointer to the contents in the success state.
25628         /// Reading from this pointer when `result_ok` is not set is undefined.
25629         pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext,
25630         /// A pointer to the contents in the error state.
25631         /// Reading from this pointer when `result_ok` is set is undefined.
25632         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25633 }
25634 #[repr(C)]
25635 /// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
25636 /// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
25637 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25638 pub struct CResult_Bolt12RefundContextDecodeErrorZ {
25639         /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
25640         /// `err` or `result` depending on the state of `result_ok`.
25641         pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr,
25642         /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
25643         pub result_ok: bool,
25644 }
25645 #[no_mangle]
25646 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
25647 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ {
25648         CResult_Bolt12RefundContextDecodeErrorZ {
25649                 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25650                         result: Box::into_raw(Box::new(o)),
25651                 },
25652                 result_ok: true,
25653         }
25654 }
25655 #[no_mangle]
25656 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
25657 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ {
25658         CResult_Bolt12RefundContextDecodeErrorZ {
25659                 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25660                         err: Box::into_raw(Box::new(e)),
25661                 },
25662                 result_ok: false,
25663         }
25664 }
25665 /// Checks if the given object is currently in the success state
25666 #[no_mangle]
25667 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool {
25668         o.result_ok
25669 }
25670 #[no_mangle]
25671 /// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
25672 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { }
25673 impl Drop for CResult_Bolt12RefundContextDecodeErrorZ {
25674         fn drop(&mut self) {
25675                 if self.result_ok {
25676                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25677                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25678                         }
25679                 } else {
25680                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25681                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25682                         }
25683                 }
25684         }
25685 }
25686 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12RefundContextDecodeErrorZ {
25687         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
25688                 let contents = if o.result_ok {
25689                         let result = unsafe { o.contents.result };
25690                         unsafe { o.contents.result = core::ptr::null_mut() };
25691                         CResult_Bolt12RefundContextDecodeErrorZPtr { result }
25692                 } else {
25693                         let err = unsafe { o.contents.err };
25694                         unsafe { o.contents.err = core::ptr::null_mut(); }
25695                         CResult_Bolt12RefundContextDecodeErrorZPtr { err }
25696                 };
25697                 Self {
25698                         contents,
25699                         result_ok: o.result_ok,
25700                 }
25701         }
25702 }
25703 impl Clone for CResult_Bolt12RefundContextDecodeErrorZ {
25704         fn clone(&self) -> Self {
25705                 if self.result_ok {
25706                         Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25707                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12RefundContext>::clone(unsafe { &*self.contents.result })))
25708                         } }
25709                 } else {
25710                         Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
25711                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25712                         } }
25713                 }
25714         }
25715 }
25716 #[no_mangle]
25717 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
25718 /// but with all dynamically-allocated buffers duplicated in new buffers.
25719 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) }
25720 #[repr(C)]
25721 /// The contents of CResult_StrSecp256k1ErrorZ
25722 pub union CResult_StrSecp256k1ErrorZPtr {
25723         /// A pointer to the contents in the success state.
25724         /// Reading from this pointer when `result_ok` is not set is undefined.
25725         pub result: *mut crate::c_types::Str,
25726         /// A pointer to the contents in the error state.
25727         /// Reading from this pointer when `result_ok` is set is undefined.
25728         pub err: *mut crate::c_types::Secp256k1Error,
25729 }
25730 #[repr(C)]
25731 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
25732 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
25733 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25734 pub struct CResult_StrSecp256k1ErrorZ {
25735         /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
25736         /// `err` or `result` depending on the state of `result_ok`.
25737         pub contents: CResult_StrSecp256k1ErrorZPtr,
25738         /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
25739         pub result_ok: bool,
25740 }
25741 #[no_mangle]
25742 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
25743 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
25744         CResult_StrSecp256k1ErrorZ {
25745                 contents: CResult_StrSecp256k1ErrorZPtr {
25746                         result: Box::into_raw(Box::new(o)),
25747                 },
25748                 result_ok: true,
25749         }
25750 }
25751 #[no_mangle]
25752 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
25753 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
25754         CResult_StrSecp256k1ErrorZ {
25755                 contents: CResult_StrSecp256k1ErrorZPtr {
25756                         err: Box::into_raw(Box::new(e)),
25757                 },
25758                 result_ok: false,
25759         }
25760 }
25761 /// Checks if the given object is currently in the success state
25762 #[no_mangle]
25763 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
25764         o.result_ok
25765 }
25766 #[no_mangle]
25767 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
25768 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
25769 impl Drop for CResult_StrSecp256k1ErrorZ {
25770         fn drop(&mut self) {
25771                 if self.result_ok {
25772                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25773                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25774                         }
25775                 } else {
25776                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25777                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25778                         }
25779                 }
25780         }
25781 }
25782 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
25783         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
25784                 let contents = if o.result_ok {
25785                         let result = unsafe { o.contents.result };
25786                         unsafe { o.contents.result = core::ptr::null_mut() };
25787                         CResult_StrSecp256k1ErrorZPtr { result }
25788                 } else {
25789                         let err = unsafe { o.contents.err };
25790                         unsafe { o.contents.err = core::ptr::null_mut(); }
25791                         CResult_StrSecp256k1ErrorZPtr { err }
25792                 };
25793                 Self {
25794                         contents,
25795                         result_ok: o.result_ok,
25796                 }
25797         }
25798 }
25799 impl Clone for CResult_StrSecp256k1ErrorZ {
25800         fn clone(&self) -> Self {
25801                 if self.result_ok {
25802                         Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
25803                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
25804                         } }
25805                 } else {
25806                         Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
25807                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
25808                         } }
25809                 }
25810         }
25811 }
25812 #[no_mangle]
25813 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
25814 /// but with all dynamically-allocated buffers duplicated in new buffers.
25815 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
25816 #[repr(C)]
25817 /// A tuple of 3 elements. See the individual fields for the types contained.
25818 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25819         /// The element at position 0
25820         pub a: crate::c_types::ThirtyTwoBytes,
25821         /// The element at position 1
25822         pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
25823         /// The element at position 2
25824         pub c: crate::lightning::routing::router::RouteParameters,
25825 }
25826 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25827         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
25828                 Self {
25829                         a: tup.0,
25830                         b: tup.1,
25831                         c: tup.2,
25832                 }
25833         }
25834 }
25835 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25836         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
25837                 (self.a, self.b, self.c)
25838         }
25839 }
25840 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25841         fn clone(&self) -> Self {
25842                 Self {
25843                         a: Clone::clone(&self.a),
25844                         b: Clone::clone(&self.b),
25845                         c: Clone::clone(&self.c),
25846                 }
25847         }
25848 }
25849 #[no_mangle]
25850 /// Creates a new tuple which has the same data as `orig`
25851 /// but with all dynamically-allocated buffers duplicated in new buffers.
25852 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
25853 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
25854 #[no_mangle]
25855 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
25856         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
25857 }
25858
25859 #[no_mangle]
25860 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
25861 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
25862 #[repr(C)]
25863 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
25864 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25865         /// A pointer to the contents in the success state.
25866         /// Reading from this pointer when `result_ok` is not set is undefined.
25867         pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
25868         /// Note that this value is always NULL, as there are no contents in the Err variant
25869         pub err: *mut core::ffi::c_void,
25870 }
25871 #[repr(C)]
25872 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
25873 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
25874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25875 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25876         /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
25877         /// `err` or `result` depending on the state of `result_ok`.
25878         pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
25879         /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
25880         pub result_ok: bool,
25881 }
25882 #[no_mangle]
25883 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
25884 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25885         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25886                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25887                         result: Box::into_raw(Box::new(o)),
25888                 },
25889                 result_ok: true,
25890         }
25891 }
25892 #[no_mangle]
25893 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
25894 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25895         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25896                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25897                         err: core::ptr::null_mut(),
25898                 },
25899                 result_ok: false,
25900         }
25901 }
25902 /// Checks if the given object is currently in the success state
25903 #[no_mangle]
25904 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
25905         o.result_ok
25906 }
25907 #[no_mangle]
25908 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
25909 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
25910 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25911         fn drop(&mut self) {
25912                 if self.result_ok {
25913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25915                         }
25916                 } else {
25917                 }
25918         }
25919 }
25920 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25921         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
25922                 let contents = if o.result_ok {
25923                         let result = unsafe { o.contents.result };
25924                         unsafe { o.contents.result = core::ptr::null_mut() };
25925                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
25926                 } else {
25927                         let _ = unsafe { Box::from_raw(o.contents.err) };
25928                         o.contents.err = core::ptr::null_mut();
25929                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
25930                 };
25931                 Self {
25932                         contents,
25933                         result_ok: o.result_ok,
25934                 }
25935         }
25936 }
25937 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
25938         fn clone(&self) -> Self {
25939                 if self.result_ok {
25940                         Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25941                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
25942                         } }
25943                 } else {
25944                         Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
25945                                 err: core::ptr::null_mut()
25946                         } }
25947                 }
25948         }
25949 }
25950 #[no_mangle]
25951 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
25952 /// but with all dynamically-allocated buffers duplicated in new buffers.
25953 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
25954 #[repr(C)]
25955 /// The contents of CResult_TxOutUtxoLookupErrorZ
25956 pub union CResult_TxOutUtxoLookupErrorZPtr {
25957         /// A pointer to the contents in the success state.
25958         /// Reading from this pointer when `result_ok` is not set is undefined.
25959         pub result: *mut crate::c_types::TxOut,
25960         /// A pointer to the contents in the error state.
25961         /// Reading from this pointer when `result_ok` is set is undefined.
25962         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
25963 }
25964 #[repr(C)]
25965 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
25966 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
25967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25968 pub struct CResult_TxOutUtxoLookupErrorZ {
25969         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
25970         /// `err` or `result` depending on the state of `result_ok`.
25971         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
25972         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
25973         pub result_ok: bool,
25974 }
25975 #[no_mangle]
25976 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
25977 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
25978         CResult_TxOutUtxoLookupErrorZ {
25979                 contents: CResult_TxOutUtxoLookupErrorZPtr {
25980                         result: Box::into_raw(Box::new(o)),
25981                 },
25982                 result_ok: true,
25983         }
25984 }
25985 #[no_mangle]
25986 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
25987 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
25988         CResult_TxOutUtxoLookupErrorZ {
25989                 contents: CResult_TxOutUtxoLookupErrorZPtr {
25990                         err: Box::into_raw(Box::new(e)),
25991                 },
25992                 result_ok: false,
25993         }
25994 }
25995 /// Checks if the given object is currently in the success state
25996 #[no_mangle]
25997 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
25998         o.result_ok
25999 }
26000 #[no_mangle]
26001 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
26002 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
26003 impl Drop for CResult_TxOutUtxoLookupErrorZ {
26004         fn drop(&mut self) {
26005                 if self.result_ok {
26006                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26007                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26008                         }
26009                 } else {
26010                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26011                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26012                         }
26013                 }
26014         }
26015 }
26016 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
26017         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
26018                 let contents = if o.result_ok {
26019                         let result = unsafe { o.contents.result };
26020                         unsafe { o.contents.result = core::ptr::null_mut() };
26021                         CResult_TxOutUtxoLookupErrorZPtr { result }
26022                 } else {
26023                         let err = unsafe { o.contents.err };
26024                         unsafe { o.contents.err = core::ptr::null_mut(); }
26025                         CResult_TxOutUtxoLookupErrorZPtr { err }
26026                 };
26027                 Self {
26028                         contents,
26029                         result_ok: o.result_ok,
26030                 }
26031         }
26032 }
26033 impl Clone for CResult_TxOutUtxoLookupErrorZ {
26034         fn clone(&self) -> Self {
26035                 if self.result_ok {
26036                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
26037                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
26038                         } }
26039                 } else {
26040                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
26041                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
26042                         } }
26043                 }
26044         }
26045 }
26046 #[no_mangle]
26047 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
26048 /// but with all dynamically-allocated buffers duplicated in new buffers.
26049 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
26050 #[repr(C)]
26051 /// A tuple of 3 elements. See the individual fields for the types contained.
26052 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26053         /// The element at position 0
26054         pub a: crate::c_types::PublicKey,
26055         /// The element at position 1
26056         pub b: crate::lightning::ln::msgs::OnionMessage,
26057         /// The element at position 2
26058         pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
26059 }
26060 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26061         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
26062                 Self {
26063                         a: tup.0,
26064                         b: tup.1,
26065                         c: tup.2,
26066                 }
26067         }
26068 }
26069 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26070         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ) {
26071                 (self.a, self.b, self.c)
26072         }
26073 }
26074 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26075         fn clone(&self) -> Self {
26076                 Self {
26077                         a: Clone::clone(&self.a),
26078                         b: Clone::clone(&self.b),
26079                         c: Clone::clone(&self.c),
26080                 }
26081         }
26082 }
26083 #[no_mangle]
26084 /// Creates a new tuple which has the same data as `orig`
26085 /// but with all dynamically-allocated buffers duplicated in new buffers.
26086 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
26087 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
26088 #[no_mangle]
26089 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage, c: crate::c_types::derived::COption_CVec_SocketAddressZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26090         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
26091 }
26092
26093 #[no_mangle]
26094 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
26095 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
26096 #[repr(C)]
26097 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
26098 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26099         /// A pointer to the contents in the success state.
26100         /// Reading from this pointer when `result_ok` is not set is undefined.
26101         pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
26102         /// A pointer to the contents in the error state.
26103         /// Reading from this pointer when `result_ok` is set is undefined.
26104         pub err: *mut crate::lightning::onion_message::messenger::SendError,
26105 }
26106 #[repr(C)]
26107 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
26108 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
26109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26110 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26111         /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
26112         /// `err` or `result` depending on the state of `result_ok`.
26113         pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
26114         /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
26115         pub result_ok: bool,
26116 }
26117 #[no_mangle]
26118 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
26119 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26120         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26121                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26122                         result: Box::into_raw(Box::new(o)),
26123                 },
26124                 result_ok: true,
26125         }
26126 }
26127 #[no_mangle]
26128 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
26129 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26130         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26131                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26132                         err: Box::into_raw(Box::new(e)),
26133                 },
26134                 result_ok: false,
26135         }
26136 }
26137 /// Checks if the given object is currently in the success state
26138 #[no_mangle]
26139 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
26140         o.result_ok
26141 }
26142 #[no_mangle]
26143 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
26144 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
26145 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26146         fn drop(&mut self) {
26147                 if self.result_ok {
26148                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26149                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26150                         }
26151                 } else {
26152                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26153                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26154                         }
26155                 }
26156         }
26157 }
26158 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>> for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26159         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
26160                 let contents = if o.result_ok {
26161                         let result = unsafe { o.contents.result };
26162                         unsafe { o.contents.result = core::ptr::null_mut() };
26163                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
26164                 } else {
26165                         let err = unsafe { o.contents.err };
26166                         unsafe { o.contents.err = core::ptr::null_mut(); }
26167                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
26168                 };
26169                 Self {
26170                         contents,
26171                         result_ok: o.result_ok,
26172                 }
26173         }
26174 }
26175 impl Clone for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26176         fn clone(&self) -> Self {
26177                 if self.result_ok {
26178                         Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26179                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ>::clone(unsafe { &*self.contents.result })))
26180                         } }
26181                 } else {
26182                         Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26183                                 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26184                         } }
26185                 }
26186         }
26187 }
26188 #[no_mangle]
26189 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
26190 /// but with all dynamically-allocated buffers duplicated in new buffers.
26191 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) }
26192 #[repr(C)]
26193 /// The contents of CResult_PeeledOnionNoneZ
26194 pub union CResult_PeeledOnionNoneZPtr {
26195         /// A pointer to the contents in the success state.
26196         /// Reading from this pointer when `result_ok` is not set is undefined.
26197         pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
26198         /// Note that this value is always NULL, as there are no contents in the Err variant
26199         pub err: *mut core::ffi::c_void,
26200 }
26201 #[repr(C)]
26202 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
26203 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
26204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26205 pub struct CResult_PeeledOnionNoneZ {
26206         /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
26207         /// `err` or `result` depending on the state of `result_ok`.
26208         pub contents: CResult_PeeledOnionNoneZPtr,
26209         /// Whether this CResult_PeeledOnionNoneZ represents a success state.
26210         pub result_ok: bool,
26211 }
26212 #[no_mangle]
26213 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
26214 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
26215         CResult_PeeledOnionNoneZ {
26216                 contents: CResult_PeeledOnionNoneZPtr {
26217                         result: Box::into_raw(Box::new(o)),
26218                 },
26219                 result_ok: true,
26220         }
26221 }
26222 #[no_mangle]
26223 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
26224 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
26225         CResult_PeeledOnionNoneZ {
26226                 contents: CResult_PeeledOnionNoneZPtr {
26227                         err: core::ptr::null_mut(),
26228                 },
26229                 result_ok: false,
26230         }
26231 }
26232 /// Checks if the given object is currently in the success state
26233 #[no_mangle]
26234 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
26235         o.result_ok
26236 }
26237 #[no_mangle]
26238 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
26239 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
26240 impl Drop for CResult_PeeledOnionNoneZ {
26241         fn drop(&mut self) {
26242                 if self.result_ok {
26243                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26244                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26245                         }
26246                 } else {
26247                 }
26248         }
26249 }
26250 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
26251         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
26252                 let contents = if o.result_ok {
26253                         let result = unsafe { o.contents.result };
26254                         unsafe { o.contents.result = core::ptr::null_mut() };
26255                         CResult_PeeledOnionNoneZPtr { result }
26256                 } else {
26257                         let _ = unsafe { Box::from_raw(o.contents.err) };
26258                         o.contents.err = core::ptr::null_mut();
26259                         CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
26260                 };
26261                 Self {
26262                         contents,
26263                         result_ok: o.result_ok,
26264                 }
26265         }
26266 }
26267 impl Clone for CResult_PeeledOnionNoneZ {
26268         fn clone(&self) -> Self {
26269                 if self.result_ok {
26270                         Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr {
26271                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::PeeledOnion>::clone(unsafe { &*self.contents.result })))
26272                         } }
26273                 } else {
26274                         Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr {
26275                                 err: core::ptr::null_mut()
26276                         } }
26277                 }
26278         }
26279 }
26280 #[no_mangle]
26281 /// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
26282 /// but with all dynamically-allocated buffers duplicated in new buffers.
26283 pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) }
26284 #[repr(C)]
26285 /// The contents of CResult_SendSuccessSendErrorZ
26286 pub union CResult_SendSuccessSendErrorZPtr {
26287         /// A pointer to the contents in the success state.
26288         /// Reading from this pointer when `result_ok` is not set is undefined.
26289         pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
26290         /// A pointer to the contents in the error state.
26291         /// Reading from this pointer when `result_ok` is set is undefined.
26292         pub err: *mut crate::lightning::onion_message::messenger::SendError,
26293 }
26294 #[repr(C)]
26295 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
26296 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
26297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26298 pub struct CResult_SendSuccessSendErrorZ {
26299         /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
26300         /// `err` or `result` depending on the state of `result_ok`.
26301         pub contents: CResult_SendSuccessSendErrorZPtr,
26302         /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
26303         pub result_ok: bool,
26304 }
26305 #[no_mangle]
26306 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
26307 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
26308         CResult_SendSuccessSendErrorZ {
26309                 contents: CResult_SendSuccessSendErrorZPtr {
26310                         result: Box::into_raw(Box::new(o)),
26311                 },
26312                 result_ok: true,
26313         }
26314 }
26315 #[no_mangle]
26316 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
26317 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
26318         CResult_SendSuccessSendErrorZ {
26319                 contents: CResult_SendSuccessSendErrorZPtr {
26320                         err: Box::into_raw(Box::new(e)),
26321                 },
26322                 result_ok: false,
26323         }
26324 }
26325 /// Checks if the given object is currently in the success state
26326 #[no_mangle]
26327 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
26328         o.result_ok
26329 }
26330 #[no_mangle]
26331 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
26332 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
26333 impl Drop for CResult_SendSuccessSendErrorZ {
26334         fn drop(&mut self) {
26335                 if self.result_ok {
26336                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26337                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26338                         }
26339                 } else {
26340                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26341                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26342                         }
26343                 }
26344         }
26345 }
26346 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
26347         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
26348                 let contents = if o.result_ok {
26349                         let result = unsafe { o.contents.result };
26350                         unsafe { o.contents.result = core::ptr::null_mut() };
26351                         CResult_SendSuccessSendErrorZPtr { result }
26352                 } else {
26353                         let err = unsafe { o.contents.err };
26354                         unsafe { o.contents.err = core::ptr::null_mut(); }
26355                         CResult_SendSuccessSendErrorZPtr { err }
26356                 };
26357                 Self {
26358                         contents,
26359                         result_ok: o.result_ok,
26360                 }
26361         }
26362 }
26363 impl Clone for CResult_SendSuccessSendErrorZ {
26364         fn clone(&self) -> Self {
26365                 if self.result_ok {
26366                         Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr {
26367                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendSuccess>::clone(unsafe { &*self.contents.result })))
26368                         } }
26369                 } else {
26370                         Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr {
26371                                 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26372                         } }
26373                 }
26374         }
26375 }
26376 #[no_mangle]
26377 /// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
26378 /// but with all dynamically-allocated buffers duplicated in new buffers.
26379 pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) }
26380 #[repr(C)]
26381 /// The contents of CResult_BlindedPathNoneZ
26382 pub union CResult_BlindedPathNoneZPtr {
26383         /// A pointer to the contents in the success state.
26384         /// Reading from this pointer when `result_ok` is not set is undefined.
26385         pub result: *mut crate::lightning::blinded_path::BlindedPath,
26386         /// Note that this value is always NULL, as there are no contents in the Err variant
26387         pub err: *mut core::ffi::c_void,
26388 }
26389 #[repr(C)]
26390 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
26391 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
26392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26393 pub struct CResult_BlindedPathNoneZ {
26394         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
26395         /// `err` or `result` depending on the state of `result_ok`.
26396         pub contents: CResult_BlindedPathNoneZPtr,
26397         /// Whether this CResult_BlindedPathNoneZ represents a success state.
26398         pub result_ok: bool,
26399 }
26400 #[no_mangle]
26401 /// Creates a new CResult_BlindedPathNoneZ in the success state.
26402 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
26403         CResult_BlindedPathNoneZ {
26404                 contents: CResult_BlindedPathNoneZPtr {
26405                         result: Box::into_raw(Box::new(o)),
26406                 },
26407                 result_ok: true,
26408         }
26409 }
26410 #[no_mangle]
26411 /// Creates a new CResult_BlindedPathNoneZ in the error state.
26412 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
26413         CResult_BlindedPathNoneZ {
26414                 contents: CResult_BlindedPathNoneZPtr {
26415                         err: core::ptr::null_mut(),
26416                 },
26417                 result_ok: false,
26418         }
26419 }
26420 /// Checks if the given object is currently in the success state
26421 #[no_mangle]
26422 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
26423         o.result_ok
26424 }
26425 #[no_mangle]
26426 /// Frees any resources used by the CResult_BlindedPathNoneZ.
26427 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
26428 impl Drop for CResult_BlindedPathNoneZ {
26429         fn drop(&mut self) {
26430                 if self.result_ok {
26431                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26432                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26433                         }
26434                 } else {
26435                 }
26436         }
26437 }
26438 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
26439         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
26440                 let contents = if o.result_ok {
26441                         let result = unsafe { o.contents.result };
26442                         unsafe { o.contents.result = core::ptr::null_mut() };
26443                         CResult_BlindedPathNoneZPtr { result }
26444                 } else {
26445                         let _ = unsafe { Box::from_raw(o.contents.err) };
26446                         o.contents.err = core::ptr::null_mut();
26447                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
26448                 };
26449                 Self {
26450                         contents,
26451                         result_ok: o.result_ok,
26452                 }
26453         }
26454 }
26455 impl Clone for CResult_BlindedPathNoneZ {
26456         fn clone(&self) -> Self {
26457                 if self.result_ok {
26458                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
26459                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26460                         } }
26461                 } else {
26462                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
26463                                 err: core::ptr::null_mut()
26464                         } }
26465                 }
26466         }
26467 }
26468 #[no_mangle]
26469 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
26470 /// but with all dynamically-allocated buffers duplicated in new buffers.
26471 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
26472 #[repr(C)]
26473 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
26474 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26475         /// A pointer to the contents in the success state.
26476         /// Reading from this pointer when `result_ok` is not set is undefined.
26477         pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
26478         /// Note that this value is always NULL, as there are no contents in the Err variant
26479         pub err: *mut core::ffi::c_void,
26480 }
26481 #[repr(C)]
26482 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
26483 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
26484 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26485 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26486         /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
26487         /// `err` or `result` depending on the state of `result_ok`.
26488         pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
26489         /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
26490         pub result_ok: bool,
26491 }
26492 #[no_mangle]
26493 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
26494 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26495         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26496                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26497                         result: Box::into_raw(Box::new(o)),
26498                 },
26499                 result_ok: true,
26500         }
26501 }
26502 #[no_mangle]
26503 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
26504 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26505         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26506                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26507                         err: core::ptr::null_mut(),
26508                 },
26509                 result_ok: false,
26510         }
26511 }
26512 /// Checks if the given object is currently in the success state
26513 #[no_mangle]
26514 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
26515         o.result_ok
26516 }
26517 #[no_mangle]
26518 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
26519 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
26520 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26521         fn drop(&mut self) {
26522                 if self.result_ok {
26523                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26524                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26525                         }
26526                 } else {
26527                 }
26528         }
26529 }
26530 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26531         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
26532                 let contents = if o.result_ok {
26533                         let result = unsafe { o.contents.result };
26534                         unsafe { o.contents.result = core::ptr::null_mut() };
26535                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
26536                 } else {
26537                         let _ = unsafe { Box::from_raw(o.contents.err) };
26538                         o.contents.err = core::ptr::null_mut();
26539                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
26540                 };
26541                 Self {
26542                         contents,
26543                         result_ok: o.result_ok,
26544                 }
26545         }
26546 }
26547 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
26548         fn clone(&self) -> Self {
26549                 if self.result_ok {
26550                         Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26551                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
26552                         } }
26553                 } else {
26554                         Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
26555                                 err: core::ptr::null_mut()
26556                         } }
26557                 }
26558         }
26559 }
26560 #[no_mangle]
26561 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
26562 /// but with all dynamically-allocated buffers duplicated in new buffers.
26563 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
26564 #[repr(C)]
26565 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
26566 /// This corresponds to std::vector in C++
26567 pub struct CVec_ForwardNodeZ {
26568         /// The elements in the array.
26569         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
26570         pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
26571         /// The number of elements pointed to by `data`.
26572         pub datalen: usize
26573 }
26574 impl CVec_ForwardNodeZ {
26575         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
26576                 if self.datalen == 0 { return Vec::new(); }
26577                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
26578                 self.data = core::ptr::null_mut();
26579                 self.datalen = 0;
26580                 ret
26581         }
26582         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
26583                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
26584         }
26585 }
26586 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
26587         fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
26588                 let datalen = v.len();
26589                 let data = Box::into_raw(v.into_boxed_slice());
26590                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
26591         }
26592 }
26593 #[no_mangle]
26594 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
26595 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
26596 impl Drop for CVec_ForwardNodeZ {
26597         fn drop(&mut self) {
26598                 if self.datalen == 0 { return; }
26599                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
26600         }
26601 }
26602 impl Clone for CVec_ForwardNodeZ {
26603         fn clone(&self) -> Self {
26604                 let mut res = Vec::new();
26605                 if self.datalen == 0 { return Self::from(res); }
26606                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
26607                 Self::from(res)
26608         }
26609 }
26610 #[repr(C)]
26611 /// The contents of CResult_BlindedPathDecodeErrorZ
26612 pub union CResult_BlindedPathDecodeErrorZPtr {
26613         /// A pointer to the contents in the success state.
26614         /// Reading from this pointer when `result_ok` is not set is undefined.
26615         pub result: *mut crate::lightning::blinded_path::BlindedPath,
26616         /// A pointer to the contents in the error state.
26617         /// Reading from this pointer when `result_ok` is set is undefined.
26618         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26619 }
26620 #[repr(C)]
26621 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
26622 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
26623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26624 pub struct CResult_BlindedPathDecodeErrorZ {
26625         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
26626         /// `err` or `result` depending on the state of `result_ok`.
26627         pub contents: CResult_BlindedPathDecodeErrorZPtr,
26628         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
26629         pub result_ok: bool,
26630 }
26631 #[no_mangle]
26632 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
26633 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
26634         CResult_BlindedPathDecodeErrorZ {
26635                 contents: CResult_BlindedPathDecodeErrorZPtr {
26636                         result: Box::into_raw(Box::new(o)),
26637                 },
26638                 result_ok: true,
26639         }
26640 }
26641 #[no_mangle]
26642 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
26643 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
26644         CResult_BlindedPathDecodeErrorZ {
26645                 contents: CResult_BlindedPathDecodeErrorZPtr {
26646                         err: Box::into_raw(Box::new(e)),
26647                 },
26648                 result_ok: false,
26649         }
26650 }
26651 /// Checks if the given object is currently in the success state
26652 #[no_mangle]
26653 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
26654         o.result_ok
26655 }
26656 #[no_mangle]
26657 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
26658 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
26659 impl Drop for CResult_BlindedPathDecodeErrorZ {
26660         fn drop(&mut self) {
26661                 if self.result_ok {
26662                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26663                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26664                         }
26665                 } else {
26666                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26667                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26668                         }
26669                 }
26670         }
26671 }
26672 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
26673         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
26674                 let contents = if o.result_ok {
26675                         let result = unsafe { o.contents.result };
26676                         unsafe { o.contents.result = core::ptr::null_mut() };
26677                         CResult_BlindedPathDecodeErrorZPtr { result }
26678                 } else {
26679                         let err = unsafe { o.contents.err };
26680                         unsafe { o.contents.err = core::ptr::null_mut(); }
26681                         CResult_BlindedPathDecodeErrorZPtr { err }
26682                 };
26683                 Self {
26684                         contents,
26685                         result_ok: o.result_ok,
26686                 }
26687         }
26688 }
26689 impl Clone for CResult_BlindedPathDecodeErrorZ {
26690         fn clone(&self) -> Self {
26691                 if self.result_ok {
26692                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
26693                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
26694                         } }
26695                 } else {
26696                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
26697                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26698                         } }
26699                 }
26700         }
26701 }
26702 #[no_mangle]
26703 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
26704 /// but with all dynamically-allocated buffers duplicated in new buffers.
26705 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
26706 #[repr(C)]
26707 /// The contents of CResult_BlindedHopDecodeErrorZ
26708 pub union CResult_BlindedHopDecodeErrorZPtr {
26709         /// A pointer to the contents in the success state.
26710         /// Reading from this pointer when `result_ok` is not set is undefined.
26711         pub result: *mut crate::lightning::blinded_path::BlindedHop,
26712         /// A pointer to the contents in the error state.
26713         /// Reading from this pointer when `result_ok` is set is undefined.
26714         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26715 }
26716 #[repr(C)]
26717 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
26718 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
26719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26720 pub struct CResult_BlindedHopDecodeErrorZ {
26721         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
26722         /// `err` or `result` depending on the state of `result_ok`.
26723         pub contents: CResult_BlindedHopDecodeErrorZPtr,
26724         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
26725         pub result_ok: bool,
26726 }
26727 #[no_mangle]
26728 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
26729 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
26730         CResult_BlindedHopDecodeErrorZ {
26731                 contents: CResult_BlindedHopDecodeErrorZPtr {
26732                         result: Box::into_raw(Box::new(o)),
26733                 },
26734                 result_ok: true,
26735         }
26736 }
26737 #[no_mangle]
26738 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
26739 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
26740         CResult_BlindedHopDecodeErrorZ {
26741                 contents: CResult_BlindedHopDecodeErrorZPtr {
26742                         err: Box::into_raw(Box::new(e)),
26743                 },
26744                 result_ok: false,
26745         }
26746 }
26747 /// Checks if the given object is currently in the success state
26748 #[no_mangle]
26749 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
26750         o.result_ok
26751 }
26752 #[no_mangle]
26753 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
26754 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
26755 impl Drop for CResult_BlindedHopDecodeErrorZ {
26756         fn drop(&mut self) {
26757                 if self.result_ok {
26758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26760                         }
26761                 } else {
26762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26764                         }
26765                 }
26766         }
26767 }
26768 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
26769         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
26770                 let contents = if o.result_ok {
26771                         let result = unsafe { o.contents.result };
26772                         unsafe { o.contents.result = core::ptr::null_mut() };
26773                         CResult_BlindedHopDecodeErrorZPtr { result }
26774                 } else {
26775                         let err = unsafe { o.contents.err };
26776                         unsafe { o.contents.err = core::ptr::null_mut(); }
26777                         CResult_BlindedHopDecodeErrorZPtr { err }
26778                 };
26779                 Self {
26780                         contents,
26781                         result_ok: o.result_ok,
26782                 }
26783         }
26784 }
26785 impl Clone for CResult_BlindedHopDecodeErrorZ {
26786         fn clone(&self) -> Self {
26787                 if self.result_ok {
26788                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
26789                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
26790                         } }
26791                 } else {
26792                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
26793                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26794                         } }
26795                 }
26796         }
26797 }
26798 #[no_mangle]
26799 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
26800 /// but with all dynamically-allocated buffers duplicated in new buffers.
26801 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
26802 #[repr(C)]
26803 /// The contents of CResult_InvoiceErrorDecodeErrorZ
26804 pub union CResult_InvoiceErrorDecodeErrorZPtr {
26805         /// A pointer to the contents in the success state.
26806         /// Reading from this pointer when `result_ok` is not set is undefined.
26807         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
26808         /// A pointer to the contents in the error state.
26809         /// Reading from this pointer when `result_ok` is set is undefined.
26810         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26811 }
26812 #[repr(C)]
26813 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
26814 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
26815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26816 pub struct CResult_InvoiceErrorDecodeErrorZ {
26817         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
26818         /// `err` or `result` depending on the state of `result_ok`.
26819         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
26820         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
26821         pub result_ok: bool,
26822 }
26823 #[no_mangle]
26824 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
26825 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
26826         CResult_InvoiceErrorDecodeErrorZ {
26827                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26828                         result: Box::into_raw(Box::new(o)),
26829                 },
26830                 result_ok: true,
26831         }
26832 }
26833 #[no_mangle]
26834 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
26835 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
26836         CResult_InvoiceErrorDecodeErrorZ {
26837                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
26838                         err: Box::into_raw(Box::new(e)),
26839                 },
26840                 result_ok: false,
26841         }
26842 }
26843 /// Checks if the given object is currently in the success state
26844 #[no_mangle]
26845 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
26846         o.result_ok
26847 }
26848 #[no_mangle]
26849 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
26850 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
26851 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
26852         fn drop(&mut self) {
26853                 if self.result_ok {
26854                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26855                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26856                         }
26857                 } else {
26858                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26859                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26860                         }
26861                 }
26862         }
26863 }
26864 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
26865         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
26866                 let contents = if o.result_ok {
26867                         let result = unsafe { o.contents.result };
26868                         unsafe { o.contents.result = core::ptr::null_mut() };
26869                         CResult_InvoiceErrorDecodeErrorZPtr { result }
26870                 } else {
26871                         let err = unsafe { o.contents.err };
26872                         unsafe { o.contents.err = core::ptr::null_mut(); }
26873                         CResult_InvoiceErrorDecodeErrorZPtr { err }
26874                 };
26875                 Self {
26876                         contents,
26877                         result_ok: o.result_ok,
26878                 }
26879         }
26880 }
26881 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
26882         fn clone(&self) -> Self {
26883                 if self.result_ok {
26884                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26885                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
26886                         } }
26887                 } else {
26888                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
26889                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26890                         } }
26891                 }
26892         }
26893 }
26894 #[no_mangle]
26895 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
26896 /// but with all dynamically-allocated buffers duplicated in new buffers.
26897 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
26898 #[repr(C)]
26899 /// The contents of CResult_TrackedSpendableOutputDecodeErrorZ
26900 pub union CResult_TrackedSpendableOutputDecodeErrorZPtr {
26901         /// A pointer to the contents in the success state.
26902         /// Reading from this pointer when `result_ok` is not set is undefined.
26903         pub result: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
26904         /// A pointer to the contents in the error state.
26905         /// Reading from this pointer when `result_ok` is set is undefined.
26906         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26907 }
26908 #[repr(C)]
26909 /// A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
26910 /// containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
26911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26912 pub struct CResult_TrackedSpendableOutputDecodeErrorZ {
26913         /// The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
26914         /// `err` or `result` depending on the state of `result_ok`.
26915         pub contents: CResult_TrackedSpendableOutputDecodeErrorZPtr,
26916         /// Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
26917         pub result_ok: bool,
26918 }
26919 #[no_mangle]
26920 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
26921 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_ok(o: crate::lightning::util::sweep::TrackedSpendableOutput) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26922         CResult_TrackedSpendableOutputDecodeErrorZ {
26923                 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26924                         result: Box::into_raw(Box::new(o)),
26925                 },
26926                 result_ok: true,
26927         }
26928 }
26929 #[no_mangle]
26930 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
26931 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrackedSpendableOutputDecodeErrorZ {
26932         CResult_TrackedSpendableOutputDecodeErrorZ {
26933                 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26934                         err: Box::into_raw(Box::new(e)),
26935                 },
26936                 result_ok: false,
26937         }
26938 }
26939 /// Checks if the given object is currently in the success state
26940 #[no_mangle]
26941 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o: &CResult_TrackedSpendableOutputDecodeErrorZ) -> bool {
26942         o.result_ok
26943 }
26944 #[no_mangle]
26945 /// Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
26946 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_free(_res: CResult_TrackedSpendableOutputDecodeErrorZ) { }
26947 impl Drop for CResult_TrackedSpendableOutputDecodeErrorZ {
26948         fn drop(&mut self) {
26949                 if self.result_ok {
26950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26952                         }
26953                 } else {
26954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26956                         }
26957                 }
26958         }
26959 }
26960 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TrackedSpendableOutputDecodeErrorZ {
26961         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
26962                 let contents = if o.result_ok {
26963                         let result = unsafe { o.contents.result };
26964                         unsafe { o.contents.result = core::ptr::null_mut() };
26965                         CResult_TrackedSpendableOutputDecodeErrorZPtr { result }
26966                 } else {
26967                         let err = unsafe { o.contents.err };
26968                         unsafe { o.contents.err = core::ptr::null_mut(); }
26969                         CResult_TrackedSpendableOutputDecodeErrorZPtr { err }
26970                 };
26971                 Self {
26972                         contents,
26973                         result_ok: o.result_ok,
26974                 }
26975         }
26976 }
26977 impl Clone for CResult_TrackedSpendableOutputDecodeErrorZ {
26978         fn clone(&self) -> Self {
26979                 if self.result_ok {
26980                         Self { result_ok: true, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26981                                 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::TrackedSpendableOutput>::clone(unsafe { &*self.contents.result })))
26982                         } }
26983                 } else {
26984                         Self { result_ok: false, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
26985                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26986                         } }
26987                 }
26988         }
26989 }
26990 #[no_mangle]
26991 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
26992 /// but with all dynamically-allocated buffers duplicated in new buffers.
26993 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig: &CResult_TrackedSpendableOutputDecodeErrorZ) -> CResult_TrackedSpendableOutputDecodeErrorZ { Clone::clone(&orig) }
26994 #[repr(C)]
26995 /// The contents of CResult_OutputSpendStatusDecodeErrorZ
26996 pub union CResult_OutputSpendStatusDecodeErrorZPtr {
26997         /// A pointer to the contents in the success state.
26998         /// Reading from this pointer when `result_ok` is not set is undefined.
26999         pub result: *mut crate::lightning::util::sweep::OutputSpendStatus,
27000         /// A pointer to the contents in the error state.
27001         /// Reading from this pointer when `result_ok` is set is undefined.
27002         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27003 }
27004 #[repr(C)]
27005 /// A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
27006 /// containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
27007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27008 pub struct CResult_OutputSpendStatusDecodeErrorZ {
27009         /// The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
27010         /// `err` or `result` depending on the state of `result_ok`.
27011         pub contents: CResult_OutputSpendStatusDecodeErrorZPtr,
27012         /// Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
27013         pub result_ok: bool,
27014 }
27015 #[no_mangle]
27016 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
27017 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSpendStatus) -> CResult_OutputSpendStatusDecodeErrorZ {
27018         CResult_OutputSpendStatusDecodeErrorZ {
27019                 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27020                         result: Box::into_raw(Box::new(o)),
27021                 },
27022                 result_ok: true,
27023         }
27024 }
27025 #[no_mangle]
27026 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
27027 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSpendStatusDecodeErrorZ {
27028         CResult_OutputSpendStatusDecodeErrorZ {
27029                 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27030                         err: Box::into_raw(Box::new(e)),
27031                 },
27032                 result_ok: false,
27033         }
27034 }
27035 /// Checks if the given object is currently in the success state
27036 #[no_mangle]
27037 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_is_ok(o: &CResult_OutputSpendStatusDecodeErrorZ) -> bool {
27038         o.result_ok
27039 }
27040 #[no_mangle]
27041 /// Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
27042 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_free(_res: CResult_OutputSpendStatusDecodeErrorZ) { }
27043 impl Drop for CResult_OutputSpendStatusDecodeErrorZ {
27044         fn drop(&mut self) {
27045                 if self.result_ok {
27046                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27047                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27048                         }
27049                 } else {
27050                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27051                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27052                         }
27053                 }
27054         }
27055 }
27056 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSpendStatusDecodeErrorZ {
27057         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>) -> Self {
27058                 let contents = if o.result_ok {
27059                         let result = unsafe { o.contents.result };
27060                         unsafe { o.contents.result = core::ptr::null_mut() };
27061                         CResult_OutputSpendStatusDecodeErrorZPtr { result }
27062                 } else {
27063                         let err = unsafe { o.contents.err };
27064                         unsafe { o.contents.err = core::ptr::null_mut(); }
27065                         CResult_OutputSpendStatusDecodeErrorZPtr { err }
27066                 };
27067                 Self {
27068                         contents,
27069                         result_ok: o.result_ok,
27070                 }
27071         }
27072 }
27073 impl Clone for CResult_OutputSpendStatusDecodeErrorZ {
27074         fn clone(&self) -> Self {
27075                 if self.result_ok {
27076                         Self { result_ok: true, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27077                                 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::OutputSpendStatus>::clone(unsafe { &*self.contents.result })))
27078                         } }
27079                 } else {
27080                         Self { result_ok: false, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27081                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27082                         } }
27083                 }
27084         }
27085 }
27086 #[no_mangle]
27087 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
27088 /// but with all dynamically-allocated buffers duplicated in new buffers.
27089 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_clone(orig: &CResult_OutputSpendStatusDecodeErrorZ) -> CResult_OutputSpendStatusDecodeErrorZ { Clone::clone(&orig) }
27090 #[repr(C)]
27091 /// An enum which can either contain a crate::lightning::chain::Filter or not
27092 pub enum COption_FilterZ {
27093         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
27094         Some(crate::lightning::chain::Filter),
27095         /// When we're in this state, this COption_FilterZ contains nothing
27096         None
27097 }
27098 impl COption_FilterZ {
27099         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
27100                 if let Self::None = self { false } else { true }
27101         }
27102         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
27103                 !self.is_some()
27104         }
27105         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
27106                 if let Self::Some(v) = self { v } else { unreachable!() }
27107         }
27108 }
27109 #[no_mangle]
27110 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
27111 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
27112         COption_FilterZ::Some(o)
27113 }
27114 #[no_mangle]
27115 /// Constructs a new COption_FilterZ containing nothing
27116 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
27117         COption_FilterZ::None
27118 }
27119 #[no_mangle]
27120 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
27121 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
27122 #[repr(C)]
27123 /// A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
27124 /// This corresponds to std::vector in C++
27125 pub struct CVec_TrackedSpendableOutputZ {
27126         /// The elements in the array.
27127         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27128         pub data: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
27129         /// The number of elements pointed to by `data`.
27130         pub datalen: usize
27131 }
27132 impl CVec_TrackedSpendableOutputZ {
27133         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::sweep::TrackedSpendableOutput> {
27134                 if self.datalen == 0 { return Vec::new(); }
27135                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27136                 self.data = core::ptr::null_mut();
27137                 self.datalen = 0;
27138                 ret
27139         }
27140         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::sweep::TrackedSpendableOutput] {
27141                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27142         }
27143 }
27144 impl From<Vec<crate::lightning::util::sweep::TrackedSpendableOutput>> for CVec_TrackedSpendableOutputZ {
27145         fn from(v: Vec<crate::lightning::util::sweep::TrackedSpendableOutput>) -> Self {
27146                 let datalen = v.len();
27147                 let data = Box::into_raw(v.into_boxed_slice());
27148                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27149         }
27150 }
27151 #[no_mangle]
27152 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27153 pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableOutputZ) { }
27154 impl Drop for CVec_TrackedSpendableOutputZ {
27155         fn drop(&mut self) {
27156                 if self.datalen == 0 { return; }
27157                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27158         }
27159 }
27160 impl Clone for CVec_TrackedSpendableOutputZ {
27161         fn clone(&self) -> Self {
27162                 let mut res = Vec::new();
27163                 if self.datalen == 0 { return Self::from(res); }
27164                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27165                 Self::from(res)
27166         }
27167 }
27168 #[repr(C)]
27169 /// The contents of CResult_OutputSweeperDecodeErrorZ
27170 pub union CResult_OutputSweeperDecodeErrorZPtr {
27171         /// A pointer to the contents in the success state.
27172         /// Reading from this pointer when `result_ok` is not set is undefined.
27173         pub result: *mut crate::lightning::util::sweep::OutputSweeper,
27174         /// A pointer to the contents in the error state.
27175         /// Reading from this pointer when `result_ok` is set is undefined.
27176         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27177 }
27178 #[repr(C)]
27179 /// A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
27180 /// containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
27181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27182 pub struct CResult_OutputSweeperDecodeErrorZ {
27183         /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
27184         /// `err` or `result` depending on the state of `result_ok`.
27185         pub contents: CResult_OutputSweeperDecodeErrorZPtr,
27186         /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
27187         pub result_ok: bool,
27188 }
27189 #[no_mangle]
27190 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
27191 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ {
27192         CResult_OutputSweeperDecodeErrorZ {
27193                 contents: CResult_OutputSweeperDecodeErrorZPtr {
27194                         result: Box::into_raw(Box::new(o)),
27195                 },
27196                 result_ok: true,
27197         }
27198 }
27199 #[no_mangle]
27200 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
27201 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ {
27202         CResult_OutputSweeperDecodeErrorZ {
27203                 contents: CResult_OutputSweeperDecodeErrorZPtr {
27204                         err: Box::into_raw(Box::new(e)),
27205                 },
27206                 result_ok: false,
27207         }
27208 }
27209 /// Checks if the given object is currently in the success state
27210 #[no_mangle]
27211 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool {
27212         o.result_ok
27213 }
27214 #[no_mangle]
27215 /// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
27216 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { }
27217 impl Drop for CResult_OutputSweeperDecodeErrorZ {
27218         fn drop(&mut self) {
27219                 if self.result_ok {
27220                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27221                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27222                         }
27223                 } else {
27224                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27225                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27226                         }
27227                 }
27228         }
27229 }
27230 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSweeperDecodeErrorZ {
27231         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>) -> Self {
27232                 let contents = if o.result_ok {
27233                         let result = unsafe { o.contents.result };
27234                         unsafe { o.contents.result = core::ptr::null_mut() };
27235                         CResult_OutputSweeperDecodeErrorZPtr { result }
27236                 } else {
27237                         let err = unsafe { o.contents.err };
27238                         unsafe { o.contents.err = core::ptr::null_mut(); }
27239                         CResult_OutputSweeperDecodeErrorZPtr { err }
27240                 };
27241                 Self {
27242                         contents,
27243                         result_ok: o.result_ok,
27244                 }
27245         }
27246 }
27247 #[repr(C)]
27248 /// A tuple of 2 elements. See the individual fields for the types contained.
27249 pub struct C2Tuple_BestBlockOutputSweeperZ {
27250         /// The element at position 0
27251         pub a: crate::lightning::chain::BestBlock,
27252         /// The element at position 1
27253         pub b: crate::lightning::util::sweep::OutputSweeper,
27254 }
27255 impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ {
27256         fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self {
27257                 Self {
27258                         a: tup.0,
27259                         b: tup.1,
27260                 }
27261         }
27262 }
27263 impl C2Tuple_BestBlockOutputSweeperZ {
27264         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) {
27265                 (self.a, self.b)
27266         }
27267 }
27268 /// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
27269 #[no_mangle]
27270 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ {
27271         C2Tuple_BestBlockOutputSweeperZ { a, b, }
27272 }
27273
27274 #[no_mangle]
27275 /// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
27276 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { }
27277 #[repr(C)]
27278 /// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
27279 pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27280         /// A pointer to the contents in the success state.
27281         /// Reading from this pointer when `result_ok` is not set is undefined.
27282         pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ,
27283         /// A pointer to the contents in the error state.
27284         /// Reading from this pointer when `result_ok` is set is undefined.
27285         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27286 }
27287 #[repr(C)]
27288 /// A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
27289 /// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
27290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27291 pub struct CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27292         /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
27293         /// `err` or `result` depending on the state of `result_ok`.
27294         pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr,
27295         /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
27296         pub result_ok: bool,
27297 }
27298 #[no_mangle]
27299 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
27300 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27301         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27302                 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27303                         result: Box::into_raw(Box::new(o)),
27304                 },
27305                 result_ok: true,
27306         }
27307 }
27308 #[no_mangle]
27309 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
27310 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27311         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27312                 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
27313                         err: Box::into_raw(Box::new(e)),
27314                 },
27315                 result_ok: false,
27316         }
27317 }
27318 /// Checks if the given object is currently in the success state
27319 #[no_mangle]
27320 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool {
27321         o.result_ok
27322 }
27323 #[no_mangle]
27324 /// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
27325 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { }
27326 impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27327         fn drop(&mut self) {
27328                 if self.result_ok {
27329                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27330                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27331                         }
27332                 } else {
27333                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27334                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27335                         }
27336                 }
27337         }
27338 }
27339 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
27340         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
27341                 let contents = if o.result_ok {
27342                         let result = unsafe { o.contents.result };
27343                         unsafe { o.contents.result = core::ptr::null_mut() };
27344                         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { result }
27345                 } else {
27346                         let err = unsafe { o.contents.err };
27347                         unsafe { o.contents.err = core::ptr::null_mut(); }
27348                         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err }
27349                 };
27350                 Self {
27351                         contents,
27352                         result_ok: o.result_ok,
27353                 }
27354         }
27355 }
27356 #[repr(C)]
27357 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
27358 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27359         /// A pointer to the contents in the success state.
27360         /// Reading from this pointer when `result_ok` is not set is undefined.
27361         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
27362         /// A pointer to the contents in the error state.
27363         /// Reading from this pointer when `result_ok` is set is undefined.
27364         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27365 }
27366 #[repr(C)]
27367 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
27368 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27370 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
27371         /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
27372         /// `err` or `result` depending on the state of `result_ok`.
27373         pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
27374         /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
27375         pub result_ok: bool,
27376 }
27377 #[no_mangle]
27378 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
27379 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27380         CResult_DelayedPaymentBasepointDecodeErrorZ {
27381                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27382                         result: Box::into_raw(Box::new(o)),
27383                 },
27384                 result_ok: true,
27385         }
27386 }
27387 #[no_mangle]
27388 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
27389 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
27390         CResult_DelayedPaymentBasepointDecodeErrorZ {
27391                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27392                         err: Box::into_raw(Box::new(e)),
27393                 },
27394                 result_ok: false,
27395         }
27396 }
27397 /// Checks if the given object is currently in the success state
27398 #[no_mangle]
27399 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
27400         o.result_ok
27401 }
27402 #[no_mangle]
27403 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
27404 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
27405 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
27406         fn drop(&mut self) {
27407                 if self.result_ok {
27408                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27409                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27410                         }
27411                 } else {
27412                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27413                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27414                         }
27415                 }
27416         }
27417 }
27418 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
27419         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27420                 let contents = if o.result_ok {
27421                         let result = unsafe { o.contents.result };
27422                         unsafe { o.contents.result = core::ptr::null_mut() };
27423                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
27424                 } else {
27425                         let err = unsafe { o.contents.err };
27426                         unsafe { o.contents.err = core::ptr::null_mut(); }
27427                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
27428                 };
27429                 Self {
27430                         contents,
27431                         result_ok: o.result_ok,
27432                 }
27433         }
27434 }
27435 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
27436         fn clone(&self) -> Self {
27437                 if self.result_ok {
27438                         Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27439                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
27440                         } }
27441                 } else {
27442                         Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
27443                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27444                         } }
27445                 }
27446         }
27447 }
27448 #[no_mangle]
27449 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
27450 /// but with all dynamically-allocated buffers duplicated in new buffers.
27451 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
27452 #[repr(C)]
27453 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
27454 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
27455         /// A pointer to the contents in the success state.
27456         /// Reading from this pointer when `result_ok` is not set is undefined.
27457         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
27458         /// A pointer to the contents in the error state.
27459         /// Reading from this pointer when `result_ok` is set is undefined.
27460         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27461 }
27462 #[repr(C)]
27463 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
27464 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27465 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27466 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
27467         /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
27468         /// `err` or `result` depending on the state of `result_ok`.
27469         pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
27470         /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
27471         pub result_ok: bool,
27472 }
27473 #[no_mangle]
27474 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
27475 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27476         CResult_DelayedPaymentKeyDecodeErrorZ {
27477                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27478                         result: Box::into_raw(Box::new(o)),
27479                 },
27480                 result_ok: true,
27481         }
27482 }
27483 #[no_mangle]
27484 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
27485 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
27486         CResult_DelayedPaymentKeyDecodeErrorZ {
27487                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27488                         err: Box::into_raw(Box::new(e)),
27489                 },
27490                 result_ok: false,
27491         }
27492 }
27493 /// Checks if the given object is currently in the success state
27494 #[no_mangle]
27495 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
27496         o.result_ok
27497 }
27498 #[no_mangle]
27499 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
27500 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
27501 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
27502         fn drop(&mut self) {
27503                 if self.result_ok {
27504                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27505                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27506                         }
27507                 } else {
27508                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27509                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27510                         }
27511                 }
27512         }
27513 }
27514 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
27515         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27516                 let contents = if o.result_ok {
27517                         let result = unsafe { o.contents.result };
27518                         unsafe { o.contents.result = core::ptr::null_mut() };
27519                         CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
27520                 } else {
27521                         let err = unsafe { o.contents.err };
27522                         unsafe { o.contents.err = core::ptr::null_mut(); }
27523                         CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
27524                 };
27525                 Self {
27526                         contents,
27527                         result_ok: o.result_ok,
27528                 }
27529         }
27530 }
27531 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
27532         fn clone(&self) -> Self {
27533                 if self.result_ok {
27534                         Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27535                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
27536                         } }
27537                 } else {
27538                         Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
27539                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27540                         } }
27541                 }
27542         }
27543 }
27544 #[no_mangle]
27545 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
27546 /// but with all dynamically-allocated buffers duplicated in new buffers.
27547 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
27548 #[repr(C)]
27549 /// The contents of CResult_HtlcBasepointDecodeErrorZ
27550 pub union CResult_HtlcBasepointDecodeErrorZPtr {
27551         /// A pointer to the contents in the success state.
27552         /// Reading from this pointer when `result_ok` is not set is undefined.
27553         pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
27554         /// A pointer to the contents in the error state.
27555         /// Reading from this pointer when `result_ok` is set is undefined.
27556         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27557 }
27558 #[repr(C)]
27559 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
27560 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27561 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27562 pub struct CResult_HtlcBasepointDecodeErrorZ {
27563         /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
27564         /// `err` or `result` depending on the state of `result_ok`.
27565         pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
27566         /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
27567         pub result_ok: bool,
27568 }
27569 #[no_mangle]
27570 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
27571 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
27572         CResult_HtlcBasepointDecodeErrorZ {
27573                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27574                         result: Box::into_raw(Box::new(o)),
27575                 },
27576                 result_ok: true,
27577         }
27578 }
27579 #[no_mangle]
27580 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
27581 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
27582         CResult_HtlcBasepointDecodeErrorZ {
27583                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
27584                         err: Box::into_raw(Box::new(e)),
27585                 },
27586                 result_ok: false,
27587         }
27588 }
27589 /// Checks if the given object is currently in the success state
27590 #[no_mangle]
27591 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
27592         o.result_ok
27593 }
27594 #[no_mangle]
27595 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
27596 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
27597 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
27598         fn drop(&mut self) {
27599                 if self.result_ok {
27600                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27601                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27602                         }
27603                 } else {
27604                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27605                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27606                         }
27607                 }
27608         }
27609 }
27610 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
27611         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27612                 let contents = if o.result_ok {
27613                         let result = unsafe { o.contents.result };
27614                         unsafe { o.contents.result = core::ptr::null_mut() };
27615                         CResult_HtlcBasepointDecodeErrorZPtr { result }
27616                 } else {
27617                         let err = unsafe { o.contents.err };
27618                         unsafe { o.contents.err = core::ptr::null_mut(); }
27619                         CResult_HtlcBasepointDecodeErrorZPtr { err }
27620                 };
27621                 Self {
27622                         contents,
27623                         result_ok: o.result_ok,
27624                 }
27625         }
27626 }
27627 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
27628         fn clone(&self) -> Self {
27629                 if self.result_ok {
27630                         Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27631                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
27632                         } }
27633                 } else {
27634                         Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
27635                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27636                         } }
27637                 }
27638         }
27639 }
27640 #[no_mangle]
27641 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
27642 /// but with all dynamically-allocated buffers duplicated in new buffers.
27643 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
27644 #[repr(C)]
27645 /// The contents of CResult_HtlcKeyDecodeErrorZ
27646 pub union CResult_HtlcKeyDecodeErrorZPtr {
27647         /// A pointer to the contents in the success state.
27648         /// Reading from this pointer when `result_ok` is not set is undefined.
27649         pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
27650         /// A pointer to the contents in the error state.
27651         /// Reading from this pointer when `result_ok` is set is undefined.
27652         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27653 }
27654 #[repr(C)]
27655 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
27656 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27657 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27658 pub struct CResult_HtlcKeyDecodeErrorZ {
27659         /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
27660         /// `err` or `result` depending on the state of `result_ok`.
27661         pub contents: CResult_HtlcKeyDecodeErrorZPtr,
27662         /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
27663         pub result_ok: bool,
27664 }
27665 #[no_mangle]
27666 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
27667 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
27668         CResult_HtlcKeyDecodeErrorZ {
27669                 contents: CResult_HtlcKeyDecodeErrorZPtr {
27670                         result: Box::into_raw(Box::new(o)),
27671                 },
27672                 result_ok: true,
27673         }
27674 }
27675 #[no_mangle]
27676 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
27677 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
27678         CResult_HtlcKeyDecodeErrorZ {
27679                 contents: CResult_HtlcKeyDecodeErrorZPtr {
27680                         err: Box::into_raw(Box::new(e)),
27681                 },
27682                 result_ok: false,
27683         }
27684 }
27685 /// Checks if the given object is currently in the success state
27686 #[no_mangle]
27687 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
27688         o.result_ok
27689 }
27690 #[no_mangle]
27691 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
27692 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
27693 impl Drop for CResult_HtlcKeyDecodeErrorZ {
27694         fn drop(&mut self) {
27695                 if self.result_ok {
27696                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27697                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27698                         }
27699                 } else {
27700                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27701                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27702                         }
27703                 }
27704         }
27705 }
27706 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
27707         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27708                 let contents = if o.result_ok {
27709                         let result = unsafe { o.contents.result };
27710                         unsafe { o.contents.result = core::ptr::null_mut() };
27711                         CResult_HtlcKeyDecodeErrorZPtr { result }
27712                 } else {
27713                         let err = unsafe { o.contents.err };
27714                         unsafe { o.contents.err = core::ptr::null_mut(); }
27715                         CResult_HtlcKeyDecodeErrorZPtr { err }
27716                 };
27717                 Self {
27718                         contents,
27719                         result_ok: o.result_ok,
27720                 }
27721         }
27722 }
27723 impl Clone for CResult_HtlcKeyDecodeErrorZ {
27724         fn clone(&self) -> Self {
27725                 if self.result_ok {
27726                         Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
27727                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
27728                         } }
27729                 } else {
27730                         Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
27731                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27732                         } }
27733                 }
27734         }
27735 }
27736 #[no_mangle]
27737 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
27738 /// but with all dynamically-allocated buffers duplicated in new buffers.
27739 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
27740 #[repr(C)]
27741 /// The contents of CResult_RevocationBasepointDecodeErrorZ
27742 pub union CResult_RevocationBasepointDecodeErrorZPtr {
27743         /// A pointer to the contents in the success state.
27744         /// Reading from this pointer when `result_ok` is not set is undefined.
27745         pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
27746         /// A pointer to the contents in the error state.
27747         /// Reading from this pointer when `result_ok` is set is undefined.
27748         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27749 }
27750 #[repr(C)]
27751 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
27752 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
27753 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27754 pub struct CResult_RevocationBasepointDecodeErrorZ {
27755         /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
27756         /// `err` or `result` depending on the state of `result_ok`.
27757         pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
27758         /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
27759         pub result_ok: bool,
27760 }
27761 #[no_mangle]
27762 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
27763 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
27764         CResult_RevocationBasepointDecodeErrorZ {
27765                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27766                         result: Box::into_raw(Box::new(o)),
27767                 },
27768                 result_ok: true,
27769         }
27770 }
27771 #[no_mangle]
27772 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
27773 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
27774         CResult_RevocationBasepointDecodeErrorZ {
27775                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
27776                         err: Box::into_raw(Box::new(e)),
27777                 },
27778                 result_ok: false,
27779         }
27780 }
27781 /// Checks if the given object is currently in the success state
27782 #[no_mangle]
27783 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
27784         o.result_ok
27785 }
27786 #[no_mangle]
27787 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
27788 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
27789 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
27790         fn drop(&mut self) {
27791                 if self.result_ok {
27792                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27793                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27794                         }
27795                 } else {
27796                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27797                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27798                         }
27799                 }
27800         }
27801 }
27802 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
27803         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
27804                 let contents = if o.result_ok {
27805                         let result = unsafe { o.contents.result };
27806                         unsafe { o.contents.result = core::ptr::null_mut() };
27807                         CResult_RevocationBasepointDecodeErrorZPtr { result }
27808                 } else {
27809                         let err = unsafe { o.contents.err };
27810                         unsafe { o.contents.err = core::ptr::null_mut(); }
27811                         CResult_RevocationBasepointDecodeErrorZPtr { err }
27812                 };
27813                 Self {
27814                         contents,
27815                         result_ok: o.result_ok,
27816                 }
27817         }
27818 }
27819 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
27820         fn clone(&self) -> Self {
27821                 if self.result_ok {
27822                         Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27823                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
27824                         } }
27825                 } else {
27826                         Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
27827                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27828                         } }
27829                 }
27830         }
27831 }
27832 #[no_mangle]
27833 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
27834 /// but with all dynamically-allocated buffers duplicated in new buffers.
27835 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
27836 #[repr(C)]
27837 /// The contents of CResult_RevocationKeyDecodeErrorZ
27838 pub union CResult_RevocationKeyDecodeErrorZPtr {
27839         /// A pointer to the contents in the success state.
27840         /// Reading from this pointer when `result_ok` is not set is undefined.
27841         pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
27842         /// A pointer to the contents in the error state.
27843         /// Reading from this pointer when `result_ok` is set is undefined.
27844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27845 }
27846 #[repr(C)]
27847 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
27848 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
27849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27850 pub struct CResult_RevocationKeyDecodeErrorZ {
27851         /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
27852         /// `err` or `result` depending on the state of `result_ok`.
27853         pub contents: CResult_RevocationKeyDecodeErrorZPtr,
27854         /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
27855         pub result_ok: bool,
27856 }
27857 #[no_mangle]
27858 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
27859 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
27860         CResult_RevocationKeyDecodeErrorZ {
27861                 contents: CResult_RevocationKeyDecodeErrorZPtr {
27862                         result: Box::into_raw(Box::new(o)),
27863                 },
27864                 result_ok: true,
27865         }
27866 }
27867 #[no_mangle]
27868 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
27869 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
27870         CResult_RevocationKeyDecodeErrorZ {
27871                 contents: CResult_RevocationKeyDecodeErrorZPtr {
27872                         err: Box::into_raw(Box::new(e)),
27873                 },
27874                 result_ok: false,
27875         }
27876 }
27877 /// Checks if the given object is currently in the success state
27878 #[no_mangle]
27879 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
27880         o.result_ok
27881 }
27882 #[no_mangle]
27883 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
27884 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
27885 impl Drop for CResult_RevocationKeyDecodeErrorZ {
27886         fn drop(&mut self) {
27887                 if self.result_ok {
27888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27890                         }
27891                 } else {
27892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27894                         }
27895                 }
27896         }
27897 }
27898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
27899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
27900                 let contents = if o.result_ok {
27901                         let result = unsafe { o.contents.result };
27902                         unsafe { o.contents.result = core::ptr::null_mut() };
27903                         CResult_RevocationKeyDecodeErrorZPtr { result }
27904                 } else {
27905                         let err = unsafe { o.contents.err };
27906                         unsafe { o.contents.err = core::ptr::null_mut(); }
27907                         CResult_RevocationKeyDecodeErrorZPtr { err }
27908                 };
27909                 Self {
27910                         contents,
27911                         result_ok: o.result_ok,
27912                 }
27913         }
27914 }
27915 impl Clone for CResult_RevocationKeyDecodeErrorZ {
27916         fn clone(&self) -> Self {
27917                 if self.result_ok {
27918                         Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
27919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
27920                         } }
27921                 } else {
27922                         Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
27923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27924                         } }
27925                 }
27926         }
27927 }
27928 #[no_mangle]
27929 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
27930 /// but with all dynamically-allocated buffers duplicated in new buffers.
27931 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
27932 #[repr(C)]
27933 /// The contents of CResult_LockedChannelMonitorNoneZ
27934 pub union CResult_LockedChannelMonitorNoneZPtr {
27935         /// A pointer to the contents in the success state.
27936         /// Reading from this pointer when `result_ok` is not set is undefined.
27937         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
27938         /// Note that this value is always NULL, as there are no contents in the Err variant
27939         pub err: *mut core::ffi::c_void,
27940 }
27941 #[repr(C)]
27942 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
27943 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
27944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27945 pub struct CResult_LockedChannelMonitorNoneZ {
27946         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
27947         /// `err` or `result` depending on the state of `result_ok`.
27948         pub contents: CResult_LockedChannelMonitorNoneZPtr,
27949         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
27950         pub result_ok: bool,
27951 }
27952 #[no_mangle]
27953 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
27954 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
27955         CResult_LockedChannelMonitorNoneZ {
27956                 contents: CResult_LockedChannelMonitorNoneZPtr {
27957                         result: Box::into_raw(Box::new(o)),
27958                 },
27959                 result_ok: true,
27960         }
27961 }
27962 #[no_mangle]
27963 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
27964 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
27965         CResult_LockedChannelMonitorNoneZ {
27966                 contents: CResult_LockedChannelMonitorNoneZPtr {
27967                         err: core::ptr::null_mut(),
27968                 },
27969                 result_ok: false,
27970         }
27971 }
27972 /// Checks if the given object is currently in the success state
27973 #[no_mangle]
27974 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
27975         o.result_ok
27976 }
27977 #[no_mangle]
27978 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
27979 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
27980 impl Drop for CResult_LockedChannelMonitorNoneZ {
27981         fn drop(&mut self) {
27982                 if self.result_ok {
27983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27985                         }
27986                 } else {
27987                 }
27988         }
27989 }
27990 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
27991         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
27992                 let contents = if o.result_ok {
27993                         let result = unsafe { o.contents.result };
27994                         unsafe { o.contents.result = core::ptr::null_mut() };
27995                         CResult_LockedChannelMonitorNoneZPtr { result }
27996                 } else {
27997                         let _ = unsafe { Box::from_raw(o.contents.err) };
27998                         o.contents.err = core::ptr::null_mut();
27999                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
28000                 };
28001                 Self {
28002                         contents,
28003                         result_ok: o.result_ok,
28004                 }
28005         }
28006 }
28007 #[repr(C)]
28008 /// A tuple of 2 elements. See the individual fields for the types contained.
28009 pub struct C2Tuple_OutPointChannelIdZ {
28010         /// The element at position 0
28011         pub a: crate::lightning::chain::transaction::OutPoint,
28012         /// The element at position 1
28013         pub b: crate::lightning::ln::types::ChannelId,
28014 }
28015 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)> for C2Tuple_OutPointChannelIdZ {
28016         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self {
28017                 Self {
28018                         a: tup.0,
28019                         b: tup.1,
28020                 }
28021         }
28022 }
28023 impl C2Tuple_OutPointChannelIdZ {
28024         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) {
28025                 (self.a, self.b)
28026         }
28027 }
28028 impl Clone for C2Tuple_OutPointChannelIdZ {
28029         fn clone(&self) -> Self {
28030                 Self {
28031                         a: Clone::clone(&self.a),
28032                         b: Clone::clone(&self.b),
28033                 }
28034         }
28035 }
28036 #[no_mangle]
28037 /// Creates a new tuple which has the same data as `orig`
28038 /// but with all dynamically-allocated buffers duplicated in new buffers.
28039 pub extern "C" fn C2Tuple_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) }
28040 /// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
28041 #[no_mangle]
28042 pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ {
28043         C2Tuple_OutPointChannelIdZ { a, b, }
28044 }
28045
28046 #[no_mangle]
28047 /// Frees any resources used by the C2Tuple_OutPointChannelIdZ.
28048 pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { }
28049 #[repr(C)]
28050 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
28051 /// This corresponds to std::vector in C++
28052 pub struct CVec_C2Tuple_OutPointChannelIdZZ {
28053         /// The elements in the array.
28054         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28055         pub data: *mut crate::c_types::derived::C2Tuple_OutPointChannelIdZ,
28056         /// The number of elements pointed to by `data`.
28057         pub datalen: usize
28058 }
28059 impl CVec_C2Tuple_OutPointChannelIdZZ {
28060         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ> {
28061                 if self.datalen == 0 { return Vec::new(); }
28062                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28063                 self.data = core::ptr::null_mut();
28064                 self.datalen = 0;
28065                 ret
28066         }
28067         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointChannelIdZ] {
28068                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28069         }
28070 }
28071 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>> for CVec_C2Tuple_OutPointChannelIdZZ {
28072         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>) -> Self {
28073                 let datalen = v.len();
28074                 let data = Box::into_raw(v.into_boxed_slice());
28075                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28076         }
28077 }
28078 #[no_mangle]
28079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28080 pub extern "C" fn CVec_C2Tuple_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { }
28081 impl Drop for CVec_C2Tuple_OutPointChannelIdZZ {
28082         fn drop(&mut self) {
28083                 if self.datalen == 0 { return; }
28084                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28085         }
28086 }
28087 impl Clone for CVec_C2Tuple_OutPointChannelIdZZ {
28088         fn clone(&self) -> Self {
28089                 let mut res = Vec::new();
28090                 if self.datalen == 0 { return Self::from(res); }
28091                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28092                 Self::from(res)
28093         }
28094 }
28095 #[repr(C)]
28096 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
28097 /// This corresponds to std::vector in C++
28098 pub struct CVec_MonitorUpdateIdZ {
28099         /// The elements in the array.
28100         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28101         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
28102         /// The number of elements pointed to by `data`.
28103         pub datalen: usize
28104 }
28105 impl CVec_MonitorUpdateIdZ {
28106         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
28107                 if self.datalen == 0 { return Vec::new(); }
28108                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28109                 self.data = core::ptr::null_mut();
28110                 self.datalen = 0;
28111                 ret
28112         }
28113         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
28114                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28115         }
28116 }
28117 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
28118         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
28119                 let datalen = v.len();
28120                 let data = Box::into_raw(v.into_boxed_slice());
28121                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28122         }
28123 }
28124 #[no_mangle]
28125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28126 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
28127 impl Drop for CVec_MonitorUpdateIdZ {
28128         fn drop(&mut self) {
28129                 if self.datalen == 0 { return; }
28130                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28131         }
28132 }
28133 impl Clone for CVec_MonitorUpdateIdZ {
28134         fn clone(&self) -> Self {
28135                 let mut res = Vec::new();
28136                 if self.datalen == 0 { return Self::from(res); }
28137                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28138                 Self::from(res)
28139         }
28140 }
28141 #[repr(C)]
28142 /// A tuple of 2 elements. See the individual fields for the types contained.
28143 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28144         /// The element at position 0
28145         pub a: crate::lightning::chain::transaction::OutPoint,
28146         /// The element at position 1
28147         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
28148 }
28149 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28150         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
28151                 Self {
28152                         a: tup.0,
28153                         b: tup.1,
28154                 }
28155         }
28156 }
28157 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28158         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
28159                 (self.a, self.b)
28160         }
28161 }
28162 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28163         fn clone(&self) -> Self {
28164                 Self {
28165                         a: Clone::clone(&self.a),
28166                         b: Clone::clone(&self.b),
28167                 }
28168         }
28169 }
28170 #[no_mangle]
28171 /// Creates a new tuple which has the same data as `orig`
28172 /// but with all dynamically-allocated buffers duplicated in new buffers.
28173 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
28174 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
28175 #[no_mangle]
28176 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28177         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
28178 }
28179
28180 #[no_mangle]
28181 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
28182 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
28183 #[repr(C)]
28184 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
28185 /// This corresponds to std::vector in C++
28186 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28187         /// The elements in the array.
28188         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28189         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
28190         /// The number of elements pointed to by `data`.
28191         pub datalen: usize
28192 }
28193 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28194         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
28195                 if self.datalen == 0 { return Vec::new(); }
28196                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28197                 self.data = core::ptr::null_mut();
28198                 self.datalen = 0;
28199                 ret
28200         }
28201         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
28202                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28203         }
28204 }
28205 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28206         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
28207                 let datalen = v.len();
28208                 let data = Box::into_raw(v.into_boxed_slice());
28209                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28210         }
28211 }
28212 #[no_mangle]
28213 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28214 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
28215 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28216         fn drop(&mut self) {
28217                 if self.datalen == 0 { return; }
28218                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28219         }
28220 }
28221 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28222         fn clone(&self) -> Self {
28223                 let mut res = Vec::new();
28224                 if self.datalen == 0 { return Self::from(res); }
28225                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28226                 Self::from(res)
28227         }
28228 }