Update auto-generated bindings to include ln-transaction-sync
[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::channel_state::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::channel_state::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::channel_state::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::channel_state::ChannelDetails] {
3834                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3835         }
3836 }
3837 impl From<Vec<crate::lightning::ln::channel_state::ChannelDetails>> for CVec_ChannelDetailsZ {
3838         fn from(v: Vec<crate::lightning::ln::channel_state::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 /// The contents of CResult_ChannelIdAPIErrorZ
9670 pub union CResult_ChannelIdAPIErrorZPtr {
9671         /// A pointer to the contents in the success state.
9672         /// Reading from this pointer when `result_ok` is not set is undefined.
9673         pub result: *mut crate::lightning::ln::types::ChannelId,
9674         /// A pointer to the contents in the error state.
9675         /// Reading from this pointer when `result_ok` is set is undefined.
9676         pub err: *mut crate::lightning::util::errors::APIError,
9677 }
9678 #[repr(C)]
9679 /// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation,
9680 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure.
9681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9682 pub struct CResult_ChannelIdAPIErrorZ {
9683         /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either
9684         /// `err` or `result` depending on the state of `result_ok`.
9685         pub contents: CResult_ChannelIdAPIErrorZPtr,
9686         /// Whether this CResult_ChannelIdAPIErrorZ represents a success state.
9687         pub result_ok: bool,
9688 }
9689 #[no_mangle]
9690 /// Creates a new CResult_ChannelIdAPIErrorZ in the success state.
9691 pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ {
9692         CResult_ChannelIdAPIErrorZ {
9693                 contents: CResult_ChannelIdAPIErrorZPtr {
9694                         result: Box::into_raw(Box::new(o)),
9695                 },
9696                 result_ok: true,
9697         }
9698 }
9699 #[no_mangle]
9700 /// Creates a new CResult_ChannelIdAPIErrorZ in the error state.
9701 pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ {
9702         CResult_ChannelIdAPIErrorZ {
9703                 contents: CResult_ChannelIdAPIErrorZPtr {
9704                         err: Box::into_raw(Box::new(e)),
9705                 },
9706                 result_ok: false,
9707         }
9708 }
9709 /// Checks if the given object is currently in the success state
9710 #[no_mangle]
9711 pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool {
9712         o.result_ok
9713 }
9714 #[no_mangle]
9715 /// Frees any resources used by the CResult_ChannelIdAPIErrorZ.
9716 pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { }
9717 impl Drop for CResult_ChannelIdAPIErrorZ {
9718         fn drop(&mut self) {
9719                 if self.result_ok {
9720                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9721                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9722                         }
9723                 } else {
9724                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9725                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9726                         }
9727                 }
9728         }
9729 }
9730 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>> for CResult_ChannelIdAPIErrorZ {
9731         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::util::errors::APIError>) -> Self {
9732                 let contents = if o.result_ok {
9733                         let result = unsafe { o.contents.result };
9734                         unsafe { o.contents.result = core::ptr::null_mut() };
9735                         CResult_ChannelIdAPIErrorZPtr { result }
9736                 } else {
9737                         let err = unsafe { o.contents.err };
9738                         unsafe { o.contents.err = core::ptr::null_mut(); }
9739                         CResult_ChannelIdAPIErrorZPtr { err }
9740                 };
9741                 Self {
9742                         contents,
9743                         result_ok: o.result_ok,
9744                 }
9745         }
9746 }
9747 impl Clone for CResult_ChannelIdAPIErrorZ {
9748         fn clone(&self) -> Self {
9749                 if self.result_ok {
9750                         Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr {
9751                                 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
9752                         } }
9753                 } else {
9754                         Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr {
9755                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9756                         } }
9757                 }
9758         }
9759 }
9760 #[no_mangle]
9761 /// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig`
9762 /// but with all dynamically-allocated buffers duplicated in new buffers.
9763 pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) }
9764 #[repr(C)]
9765 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size.
9766 /// This corresponds to std::vector in C++
9767 pub struct CVec_RecentPaymentDetailsZ {
9768         /// The elements in the array.
9769         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9770         pub data: *mut crate::lightning::ln::channelmanager::RecentPaymentDetails,
9771         /// The number of elements pointed to by `data`.
9772         pub datalen: usize
9773 }
9774 impl CVec_RecentPaymentDetailsZ {
9775         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails> {
9776                 if self.datalen == 0 { return Vec::new(); }
9777                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9778                 self.data = core::ptr::null_mut();
9779                 self.datalen = 0;
9780                 ret
9781         }
9782         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] {
9783                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9784         }
9785 }
9786 impl From<Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>> for CVec_RecentPaymentDetailsZ {
9787         fn from(v: Vec<crate::lightning::ln::channelmanager::RecentPaymentDetails>) -> Self {
9788                 let datalen = v.len();
9789                 let data = Box::into_raw(v.into_boxed_slice());
9790                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9791         }
9792 }
9793 #[no_mangle]
9794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9795 pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { }
9796 impl Drop for CVec_RecentPaymentDetailsZ {
9797         fn drop(&mut self) {
9798                 if self.datalen == 0 { return; }
9799                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9800         }
9801 }
9802 #[repr(C)]
9803 /// The contents of CResult_NonePaymentSendFailureZ
9804 pub union CResult_NonePaymentSendFailureZPtr {
9805         /// Note that this value is always NULL, as there are no contents in the OK variant
9806         pub result: *mut core::ffi::c_void,
9807         /// A pointer to the contents in the error state.
9808         /// Reading from this pointer when `result_ok` is set is undefined.
9809         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9810 }
9811 #[repr(C)]
9812 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
9813 /// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9815 pub struct CResult_NonePaymentSendFailureZ {
9816         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
9817         /// `err` or `result` depending on the state of `result_ok`.
9818         pub contents: CResult_NonePaymentSendFailureZPtr,
9819         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
9820         pub result_ok: bool,
9821 }
9822 #[no_mangle]
9823 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
9824 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
9825         CResult_NonePaymentSendFailureZ {
9826                 contents: CResult_NonePaymentSendFailureZPtr {
9827                         result: core::ptr::null_mut(),
9828                 },
9829                 result_ok: true,
9830         }
9831 }
9832 #[no_mangle]
9833 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
9834 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
9835         CResult_NonePaymentSendFailureZ {
9836                 contents: CResult_NonePaymentSendFailureZPtr {
9837                         err: Box::into_raw(Box::new(e)),
9838                 },
9839                 result_ok: false,
9840         }
9841 }
9842 /// Checks if the given object is currently in the success state
9843 #[no_mangle]
9844 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
9845         o.result_ok
9846 }
9847 #[no_mangle]
9848 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9849 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9850 impl Drop for CResult_NonePaymentSendFailureZ {
9851         fn drop(&mut self) {
9852                 if self.result_ok {
9853                 } else {
9854                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9855                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9856                         }
9857                 }
9858         }
9859 }
9860 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9861         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
9862                 let contents = if o.result_ok {
9863                         let _ = unsafe { Box::from_raw(o.contents.result) };
9864                         o.contents.result = core::ptr::null_mut();
9865                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
9866                 } else {
9867                         let err = unsafe { o.contents.err };
9868                         unsafe { o.contents.err = core::ptr::null_mut(); }
9869                         CResult_NonePaymentSendFailureZPtr { err }
9870                 };
9871                 Self {
9872                         contents,
9873                         result_ok: o.result_ok,
9874                 }
9875         }
9876 }
9877 impl Clone for CResult_NonePaymentSendFailureZ {
9878         fn clone(&self) -> Self {
9879                 if self.result_ok {
9880                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9881                                 result: core::ptr::null_mut()
9882                         } }
9883                 } else {
9884                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9885                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9886                         } }
9887                 }
9888         }
9889 }
9890 #[no_mangle]
9891 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9892 /// but with all dynamically-allocated buffers duplicated in new buffers.
9893 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
9894 #[repr(C)]
9895 /// The contents of CResult_NoneRetryableSendFailureZ
9896 pub union CResult_NoneRetryableSendFailureZPtr {
9897         /// Note that this value is always NULL, as there are no contents in the OK variant
9898         pub result: *mut core::ffi::c_void,
9899         /// A pointer to the contents in the error state.
9900         /// Reading from this pointer when `result_ok` is set is undefined.
9901         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
9902 }
9903 #[repr(C)]
9904 /// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation,
9905 /// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
9906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9907 pub struct CResult_NoneRetryableSendFailureZ {
9908         /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either
9909         /// `err` or `result` depending on the state of `result_ok`.
9910         pub contents: CResult_NoneRetryableSendFailureZPtr,
9911         /// Whether this CResult_NoneRetryableSendFailureZ represents a success state.
9912         pub result_ok: bool,
9913 }
9914 #[no_mangle]
9915 /// Creates a new CResult_NoneRetryableSendFailureZ in the success state.
9916 pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ {
9917         CResult_NoneRetryableSendFailureZ {
9918                 contents: CResult_NoneRetryableSendFailureZPtr {
9919                         result: core::ptr::null_mut(),
9920                 },
9921                 result_ok: true,
9922         }
9923 }
9924 #[no_mangle]
9925 /// Creates a new CResult_NoneRetryableSendFailureZ in the error state.
9926 pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ {
9927         CResult_NoneRetryableSendFailureZ {
9928                 contents: CResult_NoneRetryableSendFailureZPtr {
9929                         err: Box::into_raw(Box::new(e)),
9930                 },
9931                 result_ok: false,
9932         }
9933 }
9934 /// Checks if the given object is currently in the success state
9935 #[no_mangle]
9936 pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool {
9937         o.result_ok
9938 }
9939 #[no_mangle]
9940 /// Frees any resources used by the CResult_NoneRetryableSendFailureZ.
9941 pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { }
9942 impl Drop for CResult_NoneRetryableSendFailureZ {
9943         fn drop(&mut self) {
9944                 if self.result_ok {
9945                 } else {
9946                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9947                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9948                         }
9949                 }
9950         }
9951 }
9952 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_NoneRetryableSendFailureZ {
9953         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
9954                 let contents = if o.result_ok {
9955                         let _ = unsafe { Box::from_raw(o.contents.result) };
9956                         o.contents.result = core::ptr::null_mut();
9957                         CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() }
9958                 } else {
9959                         let err = unsafe { o.contents.err };
9960                         unsafe { o.contents.err = core::ptr::null_mut(); }
9961                         CResult_NoneRetryableSendFailureZPtr { err }
9962                 };
9963                 Self {
9964                         contents,
9965                         result_ok: o.result_ok,
9966                 }
9967         }
9968 }
9969 impl Clone for CResult_NoneRetryableSendFailureZ {
9970         fn clone(&self) -> Self {
9971                 if self.result_ok {
9972                         Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr {
9973                                 result: core::ptr::null_mut()
9974                         } }
9975                 } else {
9976                         Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr {
9977                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
9978                         } }
9979                 }
9980         }
9981 }
9982 #[no_mangle]
9983 /// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig`
9984 /// but with all dynamically-allocated buffers duplicated in new buffers.
9985 pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) }
9986 #[repr(C)]
9987 /// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ
9988 pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
9989         /// A pointer to the contents in the success state.
9990         /// Reading from this pointer when `result_ok` is not set is undefined.
9991         pub result: *mut crate::c_types::ThirtyTwoBytes,
9992         /// A pointer to the contents in the error state.
9993         /// Reading from this pointer when `result_ok` is set is undefined.
9994         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
9995 }
9996 #[repr(C)]
9997 /// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation,
9998 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
9999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10000 pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ {
10001         /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either
10002         /// `err` or `result` depending on the state of `result_ok`.
10003         pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr,
10004         /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state.
10005         pub result_ok: bool,
10006 }
10007 #[no_mangle]
10008 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state.
10009 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10010         CResult_ThirtyTwoBytesPaymentSendFailureZ {
10011                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10012                         result: Box::into_raw(Box::new(o)),
10013                 },
10014                 result_ok: true,
10015         }
10016 }
10017 #[no_mangle]
10018 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state.
10019 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ {
10020         CResult_ThirtyTwoBytesPaymentSendFailureZ {
10021                 contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10022                         err: Box::into_raw(Box::new(e)),
10023                 },
10024                 result_ok: false,
10025         }
10026 }
10027 /// Checks if the given object is currently in the success state
10028 #[no_mangle]
10029 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool {
10030         o.result_ok
10031 }
10032 #[no_mangle]
10033 /// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ.
10034 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { }
10035 impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10036         fn drop(&mut self) {
10037                 if self.result_ok {
10038                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10039                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10040                         }
10041                 } else {
10042                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10043                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10044                         }
10045                 }
10046         }
10047 }
10048 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10049         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10050                 let contents = if o.result_ok {
10051                         let result = unsafe { o.contents.result };
10052                         unsafe { o.contents.result = core::ptr::null_mut() };
10053                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { result }
10054                 } else {
10055                         let err = unsafe { o.contents.err };
10056                         unsafe { o.contents.err = core::ptr::null_mut(); }
10057                         CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err }
10058                 };
10059                 Self {
10060                         contents,
10061                         result_ok: o.result_ok,
10062                 }
10063         }
10064 }
10065 impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ {
10066         fn clone(&self) -> Self {
10067                 if self.result_ok {
10068                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10069                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10070                         } }
10071                 } else {
10072                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr {
10073                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10074                         } }
10075                 }
10076         }
10077 }
10078 #[no_mangle]
10079 /// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig`
10080 /// but with all dynamically-allocated buffers duplicated in new buffers.
10081 pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) }
10082 #[repr(C)]
10083 /// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ
10084 pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10085         /// A pointer to the contents in the success state.
10086         /// Reading from this pointer when `result_ok` is not set is undefined.
10087         pub result: *mut crate::c_types::ThirtyTwoBytes,
10088         /// A pointer to the contents in the error state.
10089         /// Reading from this pointer when `result_ok` is set is undefined.
10090         pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure,
10091 }
10092 #[repr(C)]
10093 /// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation,
10094 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure.
10095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10096 pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ {
10097         /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either
10098         /// `err` or `result` depending on the state of `result_ok`.
10099         pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr,
10100         /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state.
10101         pub result_ok: bool,
10102 }
10103 #[no_mangle]
10104 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state.
10105 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10106         CResult_ThirtyTwoBytesRetryableSendFailureZ {
10107                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10108                         result: Box::into_raw(Box::new(o)),
10109                 },
10110                 result_ok: true,
10111         }
10112 }
10113 #[no_mangle]
10114 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state.
10115 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ {
10116         CResult_ThirtyTwoBytesRetryableSendFailureZ {
10117                 contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10118                         err: Box::into_raw(Box::new(e)),
10119                 },
10120                 result_ok: false,
10121         }
10122 }
10123 /// Checks if the given object is currently in the success state
10124 #[no_mangle]
10125 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool {
10126         o.result_ok
10127 }
10128 #[no_mangle]
10129 /// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ.
10130 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { }
10131 impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10132         fn drop(&mut self) {
10133                 if self.result_ok {
10134                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10135                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10136                         }
10137                 } else {
10138                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10139                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10140                         }
10141                 }
10142         }
10143 }
10144 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>> for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10145         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self {
10146                 let contents = if o.result_ok {
10147                         let result = unsafe { o.contents.result };
10148                         unsafe { o.contents.result = core::ptr::null_mut() };
10149                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result }
10150                 } else {
10151                         let err = unsafe { o.contents.err };
10152                         unsafe { o.contents.err = core::ptr::null_mut(); }
10153                         CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err }
10154                 };
10155                 Self {
10156                         contents,
10157                         result_ok: o.result_ok,
10158                 }
10159         }
10160 }
10161 impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ {
10162         fn clone(&self) -> Self {
10163                 if self.result_ok {
10164                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10165                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10166                         } }
10167                 } else {
10168                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr {
10169                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::RetryableSendFailure>::clone(unsafe { &*self.contents.err })))
10170                         } }
10171                 }
10172         }
10173 }
10174 #[no_mangle]
10175 /// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig`
10176 /// but with all dynamically-allocated buffers duplicated in new buffers.
10177 pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) }
10178 #[repr(C)]
10179 /// A tuple of 2 elements. See the individual fields for the types contained.
10180 pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10181         /// The element at position 0
10182         pub a: crate::c_types::ThirtyTwoBytes,
10183         /// The element at position 1
10184         pub b: crate::c_types::ThirtyTwoBytes,
10185 }
10186 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10187         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
10188                 Self {
10189                         a: tup.0,
10190                         b: tup.1,
10191                 }
10192         }
10193 }
10194 impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10195         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
10196                 (self.a, self.b)
10197         }
10198 }
10199 impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10200         fn clone(&self) -> Self {
10201                 Self {
10202                         a: Clone::clone(&self.a),
10203                         b: Clone::clone(&self.b),
10204                 }
10205         }
10206 }
10207 #[no_mangle]
10208 /// Creates a new tuple which has the same data as `orig`
10209 /// but with all dynamically-allocated buffers duplicated in new buffers.
10210 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) }
10211 /// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements.
10212 #[no_mangle]
10213 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ {
10214         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, }
10215 }
10216
10217 #[no_mangle]
10218 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ.
10219 pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { }
10220 #[repr(C)]
10221 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ
10222 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10223         /// A pointer to the contents in the success state.
10224         /// Reading from this pointer when `result_ok` is not set is undefined.
10225         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10226         /// A pointer to the contents in the error state.
10227         /// Reading from this pointer when `result_ok` is set is undefined.
10228         pub err: *mut crate::lightning::ln::outbound_payment::PaymentSendFailure,
10229 }
10230 #[repr(C)]
10231 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation,
10232 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure.
10233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10234 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10235         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either
10236         /// `err` or `result` depending on the state of `result_ok`.
10237         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr,
10238         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state.
10239         pub result_ok: bool,
10240 }
10241 #[no_mangle]
10242 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state.
10243 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10244         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10245                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10246                         result: Box::into_raw(Box::new(o)),
10247                 },
10248                 result_ok: true,
10249         }
10250 }
10251 #[no_mangle]
10252 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state.
10253 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10254         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10255                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10256                         err: Box::into_raw(Box::new(e)),
10257                 },
10258                 result_ok: false,
10259         }
10260 }
10261 /// Checks if the given object is currently in the success state
10262 #[no_mangle]
10263 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool {
10264         o.result_ok
10265 }
10266 #[no_mangle]
10267 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ.
10268 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { }
10269 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10270         fn drop(&mut self) {
10271                 if self.result_ok {
10272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10274                         }
10275                 } else {
10276                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10277                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10278                         }
10279                 }
10280         }
10281 }
10282 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10283         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self {
10284                 let contents = if o.result_ok {
10285                         let result = unsafe { o.contents.result };
10286                         unsafe { o.contents.result = core::ptr::null_mut() };
10287                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result }
10288                 } else {
10289                         let err = unsafe { o.contents.err };
10290                         unsafe { o.contents.err = core::ptr::null_mut(); }
10291                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err }
10292                 };
10293                 Self {
10294                         contents,
10295                         result_ok: o.result_ok,
10296                 }
10297         }
10298 }
10299 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ {
10300         fn clone(&self) -> Self {
10301                 if self.result_ok {
10302                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10303                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10304                         } }
10305                 } else {
10306                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr {
10307                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
10308                         } }
10309                 }
10310         }
10311 }
10312 #[no_mangle]
10313 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig`
10314 /// but with all dynamically-allocated buffers duplicated in new buffers.
10315 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) }
10316 #[repr(C)]
10317 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size.
10318 /// This corresponds to std::vector in C++
10319 pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10320         /// The elements in the array.
10321         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10322         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10323         /// The number of elements pointed to by `data`.
10324         pub datalen: usize
10325 }
10326 impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10327         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ> {
10328                 if self.datalen == 0 { return Vec::new(); }
10329                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10330                 self.data = core::ptr::null_mut();
10331                 self.datalen = 0;
10332                 ret
10333         }
10334         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] {
10335                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10336         }
10337 }
10338 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10339         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>) -> Self {
10340                 let datalen = v.len();
10341                 let data = Box::into_raw(v.into_boxed_slice());
10342                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10343         }
10344 }
10345 #[no_mangle]
10346 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10347 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { }
10348 impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10349         fn drop(&mut self) {
10350                 if self.datalen == 0 { return; }
10351                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10352         }
10353 }
10354 impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ {
10355         fn clone(&self) -> Self {
10356                 let mut res = Vec::new();
10357                 if self.datalen == 0 { return Self::from(res); }
10358                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10359                 Self::from(res)
10360         }
10361 }
10362 #[repr(C)]
10363 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ
10364 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10365         /// A pointer to the contents in the success state.
10366         /// Reading from this pointer when `result_ok` is not set is undefined.
10367         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ,
10368         /// A pointer to the contents in the error state.
10369         /// Reading from this pointer when `result_ok` is set is undefined.
10370         pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure,
10371 }
10372 #[repr(C)]
10373 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation,
10374 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure.
10375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10376 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10377         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either
10378         /// `err` or `result` depending on the state of `result_ok`.
10379         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr,
10380         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state.
10381         pub result_ok: bool,
10382 }
10383 #[no_mangle]
10384 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state.
10385 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10386         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10387                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10388                         result: Box::into_raw(Box::new(o)),
10389                 },
10390                 result_ok: true,
10391         }
10392 }
10393 #[no_mangle]
10394 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state.
10395 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10396         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10397                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10398                         err: Box::into_raw(Box::new(e)),
10399                 },
10400                 result_ok: false,
10401         }
10402 }
10403 /// Checks if the given object is currently in the success state
10404 #[no_mangle]
10405 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool {
10406         o.result_ok
10407 }
10408 #[no_mangle]
10409 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ.
10410 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { }
10411 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10412         fn drop(&mut self) {
10413                 if self.result_ok {
10414                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10415                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10416                         }
10417                 } else {
10418                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10419                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10420                         }
10421                 }
10422         }
10423 }
10424 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10425         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, crate::lightning::ln::outbound_payment::ProbeSendFailure>) -> Self {
10426                 let contents = if o.result_ok {
10427                         let result = unsafe { o.contents.result };
10428                         unsafe { o.contents.result = core::ptr::null_mut() };
10429                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result }
10430                 } else {
10431                         let err = unsafe { o.contents.err };
10432                         unsafe { o.contents.err = core::ptr::null_mut(); }
10433                         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err }
10434                 };
10435                 Self {
10436                         contents,
10437                         result_ok: o.result_ok,
10438                 }
10439         }
10440 }
10441 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ {
10442         fn clone(&self) -> Self {
10443                 if self.result_ok {
10444                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10445                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ>::clone(unsafe { &*self.contents.result })))
10446                         } }
10447                 } else {
10448                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr {
10449                                 err: Box::into_raw(Box::new(<crate::lightning::ln::outbound_payment::ProbeSendFailure>::clone(unsafe { &*self.contents.err })))
10450                         } }
10451                 }
10452         }
10453 }
10454 #[no_mangle]
10455 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig`
10456 /// but with all dynamically-allocated buffers duplicated in new buffers.
10457 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) }
10458 #[repr(C)]
10459 /// A tuple of 2 elements. See the individual fields for the types contained.
10460 pub struct C2Tuple_ChannelIdPublicKeyZ {
10461         /// The element at position 0
10462         pub a: crate::lightning::ln::types::ChannelId,
10463         /// The element at position 1
10464         pub b: crate::c_types::PublicKey,
10465 }
10466 impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ {
10467         fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self {
10468                 Self {
10469                         a: tup.0,
10470                         b: tup.1,
10471                 }
10472         }
10473 }
10474 impl C2Tuple_ChannelIdPublicKeyZ {
10475         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) {
10476                 (self.a, self.b)
10477         }
10478 }
10479 impl Clone for C2Tuple_ChannelIdPublicKeyZ {
10480         fn clone(&self) -> Self {
10481                 Self {
10482                         a: Clone::clone(&self.a),
10483                         b: Clone::clone(&self.b),
10484                 }
10485         }
10486 }
10487 #[no_mangle]
10488 /// Creates a new tuple which has the same data as `orig`
10489 /// but with all dynamically-allocated buffers duplicated in new buffers.
10490 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) }
10491 /// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements.
10492 #[no_mangle]
10493 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ {
10494         C2Tuple_ChannelIdPublicKeyZ { a, b, }
10495 }
10496
10497 #[no_mangle]
10498 /// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ.
10499 pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { }
10500 #[repr(C)]
10501 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size.
10502 /// This corresponds to std::vector in C++
10503 pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ {
10504         /// The elements in the array.
10505         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10506         pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ,
10507         /// The number of elements pointed to by `data`.
10508         pub datalen: usize
10509 }
10510 impl CVec_C2Tuple_ChannelIdPublicKeyZZ {
10511         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ> {
10512                 if self.datalen == 0 { return Vec::new(); }
10513                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10514                 self.data = core::ptr::null_mut();
10515                 self.datalen = 0;
10516                 ret
10517         }
10518         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] {
10519                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10520         }
10521 }
10522 impl From<Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>> for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10523         fn from(v: Vec<crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ>) -> Self {
10524                 let datalen = v.len();
10525                 let data = Box::into_raw(v.into_boxed_slice());
10526                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10527         }
10528 }
10529 #[no_mangle]
10530 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10531 pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { }
10532 impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10533         fn drop(&mut self) {
10534                 if self.datalen == 0 { return; }
10535                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10536         }
10537 }
10538 impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ {
10539         fn clone(&self) -> Self {
10540                 let mut res = Vec::new();
10541                 if self.datalen == 0 { return Self::from(res); }
10542                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10543                 Self::from(res)
10544         }
10545 }
10546 #[repr(C)]
10547 /// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size.
10548 /// This corresponds to std::vector in C++
10549 pub struct CVec_ChannelIdZ {
10550         /// The elements in the array.
10551         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10552         pub data: *mut crate::lightning::ln::types::ChannelId,
10553         /// The number of elements pointed to by `data`.
10554         pub datalen: usize
10555 }
10556 impl CVec_ChannelIdZ {
10557         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::types::ChannelId> {
10558                 if self.datalen == 0 { return Vec::new(); }
10559                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10560                 self.data = core::ptr::null_mut();
10561                 self.datalen = 0;
10562                 ret
10563         }
10564         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] {
10565                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10566         }
10567 }
10568 impl From<Vec<crate::lightning::ln::types::ChannelId>> for CVec_ChannelIdZ {
10569         fn from(v: Vec<crate::lightning::ln::types::ChannelId>) -> Self {
10570                 let datalen = v.len();
10571                 let data = Box::into_raw(v.into_boxed_slice());
10572                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10573         }
10574 }
10575 #[no_mangle]
10576 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10577 pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { }
10578 impl Drop for CVec_ChannelIdZ {
10579         fn drop(&mut self) {
10580                 if self.datalen == 0 { return; }
10581                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10582         }
10583 }
10584 impl Clone for CVec_ChannelIdZ {
10585         fn clone(&self) -> Self {
10586                 let mut res = Vec::new();
10587                 if self.datalen == 0 { return Self::from(res); }
10588                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10589                 Self::from(res)
10590         }
10591 }
10592 #[repr(C)]
10593 /// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ
10594 pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10595         /// A pointer to the contents in the success state.
10596         /// Reading from this pointer when `result_ok` is not set is undefined.
10597         pub result: *mut crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder,
10598         /// A pointer to the contents in the error state.
10599         /// Reading from this pointer when `result_ok` is set is undefined.
10600         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
10601 }
10602 #[repr(C)]
10603 /// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
10604 /// containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
10605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10606 pub struct CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10607         /// The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either
10608         /// `err` or `result` depending on the state of `result_ok`.
10609         pub contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr,
10610         /// Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state.
10611         pub result_ok: bool,
10612 }
10613 #[no_mangle]
10614 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state.
10615 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10616         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10617                 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10618                         result: Box::into_raw(Box::new(o)),
10619                 },
10620                 result_ok: true,
10621         }
10622 }
10623 #[no_mangle]
10624 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state.
10625 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10626         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10627                 contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10628                         err: Box::into_raw(Box::new(e)),
10629                 },
10630                 result_ok: false,
10631         }
10632 }
10633 /// Checks if the given object is currently in the success state
10634 #[no_mangle]
10635 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool {
10636         o.result_ok
10637 }
10638 #[no_mangle]
10639 /// Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ.
10640 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) { }
10641 impl Drop for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10642         fn drop(&mut self) {
10643                 if self.result_ok {
10644                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10645                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10646                         }
10647                 } else {
10648                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10649                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10650                         }
10651                 }
10652         }
10653 }
10654 impl From<crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10655         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
10656                 let contents = if o.result_ok {
10657                         let result = unsafe { o.contents.result };
10658                         unsafe { o.contents.result = core::ptr::null_mut() };
10659                         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result }
10660                 } else {
10661                         let err = unsafe { o.contents.err };
10662                         unsafe { o.contents.err = core::ptr::null_mut(); }
10663                         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err }
10664                 };
10665                 Self {
10666                         contents,
10667                         result_ok: o.result_ok,
10668                 }
10669         }
10670 }
10671 impl Clone for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ {
10672         fn clone(&self) -> Self {
10673                 if self.result_ok {
10674                         Self { result_ok: true, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10675                                 result: Box::into_raw(Box::new(<crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder>::clone(unsafe { &*self.contents.result })))
10676                         } }
10677                 } else {
10678                         Self { result_ok: false, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr {
10679                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
10680                         } }
10681                 }
10682         }
10683 }
10684 #[no_mangle]
10685 /// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig`
10686 /// but with all dynamically-allocated buffers duplicated in new buffers.
10687 pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) }
10688 #[repr(C)]
10689 #[derive(Clone)]
10690 /// An enum which can either contain a crate::c_types::Str or not
10691 pub enum COption_StrZ {
10692         /// When we're in this state, this COption_StrZ contains a crate::c_types::Str
10693         Some(crate::c_types::Str),
10694         /// When we're in this state, this COption_StrZ contains nothing
10695         None
10696 }
10697 impl COption_StrZ {
10698         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10699                 if let Self::None = self { false } else { true }
10700         }
10701         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10702                 !self.is_some()
10703         }
10704         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Str {
10705                 if let Self::Some(v) = self { v } else { unreachable!() }
10706         }
10707 }
10708 #[no_mangle]
10709 /// Constructs a new COption_StrZ containing a crate::c_types::Str
10710 pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ {
10711         COption_StrZ::Some(o)
10712 }
10713 #[no_mangle]
10714 /// Constructs a new COption_StrZ containing nothing
10715 pub extern "C" fn COption_StrZ_none() -> COption_StrZ {
10716         COption_StrZ::None
10717 }
10718 #[no_mangle]
10719 /// Frees any resources associated with the crate::c_types::Str, if we are in the Some state
10720 pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { }
10721 #[no_mangle]
10722 /// Creates a new COption_StrZ which has the same data as `orig`
10723 /// but with all dynamically-allocated buffers duplicated in new buffers.
10724 pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) }
10725 #[repr(C)]
10726 /// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ
10727 pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10728         /// A pointer to the contents in the success state.
10729         /// Reading from this pointer when `result_ok` is not set is undefined.
10730         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ,
10731         /// Note that this value is always NULL, as there are no contents in the Err variant
10732         pub err: *mut core::ffi::c_void,
10733 }
10734 #[repr(C)]
10735 /// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation,
10736 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure.
10737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10738 pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10739         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either
10740         /// `err` or `result` depending on the state of `result_ok`.
10741         pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr,
10742         /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state.
10743         pub result_ok: bool,
10744 }
10745 #[no_mangle]
10746 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state.
10747 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10748         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10749                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10750                         result: Box::into_raw(Box::new(o)),
10751                 },
10752                 result_ok: true,
10753         }
10754 }
10755 #[no_mangle]
10756 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state.
10757 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10758         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10759                 contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10760                         err: core::ptr::null_mut(),
10761                 },
10762                 result_ok: false,
10763         }
10764 }
10765 /// Checks if the given object is currently in the success state
10766 #[no_mangle]
10767 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool {
10768         o.result_ok
10769 }
10770 #[no_mangle]
10771 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.
10772 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) { }
10773 impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10774         fn drop(&mut self) {
10775                 if self.result_ok {
10776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10778                         }
10779                 } else {
10780                 }
10781         }
10782 }
10783 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10784         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, ()>) -> Self {
10785                 let contents = if o.result_ok {
10786                         let result = unsafe { o.contents.result };
10787                         unsafe { o.contents.result = core::ptr::null_mut() };
10788                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result }
10789                 } else {
10790                         let _ = unsafe { Box::from_raw(o.contents.err) };
10791                         o.contents.err = core::ptr::null_mut();
10792                         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { err: core::ptr::null_mut() }
10793                 };
10794                 Self {
10795                         contents,
10796                         result_ok: o.result_ok,
10797                 }
10798         }
10799 }
10800 impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ {
10801         fn clone(&self) -> Self {
10802                 if self.result_ok {
10803                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10804                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ>::clone(unsafe { &*self.contents.result })))
10805                         } }
10806                 } else {
10807                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr {
10808                                 err: core::ptr::null_mut()
10809                         } }
10810                 }
10811         }
10812 }
10813 #[no_mangle]
10814 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig`
10815 /// but with all dynamically-allocated buffers duplicated in new buffers.
10816 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) }
10817 #[repr(C)]
10818 /// The contents of CResult_ThirtyTwoBytesAPIErrorZ
10819 pub union CResult_ThirtyTwoBytesAPIErrorZPtr {
10820         /// A pointer to the contents in the success state.
10821         /// Reading from this pointer when `result_ok` is not set is undefined.
10822         pub result: *mut crate::c_types::ThirtyTwoBytes,
10823         /// A pointer to the contents in the error state.
10824         /// Reading from this pointer when `result_ok` is set is undefined.
10825         pub err: *mut crate::lightning::util::errors::APIError,
10826 }
10827 #[repr(C)]
10828 /// A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation,
10829 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
10830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10831 pub struct CResult_ThirtyTwoBytesAPIErrorZ {
10832         /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either
10833         /// `err` or `result` depending on the state of `result_ok`.
10834         pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr,
10835         /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state.
10836         pub result_ok: bool,
10837 }
10838 #[no_mangle]
10839 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state.
10840 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesAPIErrorZ {
10841         CResult_ThirtyTwoBytesAPIErrorZ {
10842                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10843                         result: Box::into_raw(Box::new(o)),
10844                 },
10845                 result_ok: true,
10846         }
10847 }
10848 #[no_mangle]
10849 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state.
10850 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ThirtyTwoBytesAPIErrorZ {
10851         CResult_ThirtyTwoBytesAPIErrorZ {
10852                 contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10853                         err: Box::into_raw(Box::new(e)),
10854                 },
10855                 result_ok: false,
10856         }
10857 }
10858 /// Checks if the given object is currently in the success state
10859 #[no_mangle]
10860 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool {
10861         o.result_ok
10862 }
10863 #[no_mangle]
10864 /// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ.
10865 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { }
10866 impl Drop for CResult_ThirtyTwoBytesAPIErrorZ {
10867         fn drop(&mut self) {
10868                 if self.result_ok {
10869                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10870                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10871                         }
10872                 } else {
10873                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10874                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10875                         }
10876                 }
10877         }
10878 }
10879 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_ThirtyTwoBytesAPIErrorZ {
10880         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
10881                 let contents = if o.result_ok {
10882                         let result = unsafe { o.contents.result };
10883                         unsafe { o.contents.result = core::ptr::null_mut() };
10884                         CResult_ThirtyTwoBytesAPIErrorZPtr { result }
10885                 } else {
10886                         let err = unsafe { o.contents.err };
10887                         unsafe { o.contents.err = core::ptr::null_mut(); }
10888                         CResult_ThirtyTwoBytesAPIErrorZPtr { err }
10889                 };
10890                 Self {
10891                         contents,
10892                         result_ok: o.result_ok,
10893                 }
10894         }
10895 }
10896 impl Clone for CResult_ThirtyTwoBytesAPIErrorZ {
10897         fn clone(&self) -> Self {
10898                 if self.result_ok {
10899                         Self { result_ok: true, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10900                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10901                         } }
10902                 } else {
10903                         Self { result_ok: false, contents: CResult_ThirtyTwoBytesAPIErrorZPtr {
10904                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
10905                         } }
10906                 }
10907         }
10908 }
10909 #[no_mangle]
10910 /// Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig`
10911 /// but with all dynamically-allocated buffers duplicated in new buffers.
10912 pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) }
10913 #[repr(C)]
10914 #[derive(Clone)]
10915 /// An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not
10916 pub enum COption_OffersMessageZ {
10917         /// When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage
10918         Some(crate::lightning::onion_message::offers::OffersMessage),
10919         /// When we're in this state, this COption_OffersMessageZ contains nothing
10920         None
10921 }
10922 impl COption_OffersMessageZ {
10923         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10924                 if let Self::None = self { false } else { true }
10925         }
10926         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10927                 !self.is_some()
10928         }
10929         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::offers::OffersMessage {
10930                 if let Self::Some(v) = self { v } else { unreachable!() }
10931         }
10932 }
10933 #[no_mangle]
10934 /// Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage
10935 pub extern "C" fn COption_OffersMessageZ_some(o: crate::lightning::onion_message::offers::OffersMessage) -> COption_OffersMessageZ {
10936         COption_OffersMessageZ::Some(o)
10937 }
10938 #[no_mangle]
10939 /// Constructs a new COption_OffersMessageZ containing nothing
10940 pub extern "C" fn COption_OffersMessageZ_none() -> COption_OffersMessageZ {
10941         COption_OffersMessageZ::None
10942 }
10943 #[no_mangle]
10944 /// Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state
10945 pub extern "C" fn COption_OffersMessageZ_free(_res: COption_OffersMessageZ) { }
10946 #[no_mangle]
10947 /// Creates a new COption_OffersMessageZ which has the same data as `orig`
10948 /// but with all dynamically-allocated buffers duplicated in new buffers.
10949 pub extern "C" fn COption_OffersMessageZ_clone(orig: &COption_OffersMessageZ) -> COption_OffersMessageZ { Clone::clone(&orig) }
10950 #[repr(C)]
10951 /// A tuple of 3 elements. See the individual fields for the types contained.
10952 pub struct C3Tuple_OffersMessageDestinationBlindedPathZ {
10953         /// The element at position 0
10954         pub a: crate::lightning::onion_message::offers::OffersMessage,
10955         /// The element at position 1
10956         pub b: crate::lightning::onion_message::messenger::Destination,
10957         /// The element at position 2
10958         pub c: crate::lightning::blinded_path::BlindedPath,
10959 }
10960 impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OffersMessageDestinationBlindedPathZ {
10961         fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
10962                 Self {
10963                         a: tup.0,
10964                         b: tup.1,
10965                         c: tup.2,
10966                 }
10967         }
10968 }
10969 impl C3Tuple_OffersMessageDestinationBlindedPathZ {
10970         #[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) {
10971                 (self.a, self.b, self.c)
10972         }
10973 }
10974 impl Clone for C3Tuple_OffersMessageDestinationBlindedPathZ {
10975         fn clone(&self) -> Self {
10976                 Self {
10977                         a: Clone::clone(&self.a),
10978                         b: Clone::clone(&self.b),
10979                         c: Clone::clone(&self.c),
10980                 }
10981         }
10982 }
10983 #[no_mangle]
10984 /// Creates a new tuple which has the same data as `orig`
10985 /// but with all dynamically-allocated buffers duplicated in new buffers.
10986 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig: &C3Tuple_OffersMessageDestinationBlindedPathZ) -> C3Tuple_OffersMessageDestinationBlindedPathZ { Clone::clone(&orig) }
10987 /// Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements.
10988 #[no_mangle]
10989 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 {
10990         C3Tuple_OffersMessageDestinationBlindedPathZ { a, b, c, }
10991 }
10992
10993 #[no_mangle]
10994 /// Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ.
10995 pub extern "C" fn C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res: C3Tuple_OffersMessageDestinationBlindedPathZ) { }
10996 #[repr(C)]
10997 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size.
10998 /// This corresponds to std::vector in C++
10999 pub struct CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11000         /// The elements in the array.
11001         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11002         pub data: *mut crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ,
11003         /// The number of elements pointed to by `data`.
11004         pub datalen: usize
11005 }
11006 impl CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11007         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ> {
11008                 if self.datalen == 0 { return Vec::new(); }
11009                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11010                 self.data = core::ptr::null_mut();
11011                 self.datalen = 0;
11012                 ret
11013         }
11014         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ] {
11015                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11016         }
11017 }
11018 impl From<Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>> for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11019         fn from(v: Vec<crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZ>) -> Self {
11020                 let datalen = v.len();
11021                 let data = Box::into_raw(v.into_boxed_slice());
11022                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11023         }
11024 }
11025 #[no_mangle]
11026 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11027 pub extern "C" fn CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ) { }
11028 impl Drop for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11029         fn drop(&mut self) {
11030                 if self.datalen == 0 { return; }
11031                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11032         }
11033 }
11034 impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ {
11035         fn clone(&self) -> Self {
11036                 let mut res = Vec::new();
11037                 if self.datalen == 0 { return Self::from(res); }
11038                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11039                 Self::from(res)
11040         }
11041 }
11042 #[repr(C)]
11043 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
11044 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
11045         /// A pointer to the contents in the success state.
11046         /// Reading from this pointer when `result_ok` is not set is undefined.
11047         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
11048         /// A pointer to the contents in the error state.
11049         /// Reading from this pointer when `result_ok` is set is undefined.
11050         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11051 }
11052 #[repr(C)]
11053 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
11054 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
11055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11056 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
11057         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
11058         /// `err` or `result` depending on the state of `result_ok`.
11059         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
11060         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
11061         pub result_ok: bool,
11062 }
11063 #[no_mangle]
11064 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
11065 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
11066         CResult_PhantomRouteHintsDecodeErrorZ {
11067                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11068                         result: Box::into_raw(Box::new(o)),
11069                 },
11070                 result_ok: true,
11071         }
11072 }
11073 #[no_mangle]
11074 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
11075 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
11076         CResult_PhantomRouteHintsDecodeErrorZ {
11077                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11078                         err: Box::into_raw(Box::new(e)),
11079                 },
11080                 result_ok: false,
11081         }
11082 }
11083 /// Checks if the given object is currently in the success state
11084 #[no_mangle]
11085 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
11086         o.result_ok
11087 }
11088 #[no_mangle]
11089 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
11090 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
11091 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
11092         fn drop(&mut self) {
11093                 if self.result_ok {
11094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11096                         }
11097                 } else {
11098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11100                         }
11101                 }
11102         }
11103 }
11104 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
11105         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
11106                 let contents = if o.result_ok {
11107                         let result = unsafe { o.contents.result };
11108                         unsafe { o.contents.result = core::ptr::null_mut() };
11109                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
11110                 } else {
11111                         let err = unsafe { o.contents.err };
11112                         unsafe { o.contents.err = core::ptr::null_mut(); }
11113                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
11114                 };
11115                 Self {
11116                         contents,
11117                         result_ok: o.result_ok,
11118                 }
11119         }
11120 }
11121 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
11122         fn clone(&self) -> Self {
11123                 if self.result_ok {
11124                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11125                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
11126                         } }
11127                 } else {
11128                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
11129                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11130                         } }
11131                 }
11132         }
11133 }
11134 #[no_mangle]
11135 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
11136 /// but with all dynamically-allocated buffers duplicated in new buffers.
11137 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
11138 #[repr(C)]
11139 /// The contents of CResult_BlindedForwardDecodeErrorZ
11140 pub union CResult_BlindedForwardDecodeErrorZPtr {
11141         /// A pointer to the contents in the success state.
11142         /// Reading from this pointer when `result_ok` is not set is undefined.
11143         pub result: *mut crate::lightning::ln::channelmanager::BlindedForward,
11144         /// A pointer to the contents in the error state.
11145         /// Reading from this pointer when `result_ok` is set is undefined.
11146         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11147 }
11148 #[repr(C)]
11149 /// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation,
11150 /// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure.
11151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11152 pub struct CResult_BlindedForwardDecodeErrorZ {
11153         /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either
11154         /// `err` or `result` depending on the state of `result_ok`.
11155         pub contents: CResult_BlindedForwardDecodeErrorZPtr,
11156         /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state.
11157         pub result_ok: bool,
11158 }
11159 #[no_mangle]
11160 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state.
11161 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ {
11162         CResult_BlindedForwardDecodeErrorZ {
11163                 contents: CResult_BlindedForwardDecodeErrorZPtr {
11164                         result: Box::into_raw(Box::new(o)),
11165                 },
11166                 result_ok: true,
11167         }
11168 }
11169 #[no_mangle]
11170 /// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state.
11171 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ {
11172         CResult_BlindedForwardDecodeErrorZ {
11173                 contents: CResult_BlindedForwardDecodeErrorZPtr {
11174                         err: Box::into_raw(Box::new(e)),
11175                 },
11176                 result_ok: false,
11177         }
11178 }
11179 /// Checks if the given object is currently in the success state
11180 #[no_mangle]
11181 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool {
11182         o.result_ok
11183 }
11184 #[no_mangle]
11185 /// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ.
11186 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { }
11187 impl Drop for CResult_BlindedForwardDecodeErrorZ {
11188         fn drop(&mut self) {
11189                 if self.result_ok {
11190                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11191                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11192                         }
11193                 } else {
11194                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11195                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11196                         }
11197                 }
11198         }
11199 }
11200 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedForwardDecodeErrorZ {
11201         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedForward, crate::lightning::ln::msgs::DecodeError>) -> Self {
11202                 let contents = if o.result_ok {
11203                         let result = unsafe { o.contents.result };
11204                         unsafe { o.contents.result = core::ptr::null_mut() };
11205                         CResult_BlindedForwardDecodeErrorZPtr { result }
11206                 } else {
11207                         let err = unsafe { o.contents.err };
11208                         unsafe { o.contents.err = core::ptr::null_mut(); }
11209                         CResult_BlindedForwardDecodeErrorZPtr { err }
11210                 };
11211                 Self {
11212                         contents,
11213                         result_ok: o.result_ok,
11214                 }
11215         }
11216 }
11217 impl Clone for CResult_BlindedForwardDecodeErrorZ {
11218         fn clone(&self) -> Self {
11219                 if self.result_ok {
11220                         Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr {
11221                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedForward>::clone(unsafe { &*self.contents.result })))
11222                         } }
11223                 } else {
11224                         Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr {
11225                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11226                         } }
11227                 }
11228         }
11229 }
11230 #[no_mangle]
11231 /// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig`
11232 /// but with all dynamically-allocated buffers duplicated in new buffers.
11233 pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) }
11234 #[repr(C)]
11235 /// The contents of CResult_PendingHTLCRoutingDecodeErrorZ
11236 pub union CResult_PendingHTLCRoutingDecodeErrorZPtr {
11237         /// A pointer to the contents in the success state.
11238         /// Reading from this pointer when `result_ok` is not set is undefined.
11239         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting,
11240         /// A pointer to the contents in the error state.
11241         /// Reading from this pointer when `result_ok` is set is undefined.
11242         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11243 }
11244 #[repr(C)]
11245 /// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation,
11246 /// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure.
11247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11248 pub struct CResult_PendingHTLCRoutingDecodeErrorZ {
11249         /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either
11250         /// `err` or `result` depending on the state of `result_ok`.
11251         pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr,
11252         /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state.
11253         pub result_ok: bool,
11254 }
11255 #[no_mangle]
11256 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state.
11257 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11258         CResult_PendingHTLCRoutingDecodeErrorZ {
11259                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11260                         result: Box::into_raw(Box::new(o)),
11261                 },
11262                 result_ok: true,
11263         }
11264 }
11265 #[no_mangle]
11266 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state.
11267 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ {
11268         CResult_PendingHTLCRoutingDecodeErrorZ {
11269                 contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11270                         err: Box::into_raw(Box::new(e)),
11271                 },
11272                 result_ok: false,
11273         }
11274 }
11275 /// Checks if the given object is currently in the success state
11276 #[no_mangle]
11277 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool {
11278         o.result_ok
11279 }
11280 #[no_mangle]
11281 /// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ.
11282 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { }
11283 impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ {
11284         fn drop(&mut self) {
11285                 if self.result_ok {
11286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11288                         }
11289                 } else {
11290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11292                         }
11293                 }
11294         }
11295 }
11296 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCRoutingDecodeErrorZ {
11297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCRouting, crate::lightning::ln::msgs::DecodeError>) -> Self {
11298                 let contents = if o.result_ok {
11299                         let result = unsafe { o.contents.result };
11300                         unsafe { o.contents.result = core::ptr::null_mut() };
11301                         CResult_PendingHTLCRoutingDecodeErrorZPtr { result }
11302                 } else {
11303                         let err = unsafe { o.contents.err };
11304                         unsafe { o.contents.err = core::ptr::null_mut(); }
11305                         CResult_PendingHTLCRoutingDecodeErrorZPtr { err }
11306                 };
11307                 Self {
11308                         contents,
11309                         result_ok: o.result_ok,
11310                 }
11311         }
11312 }
11313 impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ {
11314         fn clone(&self) -> Self {
11315                 if self.result_ok {
11316                         Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11317                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCRouting>::clone(unsafe { &*self.contents.result })))
11318                         } }
11319                 } else {
11320                         Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr {
11321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11322                         } }
11323                 }
11324         }
11325 }
11326 #[no_mangle]
11327 /// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig`
11328 /// but with all dynamically-allocated buffers duplicated in new buffers.
11329 pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) }
11330 #[repr(C)]
11331 /// The contents of CResult_PendingHTLCInfoDecodeErrorZ
11332 pub union CResult_PendingHTLCInfoDecodeErrorZPtr {
11333         /// A pointer to the contents in the success state.
11334         /// Reading from this pointer when `result_ok` is not set is undefined.
11335         pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo,
11336         /// A pointer to the contents in the error state.
11337         /// Reading from this pointer when `result_ok` is set is undefined.
11338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11339 }
11340 #[repr(C)]
11341 /// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation,
11342 /// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11344 pub struct CResult_PendingHTLCInfoDecodeErrorZ {
11345         /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either
11346         /// `err` or `result` depending on the state of `result_ok`.
11347         pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr,
11348         /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state.
11349         pub result_ok: bool,
11350 }
11351 #[no_mangle]
11352 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state.
11353 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ {
11354         CResult_PendingHTLCInfoDecodeErrorZ {
11355                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11356                         result: Box::into_raw(Box::new(o)),
11357                 },
11358                 result_ok: true,
11359         }
11360 }
11361 #[no_mangle]
11362 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state.
11363 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ {
11364         CResult_PendingHTLCInfoDecodeErrorZ {
11365                 contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11366                         err: Box::into_raw(Box::new(e)),
11367                 },
11368                 result_ok: false,
11369         }
11370 }
11371 /// Checks if the given object is currently in the success state
11372 #[no_mangle]
11373 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool {
11374         o.result_ok
11375 }
11376 #[no_mangle]
11377 /// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ.
11378 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { }
11379 impl Drop for CResult_PendingHTLCInfoDecodeErrorZ {
11380         fn drop(&mut self) {
11381                 if self.result_ok {
11382                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11383                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11384                         }
11385                 } else {
11386                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11387                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11388                         }
11389                 }
11390         }
11391 }
11392 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_PendingHTLCInfoDecodeErrorZ {
11393         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PendingHTLCInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11394                 let contents = if o.result_ok {
11395                         let result = unsafe { o.contents.result };
11396                         unsafe { o.contents.result = core::ptr::null_mut() };
11397                         CResult_PendingHTLCInfoDecodeErrorZPtr { result }
11398                 } else {
11399                         let err = unsafe { o.contents.err };
11400                         unsafe { o.contents.err = core::ptr::null_mut(); }
11401                         CResult_PendingHTLCInfoDecodeErrorZPtr { err }
11402                 };
11403                 Self {
11404                         contents,
11405                         result_ok: o.result_ok,
11406                 }
11407         }
11408 }
11409 impl Clone for CResult_PendingHTLCInfoDecodeErrorZ {
11410         fn clone(&self) -> Self {
11411                 if self.result_ok {
11412                         Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11413                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PendingHTLCInfo>::clone(unsafe { &*self.contents.result })))
11414                         } }
11415                 } else {
11416                         Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr {
11417                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11418                         } }
11419                 }
11420         }
11421 }
11422 #[no_mangle]
11423 /// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig`
11424 /// but with all dynamically-allocated buffers duplicated in new buffers.
11425 pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) }
11426 #[repr(C)]
11427 /// The contents of CResult_BlindedFailureDecodeErrorZ
11428 pub union CResult_BlindedFailureDecodeErrorZPtr {
11429         /// A pointer to the contents in the success state.
11430         /// Reading from this pointer when `result_ok` is not set is undefined.
11431         pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure,
11432         /// A pointer to the contents in the error state.
11433         /// Reading from this pointer when `result_ok` is set is undefined.
11434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11435 }
11436 #[repr(C)]
11437 /// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation,
11438 /// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11440 pub struct CResult_BlindedFailureDecodeErrorZ {
11441         /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either
11442         /// `err` or `result` depending on the state of `result_ok`.
11443         pub contents: CResult_BlindedFailureDecodeErrorZPtr,
11444         /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state.
11445         pub result_ok: bool,
11446 }
11447 #[no_mangle]
11448 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state.
11449 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ {
11450         CResult_BlindedFailureDecodeErrorZ {
11451                 contents: CResult_BlindedFailureDecodeErrorZPtr {
11452                         result: Box::into_raw(Box::new(o)),
11453                 },
11454                 result_ok: true,
11455         }
11456 }
11457 #[no_mangle]
11458 /// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state.
11459 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ {
11460         CResult_BlindedFailureDecodeErrorZ {
11461                 contents: CResult_BlindedFailureDecodeErrorZPtr {
11462                         err: Box::into_raw(Box::new(e)),
11463                 },
11464                 result_ok: false,
11465         }
11466 }
11467 /// Checks if the given object is currently in the success state
11468 #[no_mangle]
11469 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool {
11470         o.result_ok
11471 }
11472 #[no_mangle]
11473 /// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ.
11474 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { }
11475 impl Drop for CResult_BlindedFailureDecodeErrorZ {
11476         fn drop(&mut self) {
11477                 if self.result_ok {
11478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11480                         }
11481                 } else {
11482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11484                         }
11485                 }
11486         }
11487 }
11488 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedFailureDecodeErrorZ {
11489         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::BlindedFailure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11490                 let contents = if o.result_ok {
11491                         let result = unsafe { o.contents.result };
11492                         unsafe { o.contents.result = core::ptr::null_mut() };
11493                         CResult_BlindedFailureDecodeErrorZPtr { result }
11494                 } else {
11495                         let err = unsafe { o.contents.err };
11496                         unsafe { o.contents.err = core::ptr::null_mut(); }
11497                         CResult_BlindedFailureDecodeErrorZPtr { err }
11498                 };
11499                 Self {
11500                         contents,
11501                         result_ok: o.result_ok,
11502                 }
11503         }
11504 }
11505 impl Clone for CResult_BlindedFailureDecodeErrorZ {
11506         fn clone(&self) -> Self {
11507                 if self.result_ok {
11508                         Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr {
11509                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::BlindedFailure>::clone(unsafe { &*self.contents.result })))
11510                         } }
11511                 } else {
11512                         Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr {
11513                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11514                         } }
11515                 }
11516         }
11517 }
11518 #[no_mangle]
11519 /// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig`
11520 /// but with all dynamically-allocated buffers duplicated in new buffers.
11521 pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) }
11522 #[repr(C)]
11523 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
11524 /// This corresponds to std::vector in C++
11525 pub struct CVec_ChannelMonitorZ {
11526         /// The elements in the array.
11527         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11528         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
11529         /// The number of elements pointed to by `data`.
11530         pub datalen: usize
11531 }
11532 impl CVec_ChannelMonitorZ {
11533         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
11534                 if self.datalen == 0 { return Vec::new(); }
11535                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11536                 self.data = core::ptr::null_mut();
11537                 self.datalen = 0;
11538                 ret
11539         }
11540         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
11541                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11542         }
11543 }
11544 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
11545         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
11546                 let datalen = v.len();
11547                 let data = Box::into_raw(v.into_boxed_slice());
11548                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11549         }
11550 }
11551 #[no_mangle]
11552 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11553 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
11554 impl Drop for CVec_ChannelMonitorZ {
11555         fn drop(&mut self) {
11556                 if self.datalen == 0 { return; }
11557                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11558         }
11559 }
11560 impl Clone for CVec_ChannelMonitorZ {
11561         fn clone(&self) -> Self {
11562                 let mut res = Vec::new();
11563                 if self.datalen == 0 { return Self::from(res); }
11564                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11565                 Self::from(res)
11566         }
11567 }
11568 #[repr(C)]
11569 /// A tuple of 2 elements. See the individual fields for the types contained.
11570 pub struct C2Tuple_ThirtyTwoBytesChannelManagerZ {
11571         /// The element at position 0
11572         pub a: crate::c_types::ThirtyTwoBytes,
11573         /// The element at position 1
11574         pub b: crate::lightning::ln::channelmanager::ChannelManager,
11575 }
11576 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ {
11577         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
11578                 Self {
11579                         a: tup.0,
11580                         b: tup.1,
11581                 }
11582         }
11583 }
11584 impl C2Tuple_ThirtyTwoBytesChannelManagerZ {
11585         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
11586                 (self.a, self.b)
11587         }
11588 }
11589 /// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements.
11590 #[no_mangle]
11591 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ {
11592         C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, }
11593 }
11594
11595 #[no_mangle]
11596 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ.
11597 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { }
11598 #[repr(C)]
11599 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ
11600 pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11601         /// A pointer to the contents in the success state.
11602         /// Reading from this pointer when `result_ok` is not set is undefined.
11603         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ,
11604         /// A pointer to the contents in the error state.
11605         /// Reading from this pointer when `result_ok` is set is undefined.
11606         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11607 }
11608 #[repr(C)]
11609 /// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation,
11610 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11611 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11612 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11613         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either
11614         /// `err` or `result` depending on the state of `result_ok`.
11615         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr,
11616         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state.
11617         pub result_ok: bool,
11618 }
11619 #[no_mangle]
11620 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state.
11621 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11622         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11623                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11624                         result: Box::into_raw(Box::new(o)),
11625                 },
11626                 result_ok: true,
11627         }
11628 }
11629 #[no_mangle]
11630 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state.
11631 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11632         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11633                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr {
11634                         err: Box::into_raw(Box::new(e)),
11635                 },
11636                 result_ok: false,
11637         }
11638 }
11639 /// Checks if the given object is currently in the success state
11640 #[no_mangle]
11641 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool {
11642         o.result_ok
11643 }
11644 #[no_mangle]
11645 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.
11646 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { }
11647 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11648         fn drop(&mut self) {
11649                 if self.result_ok {
11650                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11651                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11652                         }
11653                 } else {
11654                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11655                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11656                         }
11657                 }
11658         }
11659 }
11660 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ {
11661         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11662                 let contents = if o.result_ok {
11663                         let result = unsafe { o.contents.result };
11664                         unsafe { o.contents.result = core::ptr::null_mut() };
11665                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result }
11666                 } else {
11667                         let err = unsafe { o.contents.err };
11668                         unsafe { o.contents.err = core::ptr::null_mut(); }
11669                         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err }
11670                 };
11671                 Self {
11672                         contents,
11673                         result_ok: o.result_ok,
11674                 }
11675         }
11676 }
11677 #[repr(C)]
11678 /// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ
11679 pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11680         /// A pointer to the contents in the success state.
11681         /// Reading from this pointer when `result_ok` is not set is undefined.
11682         pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure,
11683         /// A pointer to the contents in the error state.
11684         /// Reading from this pointer when `result_ok` is set is undefined.
11685         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11686 }
11687 #[repr(C)]
11688 /// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation,
11689 /// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure.
11690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11691 pub struct CResult_MaxDustHTLCExposureDecodeErrorZ {
11692         /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either
11693         /// `err` or `result` depending on the state of `result_ok`.
11694         pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr,
11695         /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state.
11696         pub result_ok: bool,
11697 }
11698 #[no_mangle]
11699 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state.
11700 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11701         CResult_MaxDustHTLCExposureDecodeErrorZ {
11702                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11703                         result: Box::into_raw(Box::new(o)),
11704                 },
11705                 result_ok: true,
11706         }
11707 }
11708 #[no_mangle]
11709 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state.
11710 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ {
11711         CResult_MaxDustHTLCExposureDecodeErrorZ {
11712                 contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11713                         err: Box::into_raw(Box::new(e)),
11714                 },
11715                 result_ok: false,
11716         }
11717 }
11718 /// Checks if the given object is currently in the success state
11719 #[no_mangle]
11720 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool {
11721         o.result_ok
11722 }
11723 #[no_mangle]
11724 /// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ.
11725 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { }
11726 impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ {
11727         fn drop(&mut self) {
11728                 if self.result_ok {
11729                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11730                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11731                         }
11732                 } else {
11733                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11734                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11735                         }
11736                 }
11737         }
11738 }
11739 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>> for CResult_MaxDustHTLCExposureDecodeErrorZ {
11740         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::MaxDustHTLCExposure, crate::lightning::ln::msgs::DecodeError>) -> Self {
11741                 let contents = if o.result_ok {
11742                         let result = unsafe { o.contents.result };
11743                         unsafe { o.contents.result = core::ptr::null_mut() };
11744                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { result }
11745                 } else {
11746                         let err = unsafe { o.contents.err };
11747                         unsafe { o.contents.err = core::ptr::null_mut(); }
11748                         CResult_MaxDustHTLCExposureDecodeErrorZPtr { err }
11749                 };
11750                 Self {
11751                         contents,
11752                         result_ok: o.result_ok,
11753                 }
11754         }
11755 }
11756 impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ {
11757         fn clone(&self) -> Self {
11758                 if self.result_ok {
11759                         Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11760                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::MaxDustHTLCExposure>::clone(unsafe { &*self.contents.result })))
11761                         } }
11762                 } else {
11763                         Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr {
11764                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11765                         } }
11766                 }
11767         }
11768 }
11769 #[no_mangle]
11770 /// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig`
11771 /// but with all dynamically-allocated buffers duplicated in new buffers.
11772 pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) }
11773 #[repr(C)]
11774 /// The contents of CResult_ChannelConfigDecodeErrorZ
11775 pub union CResult_ChannelConfigDecodeErrorZPtr {
11776         /// A pointer to the contents in the success state.
11777         /// Reading from this pointer when `result_ok` is not set is undefined.
11778         pub result: *mut crate::lightning::util::config::ChannelConfig,
11779         /// A pointer to the contents in the error state.
11780         /// Reading from this pointer when `result_ok` is set is undefined.
11781         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11782 }
11783 #[repr(C)]
11784 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
11785 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
11786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11787 pub struct CResult_ChannelConfigDecodeErrorZ {
11788         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
11789         /// `err` or `result` depending on the state of `result_ok`.
11790         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
11791         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
11792         pub result_ok: bool,
11793 }
11794 #[no_mangle]
11795 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
11796 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
11797         CResult_ChannelConfigDecodeErrorZ {
11798                 contents: CResult_ChannelConfigDecodeErrorZPtr {
11799                         result: Box::into_raw(Box::new(o)),
11800                 },
11801                 result_ok: true,
11802         }
11803 }
11804 #[no_mangle]
11805 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
11806 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
11807         CResult_ChannelConfigDecodeErrorZ {
11808                 contents: CResult_ChannelConfigDecodeErrorZPtr {
11809                         err: Box::into_raw(Box::new(e)),
11810                 },
11811                 result_ok: false,
11812         }
11813 }
11814 /// Checks if the given object is currently in the success state
11815 #[no_mangle]
11816 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
11817         o.result_ok
11818 }
11819 #[no_mangle]
11820 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
11821 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
11822 impl Drop for CResult_ChannelConfigDecodeErrorZ {
11823         fn drop(&mut self) {
11824                 if self.result_ok {
11825                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11826                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11827                         }
11828                 } else {
11829                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11830                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11831                         }
11832                 }
11833         }
11834 }
11835 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
11836         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
11837                 let contents = if o.result_ok {
11838                         let result = unsafe { o.contents.result };
11839                         unsafe { o.contents.result = core::ptr::null_mut() };
11840                         CResult_ChannelConfigDecodeErrorZPtr { result }
11841                 } else {
11842                         let err = unsafe { o.contents.err };
11843                         unsafe { o.contents.err = core::ptr::null_mut(); }
11844                         CResult_ChannelConfigDecodeErrorZPtr { err }
11845                 };
11846                 Self {
11847                         contents,
11848                         result_ok: o.result_ok,
11849                 }
11850         }
11851 }
11852 impl Clone for CResult_ChannelConfigDecodeErrorZ {
11853         fn clone(&self) -> Self {
11854                 if self.result_ok {
11855                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
11856                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
11857                         } }
11858                 } else {
11859                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
11860                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11861                         } }
11862                 }
11863         }
11864 }
11865 #[no_mangle]
11866 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
11867 /// but with all dynamically-allocated buffers duplicated in new buffers.
11868 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
11869 #[repr(C)]
11870 #[derive(Clone)]
11871 /// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not
11872 pub enum COption_MaxDustHTLCExposureZ {
11873         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure
11874         Some(crate::lightning::util::config::MaxDustHTLCExposure),
11875         /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing
11876         None
11877 }
11878 impl COption_MaxDustHTLCExposureZ {
11879         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11880                 if let Self::None = self { false } else { true }
11881         }
11882         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11883                 !self.is_some()
11884         }
11885         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure {
11886                 if let Self::Some(v) = self { v } else { unreachable!() }
11887         }
11888 }
11889 #[no_mangle]
11890 /// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure
11891 pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ {
11892         COption_MaxDustHTLCExposureZ::Some(o)
11893 }
11894 #[no_mangle]
11895 /// Constructs a new COption_MaxDustHTLCExposureZ containing nothing
11896 pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ {
11897         COption_MaxDustHTLCExposureZ::None
11898 }
11899 #[no_mangle]
11900 /// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state
11901 pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { }
11902 #[no_mangle]
11903 /// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig`
11904 /// but with all dynamically-allocated buffers duplicated in new buffers.
11905 pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) }
11906 #[repr(C)]
11907 #[derive(Clone)]
11908 /// An enum which can either contain a crate::lightning::util::errors::APIError or not
11909 pub enum COption_APIErrorZ {
11910         /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError
11911         Some(crate::lightning::util::errors::APIError),
11912         /// When we're in this state, this COption_APIErrorZ contains nothing
11913         None
11914 }
11915 impl COption_APIErrorZ {
11916         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11917                 if let Self::None = self { false } else { true }
11918         }
11919         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11920                 !self.is_some()
11921         }
11922         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError {
11923                 if let Self::Some(v) = self { v } else { unreachable!() }
11924         }
11925 }
11926 #[no_mangle]
11927 /// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError
11928 pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ {
11929         COption_APIErrorZ::Some(o)
11930 }
11931 #[no_mangle]
11932 /// Constructs a new COption_APIErrorZ containing nothing
11933 pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ {
11934         COption_APIErrorZ::None
11935 }
11936 #[no_mangle]
11937 /// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state
11938 pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { }
11939 #[no_mangle]
11940 /// Creates a new COption_APIErrorZ which has the same data as `orig`
11941 /// but with all dynamically-allocated buffers duplicated in new buffers.
11942 pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) }
11943 #[repr(C)]
11944 /// The contents of CResult_COption_APIErrorZDecodeErrorZ
11945 pub union CResult_COption_APIErrorZDecodeErrorZPtr {
11946         /// A pointer to the contents in the success state.
11947         /// Reading from this pointer when `result_ok` is not set is undefined.
11948         pub result: *mut crate::c_types::derived::COption_APIErrorZ,
11949         /// A pointer to the contents in the error state.
11950         /// Reading from this pointer when `result_ok` is set is undefined.
11951         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11952 }
11953 #[repr(C)]
11954 /// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation,
11955 /// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11957 pub struct CResult_COption_APIErrorZDecodeErrorZ {
11958         /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either
11959         /// `err` or `result` depending on the state of `result_ok`.
11960         pub contents: CResult_COption_APIErrorZDecodeErrorZPtr,
11961         /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state.
11962         pub result_ok: bool,
11963 }
11964 #[no_mangle]
11965 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state.
11966 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ {
11967         CResult_COption_APIErrorZDecodeErrorZ {
11968                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11969                         result: Box::into_raw(Box::new(o)),
11970                 },
11971                 result_ok: true,
11972         }
11973 }
11974 #[no_mangle]
11975 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state.
11976 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ {
11977         CResult_COption_APIErrorZDecodeErrorZ {
11978                 contents: CResult_COption_APIErrorZDecodeErrorZPtr {
11979                         err: Box::into_raw(Box::new(e)),
11980                 },
11981                 result_ok: false,
11982         }
11983 }
11984 /// Checks if the given object is currently in the success state
11985 #[no_mangle]
11986 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool {
11987         o.result_ok
11988 }
11989 #[no_mangle]
11990 /// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ.
11991 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { }
11992 impl Drop for CResult_COption_APIErrorZDecodeErrorZ {
11993         fn drop(&mut self) {
11994                 if self.result_ok {
11995                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11996                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11997                         }
11998                 } else {
11999                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12000                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12001                         }
12002                 }
12003         }
12004 }
12005 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_APIErrorZDecodeErrorZ {
12006         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_APIErrorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12007                 let contents = if o.result_ok {
12008                         let result = unsafe { o.contents.result };
12009                         unsafe { o.contents.result = core::ptr::null_mut() };
12010                         CResult_COption_APIErrorZDecodeErrorZPtr { result }
12011                 } else {
12012                         let err = unsafe { o.contents.err };
12013                         unsafe { o.contents.err = core::ptr::null_mut(); }
12014                         CResult_COption_APIErrorZDecodeErrorZPtr { err }
12015                 };
12016                 Self {
12017                         contents,
12018                         result_ok: o.result_ok,
12019                 }
12020         }
12021 }
12022 impl Clone for CResult_COption_APIErrorZDecodeErrorZ {
12023         fn clone(&self) -> Self {
12024                 if self.result_ok {
12025                         Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12026                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_APIErrorZ>::clone(unsafe { &*self.contents.result })))
12027                         } }
12028                 } else {
12029                         Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr {
12030                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12031                         } }
12032                 }
12033         }
12034 }
12035 #[no_mangle]
12036 /// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig`
12037 /// but with all dynamically-allocated buffers duplicated in new buffers.
12038 pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) }
12039 #[repr(C)]
12040 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
12041 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12042         /// A pointer to the contents in the success state.
12043         /// Reading from this pointer when `result_ok` is not set is undefined.
12044         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
12045         /// A pointer to the contents in the error state.
12046         /// Reading from this pointer when `result_ok` is set is undefined.
12047         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12048 }
12049 #[repr(C)]
12050 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
12051 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12053 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
12054         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
12055         /// `err` or `result` depending on the state of `result_ok`.
12056         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
12057         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
12058         pub result_ok: bool,
12059 }
12060 #[no_mangle]
12061 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
12062 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12063         CResult_ChannelMonitorUpdateDecodeErrorZ {
12064                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12065                         result: Box::into_raw(Box::new(o)),
12066                 },
12067                 result_ok: true,
12068         }
12069 }
12070 #[no_mangle]
12071 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
12072 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
12073         CResult_ChannelMonitorUpdateDecodeErrorZ {
12074                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12075                         err: Box::into_raw(Box::new(e)),
12076                 },
12077                 result_ok: false,
12078         }
12079 }
12080 /// Checks if the given object is currently in the success state
12081 #[no_mangle]
12082 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
12083         o.result_ok
12084 }
12085 #[no_mangle]
12086 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
12087 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
12088 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
12089         fn drop(&mut self) {
12090                 if self.result_ok {
12091                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12092                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12093                         }
12094                 } else {
12095                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12096                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12097                         }
12098                 }
12099         }
12100 }
12101 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
12102         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12103                 let contents = if o.result_ok {
12104                         let result = unsafe { o.contents.result };
12105                         unsafe { o.contents.result = core::ptr::null_mut() };
12106                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
12107                 } else {
12108                         let err = unsafe { o.contents.err };
12109                         unsafe { o.contents.err = core::ptr::null_mut(); }
12110                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
12111                 };
12112                 Self {
12113                         contents,
12114                         result_ok: o.result_ok,
12115                 }
12116         }
12117 }
12118 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
12119         fn clone(&self) -> Self {
12120                 if self.result_ok {
12121                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12122                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
12123                         } }
12124                 } else {
12125                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
12126                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12127                         } }
12128                 }
12129         }
12130 }
12131 #[no_mangle]
12132 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
12133 /// but with all dynamically-allocated buffers duplicated in new buffers.
12134 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
12135 #[repr(C)]
12136 #[derive(Clone)]
12137 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12138 pub enum COption_MonitorEventZ {
12139         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
12140         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
12141         /// When we're in this state, this COption_MonitorEventZ contains nothing
12142         None
12143 }
12144 impl COption_MonitorEventZ {
12145         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
12146                 if let Self::None = self { false } else { true }
12147         }
12148         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
12149                 !self.is_some()
12150         }
12151         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
12152                 if let Self::Some(v) = self { v } else { unreachable!() }
12153         }
12154 }
12155 #[no_mangle]
12156 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
12157 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
12158         COption_MonitorEventZ::Some(o)
12159 }
12160 #[no_mangle]
12161 /// Constructs a new COption_MonitorEventZ containing nothing
12162 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
12163         COption_MonitorEventZ::None
12164 }
12165 #[no_mangle]
12166 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
12167 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
12168 #[no_mangle]
12169 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
12170 /// but with all dynamically-allocated buffers duplicated in new buffers.
12171 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
12172 #[repr(C)]
12173 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
12174 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
12175         /// A pointer to the contents in the success state.
12176         /// Reading from this pointer when `result_ok` is not set is undefined.
12177         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
12178         /// A pointer to the contents in the error state.
12179         /// Reading from this pointer when `result_ok` is set is undefined.
12180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12181 }
12182 #[repr(C)]
12183 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
12184 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12186 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
12187         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
12188         /// `err` or `result` depending on the state of `result_ok`.
12189         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
12190         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
12191         pub result_ok: bool,
12192 }
12193 #[no_mangle]
12194 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
12195 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
12196         CResult_COption_MonitorEventZDecodeErrorZ {
12197                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12198                         result: Box::into_raw(Box::new(o)),
12199                 },
12200                 result_ok: true,
12201         }
12202 }
12203 #[no_mangle]
12204 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
12205 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
12206         CResult_COption_MonitorEventZDecodeErrorZ {
12207                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12208                         err: Box::into_raw(Box::new(e)),
12209                 },
12210                 result_ok: false,
12211         }
12212 }
12213 /// Checks if the given object is currently in the success state
12214 #[no_mangle]
12215 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
12216         o.result_ok
12217 }
12218 #[no_mangle]
12219 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
12220 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
12221 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
12222         fn drop(&mut self) {
12223                 if self.result_ok {
12224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12226                         }
12227                 } else {
12228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12230                         }
12231                 }
12232         }
12233 }
12234 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
12235         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12236                 let contents = if o.result_ok {
12237                         let result = unsafe { o.contents.result };
12238                         unsafe { o.contents.result = core::ptr::null_mut() };
12239                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
12240                 } else {
12241                         let err = unsafe { o.contents.err };
12242                         unsafe { o.contents.err = core::ptr::null_mut(); }
12243                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
12244                 };
12245                 Self {
12246                         contents,
12247                         result_ok: o.result_ok,
12248                 }
12249         }
12250 }
12251 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
12252         fn clone(&self) -> Self {
12253                 if self.result_ok {
12254                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12255                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
12256                         } }
12257                 } else {
12258                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
12259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12260                         } }
12261                 }
12262         }
12263 }
12264 #[no_mangle]
12265 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
12266 /// but with all dynamically-allocated buffers duplicated in new buffers.
12267 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
12268 #[repr(C)]
12269 /// The contents of CResult_HTLCUpdateDecodeErrorZ
12270 pub union CResult_HTLCUpdateDecodeErrorZPtr {
12271         /// A pointer to the contents in the success state.
12272         /// Reading from this pointer when `result_ok` is not set is undefined.
12273         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
12274         /// A pointer to the contents in the error state.
12275         /// Reading from this pointer when `result_ok` is set is undefined.
12276         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12277 }
12278 #[repr(C)]
12279 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
12280 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
12281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12282 pub struct CResult_HTLCUpdateDecodeErrorZ {
12283         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
12284         /// `err` or `result` depending on the state of `result_ok`.
12285         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
12286         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
12287         pub result_ok: bool,
12288 }
12289 #[no_mangle]
12290 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
12291 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
12292         CResult_HTLCUpdateDecodeErrorZ {
12293                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12294                         result: Box::into_raw(Box::new(o)),
12295                 },
12296                 result_ok: true,
12297         }
12298 }
12299 #[no_mangle]
12300 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
12301 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
12302         CResult_HTLCUpdateDecodeErrorZ {
12303                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
12304                         err: Box::into_raw(Box::new(e)),
12305                 },
12306                 result_ok: false,
12307         }
12308 }
12309 /// Checks if the given object is currently in the success state
12310 #[no_mangle]
12311 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
12312         o.result_ok
12313 }
12314 #[no_mangle]
12315 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
12316 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
12317 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
12318         fn drop(&mut self) {
12319                 if self.result_ok {
12320                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12321                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12322                         }
12323                 } else {
12324                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12325                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12326                         }
12327                 }
12328         }
12329 }
12330 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
12331         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
12332                 let contents = if o.result_ok {
12333                         let result = unsafe { o.contents.result };
12334                         unsafe { o.contents.result = core::ptr::null_mut() };
12335                         CResult_HTLCUpdateDecodeErrorZPtr { result }
12336                 } else {
12337                         let err = unsafe { o.contents.err };
12338                         unsafe { o.contents.err = core::ptr::null_mut(); }
12339                         CResult_HTLCUpdateDecodeErrorZPtr { err }
12340                 };
12341                 Self {
12342                         contents,
12343                         result_ok: o.result_ok,
12344                 }
12345         }
12346 }
12347 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
12348         fn clone(&self) -> Self {
12349                 if self.result_ok {
12350                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12351                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
12352                         } }
12353                 } else {
12354                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
12355                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12356                         } }
12357                 }
12358         }
12359 }
12360 #[no_mangle]
12361 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
12362 /// but with all dynamically-allocated buffers duplicated in new buffers.
12363 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
12364 #[repr(C)]
12365 /// A tuple of 2 elements. See the individual fields for the types contained.
12366 pub struct C2Tuple_OutPointCVec_u8ZZ {
12367         /// The element at position 0
12368         pub a: crate::lightning::chain::transaction::OutPoint,
12369         /// The element at position 1
12370         pub b: crate::c_types::derived::CVec_u8Z,
12371 }
12372 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ {
12373         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
12374                 Self {
12375                         a: tup.0,
12376                         b: tup.1,
12377                 }
12378         }
12379 }
12380 impl C2Tuple_OutPointCVec_u8ZZ {
12381         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
12382                 (self.a, self.b)
12383         }
12384 }
12385 impl Clone for C2Tuple_OutPointCVec_u8ZZ {
12386         fn clone(&self) -> Self {
12387                 Self {
12388                         a: Clone::clone(&self.a),
12389                         b: Clone::clone(&self.b),
12390                 }
12391         }
12392 }
12393 #[no_mangle]
12394 /// Creates a new tuple which has the same data as `orig`
12395 /// but with all dynamically-allocated buffers duplicated in new buffers.
12396 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) }
12397 /// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements.
12398 #[no_mangle]
12399 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ {
12400         C2Tuple_OutPointCVec_u8ZZ { a, b, }
12401 }
12402
12403 #[no_mangle]
12404 /// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ.
12405 pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { }
12406 #[repr(C)]
12407 /// A tuple of 2 elements. See the individual fields for the types contained.
12408 pub struct C2Tuple_u32CVec_u8ZZ {
12409         /// The element at position 0
12410         pub a: u32,
12411         /// The element at position 1
12412         pub b: crate::c_types::derived::CVec_u8Z,
12413 }
12414 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ {
12415         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
12416                 Self {
12417                         a: tup.0,
12418                         b: tup.1,
12419                 }
12420         }
12421 }
12422 impl C2Tuple_u32CVec_u8ZZ {
12423         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
12424                 (self.a, self.b)
12425         }
12426 }
12427 impl Clone for C2Tuple_u32CVec_u8ZZ {
12428         fn clone(&self) -> Self {
12429                 Self {
12430                         a: Clone::clone(&self.a),
12431                         b: Clone::clone(&self.b),
12432                 }
12433         }
12434 }
12435 #[no_mangle]
12436 /// Creates a new tuple which has the same data as `orig`
12437 /// but with all dynamically-allocated buffers duplicated in new buffers.
12438 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) }
12439 /// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements.
12440 #[no_mangle]
12441 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ {
12442         C2Tuple_u32CVec_u8ZZ { a, b, }
12443 }
12444
12445 #[no_mangle]
12446 /// Frees any resources used by the C2Tuple_u32CVec_u8ZZ.
12447 pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { }
12448 #[repr(C)]
12449 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size.
12450 /// This corresponds to std::vector in C++
12451 pub struct CVec_C2Tuple_u32CVec_u8ZZZ {
12452         /// The elements in the array.
12453         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12454         pub data: *mut crate::c_types::derived::C2Tuple_u32CVec_u8ZZ,
12455         /// The number of elements pointed to by `data`.
12456         pub datalen: usize
12457 }
12458 impl CVec_C2Tuple_u32CVec_u8ZZZ {
12459         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ> {
12460                 if self.datalen == 0 { return Vec::new(); }
12461                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12462                 self.data = core::ptr::null_mut();
12463                 self.datalen = 0;
12464                 ret
12465         }
12466         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] {
12467                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12468         }
12469 }
12470 impl From<Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>> for CVec_C2Tuple_u32CVec_u8ZZZ {
12471         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32CVec_u8ZZ>) -> Self {
12472                 let datalen = v.len();
12473                 let data = Box::into_raw(v.into_boxed_slice());
12474                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12475         }
12476 }
12477 #[no_mangle]
12478 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12479 pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { }
12480 impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ {
12481         fn drop(&mut self) {
12482                 if self.datalen == 0 { return; }
12483                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12484         }
12485 }
12486 impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ {
12487         fn clone(&self) -> Self {
12488                 let mut res = Vec::new();
12489                 if self.datalen == 0 { return Self::from(res); }
12490                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12491                 Self::from(res)
12492         }
12493 }
12494 #[repr(C)]
12495 /// A tuple of 2 elements. See the individual fields for the types contained.
12496 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12497         /// The element at position 0
12498         pub a: crate::c_types::ThirtyTwoBytes,
12499         /// The element at position 1
12500         pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ,
12501 }
12502 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12503         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self {
12504                 Self {
12505                         a: tup.0,
12506                         b: tup.1,
12507                 }
12508         }
12509 }
12510 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12511         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) {
12512                 (self.a, self.b)
12513         }
12514 }
12515 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ {
12516         fn clone(&self) -> Self {
12517                 Self {
12518                         a: Clone::clone(&self.a),
12519                         b: Clone::clone(&self.b),
12520                 }
12521         }
12522 }
12523 #[no_mangle]
12524 /// Creates a new tuple which has the same data as `orig`
12525 /// but with all dynamically-allocated buffers duplicated in new buffers.
12526 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) }
12527 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements.
12528 #[no_mangle]
12529 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 {
12530         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, }
12531 }
12532
12533 #[no_mangle]
12534 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ.
12535 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { }
12536 #[repr(C)]
12537 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size.
12538 /// This corresponds to std::vector in C++
12539 pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12540         /// The elements in the array.
12541         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12542         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ,
12543         /// The number of elements pointed to by `data`.
12544         pub datalen: usize
12545 }
12546 impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12547         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ> {
12548                 if self.datalen == 0 { return Vec::new(); }
12549                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12550                 self.data = core::ptr::null_mut();
12551                 self.datalen = 0;
12552                 ret
12553         }
12554         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] {
12555                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12556         }
12557 }
12558 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12559         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ>) -> Self {
12560                 let datalen = v.len();
12561                 let data = Box::into_raw(v.into_boxed_slice());
12562                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12563         }
12564 }
12565 #[no_mangle]
12566 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12567 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { }
12568 impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12569         fn drop(&mut self) {
12570                 if self.datalen == 0 { return; }
12571                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12572         }
12573 }
12574 impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ {
12575         fn clone(&self) -> Self {
12576                 let mut res = Vec::new();
12577                 if self.datalen == 0 { return Self::from(res); }
12578                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12579                 Self::from(res)
12580         }
12581 }
12582 #[repr(C)]
12583 /// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size.
12584 /// This corresponds to std::vector in C++
12585 pub struct CVec_CommitmentTransactionZ {
12586         /// The elements in the array.
12587         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12588         pub data: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
12589         /// The number of elements pointed to by `data`.
12590         pub datalen: usize
12591 }
12592 impl CVec_CommitmentTransactionZ {
12593         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::chan_utils::CommitmentTransaction> {
12594                 if self.datalen == 0 { return Vec::new(); }
12595                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12596                 self.data = core::ptr::null_mut();
12597                 self.datalen = 0;
12598                 ret
12599         }
12600         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::CommitmentTransaction] {
12601                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12602         }
12603 }
12604 impl From<Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>> for CVec_CommitmentTransactionZ {
12605         fn from(v: Vec<crate::lightning::ln::chan_utils::CommitmentTransaction>) -> Self {
12606                 let datalen = v.len();
12607                 let data = Box::into_raw(v.into_boxed_slice());
12608                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12609         }
12610 }
12611 #[no_mangle]
12612 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12613 pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { }
12614 impl Drop for CVec_CommitmentTransactionZ {
12615         fn drop(&mut self) {
12616                 if self.datalen == 0 { return; }
12617                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12618         }
12619 }
12620 impl Clone for CVec_CommitmentTransactionZ {
12621         fn clone(&self) -> Self {
12622                 let mut res = Vec::new();
12623                 if self.datalen == 0 { return Self::from(res); }
12624                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12625                 Self::from(res)
12626         }
12627 }
12628 #[repr(C)]
12629 /// A tuple of 2 elements. See the individual fields for the types contained.
12630 pub struct C2Tuple_u32TxOutZ {
12631         /// The element at position 0
12632         pub a: u32,
12633         /// The element at position 1
12634         pub b: crate::c_types::TxOut,
12635 }
12636 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
12637         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
12638                 Self {
12639                         a: tup.0,
12640                         b: tup.1,
12641                 }
12642         }
12643 }
12644 impl C2Tuple_u32TxOutZ {
12645         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
12646                 (self.a, self.b)
12647         }
12648 }
12649 impl Clone for C2Tuple_u32TxOutZ {
12650         fn clone(&self) -> Self {
12651                 Self {
12652                         a: Clone::clone(&self.a),
12653                         b: Clone::clone(&self.b),
12654                 }
12655         }
12656 }
12657 #[no_mangle]
12658 /// Creates a new tuple which has the same data as `orig`
12659 /// but with all dynamically-allocated buffers duplicated in new buffers.
12660 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
12661 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
12662 #[no_mangle]
12663 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
12664         C2Tuple_u32TxOutZ { a, b, }
12665 }
12666
12667 #[no_mangle]
12668 /// Frees any resources used by the C2Tuple_u32TxOutZ.
12669 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
12670 #[repr(C)]
12671 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
12672 /// This corresponds to std::vector in C++
12673 pub struct CVec_C2Tuple_u32TxOutZZ {
12674         /// The elements in the array.
12675         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12676         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
12677         /// The number of elements pointed to by `data`.
12678         pub datalen: usize
12679 }
12680 impl CVec_C2Tuple_u32TxOutZZ {
12681         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
12682                 if self.datalen == 0 { return Vec::new(); }
12683                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12684                 self.data = core::ptr::null_mut();
12685                 self.datalen = 0;
12686                 ret
12687         }
12688         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
12689                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12690         }
12691 }
12692 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
12693         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
12694                 let datalen = v.len();
12695                 let data = Box::into_raw(v.into_boxed_slice());
12696                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12697         }
12698 }
12699 #[no_mangle]
12700 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12701 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
12702 impl Drop for CVec_C2Tuple_u32TxOutZZ {
12703         fn drop(&mut self) {
12704                 if self.datalen == 0 { return; }
12705                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12706         }
12707 }
12708 impl Clone for CVec_C2Tuple_u32TxOutZZ {
12709         fn clone(&self) -> Self {
12710                 let mut res = Vec::new();
12711                 if self.datalen == 0 { return Self::from(res); }
12712                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12713                 Self::from(res)
12714         }
12715 }
12716 #[repr(C)]
12717 /// A tuple of 2 elements. See the individual fields for the types contained.
12718 pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12719         /// The element at position 0
12720         pub a: crate::c_types::ThirtyTwoBytes,
12721         /// The element at position 1
12722         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
12723 }
12724 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12725         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
12726                 Self {
12727                         a: tup.0,
12728                         b: tup.1,
12729                 }
12730         }
12731 }
12732 impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12733         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
12734                 (self.a, self.b)
12735         }
12736 }
12737 impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ {
12738         fn clone(&self) -> Self {
12739                 Self {
12740                         a: Clone::clone(&self.a),
12741                         b: Clone::clone(&self.b),
12742                 }
12743         }
12744 }
12745 #[no_mangle]
12746 /// Creates a new tuple which has the same data as `orig`
12747 /// but with all dynamically-allocated buffers duplicated in new buffers.
12748 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
12749 /// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements.
12750 #[no_mangle]
12751 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 {
12752         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, }
12753 }
12754
12755 #[no_mangle]
12756 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ.
12757 pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { }
12758 #[repr(C)]
12759 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
12760 /// This corresponds to std::vector in C++
12761 pub struct CVec_TransactionOutputsZ {
12762         /// The elements in the array.
12763         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12764         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ,
12765         /// The number of elements pointed to by `data`.
12766         pub datalen: usize
12767 }
12768 impl CVec_TransactionOutputsZ {
12769         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ> {
12770                 if self.datalen == 0 { return Vec::new(); }
12771                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12772                 self.data = core::ptr::null_mut();
12773                 self.datalen = 0;
12774                 ret
12775         }
12776         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] {
12777                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12778         }
12779 }
12780 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
12781         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ>) -> Self {
12782                 let datalen = v.len();
12783                 let data = Box::into_raw(v.into_boxed_slice());
12784                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12785         }
12786 }
12787 #[no_mangle]
12788 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12789 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
12790 impl Drop for CVec_TransactionOutputsZ {
12791         fn drop(&mut self) {
12792                 if self.datalen == 0 { return; }
12793                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12794         }
12795 }
12796 impl Clone for CVec_TransactionOutputsZ {
12797         fn clone(&self) -> Self {
12798                 let mut res = Vec::new();
12799                 if self.datalen == 0 { return Self::from(res); }
12800                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12801                 Self::from(res)
12802         }
12803 }
12804 #[repr(C)]
12805 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
12806 /// This corresponds to std::vector in C++
12807 pub struct CVec_BalanceZ {
12808         /// The elements in the array.
12809         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12810         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
12811         /// The number of elements pointed to by `data`.
12812         pub datalen: usize
12813 }
12814 impl CVec_BalanceZ {
12815         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
12816                 if self.datalen == 0 { return Vec::new(); }
12817                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12818                 self.data = core::ptr::null_mut();
12819                 self.datalen = 0;
12820                 ret
12821         }
12822         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
12823                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12824         }
12825 }
12826 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
12827         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
12828                 let datalen = v.len();
12829                 let data = Box::into_raw(v.into_boxed_slice());
12830                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12831         }
12832 }
12833 #[no_mangle]
12834 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12835 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
12836 impl Drop for CVec_BalanceZ {
12837         fn drop(&mut self) {
12838                 if self.datalen == 0 { return; }
12839                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12840         }
12841 }
12842 impl Clone for CVec_BalanceZ {
12843         fn clone(&self) -> Self {
12844                 let mut res = Vec::new();
12845                 if self.datalen == 0 { return Self::from(res); }
12846                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12847                 Self::from(res)
12848         }
12849 }
12850 #[repr(C)]
12851 /// A tuple of 2 elements. See the individual fields for the types contained.
12852 pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12853         /// The element at position 0
12854         pub a: crate::c_types::ThirtyTwoBytes,
12855         /// The element at position 1
12856         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
12857 }
12858 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12859         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
12860                 Self {
12861                         a: tup.0,
12862                         b: tup.1,
12863                 }
12864         }
12865 }
12866 impl C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12867         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
12868                 (self.a, self.b)
12869         }
12870 }
12871 impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12872         fn clone(&self) -> Self {
12873                 Self {
12874                         a: Clone::clone(&self.a),
12875                         b: Clone::clone(&self.b),
12876                 }
12877         }
12878 }
12879 #[no_mangle]
12880 /// Creates a new tuple which has the same data as `orig`
12881 /// but with all dynamically-allocated buffers duplicated in new buffers.
12882 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) }
12883 /// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements.
12884 #[no_mangle]
12885 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ {
12886         C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, }
12887 }
12888
12889 #[no_mangle]
12890 /// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ.
12891 pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { }
12892 #[repr(C)]
12893 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ
12894 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12895         /// A pointer to the contents in the success state.
12896         /// Reading from this pointer when `result_ok` is not set is undefined.
12897         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
12898         /// A pointer to the contents in the error state.
12899         /// Reading from this pointer when `result_ok` is set is undefined.
12900         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12901 }
12902 #[repr(C)]
12903 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
12904 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
12905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12906 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12907         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either
12908         /// `err` or `result` depending on the state of `result_ok`.
12909         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr,
12910         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state.
12911         pub result_ok: bool,
12912 }
12913 #[no_mangle]
12914 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state.
12915 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12916         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12917                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12918                         result: Box::into_raw(Box::new(o)),
12919                 },
12920                 result_ok: true,
12921         }
12922 }
12923 #[no_mangle]
12924 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state.
12925 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12926         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12927                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12928                         err: Box::into_raw(Box::new(e)),
12929                 },
12930                 result_ok: false,
12931         }
12932 }
12933 /// Checks if the given object is currently in the success state
12934 #[no_mangle]
12935 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool {
12936         o.result_ok
12937 }
12938 #[no_mangle]
12939 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.
12940 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { }
12941 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12942         fn drop(&mut self) {
12943                 if self.result_ok {
12944                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12945                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12946                         }
12947                 } else {
12948                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12949                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12950                         }
12951                 }
12952         }
12953 }
12954 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12955         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
12956                 let contents = if o.result_ok {
12957                         let result = unsafe { o.contents.result };
12958                         unsafe { o.contents.result = core::ptr::null_mut() };
12959                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result }
12960                 } else {
12961                         let err = unsafe { o.contents.err };
12962                         unsafe { o.contents.err = core::ptr::null_mut(); }
12963                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err }
12964                 };
12965                 Self {
12966                         contents,
12967                         result_ok: o.result_ok,
12968                 }
12969         }
12970 }
12971 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ {
12972         fn clone(&self) -> Self {
12973                 if self.result_ok {
12974                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12975                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
12976                         } }
12977                 } else {
12978                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr {
12979                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12980                         } }
12981                 }
12982         }
12983 }
12984 #[no_mangle]
12985 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig`
12986 /// but with all dynamically-allocated buffers duplicated in new buffers.
12987 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) }
12988 #[repr(C)]
12989 /// A tuple of 2 elements. See the individual fields for the types contained.
12990 pub struct C2Tuple_PublicKeyTypeZ {
12991         /// The element at position 0
12992         pub a: crate::c_types::PublicKey,
12993         /// The element at position 1
12994         pub b: crate::lightning::ln::wire::Type,
12995 }
12996 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
12997         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
12998                 Self {
12999                         a: tup.0,
13000                         b: tup.1,
13001                 }
13002         }
13003 }
13004 impl C2Tuple_PublicKeyTypeZ {
13005         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
13006                 (self.a, self.b)
13007         }
13008 }
13009 impl Clone for C2Tuple_PublicKeyTypeZ {
13010         fn clone(&self) -> Self {
13011                 Self {
13012                         a: Clone::clone(&self.a),
13013                         b: Clone::clone(&self.b),
13014                 }
13015         }
13016 }
13017 #[no_mangle]
13018 /// Creates a new tuple which has the same data as `orig`
13019 /// but with all dynamically-allocated buffers duplicated in new buffers.
13020 pub extern "C" fn C2Tuple_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) }
13021 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
13022 #[no_mangle]
13023 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
13024         C2Tuple_PublicKeyTypeZ { a, b, }
13025 }
13026
13027 #[no_mangle]
13028 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
13029 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
13030 #[repr(C)]
13031 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
13032 /// This corresponds to std::vector in C++
13033 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
13034         /// The elements in the array.
13035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13036         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
13037         /// The number of elements pointed to by `data`.
13038         pub datalen: usize
13039 }
13040 impl CVec_C2Tuple_PublicKeyTypeZZ {
13041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
13042                 if self.datalen == 0 { return Vec::new(); }
13043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13044                 self.data = core::ptr::null_mut();
13045                 self.datalen = 0;
13046                 ret
13047         }
13048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
13049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13050         }
13051 }
13052 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
13053         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
13054                 let datalen = v.len();
13055                 let data = Box::into_raw(v.into_boxed_slice());
13056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13057         }
13058 }
13059 #[no_mangle]
13060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13061 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
13062 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
13063         fn drop(&mut self) {
13064                 if self.datalen == 0 { return; }
13065                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13066         }
13067 }
13068 impl Clone for CVec_C2Tuple_PublicKeyTypeZZ {
13069         fn clone(&self) -> Self {
13070                 let mut res = Vec::new();
13071                 if self.datalen == 0 { return Self::from(res); }
13072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13073                 Self::from(res)
13074         }
13075 }
13076 #[repr(C)]
13077 /// A tuple of 2 elements. See the individual fields for the types contained.
13078 pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ {
13079         /// The element at position 0
13080         pub a: crate::c_types::PublicKey,
13081         /// The element at position 1
13082         pub b: crate::c_types::derived::CVec_SocketAddressZ,
13083 }
13084 impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13085         fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self {
13086                 Self {
13087                         a: tup.0,
13088                         b: tup.1,
13089                 }
13090         }
13091 }
13092 impl C2Tuple_PublicKeyCVec_SocketAddressZZ {
13093         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) {
13094                 (self.a, self.b)
13095         }
13096 }
13097 impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ {
13098         fn clone(&self) -> Self {
13099                 Self {
13100                         a: Clone::clone(&self.a),
13101                         b: Clone::clone(&self.b),
13102                 }
13103         }
13104 }
13105 #[no_mangle]
13106 /// Creates a new tuple which has the same data as `orig`
13107 /// but with all dynamically-allocated buffers duplicated in new buffers.
13108 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) }
13109 /// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
13110 #[no_mangle]
13111 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ {
13112         C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, }
13113 }
13114
13115 #[no_mangle]
13116 /// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ.
13117 pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { }
13118 #[repr(C)]
13119 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size.
13120 /// This corresponds to std::vector in C++
13121 pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13122         /// The elements in the array.
13123         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13124         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ,
13125         /// The number of elements pointed to by `data`.
13126         pub datalen: usize
13127 }
13128 impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13129         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ> {
13130                 if self.datalen == 0 { return Vec::new(); }
13131                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13132                 self.data = core::ptr::null_mut();
13133                 self.datalen = 0;
13134                 ret
13135         }
13136         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] {
13137                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13138         }
13139 }
13140 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13141         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ>) -> Self {
13142                 let datalen = v.len();
13143                 let data = Box::into_raw(v.into_boxed_slice());
13144                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13145         }
13146 }
13147 #[no_mangle]
13148 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13149 pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { }
13150 impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13151         fn drop(&mut self) {
13152                 if self.datalen == 0 { return; }
13153                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13154         }
13155 }
13156 impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ {
13157         fn clone(&self) -> Self {
13158                 let mut res = Vec::new();
13159                 if self.datalen == 0 { return Self::from(res); }
13160                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13161                 Self::from(res)
13162         }
13163 }
13164 #[repr(C)]
13165 #[derive(Clone)]
13166 /// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not
13167 pub enum COption_OnionMessageContentsZ {
13168         /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents
13169         Some(crate::lightning::onion_message::packet::OnionMessageContents),
13170         /// When we're in this state, this COption_OnionMessageContentsZ contains nothing
13171         None
13172 }
13173 impl COption_OnionMessageContentsZ {
13174         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13175                 if let Self::None = self { false } else { true }
13176         }
13177         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13178                 !self.is_some()
13179         }
13180         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents {
13181                 if let Self::Some(v) = self { v } else { unreachable!() }
13182         }
13183 }
13184 #[no_mangle]
13185 /// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents
13186 pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ {
13187         COption_OnionMessageContentsZ::Some(o)
13188 }
13189 #[no_mangle]
13190 /// Constructs a new COption_OnionMessageContentsZ containing nothing
13191 pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ {
13192         COption_OnionMessageContentsZ::None
13193 }
13194 #[no_mangle]
13195 /// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state
13196 pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { }
13197 #[no_mangle]
13198 /// Creates a new COption_OnionMessageContentsZ which has the same data as `orig`
13199 /// but with all dynamically-allocated buffers duplicated in new buffers.
13200 pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) }
13201 #[repr(C)]
13202 /// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ
13203 pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13204         /// A pointer to the contents in the success state.
13205         /// Reading from this pointer when `result_ok` is not set is undefined.
13206         pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ,
13207         /// A pointer to the contents in the error state.
13208         /// Reading from this pointer when `result_ok` is set is undefined.
13209         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13210 }
13211 #[repr(C)]
13212 /// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
13213 /// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13215 pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ {
13216         /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either
13217         /// `err` or `result` depending on the state of `result_ok`.
13218         pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr,
13219         /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state.
13220         pub result_ok: bool,
13221 }
13222 #[no_mangle]
13223 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state.
13224 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13225         CResult_COption_OnionMessageContentsZDecodeErrorZ {
13226                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13227                         result: Box::into_raw(Box::new(o)),
13228                 },
13229                 result_ok: true,
13230         }
13231 }
13232 #[no_mangle]
13233 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state.
13234 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ {
13235         CResult_COption_OnionMessageContentsZDecodeErrorZ {
13236                 contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13237                         err: Box::into_raw(Box::new(e)),
13238                 },
13239                 result_ok: false,
13240         }
13241 }
13242 /// Checks if the given object is currently in the success state
13243 #[no_mangle]
13244 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool {
13245         o.result_ok
13246 }
13247 #[no_mangle]
13248 /// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ.
13249 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { }
13250 impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13251         fn drop(&mut self) {
13252                 if self.result_ok {
13253                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13254                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13255                         }
13256                 } else {
13257                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13258                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13259                         }
13260                 }
13261         }
13262 }
13263 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13264         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13265                 let contents = if o.result_ok {
13266                         let result = unsafe { o.contents.result };
13267                         unsafe { o.contents.result = core::ptr::null_mut() };
13268                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result }
13269                 } else {
13270                         let err = unsafe { o.contents.err };
13271                         unsafe { o.contents.err = core::ptr::null_mut(); }
13272                         CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err }
13273                 };
13274                 Self {
13275                         contents,
13276                         result_ok: o.result_ok,
13277                 }
13278         }
13279 }
13280 impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ {
13281         fn clone(&self) -> Self {
13282                 if self.result_ok {
13283                         Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13284                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OnionMessageContentsZ>::clone(unsafe { &*self.contents.result })))
13285                         } }
13286                 } else {
13287                         Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr {
13288                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13289                         } }
13290                 }
13291         }
13292 }
13293 #[no_mangle]
13294 /// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig`
13295 /// but with all dynamically-allocated buffers duplicated in new buffers.
13296 pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) }
13297 #[repr(C)]
13298 /// A tuple of 3 elements. See the individual fields for the types contained.
13299 pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13300         /// The element at position 0
13301         pub a: crate::lightning::onion_message::packet::OnionMessageContents,
13302         /// The element at position 1
13303         pub b: crate::lightning::onion_message::messenger::Destination,
13304         /// The element at position 2
13305         pub c: crate::lightning::blinded_path::BlindedPath,
13306 }
13307 impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13308         fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self {
13309                 Self {
13310                         a: tup.0,
13311                         b: tup.1,
13312                         c: tup.2,
13313                 }
13314         }
13315 }
13316 impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13317         #[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) {
13318                 (self.a, self.b, self.c)
13319         }
13320 }
13321 impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ {
13322         fn clone(&self) -> Self {
13323                 Self {
13324                         a: Clone::clone(&self.a),
13325                         b: Clone::clone(&self.b),
13326                         c: Clone::clone(&self.c),
13327                 }
13328         }
13329 }
13330 #[no_mangle]
13331 /// Creates a new tuple which has the same data as `orig`
13332 /// but with all dynamically-allocated buffers duplicated in new buffers.
13333 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) }
13334 /// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements.
13335 #[no_mangle]
13336 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 {
13337         C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, }
13338 }
13339
13340 #[no_mangle]
13341 /// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ.
13342 pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { }
13343 #[repr(C)]
13344 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size.
13345 /// This corresponds to std::vector in C++
13346 pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13347         /// The elements in the array.
13348         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13349         pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ,
13350         /// The number of elements pointed to by `data`.
13351         pub datalen: usize
13352 }
13353 impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13354         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ> {
13355                 if self.datalen == 0 { return Vec::new(); }
13356                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13357                 self.data = core::ptr::null_mut();
13358                 self.datalen = 0;
13359                 ret
13360         }
13361         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] {
13362                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13363         }
13364 }
13365 impl From<Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13366         fn from(v: Vec<crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ>) -> Self {
13367                 let datalen = v.len();
13368                 let data = Box::into_raw(v.into_boxed_slice());
13369                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13370         }
13371 }
13372 #[no_mangle]
13373 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13374 pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { }
13375 impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13376         fn drop(&mut self) {
13377                 if self.datalen == 0 { return; }
13378                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13379         }
13380 }
13381 impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
13382         fn clone(&self) -> Self {
13383                 let mut res = Vec::new();
13384                 if self.datalen == 0 { return Self::from(res); }
13385                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13386                 Self::from(res)
13387         }
13388 }
13389 #[repr(C)]
13390 #[derive(Clone)]
13391 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
13392 pub enum COption_TypeZ {
13393         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
13394         Some(crate::lightning::ln::wire::Type),
13395         /// When we're in this state, this COption_TypeZ contains nothing
13396         None
13397 }
13398 impl COption_TypeZ {
13399         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13400                 if let Self::None = self { false } else { true }
13401         }
13402         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13403                 !self.is_some()
13404         }
13405         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
13406                 if let Self::Some(v) = self { v } else { unreachable!() }
13407         }
13408 }
13409 #[no_mangle]
13410 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
13411 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
13412         COption_TypeZ::Some(o)
13413 }
13414 #[no_mangle]
13415 /// Constructs a new COption_TypeZ containing nothing
13416 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
13417         COption_TypeZ::None
13418 }
13419 #[no_mangle]
13420 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
13421 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
13422 #[no_mangle]
13423 /// Creates a new COption_TypeZ which has the same data as `orig`
13424 /// but with all dynamically-allocated buffers duplicated in new buffers.
13425 pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) }
13426 #[repr(C)]
13427 /// The contents of CResult_COption_TypeZDecodeErrorZ
13428 pub union CResult_COption_TypeZDecodeErrorZPtr {
13429         /// A pointer to the contents in the success state.
13430         /// Reading from this pointer when `result_ok` is not set is undefined.
13431         pub result: *mut crate::c_types::derived::COption_TypeZ,
13432         /// A pointer to the contents in the error state.
13433         /// Reading from this pointer when `result_ok` is set is undefined.
13434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13435 }
13436 #[repr(C)]
13437 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
13438 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
13439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13440 pub struct CResult_COption_TypeZDecodeErrorZ {
13441         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
13442         /// `err` or `result` depending on the state of `result_ok`.
13443         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
13444         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
13445         pub result_ok: bool,
13446 }
13447 #[no_mangle]
13448 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
13449 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
13450         CResult_COption_TypeZDecodeErrorZ {
13451                 contents: CResult_COption_TypeZDecodeErrorZPtr {
13452                         result: Box::into_raw(Box::new(o)),
13453                 },
13454                 result_ok: true,
13455         }
13456 }
13457 #[no_mangle]
13458 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
13459 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
13460         CResult_COption_TypeZDecodeErrorZ {
13461                 contents: CResult_COption_TypeZDecodeErrorZPtr {
13462                         err: Box::into_raw(Box::new(e)),
13463                 },
13464                 result_ok: false,
13465         }
13466 }
13467 /// Checks if the given object is currently in the success state
13468 #[no_mangle]
13469 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
13470         o.result_ok
13471 }
13472 #[no_mangle]
13473 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
13474 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
13475 impl Drop for CResult_COption_TypeZDecodeErrorZ {
13476         fn drop(&mut self) {
13477                 if self.result_ok {
13478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13480                         }
13481                 } else {
13482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13484                         }
13485                 }
13486         }
13487 }
13488 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
13489         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
13490                 let contents = if o.result_ok {
13491                         let result = unsafe { o.contents.result };
13492                         unsafe { o.contents.result = core::ptr::null_mut() };
13493                         CResult_COption_TypeZDecodeErrorZPtr { result }
13494                 } else {
13495                         let err = unsafe { o.contents.err };
13496                         unsafe { o.contents.err = core::ptr::null_mut(); }
13497                         CResult_COption_TypeZDecodeErrorZPtr { err }
13498                 };
13499                 Self {
13500                         contents,
13501                         result_ok: o.result_ok,
13502                 }
13503         }
13504 }
13505 impl Clone for CResult_COption_TypeZDecodeErrorZ {
13506         fn clone(&self) -> Self {
13507                 if self.result_ok {
13508                         Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr {
13509                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_TypeZ>::clone(unsafe { &*self.contents.result })))
13510                         } }
13511                 } else {
13512                         Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr {
13513                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13514                         } }
13515                 }
13516         }
13517 }
13518 #[no_mangle]
13519 /// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
13520 /// but with all dynamically-allocated buffers duplicated in new buffers.
13521 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) }
13522 #[repr(C)]
13523 #[derive(Clone)]
13524 /// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not
13525 pub enum COption_SocketAddressZ {
13526         /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress
13527         Some(crate::lightning::ln::msgs::SocketAddress),
13528         /// When we're in this state, this COption_SocketAddressZ contains nothing
13529         None
13530 }
13531 impl COption_SocketAddressZ {
13532         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
13533                 if let Self::None = self { false } else { true }
13534         }
13535         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
13536                 !self.is_some()
13537         }
13538         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress {
13539                 if let Self::Some(v) = self { v } else { unreachable!() }
13540         }
13541 }
13542 #[no_mangle]
13543 /// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress
13544 pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ {
13545         COption_SocketAddressZ::Some(o)
13546 }
13547 #[no_mangle]
13548 /// Constructs a new COption_SocketAddressZ containing nothing
13549 pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ {
13550         COption_SocketAddressZ::None
13551 }
13552 #[no_mangle]
13553 /// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state
13554 pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { }
13555 #[no_mangle]
13556 /// Creates a new COption_SocketAddressZ which has the same data as `orig`
13557 /// but with all dynamically-allocated buffers duplicated in new buffers.
13558 pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) }
13559 #[repr(C)]
13560 /// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size.
13561 /// This corresponds to std::vector in C++
13562 pub struct CVec_PeerDetailsZ {
13563         /// The elements in the array.
13564         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13565         pub data: *mut crate::lightning::ln::peer_handler::PeerDetails,
13566         /// The number of elements pointed to by `data`.
13567         pub datalen: usize
13568 }
13569 impl CVec_PeerDetailsZ {
13570         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::peer_handler::PeerDetails> {
13571                 if self.datalen == 0 { return Vec::new(); }
13572                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13573                 self.data = core::ptr::null_mut();
13574                 self.datalen = 0;
13575                 ret
13576         }
13577         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] {
13578                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13579         }
13580 }
13581 impl From<Vec<crate::lightning::ln::peer_handler::PeerDetails>> for CVec_PeerDetailsZ {
13582         fn from(v: Vec<crate::lightning::ln::peer_handler::PeerDetails>) -> Self {
13583                 let datalen = v.len();
13584                 let data = Box::into_raw(v.into_boxed_slice());
13585                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13586         }
13587 }
13588 #[no_mangle]
13589 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13590 pub extern "C" fn CVec_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { }
13591 impl Drop for CVec_PeerDetailsZ {
13592         fn drop(&mut self) {
13593                 if self.datalen == 0 { return; }
13594                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13595         }
13596 }
13597 #[repr(C)]
13598 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
13599 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
13600         /// A pointer to the contents in the success state.
13601         /// Reading from this pointer when `result_ok` is not set is undefined.
13602         pub result: *mut crate::c_types::derived::CVec_u8Z,
13603         /// A pointer to the contents in the error state.
13604         /// Reading from this pointer when `result_ok` is set is undefined.
13605         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13606 }
13607 #[repr(C)]
13608 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
13609 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13611 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
13612         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
13613         /// `err` or `result` depending on the state of `result_ok`.
13614         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
13615         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
13616         pub result_ok: bool,
13617 }
13618 #[no_mangle]
13619 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
13620 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
13621         CResult_CVec_u8ZPeerHandleErrorZ {
13622                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13623                         result: Box::into_raw(Box::new(o)),
13624                 },
13625                 result_ok: true,
13626         }
13627 }
13628 #[no_mangle]
13629 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
13630 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
13631         CResult_CVec_u8ZPeerHandleErrorZ {
13632                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13633                         err: Box::into_raw(Box::new(e)),
13634                 },
13635                 result_ok: false,
13636         }
13637 }
13638 /// Checks if the given object is currently in the success state
13639 #[no_mangle]
13640 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
13641         o.result_ok
13642 }
13643 #[no_mangle]
13644 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
13645 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
13646 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
13647         fn drop(&mut self) {
13648                 if self.result_ok {
13649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13651                         }
13652                 } else {
13653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13655                         }
13656                 }
13657         }
13658 }
13659 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
13660         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13661                 let contents = if o.result_ok {
13662                         let result = unsafe { o.contents.result };
13663                         unsafe { o.contents.result = core::ptr::null_mut() };
13664                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
13665                 } else {
13666                         let err = unsafe { o.contents.err };
13667                         unsafe { o.contents.err = core::ptr::null_mut(); }
13668                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
13669                 };
13670                 Self {
13671                         contents,
13672                         result_ok: o.result_ok,
13673                 }
13674         }
13675 }
13676 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
13677         fn clone(&self) -> Self {
13678                 if self.result_ok {
13679                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13680                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
13681                         } }
13682                 } else {
13683                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
13684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13685                         } }
13686                 }
13687         }
13688 }
13689 #[no_mangle]
13690 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
13691 /// but with all dynamically-allocated buffers duplicated in new buffers.
13692 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
13693 #[repr(C)]
13694 /// The contents of CResult_NonePeerHandleErrorZ
13695 pub union CResult_NonePeerHandleErrorZPtr {
13696         /// Note that this value is always NULL, as there are no contents in the OK variant
13697         pub result: *mut core::ffi::c_void,
13698         /// A pointer to the contents in the error state.
13699         /// Reading from this pointer when `result_ok` is set is undefined.
13700         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13701 }
13702 #[repr(C)]
13703 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
13704 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13705 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13706 pub struct CResult_NonePeerHandleErrorZ {
13707         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
13708         /// `err` or `result` depending on the state of `result_ok`.
13709         pub contents: CResult_NonePeerHandleErrorZPtr,
13710         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
13711         pub result_ok: bool,
13712 }
13713 #[no_mangle]
13714 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
13715 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
13716         CResult_NonePeerHandleErrorZ {
13717                 contents: CResult_NonePeerHandleErrorZPtr {
13718                         result: core::ptr::null_mut(),
13719                 },
13720                 result_ok: true,
13721         }
13722 }
13723 #[no_mangle]
13724 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
13725 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
13726         CResult_NonePeerHandleErrorZ {
13727                 contents: CResult_NonePeerHandleErrorZPtr {
13728                         err: Box::into_raw(Box::new(e)),
13729                 },
13730                 result_ok: false,
13731         }
13732 }
13733 /// Checks if the given object is currently in the success state
13734 #[no_mangle]
13735 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
13736         o.result_ok
13737 }
13738 #[no_mangle]
13739 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
13740 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
13741 impl Drop for CResult_NonePeerHandleErrorZ {
13742         fn drop(&mut self) {
13743                 if self.result_ok {
13744                 } else {
13745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13747                         }
13748                 }
13749         }
13750 }
13751 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
13752         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13753                 let contents = if o.result_ok {
13754                         let _ = unsafe { Box::from_raw(o.contents.result) };
13755                         o.contents.result = core::ptr::null_mut();
13756                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
13757                 } else {
13758                         let err = unsafe { o.contents.err };
13759                         unsafe { o.contents.err = core::ptr::null_mut(); }
13760                         CResult_NonePeerHandleErrorZPtr { err }
13761                 };
13762                 Self {
13763                         contents,
13764                         result_ok: o.result_ok,
13765                 }
13766         }
13767 }
13768 impl Clone for CResult_NonePeerHandleErrorZ {
13769         fn clone(&self) -> Self {
13770                 if self.result_ok {
13771                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
13772                                 result: core::ptr::null_mut()
13773                         } }
13774                 } else {
13775                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
13776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13777                         } }
13778                 }
13779         }
13780 }
13781 #[no_mangle]
13782 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
13783 /// but with all dynamically-allocated buffers duplicated in new buffers.
13784 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
13785 #[repr(C)]
13786 /// The contents of CResult_boolPeerHandleErrorZ
13787 pub union CResult_boolPeerHandleErrorZPtr {
13788         /// A pointer to the contents in the success state.
13789         /// Reading from this pointer when `result_ok` is not set is undefined.
13790         pub result: *mut bool,
13791         /// A pointer to the contents in the error state.
13792         /// Reading from this pointer when `result_ok` is set is undefined.
13793         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
13794 }
13795 #[repr(C)]
13796 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
13797 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
13798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13799 pub struct CResult_boolPeerHandleErrorZ {
13800         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
13801         /// `err` or `result` depending on the state of `result_ok`.
13802         pub contents: CResult_boolPeerHandleErrorZPtr,
13803         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
13804         pub result_ok: bool,
13805 }
13806 #[no_mangle]
13807 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
13808 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
13809         CResult_boolPeerHandleErrorZ {
13810                 contents: CResult_boolPeerHandleErrorZPtr {
13811                         result: Box::into_raw(Box::new(o)),
13812                 },
13813                 result_ok: true,
13814         }
13815 }
13816 #[no_mangle]
13817 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
13818 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
13819         CResult_boolPeerHandleErrorZ {
13820                 contents: CResult_boolPeerHandleErrorZPtr {
13821                         err: Box::into_raw(Box::new(e)),
13822                 },
13823                 result_ok: false,
13824         }
13825 }
13826 /// Checks if the given object is currently in the success state
13827 #[no_mangle]
13828 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
13829         o.result_ok
13830 }
13831 #[no_mangle]
13832 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
13833 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
13834 impl Drop for CResult_boolPeerHandleErrorZ {
13835         fn drop(&mut self) {
13836                 if self.result_ok {
13837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13839                         }
13840                 } else {
13841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13843                         }
13844                 }
13845         }
13846 }
13847 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
13848         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
13849                 let contents = if o.result_ok {
13850                         let result = unsafe { o.contents.result };
13851                         unsafe { o.contents.result = core::ptr::null_mut() };
13852                         CResult_boolPeerHandleErrorZPtr { result }
13853                 } else {
13854                         let err = unsafe { o.contents.err };
13855                         unsafe { o.contents.err = core::ptr::null_mut(); }
13856                         CResult_boolPeerHandleErrorZPtr { err }
13857                 };
13858                 Self {
13859                         contents,
13860                         result_ok: o.result_ok,
13861                 }
13862         }
13863 }
13864 impl Clone for CResult_boolPeerHandleErrorZ {
13865         fn clone(&self) -> Self {
13866                 if self.result_ok {
13867                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
13868                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
13869                         } }
13870                 } else {
13871                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
13872                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
13873                         } }
13874                 }
13875         }
13876 }
13877 #[no_mangle]
13878 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
13879 /// but with all dynamically-allocated buffers duplicated in new buffers.
13880 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
13881 #[repr(C)]
13882 /// The contents of CResult_u32GraphSyncErrorZ
13883 pub union CResult_u32GraphSyncErrorZPtr {
13884         /// A pointer to the contents in the success state.
13885         /// Reading from this pointer when `result_ok` is not set is undefined.
13886         pub result: *mut u32,
13887         /// A pointer to the contents in the error state.
13888         /// Reading from this pointer when `result_ok` is set is undefined.
13889         pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError,
13890 }
13891 #[repr(C)]
13892 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13893 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure.
13894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13895 pub struct CResult_u32GraphSyncErrorZ {
13896         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13897         /// `err` or `result` depending on the state of `result_ok`.
13898         pub contents: CResult_u32GraphSyncErrorZPtr,
13899         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13900         pub result_ok: bool,
13901 }
13902 #[no_mangle]
13903 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13904 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13905         CResult_u32GraphSyncErrorZ {
13906                 contents: CResult_u32GraphSyncErrorZPtr {
13907                         result: Box::into_raw(Box::new(o)),
13908                 },
13909                 result_ok: true,
13910         }
13911 }
13912 #[no_mangle]
13913 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13914 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13915         CResult_u32GraphSyncErrorZ {
13916                 contents: CResult_u32GraphSyncErrorZPtr {
13917                         err: Box::into_raw(Box::new(e)),
13918                 },
13919                 result_ok: false,
13920         }
13921 }
13922 /// Checks if the given object is currently in the success state
13923 #[no_mangle]
13924 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13925         o.result_ok
13926 }
13927 #[no_mangle]
13928 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13929 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13930 impl Drop for CResult_u32GraphSyncErrorZ {
13931         fn drop(&mut self) {
13932                 if self.result_ok {
13933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13935                         }
13936                 } else {
13937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13939                         }
13940                 }
13941         }
13942 }
13943 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13944         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::GraphSyncError>) -> Self {
13945                 let contents = if o.result_ok {
13946                         let result = unsafe { o.contents.result };
13947                         unsafe { o.contents.result = core::ptr::null_mut() };
13948                         CResult_u32GraphSyncErrorZPtr { result }
13949                 } else {
13950                         let err = unsafe { o.contents.err };
13951                         unsafe { o.contents.err = core::ptr::null_mut(); }
13952                         CResult_u32GraphSyncErrorZPtr { err }
13953                 };
13954                 Self {
13955                         contents,
13956                         result_ok: o.result_ok,
13957                 }
13958         }
13959 }
13960 #[repr(C)]
13961 /// The contents of CResult_CVec_u8ZIOErrorZ
13962 pub union CResult_CVec_u8ZIOErrorZPtr {
13963         /// A pointer to the contents in the success state.
13964         /// Reading from this pointer when `result_ok` is not set is undefined.
13965         pub result: *mut crate::c_types::derived::CVec_u8Z,
13966         /// A pointer to the contents in the error state.
13967         /// Reading from this pointer when `result_ok` is set is undefined.
13968         pub err: *mut crate::c_types::IOError,
13969 }
13970 #[repr(C)]
13971 /// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation,
13972 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure.
13973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13974 pub struct CResult_CVec_u8ZIOErrorZ {
13975         /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either
13976         /// `err` or `result` depending on the state of `result_ok`.
13977         pub contents: CResult_CVec_u8ZIOErrorZPtr,
13978         /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state.
13979         pub result_ok: bool,
13980 }
13981 #[no_mangle]
13982 /// Creates a new CResult_CVec_u8ZIOErrorZ in the success state.
13983 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ {
13984         CResult_CVec_u8ZIOErrorZ {
13985                 contents: CResult_CVec_u8ZIOErrorZPtr {
13986                         result: Box::into_raw(Box::new(o)),
13987                 },
13988                 result_ok: true,
13989         }
13990 }
13991 #[no_mangle]
13992 /// Creates a new CResult_CVec_u8ZIOErrorZ in the error state.
13993 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ {
13994         CResult_CVec_u8ZIOErrorZ {
13995                 contents: CResult_CVec_u8ZIOErrorZPtr {
13996                         err: Box::into_raw(Box::new(e)),
13997                 },
13998                 result_ok: false,
13999         }
14000 }
14001 /// Checks if the given object is currently in the success state
14002 #[no_mangle]
14003 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool {
14004         o.result_ok
14005 }
14006 #[no_mangle]
14007 /// Frees any resources used by the CResult_CVec_u8ZIOErrorZ.
14008 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { }
14009 impl Drop for CResult_CVec_u8ZIOErrorZ {
14010         fn drop(&mut self) {
14011                 if self.result_ok {
14012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14014                         }
14015                 } else {
14016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14018                         }
14019                 }
14020         }
14021 }
14022 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>> for CResult_CVec_u8ZIOErrorZ {
14023         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::IOError>) -> Self {
14024                 let contents = if o.result_ok {
14025                         let result = unsafe { o.contents.result };
14026                         unsafe { o.contents.result = core::ptr::null_mut() };
14027                         CResult_CVec_u8ZIOErrorZPtr { result }
14028                 } else {
14029                         let err = unsafe { o.contents.err };
14030                         unsafe { o.contents.err = core::ptr::null_mut(); }
14031                         CResult_CVec_u8ZIOErrorZPtr { err }
14032                 };
14033                 Self {
14034                         contents,
14035                         result_ok: o.result_ok,
14036                 }
14037         }
14038 }
14039 impl Clone for CResult_CVec_u8ZIOErrorZ {
14040         fn clone(&self) -> Self {
14041                 if self.result_ok {
14042                         Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr {
14043                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
14044                         } }
14045                 } else {
14046                         Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr {
14047                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14048                         } }
14049                 }
14050         }
14051 }
14052 #[no_mangle]
14053 /// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig`
14054 /// but with all dynamically-allocated buffers duplicated in new buffers.
14055 pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) }
14056 #[repr(C)]
14057 /// A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
14058 /// This corresponds to std::vector in C++
14059 pub struct CVec_StrZ {
14060         /// The elements in the array.
14061         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14062         pub data: *mut crate::c_types::Str,
14063         /// The number of elements pointed to by `data`.
14064         pub datalen: usize
14065 }
14066 impl CVec_StrZ {
14067         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Str> {
14068                 if self.datalen == 0 { return Vec::new(); }
14069                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14070                 self.data = core::ptr::null_mut();
14071                 self.datalen = 0;
14072                 ret
14073         }
14074         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] {
14075                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14076         }
14077 }
14078 impl From<Vec<crate::c_types::Str>> for CVec_StrZ {
14079         fn from(v: Vec<crate::c_types::Str>) -> Self {
14080                 let datalen = v.len();
14081                 let data = Box::into_raw(v.into_boxed_slice());
14082                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14083         }
14084 }
14085 #[no_mangle]
14086 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14087 pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { }
14088 impl Drop for CVec_StrZ {
14089         fn drop(&mut self) {
14090                 if self.datalen == 0 { return; }
14091                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14092         }
14093 }
14094 impl Clone for CVec_StrZ {
14095         fn clone(&self) -> Self {
14096                 let mut res = Vec::new();
14097                 if self.datalen == 0 { return Self::from(res); }
14098                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14099                 Self::from(res)
14100         }
14101 }
14102 #[repr(C)]
14103 /// The contents of CResult_CVec_StrZIOErrorZ
14104 pub union CResult_CVec_StrZIOErrorZPtr {
14105         /// A pointer to the contents in the success state.
14106         /// Reading from this pointer when `result_ok` is not set is undefined.
14107         pub result: *mut crate::c_types::derived::CVec_StrZ,
14108         /// A pointer to the contents in the error state.
14109         /// Reading from this pointer when `result_ok` is set is undefined.
14110         pub err: *mut crate::c_types::IOError,
14111 }
14112 #[repr(C)]
14113 /// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation,
14114 /// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure.
14115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14116 pub struct CResult_CVec_StrZIOErrorZ {
14117         /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either
14118         /// `err` or `result` depending on the state of `result_ok`.
14119         pub contents: CResult_CVec_StrZIOErrorZPtr,
14120         /// Whether this CResult_CVec_StrZIOErrorZ represents a success state.
14121         pub result_ok: bool,
14122 }
14123 #[no_mangle]
14124 /// Creates a new CResult_CVec_StrZIOErrorZ in the success state.
14125 pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ {
14126         CResult_CVec_StrZIOErrorZ {
14127                 contents: CResult_CVec_StrZIOErrorZPtr {
14128                         result: Box::into_raw(Box::new(o)),
14129                 },
14130                 result_ok: true,
14131         }
14132 }
14133 #[no_mangle]
14134 /// Creates a new CResult_CVec_StrZIOErrorZ in the error state.
14135 pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ {
14136         CResult_CVec_StrZIOErrorZ {
14137                 contents: CResult_CVec_StrZIOErrorZPtr {
14138                         err: Box::into_raw(Box::new(e)),
14139                 },
14140                 result_ok: false,
14141         }
14142 }
14143 /// Checks if the given object is currently in the success state
14144 #[no_mangle]
14145 pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool {
14146         o.result_ok
14147 }
14148 #[no_mangle]
14149 /// Frees any resources used by the CResult_CVec_StrZIOErrorZ.
14150 pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { }
14151 impl Drop for CResult_CVec_StrZIOErrorZ {
14152         fn drop(&mut self) {
14153                 if self.result_ok {
14154                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14155                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14156                         }
14157                 } else {
14158                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14159                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14160                         }
14161                 }
14162         }
14163 }
14164 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>> for CResult_CVec_StrZIOErrorZ {
14165         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_StrZ, crate::c_types::IOError>) -> Self {
14166                 let contents = if o.result_ok {
14167                         let result = unsafe { o.contents.result };
14168                         unsafe { o.contents.result = core::ptr::null_mut() };
14169                         CResult_CVec_StrZIOErrorZPtr { result }
14170                 } else {
14171                         let err = unsafe { o.contents.err };
14172                         unsafe { o.contents.err = core::ptr::null_mut(); }
14173                         CResult_CVec_StrZIOErrorZPtr { err }
14174                 };
14175                 Self {
14176                         contents,
14177                         result_ok: o.result_ok,
14178                 }
14179         }
14180 }
14181 impl Clone for CResult_CVec_StrZIOErrorZ {
14182         fn clone(&self) -> Self {
14183                 if self.result_ok {
14184                         Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr {
14185                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_StrZ>::clone(unsafe { &*self.contents.result })))
14186                         } }
14187                 } else {
14188                         Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr {
14189                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14190                         } }
14191                 }
14192         }
14193 }
14194 #[no_mangle]
14195 /// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig`
14196 /// but with all dynamically-allocated buffers duplicated in new buffers.
14197 pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) }
14198 #[repr(C)]
14199 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size.
14200 /// This corresponds to std::vector in C++
14201 pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14202         /// The elements in the array.
14203         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14204         pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14205         /// The number of elements pointed to by `data`.
14206         pub datalen: usize
14207 }
14208 impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14209         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ> {
14210                 if self.datalen == 0 { return Vec::new(); }
14211                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14212                 self.data = core::ptr::null_mut();
14213                 self.datalen = 0;
14214                 ret
14215         }
14216         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] {
14217                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14218         }
14219 }
14220 impl From<Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14221         fn from(v: Vec<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>) -> Self {
14222                 let datalen = v.len();
14223                 let data = Box::into_raw(v.into_boxed_slice());
14224                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14225         }
14226 }
14227 #[no_mangle]
14228 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14229 pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { }
14230 impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14231         fn drop(&mut self) {
14232                 if self.datalen == 0 { return; }
14233                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14234         }
14235 }
14236 impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ {
14237         fn clone(&self) -> Self {
14238                 let mut res = Vec::new();
14239                 if self.datalen == 0 { return Self::from(res); }
14240                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14241                 Self::from(res)
14242         }
14243 }
14244 #[repr(C)]
14245 /// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ
14246 pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14247         /// A pointer to the contents in the success state.
14248         /// Reading from this pointer when `result_ok` is not set is undefined.
14249         pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ,
14250         /// A pointer to the contents in the error state.
14251         /// Reading from this pointer when `result_ok` is set is undefined.
14252         pub err: *mut crate::c_types::IOError,
14253 }
14254 #[repr(C)]
14255 /// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation,
14256 /// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure.
14257 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14258 pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14259         /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either
14260         /// `err` or `result` depending on the state of `result_ok`.
14261         pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr,
14262         /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state.
14263         pub result_ok: bool,
14264 }
14265 #[no_mangle]
14266 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state.
14267 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14268         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14269                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14270                         result: Box::into_raw(Box::new(o)),
14271                 },
14272                 result_ok: true,
14273         }
14274 }
14275 #[no_mangle]
14276 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state.
14277 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14278         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14279                 contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14280                         err: Box::into_raw(Box::new(e)),
14281                 },
14282                 result_ok: false,
14283         }
14284 }
14285 /// Checks if the given object is currently in the success state
14286 #[no_mangle]
14287 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool {
14288         o.result_ok
14289 }
14290 #[no_mangle]
14291 /// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.
14292 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { }
14293 impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14294         fn drop(&mut self) {
14295                 if self.result_ok {
14296                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14297                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14298                         }
14299                 } else {
14300                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14301                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14302                         }
14303                 }
14304         }
14305 }
14306 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14307         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, crate::c_types::IOError>) -> Self {
14308                 let contents = if o.result_ok {
14309                         let result = unsafe { o.contents.result };
14310                         unsafe { o.contents.result = core::ptr::null_mut() };
14311                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result }
14312                 } else {
14313                         let err = unsafe { o.contents.err };
14314                         unsafe { o.contents.err = core::ptr::null_mut(); }
14315                         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err }
14316                 };
14317                 Self {
14318                         contents,
14319                         result_ok: o.result_ok,
14320                 }
14321         }
14322 }
14323 impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ {
14324         fn clone(&self) -> Self {
14325                 if self.result_ok {
14326                         Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14327                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ>::clone(unsafe { &*self.contents.result })))
14328                         } }
14329                 } else {
14330                         Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr {
14331                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14332                         } }
14333                 }
14334         }
14335 }
14336 #[no_mangle]
14337 /// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig`
14338 /// but with all dynamically-allocated buffers duplicated in new buffers.
14339 pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) }
14340 #[repr(C)]
14341 /// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ
14342 pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14343         /// A pointer to the contents in the success state.
14344         /// Reading from this pointer when `result_ok` is not set is undefined.
14345         pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ,
14346         /// A pointer to the contents in the error state.
14347         /// Reading from this pointer when `result_ok` is set is undefined.
14348         pub err: *mut crate::c_types::IOError,
14349 }
14350 #[repr(C)]
14351 /// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation,
14352 /// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure.
14353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14354 pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14355         /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either
14356         /// `err` or `result` depending on the state of `result_ok`.
14357         pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr,
14358         /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state.
14359         pub result_ok: bool,
14360 }
14361 #[no_mangle]
14362 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state.
14363 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14364         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14365                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14366                         result: Box::into_raw(Box::new(o)),
14367                 },
14368                 result_ok: true,
14369         }
14370 }
14371 #[no_mangle]
14372 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state.
14373 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14374         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14375                 contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14376                         err: Box::into_raw(Box::new(e)),
14377                 },
14378                 result_ok: false,
14379         }
14380 }
14381 /// Checks if the given object is currently in the success state
14382 #[no_mangle]
14383 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool {
14384         o.result_ok
14385 }
14386 #[no_mangle]
14387 /// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ.
14388 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { }
14389 impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14390         fn drop(&mut self) {
14391                 if self.result_ok {
14392                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14393                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14394                         }
14395                 } else {
14396                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14397                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14398                         }
14399                 }
14400         }
14401 }
14402 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14403         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, crate::c_types::IOError>) -> Self {
14404                 let contents = if o.result_ok {
14405                         let result = unsafe { o.contents.result };
14406                         unsafe { o.contents.result = core::ptr::null_mut() };
14407                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result }
14408                 } else {
14409                         let err = unsafe { o.contents.err };
14410                         unsafe { o.contents.err = core::ptr::null_mut(); }
14411                         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err }
14412                 };
14413                 Self {
14414                         contents,
14415                         result_ok: o.result_ok,
14416                 }
14417         }
14418 }
14419 impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ {
14420         fn clone(&self) -> Self {
14421                 if self.result_ok {
14422                         Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14423                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ>::clone(unsafe { &*self.contents.result })))
14424                         } }
14425                 } else {
14426                         Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr {
14427                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
14428                         } }
14429                 }
14430         }
14431 }
14432 #[no_mangle]
14433 /// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig`
14434 /// but with all dynamically-allocated buffers duplicated in new buffers.
14435 pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) }
14436 #[repr(C)]
14437 /// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ
14438 pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14439         /// A pointer to the contents in the success state.
14440         /// Reading from this pointer when `result_ok` is not set is undefined.
14441         pub result: *mut crate::lightning::offers::invoice_request::UnsignedInvoiceRequest,
14442         /// A pointer to the contents in the error state.
14443         /// Reading from this pointer when `result_ok` is set is undefined.
14444         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14445 }
14446 #[repr(C)]
14447 /// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14448 /// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14450 pub struct CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14451         /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either
14452         /// `err` or `result` depending on the state of `result_ok`.
14453         pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr,
14454         /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state.
14455         pub result_ok: bool,
14456 }
14457 #[no_mangle]
14458 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state.
14459 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14460         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14461                 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14462                         result: Box::into_raw(Box::new(o)),
14463                 },
14464                 result_ok: true,
14465         }
14466 }
14467 #[no_mangle]
14468 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state.
14469 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14470         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14471                 contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14472                         err: Box::into_raw(Box::new(e)),
14473                 },
14474                 result_ok: false,
14475         }
14476 }
14477 /// Checks if the given object is currently in the success state
14478 #[no_mangle]
14479 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool {
14480         o.result_ok
14481 }
14482 #[no_mangle]
14483 /// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ.
14484 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { }
14485 impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14486         fn drop(&mut self) {
14487                 if self.result_ok {
14488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14490                         }
14491                 } else {
14492                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14493                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14494                         }
14495                 }
14496         }
14497 }
14498 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14499         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14500                 let contents = if o.result_ok {
14501                         let result = unsafe { o.contents.result };
14502                         unsafe { o.contents.result = core::ptr::null_mut() };
14503                         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result }
14504                 } else {
14505                         let err = unsafe { o.contents.err };
14506                         unsafe { o.contents.err = core::ptr::null_mut(); }
14507                         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err }
14508                 };
14509                 Self {
14510                         contents,
14511                         result_ok: o.result_ok,
14512                 }
14513         }
14514 }
14515 impl Clone for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ {
14516         fn clone(&self) -> Self {
14517                 if self.result_ok {
14518                         Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14519                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::UnsignedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14520                         } }
14521                 } else {
14522                         Self { result_ok: false, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr {
14523                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14524                         } }
14525                 }
14526         }
14527 }
14528 #[no_mangle]
14529 /// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14530 /// but with all dynamically-allocated buffers duplicated in new buffers.
14531 pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14532 #[repr(C)]
14533 /// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ
14534 pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14535         /// A pointer to the contents in the success state.
14536         /// Reading from this pointer when `result_ok` is not set is undefined.
14537         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest,
14538         /// A pointer to the contents in the error state.
14539         /// Reading from this pointer when `result_ok` is set is undefined.
14540         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14541 }
14542 #[repr(C)]
14543 /// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation,
14544 /// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14546 pub struct CResult_InvoiceRequestBolt12SemanticErrorZ {
14547         /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either
14548         /// `err` or `result` depending on the state of `result_ok`.
14549         pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr,
14550         /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state.
14551         pub result_ok: bool,
14552 }
14553 #[no_mangle]
14554 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state.
14555 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14556         CResult_InvoiceRequestBolt12SemanticErrorZ {
14557                 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14558                         result: Box::into_raw(Box::new(o)),
14559                 },
14560                 result_ok: true,
14561         }
14562 }
14563 #[no_mangle]
14564 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state.
14565 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ {
14566         CResult_InvoiceRequestBolt12SemanticErrorZ {
14567                 contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14568                         err: Box::into_raw(Box::new(e)),
14569                 },
14570                 result_ok: false,
14571         }
14572 }
14573 /// Checks if the given object is currently in the success state
14574 #[no_mangle]
14575 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool {
14576         o.result_ok
14577 }
14578 #[no_mangle]
14579 /// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ.
14580 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { }
14581 impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ {
14582         fn drop(&mut self) {
14583                 if self.result_ok {
14584                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14585                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14586                         }
14587                 } else {
14588                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14589                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14590                         }
14591                 }
14592         }
14593 }
14594 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceRequestBolt12SemanticErrorZ {
14595         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequest, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14596                 let contents = if o.result_ok {
14597                         let result = unsafe { o.contents.result };
14598                         unsafe { o.contents.result = core::ptr::null_mut() };
14599                         CResult_InvoiceRequestBolt12SemanticErrorZPtr { result }
14600                 } else {
14601                         let err = unsafe { o.contents.err };
14602                         unsafe { o.contents.err = core::ptr::null_mut(); }
14603                         CResult_InvoiceRequestBolt12SemanticErrorZPtr { err }
14604                 };
14605                 Self {
14606                         contents,
14607                         result_ok: o.result_ok,
14608                 }
14609         }
14610 }
14611 impl Clone for CResult_InvoiceRequestBolt12SemanticErrorZ {
14612         fn clone(&self) -> Self {
14613                 if self.result_ok {
14614                         Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14615                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequest>::clone(unsafe { &*self.contents.result })))
14616                         } }
14617                 } else {
14618                         Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr {
14619                                 err: Box::into_raw(Box::new(<crate::lightning::offers::parse::Bolt12SemanticError>::clone(unsafe { &*self.contents.err })))
14620                         } }
14621                 }
14622         }
14623 }
14624 #[no_mangle]
14625 /// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig`
14626 /// but with all dynamically-allocated buffers duplicated in new buffers.
14627 pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) }
14628 #[repr(C)]
14629 #[derive(Clone)]
14630 /// An enum which can either contain a crate::c_types::SecretKey or not
14631 pub enum COption_SecretKeyZ {
14632         /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey
14633         Some(crate::c_types::SecretKey),
14634         /// When we're in this state, this COption_SecretKeyZ contains nothing
14635         None
14636 }
14637 impl COption_SecretKeyZ {
14638         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14639                 if let Self::None = self { false } else { true }
14640         }
14641         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14642                 !self.is_some()
14643         }
14644         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey {
14645                 if let Self::Some(v) = self { v } else { unreachable!() }
14646         }
14647 }
14648 #[no_mangle]
14649 /// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey
14650 pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ {
14651         COption_SecretKeyZ::Some(o)
14652 }
14653 #[no_mangle]
14654 /// Constructs a new COption_SecretKeyZ containing nothing
14655 pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ {
14656         COption_SecretKeyZ::None
14657 }
14658 #[no_mangle]
14659 /// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state
14660 pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { }
14661 #[no_mangle]
14662 /// Creates a new COption_SecretKeyZ which has the same data as `orig`
14663 /// but with all dynamically-allocated buffers duplicated in new buffers.
14664 pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) }
14665 #[repr(C)]
14666 /// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ
14667 pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
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::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder,
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::lightning::offers::parse::Bolt12SemanticError,
14674 }
14675 #[repr(C)]
14676 /// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14677 /// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14679 pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14680         /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14681         /// `err` or `result` depending on the state of `result_ok`.
14682         pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr,
14683         /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14684         pub result_ok: bool,
14685 }
14686 #[no_mangle]
14687 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
14688 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14689         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14690                 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14691                         result: Box::into_raw(Box::new(o)),
14692                 },
14693                 result_ok: true,
14694         }
14695 }
14696 #[no_mangle]
14697 /// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
14698 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14699         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14700                 contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr {
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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
14709         o.result_ok
14710 }
14711 #[no_mangle]
14712 /// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.
14713 pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { }
14714 impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
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::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
14728         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> 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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
14733                 } else {
14734                         let err = unsafe { o.contents.err };
14735                         unsafe { o.contents.err = core::ptr::null_mut(); }
14736                         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
14737                 };
14738                 Self {
14739                         contents,
14740                         result_ok: o.result_ok,
14741                 }
14742         }
14743 }
14744 #[repr(C)]
14745 /// The contents of CResult_VerifiedInvoiceRequestNoneZ
14746 pub union CResult_VerifiedInvoiceRequestNoneZPtr {
14747         /// A pointer to the contents in the success state.
14748         /// Reading from this pointer when `result_ok` is not set is undefined.
14749         pub result: *mut crate::lightning::offers::invoice_request::VerifiedInvoiceRequest,
14750         /// Note that this value is always NULL, as there are no contents in the Err variant
14751         pub err: *mut core::ffi::c_void,
14752 }
14753 #[repr(C)]
14754 /// A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation,
14755 /// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure.
14756 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14757 pub struct CResult_VerifiedInvoiceRequestNoneZ {
14758         /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either
14759         /// `err` or `result` depending on the state of `result_ok`.
14760         pub contents: CResult_VerifiedInvoiceRequestNoneZPtr,
14761         /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state.
14762         pub result_ok: bool,
14763 }
14764 #[no_mangle]
14765 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state.
14766 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ {
14767         CResult_VerifiedInvoiceRequestNoneZ {
14768                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14769                         result: Box::into_raw(Box::new(o)),
14770                 },
14771                 result_ok: true,
14772         }
14773 }
14774 #[no_mangle]
14775 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state.
14776 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ {
14777         CResult_VerifiedInvoiceRequestNoneZ {
14778                 contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14779                         err: core::ptr::null_mut(),
14780                 },
14781                 result_ok: false,
14782         }
14783 }
14784 /// Checks if the given object is currently in the success state
14785 #[no_mangle]
14786 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool {
14787         o.result_ok
14788 }
14789 #[no_mangle]
14790 /// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ.
14791 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { }
14792 impl Drop for CResult_VerifiedInvoiceRequestNoneZ {
14793         fn drop(&mut self) {
14794                 if self.result_ok {
14795                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14796                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14797                         }
14798                 } else {
14799                 }
14800         }
14801 }
14802 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>> for CResult_VerifiedInvoiceRequestNoneZ {
14803         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, ()>) -> Self {
14804                 let contents = if o.result_ok {
14805                         let result = unsafe { o.contents.result };
14806                         unsafe { o.contents.result = core::ptr::null_mut() };
14807                         CResult_VerifiedInvoiceRequestNoneZPtr { result }
14808                 } else {
14809                         let _ = unsafe { Box::from_raw(o.contents.err) };
14810                         o.contents.err = core::ptr::null_mut();
14811                         CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() }
14812                 };
14813                 Self {
14814                         contents,
14815                         result_ok: o.result_ok,
14816                 }
14817         }
14818 }
14819 impl Clone for CResult_VerifiedInvoiceRequestNoneZ {
14820         fn clone(&self) -> Self {
14821                 if self.result_ok {
14822                         Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14823                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::VerifiedInvoiceRequest>::clone(unsafe { &*self.contents.result })))
14824                         } }
14825                 } else {
14826                         Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr {
14827                                 err: core::ptr::null_mut()
14828                         } }
14829                 }
14830         }
14831 }
14832 #[no_mangle]
14833 /// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig`
14834 /// but with all dynamically-allocated buffers duplicated in new buffers.
14835 pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) }
14836 #[repr(C)]
14837 /// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ
14838 pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14839         /// A pointer to the contents in the success state.
14840         /// Reading from this pointer when `result_ok` is not set is undefined.
14841         pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder,
14842         /// A pointer to the contents in the error state.
14843         /// Reading from this pointer when `result_ok` is set is undefined.
14844         pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError,
14845 }
14846 #[repr(C)]
14847 /// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation,
14848 /// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure.
14849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14850 pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14851         /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either
14852         /// `err` or `result` depending on the state of `result_ok`.
14853         pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr,
14854         /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state.
14855         pub result_ok: bool,
14856 }
14857 #[no_mangle]
14858 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
14859 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14860         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14861                 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14862                         result: Box::into_raw(Box::new(o)),
14863                 },
14864                 result_ok: true,
14865         }
14866 }
14867 #[no_mangle]
14868 /// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
14869 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14870         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14871                 contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr {
14872                         err: Box::into_raw(Box::new(e)),
14873                 },
14874                 result_ok: false,
14875         }
14876 }
14877 /// Checks if the given object is currently in the success state
14878 #[no_mangle]
14879 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool {
14880         o.result_ok
14881 }
14882 #[no_mangle]
14883 /// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ.
14884 pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { }
14885 impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14886         fn drop(&mut self) {
14887                 if self.result_ok {
14888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14890                         }
14891                 } else {
14892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14894                         }
14895                 }
14896         }
14897 }
14898 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ {
14899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, crate::lightning::offers::parse::Bolt12SemanticError>) -> Self {
14900                 let contents = if o.result_ok {
14901                         let result = unsafe { o.contents.result };
14902                         unsafe { o.contents.result = core::ptr::null_mut() };
14903                         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result }
14904                 } else {
14905                         let err = unsafe { o.contents.err };
14906                         unsafe { o.contents.err = core::ptr::null_mut(); }
14907                         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err }
14908                 };
14909                 Self {
14910                         contents,
14911                         result_ok: o.result_ok,
14912                 }
14913         }
14914 }
14915 #[repr(C)]
14916 /// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ
14917 pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14918         /// A pointer to the contents in the success state.
14919         /// Reading from this pointer when `result_ok` is not set is undefined.
14920         pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields,
14921         /// A pointer to the contents in the error state.
14922         /// Reading from this pointer when `result_ok` is set is undefined.
14923         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14924 }
14925 #[repr(C)]
14926 /// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation,
14927 /// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure.
14928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14929 pub struct CResult_InvoiceRequestFieldsDecodeErrorZ {
14930         /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either
14931         /// `err` or `result` depending on the state of `result_ok`.
14932         pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr,
14933         /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state.
14934         pub result_ok: bool,
14935 }
14936 #[no_mangle]
14937 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state.
14938 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
14939         CResult_InvoiceRequestFieldsDecodeErrorZ {
14940                 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14941                         result: Box::into_raw(Box::new(o)),
14942                 },
14943                 result_ok: true,
14944         }
14945 }
14946 #[no_mangle]
14947 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state.
14948 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ {
14949         CResult_InvoiceRequestFieldsDecodeErrorZ {
14950                 contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14951                         err: Box::into_raw(Box::new(e)),
14952                 },
14953                 result_ok: false,
14954         }
14955 }
14956 /// Checks if the given object is currently in the success state
14957 #[no_mangle]
14958 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool {
14959         o.result_ok
14960 }
14961 #[no_mangle]
14962 /// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ.
14963 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { }
14964 impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ {
14965         fn drop(&mut self) {
14966                 if self.result_ok {
14967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14969                         }
14970                 } else {
14971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14973                         }
14974                 }
14975         }
14976 }
14977 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFieldsDecodeErrorZ {
14978         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_request::InvoiceRequestFields, crate::lightning::ln::msgs::DecodeError>) -> Self {
14979                 let contents = if o.result_ok {
14980                         let result = unsafe { o.contents.result };
14981                         unsafe { o.contents.result = core::ptr::null_mut() };
14982                         CResult_InvoiceRequestFieldsDecodeErrorZPtr { result }
14983                 } else {
14984                         let err = unsafe { o.contents.err };
14985                         unsafe { o.contents.err = core::ptr::null_mut(); }
14986                         CResult_InvoiceRequestFieldsDecodeErrorZPtr { err }
14987                 };
14988                 Self {
14989                         contents,
14990                         result_ok: o.result_ok,
14991                 }
14992         }
14993 }
14994 impl Clone for CResult_InvoiceRequestFieldsDecodeErrorZ {
14995         fn clone(&self) -> Self {
14996                 if self.result_ok {
14997                         Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
14998                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_request::InvoiceRequestFields>::clone(unsafe { &*self.contents.result })))
14999                         } }
15000                 } else {
15001                         Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr {
15002                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15003                         } }
15004                 }
15005         }
15006 }
15007 #[no_mangle]
15008 /// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig`
15009 /// but with all dynamically-allocated buffers duplicated in new buffers.
15010 pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) }
15011 #[repr(C)]
15012 /// An enum which can either contain a  or not
15013 pub enum COption_NoneZ {
15014         /// When we're in this state, this COption_NoneZ contains a 
15015         Some,
15016         /// When we're in this state, this COption_NoneZ contains nothing
15017         None
15018 }
15019 impl COption_NoneZ {
15020         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15021                 if let Self::None = self { false } else { true }
15022         }
15023         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15024                 !self.is_some()
15025         }
15026 }
15027 #[no_mangle]
15028 /// Constructs a new COption_NoneZ containing a 
15029 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
15030         COption_NoneZ::Some
15031 }
15032 #[no_mangle]
15033 /// Constructs a new COption_NoneZ containing nothing
15034 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
15035         COption_NoneZ::None
15036 }
15037 #[no_mangle]
15038 /// Frees any resources associated with the , if we are in the Some state
15039 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
15040 #[repr(C)]
15041 /// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size.
15042 /// This corresponds to std::vector in C++
15043 pub struct CVec_WitnessZ {
15044         /// The elements in the array.
15045         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15046         pub data: *mut crate::c_types::Witness,
15047         /// The number of elements pointed to by `data`.
15048         pub datalen: usize
15049 }
15050 impl CVec_WitnessZ {
15051         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Witness> {
15052                 if self.datalen == 0 { return Vec::new(); }
15053                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15054                 self.data = core::ptr::null_mut();
15055                 self.datalen = 0;
15056                 ret
15057         }
15058         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] {
15059                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15060         }
15061 }
15062 impl From<Vec<crate::c_types::Witness>> for CVec_WitnessZ {
15063         fn from(v: Vec<crate::c_types::Witness>) -> Self {
15064                 let datalen = v.len();
15065                 let data = Box::into_raw(v.into_boxed_slice());
15066                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15067         }
15068 }
15069 #[no_mangle]
15070 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15071 pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { }
15072 impl Drop for CVec_WitnessZ {
15073         fn drop(&mut self) {
15074                 if self.datalen == 0 { return; }
15075                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15076         }
15077 }
15078 impl Clone for CVec_WitnessZ {
15079         fn clone(&self) -> Self {
15080                 let mut res = Vec::new();
15081                 if self.datalen == 0 { return Self::from(res); }
15082                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15083                 Self::from(res)
15084         }
15085 }
15086 #[repr(C)]
15087 #[derive(Clone)]
15088 /// An enum which can either contain a crate::c_types::ECDSASignature or not
15089 pub enum COption_ECDSASignatureZ {
15090         /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature
15091         Some(crate::c_types::ECDSASignature),
15092         /// When we're in this state, this COption_ECDSASignatureZ contains nothing
15093         None
15094 }
15095 impl COption_ECDSASignatureZ {
15096         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15097                 if let Self::None = self { false } else { true }
15098         }
15099         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15100                 !self.is_some()
15101         }
15102         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature {
15103                 if let Self::Some(v) = self { v } else { unreachable!() }
15104         }
15105 }
15106 #[no_mangle]
15107 /// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature
15108 pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ {
15109         COption_ECDSASignatureZ::Some(o)
15110 }
15111 #[no_mangle]
15112 /// Constructs a new COption_ECDSASignatureZ containing nothing
15113 pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ {
15114         COption_ECDSASignatureZ::None
15115 }
15116 #[no_mangle]
15117 /// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state
15118 pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { }
15119 #[no_mangle]
15120 /// Creates a new COption_ECDSASignatureZ which has the same data as `orig`
15121 /// but with all dynamically-allocated buffers duplicated in new buffers.
15122 pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) }
15123 #[repr(C)]
15124 #[derive(Clone)]
15125 /// An enum which can either contain a i64 or not
15126 pub enum COption_i64Z {
15127         /// When we're in this state, this COption_i64Z contains a i64
15128         Some(i64),
15129         /// When we're in this state, this COption_i64Z contains nothing
15130         None
15131 }
15132 impl COption_i64Z {
15133         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15134                 if let Self::None = self { false } else { true }
15135         }
15136         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15137                 !self.is_some()
15138         }
15139         #[allow(unused)] pub(crate) fn take(mut self) -> i64 {
15140                 if let Self::Some(v) = self { v } else { unreachable!() }
15141         }
15142 }
15143 #[no_mangle]
15144 /// Constructs a new COption_i64Z containing a i64
15145 pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z {
15146         COption_i64Z::Some(o)
15147 }
15148 #[no_mangle]
15149 /// Constructs a new COption_i64Z containing nothing
15150 pub extern "C" fn COption_i64Z_none() -> COption_i64Z {
15151         COption_i64Z::None
15152 }
15153 #[no_mangle]
15154 /// Frees any resources associated with the i64, if we are in the Some state
15155 pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { }
15156 #[no_mangle]
15157 /// Creates a new COption_i64Z which has the same data as `orig`
15158 /// but with all dynamically-allocated buffers duplicated in new buffers.
15159 pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) }
15160 #[repr(C)]
15161 /// The contents of CResult_SocketAddressDecodeErrorZ
15162 pub union CResult_SocketAddressDecodeErrorZPtr {
15163         /// A pointer to the contents in the success state.
15164         /// Reading from this pointer when `result_ok` is not set is undefined.
15165         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15166         /// A pointer to the contents in the error state.
15167         /// Reading from this pointer when `result_ok` is set is undefined.
15168         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15169 }
15170 #[repr(C)]
15171 /// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation,
15172 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
15173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15174 pub struct CResult_SocketAddressDecodeErrorZ {
15175         /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either
15176         /// `err` or `result` depending on the state of `result_ok`.
15177         pub contents: CResult_SocketAddressDecodeErrorZPtr,
15178         /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state.
15179         pub result_ok: bool,
15180 }
15181 #[no_mangle]
15182 /// Creates a new CResult_SocketAddressDecodeErrorZ in the success state.
15183 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ {
15184         CResult_SocketAddressDecodeErrorZ {
15185                 contents: CResult_SocketAddressDecodeErrorZPtr {
15186                         result: Box::into_raw(Box::new(o)),
15187                 },
15188                 result_ok: true,
15189         }
15190 }
15191 #[no_mangle]
15192 /// Creates a new CResult_SocketAddressDecodeErrorZ in the error state.
15193 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ {
15194         CResult_SocketAddressDecodeErrorZ {
15195                 contents: CResult_SocketAddressDecodeErrorZPtr {
15196                         err: Box::into_raw(Box::new(e)),
15197                 },
15198                 result_ok: false,
15199         }
15200 }
15201 /// Checks if the given object is currently in the success state
15202 #[no_mangle]
15203 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool {
15204         o.result_ok
15205 }
15206 #[no_mangle]
15207 /// Frees any resources used by the CResult_SocketAddressDecodeErrorZ.
15208 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { }
15209 impl Drop for CResult_SocketAddressDecodeErrorZ {
15210         fn drop(&mut self) {
15211                 if self.result_ok {
15212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15214                         }
15215                 } else {
15216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15218                         }
15219                 }
15220         }
15221 }
15222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_SocketAddressDecodeErrorZ {
15223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
15224                 let contents = if o.result_ok {
15225                         let result = unsafe { o.contents.result };
15226                         unsafe { o.contents.result = core::ptr::null_mut() };
15227                         CResult_SocketAddressDecodeErrorZPtr { result }
15228                 } else {
15229                         let err = unsafe { o.contents.err };
15230                         unsafe { o.contents.err = core::ptr::null_mut(); }
15231                         CResult_SocketAddressDecodeErrorZPtr { err }
15232                 };
15233                 Self {
15234                         contents,
15235                         result_ok: o.result_ok,
15236                 }
15237         }
15238 }
15239 impl Clone for CResult_SocketAddressDecodeErrorZ {
15240         fn clone(&self) -> Self {
15241                 if self.result_ok {
15242                         Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr {
15243                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15244                         } }
15245                 } else {
15246                         Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr {
15247                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15248                         } }
15249                 }
15250         }
15251 }
15252 #[no_mangle]
15253 /// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig`
15254 /// but with all dynamically-allocated buffers duplicated in new buffers.
15255 pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) }
15256 #[repr(C)]
15257 /// The contents of CResult_SocketAddressSocketAddressParseErrorZ
15258 pub union CResult_SocketAddressSocketAddressParseErrorZPtr {
15259         /// A pointer to the contents in the success state.
15260         /// Reading from this pointer when `result_ok` is not set is undefined.
15261         pub result: *mut crate::lightning::ln::msgs::SocketAddress,
15262         /// A pointer to the contents in the error state.
15263         /// Reading from this pointer when `result_ok` is set is undefined.
15264         pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError,
15265 }
15266 #[repr(C)]
15267 /// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation,
15268 /// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure.
15269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15270 pub struct CResult_SocketAddressSocketAddressParseErrorZ {
15271         /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either
15272         /// `err` or `result` depending on the state of `result_ok`.
15273         pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr,
15274         /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state.
15275         pub result_ok: bool,
15276 }
15277 #[no_mangle]
15278 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state.
15279 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ {
15280         CResult_SocketAddressSocketAddressParseErrorZ {
15281                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15282                         result: Box::into_raw(Box::new(o)),
15283                 },
15284                 result_ok: true,
15285         }
15286 }
15287 #[no_mangle]
15288 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state.
15289 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ {
15290         CResult_SocketAddressSocketAddressParseErrorZ {
15291                 contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15292                         err: Box::into_raw(Box::new(e)),
15293                 },
15294                 result_ok: false,
15295         }
15296 }
15297 /// Checks if the given object is currently in the success state
15298 #[no_mangle]
15299 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool {
15300         o.result_ok
15301 }
15302 #[no_mangle]
15303 /// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ.
15304 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { }
15305 impl Drop for CResult_SocketAddressSocketAddressParseErrorZ {
15306         fn drop(&mut self) {
15307                 if self.result_ok {
15308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15310                         }
15311                 } else {
15312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15314                         }
15315                 }
15316         }
15317 }
15318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>> for CResult_SocketAddressSocketAddressParseErrorZ {
15319         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SocketAddress, crate::lightning::ln::msgs::SocketAddressParseError>) -> Self {
15320                 let contents = if o.result_ok {
15321                         let result = unsafe { o.contents.result };
15322                         unsafe { o.contents.result = core::ptr::null_mut() };
15323                         CResult_SocketAddressSocketAddressParseErrorZPtr { result }
15324                 } else {
15325                         let err = unsafe { o.contents.err };
15326                         unsafe { o.contents.err = core::ptr::null_mut(); }
15327                         CResult_SocketAddressSocketAddressParseErrorZPtr { err }
15328                 };
15329                 Self {
15330                         contents,
15331                         result_ok: o.result_ok,
15332                 }
15333         }
15334 }
15335 impl Clone for CResult_SocketAddressSocketAddressParseErrorZ {
15336         fn clone(&self) -> Self {
15337                 if self.result_ok {
15338                         Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15339                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddress>::clone(unsafe { &*self.contents.result })))
15340                         } }
15341                 } else {
15342                         Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr {
15343                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SocketAddressParseError>::clone(unsafe { &*self.contents.err })))
15344                         } }
15345                 }
15346         }
15347 }
15348 #[no_mangle]
15349 /// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig`
15350 /// but with all dynamically-allocated buffers duplicated in new buffers.
15351 pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) }
15352 #[repr(C)]
15353 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
15354 /// This corresponds to std::vector in C++
15355 pub struct CVec_UpdateAddHTLCZ {
15356         /// The elements in the array.
15357         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15358         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15359         /// The number of elements pointed to by `data`.
15360         pub datalen: usize
15361 }
15362 impl CVec_UpdateAddHTLCZ {
15363         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
15364                 if self.datalen == 0 { return Vec::new(); }
15365                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15366                 self.data = core::ptr::null_mut();
15367                 self.datalen = 0;
15368                 ret
15369         }
15370         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
15371                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15372         }
15373 }
15374 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
15375         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
15376                 let datalen = v.len();
15377                 let data = Box::into_raw(v.into_boxed_slice());
15378                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15379         }
15380 }
15381 #[no_mangle]
15382 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15383 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
15384 impl Drop for CVec_UpdateAddHTLCZ {
15385         fn drop(&mut self) {
15386                 if self.datalen == 0 { return; }
15387                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15388         }
15389 }
15390 impl Clone for CVec_UpdateAddHTLCZ {
15391         fn clone(&self) -> Self {
15392                 let mut res = Vec::new();
15393                 if self.datalen == 0 { return Self::from(res); }
15394                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15395                 Self::from(res)
15396         }
15397 }
15398 #[repr(C)]
15399 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
15400 /// This corresponds to std::vector in C++
15401 pub struct CVec_UpdateFulfillHTLCZ {
15402         /// The elements in the array.
15403         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15404         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
15405         /// The number of elements pointed to by `data`.
15406         pub datalen: usize
15407 }
15408 impl CVec_UpdateFulfillHTLCZ {
15409         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
15410                 if self.datalen == 0 { return Vec::new(); }
15411                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15412                 self.data = core::ptr::null_mut();
15413                 self.datalen = 0;
15414                 ret
15415         }
15416         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
15417                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15418         }
15419 }
15420 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
15421         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
15422                 let datalen = v.len();
15423                 let data = Box::into_raw(v.into_boxed_slice());
15424                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15425         }
15426 }
15427 #[no_mangle]
15428 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15429 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
15430 impl Drop for CVec_UpdateFulfillHTLCZ {
15431         fn drop(&mut self) {
15432                 if self.datalen == 0 { return; }
15433                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15434         }
15435 }
15436 impl Clone for CVec_UpdateFulfillHTLCZ {
15437         fn clone(&self) -> Self {
15438                 let mut res = Vec::new();
15439                 if self.datalen == 0 { return Self::from(res); }
15440                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15441                 Self::from(res)
15442         }
15443 }
15444 #[repr(C)]
15445 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
15446 /// This corresponds to std::vector in C++
15447 pub struct CVec_UpdateFailHTLCZ {
15448         /// The elements in the array.
15449         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15450         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
15451         /// The number of elements pointed to by `data`.
15452         pub datalen: usize
15453 }
15454 impl CVec_UpdateFailHTLCZ {
15455         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
15456                 if self.datalen == 0 { return Vec::new(); }
15457                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15458                 self.data = core::ptr::null_mut();
15459                 self.datalen = 0;
15460                 ret
15461         }
15462         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
15463                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15464         }
15465 }
15466 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
15467         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
15468                 let datalen = v.len();
15469                 let data = Box::into_raw(v.into_boxed_slice());
15470                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15471         }
15472 }
15473 #[no_mangle]
15474 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15475 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
15476 impl Drop for CVec_UpdateFailHTLCZ {
15477         fn drop(&mut self) {
15478                 if self.datalen == 0 { return; }
15479                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15480         }
15481 }
15482 impl Clone for CVec_UpdateFailHTLCZ {
15483         fn clone(&self) -> Self {
15484                 let mut res = Vec::new();
15485                 if self.datalen == 0 { return Self::from(res); }
15486                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15487                 Self::from(res)
15488         }
15489 }
15490 #[repr(C)]
15491 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
15492 /// This corresponds to std::vector in C++
15493 pub struct CVec_UpdateFailMalformedHTLCZ {
15494         /// The elements in the array.
15495         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15496         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
15497         /// The number of elements pointed to by `data`.
15498         pub datalen: usize
15499 }
15500 impl CVec_UpdateFailMalformedHTLCZ {
15501         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
15502                 if self.datalen == 0 { return Vec::new(); }
15503                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15504                 self.data = core::ptr::null_mut();
15505                 self.datalen = 0;
15506                 ret
15507         }
15508         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
15509                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15510         }
15511 }
15512 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
15513         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
15514                 let datalen = v.len();
15515                 let data = Box::into_raw(v.into_boxed_slice());
15516                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15517         }
15518 }
15519 #[no_mangle]
15520 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15521 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
15522 impl Drop for CVec_UpdateFailMalformedHTLCZ {
15523         fn drop(&mut self) {
15524                 if self.datalen == 0 { return; }
15525                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15526         }
15527 }
15528 impl Clone for CVec_UpdateFailMalformedHTLCZ {
15529         fn clone(&self) -> Self {
15530                 let mut res = Vec::new();
15531                 if self.datalen == 0 { return Self::from(res); }
15532                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15533                 Self::from(res)
15534         }
15535 }
15536 #[repr(C)]
15537 /// The contents of CResult_AcceptChannelDecodeErrorZ
15538 pub union CResult_AcceptChannelDecodeErrorZPtr {
15539         /// A pointer to the contents in the success state.
15540         /// Reading from this pointer when `result_ok` is not set is undefined.
15541         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
15542         /// A pointer to the contents in the error state.
15543         /// Reading from this pointer when `result_ok` is set is undefined.
15544         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15545 }
15546 #[repr(C)]
15547 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
15548 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
15549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15550 pub struct CResult_AcceptChannelDecodeErrorZ {
15551         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
15552         /// `err` or `result` depending on the state of `result_ok`.
15553         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
15554         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
15555         pub result_ok: bool,
15556 }
15557 #[no_mangle]
15558 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15559 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
15560         CResult_AcceptChannelDecodeErrorZ {
15561                 contents: CResult_AcceptChannelDecodeErrorZPtr {
15562                         result: Box::into_raw(Box::new(o)),
15563                 },
15564                 result_ok: true,
15565         }
15566 }
15567 #[no_mangle]
15568 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15569 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
15570         CResult_AcceptChannelDecodeErrorZ {
15571                 contents: CResult_AcceptChannelDecodeErrorZPtr {
15572                         err: Box::into_raw(Box::new(e)),
15573                 },
15574                 result_ok: false,
15575         }
15576 }
15577 /// Checks if the given object is currently in the success state
15578 #[no_mangle]
15579 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
15580         o.result_ok
15581 }
15582 #[no_mangle]
15583 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15584 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
15585 impl Drop for CResult_AcceptChannelDecodeErrorZ {
15586         fn drop(&mut self) {
15587                 if self.result_ok {
15588                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15589                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15590                         }
15591                 } else {
15592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15594                         }
15595                 }
15596         }
15597 }
15598 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
15599         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
15600                 let contents = if o.result_ok {
15601                         let result = unsafe { o.contents.result };
15602                         unsafe { o.contents.result = core::ptr::null_mut() };
15603                         CResult_AcceptChannelDecodeErrorZPtr { result }
15604                 } else {
15605                         let err = unsafe { o.contents.err };
15606                         unsafe { o.contents.err = core::ptr::null_mut(); }
15607                         CResult_AcceptChannelDecodeErrorZPtr { err }
15608                 };
15609                 Self {
15610                         contents,
15611                         result_ok: o.result_ok,
15612                 }
15613         }
15614 }
15615 impl Clone for CResult_AcceptChannelDecodeErrorZ {
15616         fn clone(&self) -> Self {
15617                 if self.result_ok {
15618                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
15619                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
15620                         } }
15621                 } else {
15622                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
15623                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15624                         } }
15625                 }
15626         }
15627 }
15628 #[no_mangle]
15629 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15630 /// but with all dynamically-allocated buffers duplicated in new buffers.
15631 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
15632 #[repr(C)]
15633 /// The contents of CResult_AcceptChannelV2DecodeErrorZ
15634 pub union CResult_AcceptChannelV2DecodeErrorZPtr {
15635         /// A pointer to the contents in the success state.
15636         /// Reading from this pointer when `result_ok` is not set is undefined.
15637         pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2,
15638         /// A pointer to the contents in the error state.
15639         /// Reading from this pointer when `result_ok` is set is undefined.
15640         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15641 }
15642 #[repr(C)]
15643 /// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation,
15644 /// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
15645 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15646 pub struct CResult_AcceptChannelV2DecodeErrorZ {
15647         /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either
15648         /// `err` or `result` depending on the state of `result_ok`.
15649         pub contents: CResult_AcceptChannelV2DecodeErrorZPtr,
15650         /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state.
15651         pub result_ok: bool,
15652 }
15653 #[no_mangle]
15654 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state.
15655 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ {
15656         CResult_AcceptChannelV2DecodeErrorZ {
15657                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15658                         result: Box::into_raw(Box::new(o)),
15659                 },
15660                 result_ok: true,
15661         }
15662 }
15663 #[no_mangle]
15664 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state.
15665 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ {
15666         CResult_AcceptChannelV2DecodeErrorZ {
15667                 contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15668                         err: Box::into_raw(Box::new(e)),
15669                 },
15670                 result_ok: false,
15671         }
15672 }
15673 /// Checks if the given object is currently in the success state
15674 #[no_mangle]
15675 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool {
15676         o.result_ok
15677 }
15678 #[no_mangle]
15679 /// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ.
15680 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { }
15681 impl Drop for CResult_AcceptChannelV2DecodeErrorZ {
15682         fn drop(&mut self) {
15683                 if self.result_ok {
15684                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15685                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15686                         }
15687                 } else {
15688                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15689                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15690                         }
15691                 }
15692         }
15693 }
15694 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelV2DecodeErrorZ {
15695         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
15696                 let contents = if o.result_ok {
15697                         let result = unsafe { o.contents.result };
15698                         unsafe { o.contents.result = core::ptr::null_mut() };
15699                         CResult_AcceptChannelV2DecodeErrorZPtr { result }
15700                 } else {
15701                         let err = unsafe { o.contents.err };
15702                         unsafe { o.contents.err = core::ptr::null_mut(); }
15703                         CResult_AcceptChannelV2DecodeErrorZPtr { err }
15704                 };
15705                 Self {
15706                         contents,
15707                         result_ok: o.result_ok,
15708                 }
15709         }
15710 }
15711 impl Clone for CResult_AcceptChannelV2DecodeErrorZ {
15712         fn clone(&self) -> Self {
15713                 if self.result_ok {
15714                         Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15715                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannelV2>::clone(unsafe { &*self.contents.result })))
15716                         } }
15717                 } else {
15718                         Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr {
15719                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15720                         } }
15721                 }
15722         }
15723 }
15724 #[no_mangle]
15725 /// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig`
15726 /// but with all dynamically-allocated buffers duplicated in new buffers.
15727 pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) }
15728 #[repr(C)]
15729 /// The contents of CResult_StfuDecodeErrorZ
15730 pub union CResult_StfuDecodeErrorZPtr {
15731         /// A pointer to the contents in the success state.
15732         /// Reading from this pointer when `result_ok` is not set is undefined.
15733         pub result: *mut crate::lightning::ln::msgs::Stfu,
15734         /// A pointer to the contents in the error state.
15735         /// Reading from this pointer when `result_ok` is set is undefined.
15736         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15737 }
15738 #[repr(C)]
15739 /// A CResult_StfuDecodeErrorZ represents the result of a fallible operation,
15740 /// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure.
15741 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15742 pub struct CResult_StfuDecodeErrorZ {
15743         /// The contents of this CResult_StfuDecodeErrorZ, accessible via either
15744         /// `err` or `result` depending on the state of `result_ok`.
15745         pub contents: CResult_StfuDecodeErrorZPtr,
15746         /// Whether this CResult_StfuDecodeErrorZ represents a success state.
15747         pub result_ok: bool,
15748 }
15749 #[no_mangle]
15750 /// Creates a new CResult_StfuDecodeErrorZ in the success state.
15751 pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ {
15752         CResult_StfuDecodeErrorZ {
15753                 contents: CResult_StfuDecodeErrorZPtr {
15754                         result: Box::into_raw(Box::new(o)),
15755                 },
15756                 result_ok: true,
15757         }
15758 }
15759 #[no_mangle]
15760 /// Creates a new CResult_StfuDecodeErrorZ in the error state.
15761 pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ {
15762         CResult_StfuDecodeErrorZ {
15763                 contents: CResult_StfuDecodeErrorZPtr {
15764                         err: Box::into_raw(Box::new(e)),
15765                 },
15766                 result_ok: false,
15767         }
15768 }
15769 /// Checks if the given object is currently in the success state
15770 #[no_mangle]
15771 pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool {
15772         o.result_ok
15773 }
15774 #[no_mangle]
15775 /// Frees any resources used by the CResult_StfuDecodeErrorZ.
15776 pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { }
15777 impl Drop for CResult_StfuDecodeErrorZ {
15778         fn drop(&mut self) {
15779                 if self.result_ok {
15780                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15781                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15782                         }
15783                 } else {
15784                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15785                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15786                         }
15787                 }
15788         }
15789 }
15790 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>> for CResult_StfuDecodeErrorZ {
15791         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Stfu, crate::lightning::ln::msgs::DecodeError>) -> Self {
15792                 let contents = if o.result_ok {
15793                         let result = unsafe { o.contents.result };
15794                         unsafe { o.contents.result = core::ptr::null_mut() };
15795                         CResult_StfuDecodeErrorZPtr { result }
15796                 } else {
15797                         let err = unsafe { o.contents.err };
15798                         unsafe { o.contents.err = core::ptr::null_mut(); }
15799                         CResult_StfuDecodeErrorZPtr { err }
15800                 };
15801                 Self {
15802                         contents,
15803                         result_ok: o.result_ok,
15804                 }
15805         }
15806 }
15807 impl Clone for CResult_StfuDecodeErrorZ {
15808         fn clone(&self) -> Self {
15809                 if self.result_ok {
15810                         Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr {
15811                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Stfu>::clone(unsafe { &*self.contents.result })))
15812                         } }
15813                 } else {
15814                         Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr {
15815                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15816                         } }
15817                 }
15818         }
15819 }
15820 #[no_mangle]
15821 /// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig`
15822 /// but with all dynamically-allocated buffers duplicated in new buffers.
15823 pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) }
15824 #[repr(C)]
15825 /// The contents of CResult_SpliceDecodeErrorZ
15826 pub union CResult_SpliceDecodeErrorZPtr {
15827         /// A pointer to the contents in the success state.
15828         /// Reading from this pointer when `result_ok` is not set is undefined.
15829         pub result: *mut crate::lightning::ln::msgs::Splice,
15830         /// A pointer to the contents in the error state.
15831         /// Reading from this pointer when `result_ok` is set is undefined.
15832         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15833 }
15834 #[repr(C)]
15835 /// A CResult_SpliceDecodeErrorZ represents the result of a fallible operation,
15836 /// containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure.
15837 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15838 pub struct CResult_SpliceDecodeErrorZ {
15839         /// The contents of this CResult_SpliceDecodeErrorZ, accessible via either
15840         /// `err` or `result` depending on the state of `result_ok`.
15841         pub contents: CResult_SpliceDecodeErrorZPtr,
15842         /// Whether this CResult_SpliceDecodeErrorZ represents a success state.
15843         pub result_ok: bool,
15844 }
15845 #[no_mangle]
15846 /// Creates a new CResult_SpliceDecodeErrorZ in the success state.
15847 pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ {
15848         CResult_SpliceDecodeErrorZ {
15849                 contents: CResult_SpliceDecodeErrorZPtr {
15850                         result: Box::into_raw(Box::new(o)),
15851                 },
15852                 result_ok: true,
15853         }
15854 }
15855 #[no_mangle]
15856 /// Creates a new CResult_SpliceDecodeErrorZ in the error state.
15857 pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ {
15858         CResult_SpliceDecodeErrorZ {
15859                 contents: CResult_SpliceDecodeErrorZPtr {
15860                         err: Box::into_raw(Box::new(e)),
15861                 },
15862                 result_ok: false,
15863         }
15864 }
15865 /// Checks if the given object is currently in the success state
15866 #[no_mangle]
15867 pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> bool {
15868         o.result_ok
15869 }
15870 #[no_mangle]
15871 /// Frees any resources used by the CResult_SpliceDecodeErrorZ.
15872 pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { }
15873 impl Drop for CResult_SpliceDecodeErrorZ {
15874         fn drop(&mut self) {
15875                 if self.result_ok {
15876                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15877                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15878                         }
15879                 } else {
15880                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15881                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15882                         }
15883                 }
15884         }
15885 }
15886 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceDecodeErrorZ {
15887         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Splice, crate::lightning::ln::msgs::DecodeError>) -> Self {
15888                 let contents = if o.result_ok {
15889                         let result = unsafe { o.contents.result };
15890                         unsafe { o.contents.result = core::ptr::null_mut() };
15891                         CResult_SpliceDecodeErrorZPtr { result }
15892                 } else {
15893                         let err = unsafe { o.contents.err };
15894                         unsafe { o.contents.err = core::ptr::null_mut(); }
15895                         CResult_SpliceDecodeErrorZPtr { err }
15896                 };
15897                 Self {
15898                         contents,
15899                         result_ok: o.result_ok,
15900                 }
15901         }
15902 }
15903 impl Clone for CResult_SpliceDecodeErrorZ {
15904         fn clone(&self) -> Self {
15905                 if self.result_ok {
15906                         Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr {
15907                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Splice>::clone(unsafe { &*self.contents.result })))
15908                         } }
15909                 } else {
15910                         Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr {
15911                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15912                         } }
15913                 }
15914         }
15915 }
15916 #[no_mangle]
15917 /// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig`
15918 /// but with all dynamically-allocated buffers duplicated in new buffers.
15919 pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) }
15920 #[repr(C)]
15921 /// The contents of CResult_SpliceAckDecodeErrorZ
15922 pub union CResult_SpliceAckDecodeErrorZPtr {
15923         /// A pointer to the contents in the success state.
15924         /// Reading from this pointer when `result_ok` is not set is undefined.
15925         pub result: *mut crate::lightning::ln::msgs::SpliceAck,
15926         /// A pointer to the contents in the error state.
15927         /// Reading from this pointer when `result_ok` is set is undefined.
15928         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15929 }
15930 #[repr(C)]
15931 /// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation,
15932 /// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure.
15933 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15934 pub struct CResult_SpliceAckDecodeErrorZ {
15935         /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either
15936         /// `err` or `result` depending on the state of `result_ok`.
15937         pub contents: CResult_SpliceAckDecodeErrorZPtr,
15938         /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state.
15939         pub result_ok: bool,
15940 }
15941 #[no_mangle]
15942 /// Creates a new CResult_SpliceAckDecodeErrorZ in the success state.
15943 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ {
15944         CResult_SpliceAckDecodeErrorZ {
15945                 contents: CResult_SpliceAckDecodeErrorZPtr {
15946                         result: Box::into_raw(Box::new(o)),
15947                 },
15948                 result_ok: true,
15949         }
15950 }
15951 #[no_mangle]
15952 /// Creates a new CResult_SpliceAckDecodeErrorZ in the error state.
15953 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ {
15954         CResult_SpliceAckDecodeErrorZ {
15955                 contents: CResult_SpliceAckDecodeErrorZPtr {
15956                         err: Box::into_raw(Box::new(e)),
15957                 },
15958                 result_ok: false,
15959         }
15960 }
15961 /// Checks if the given object is currently in the success state
15962 #[no_mangle]
15963 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool {
15964         o.result_ok
15965 }
15966 #[no_mangle]
15967 /// Frees any resources used by the CResult_SpliceAckDecodeErrorZ.
15968 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { }
15969 impl Drop for CResult_SpliceAckDecodeErrorZ {
15970         fn drop(&mut self) {
15971                 if self.result_ok {
15972                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15973                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15974                         }
15975                 } else {
15976                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15977                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15978                         }
15979                 }
15980         }
15981 }
15982 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceAckDecodeErrorZ {
15983         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceAck, crate::lightning::ln::msgs::DecodeError>) -> Self {
15984                 let contents = if o.result_ok {
15985                         let result = unsafe { o.contents.result };
15986                         unsafe { o.contents.result = core::ptr::null_mut() };
15987                         CResult_SpliceAckDecodeErrorZPtr { result }
15988                 } else {
15989                         let err = unsafe { o.contents.err };
15990                         unsafe { o.contents.err = core::ptr::null_mut(); }
15991                         CResult_SpliceAckDecodeErrorZPtr { err }
15992                 };
15993                 Self {
15994                         contents,
15995                         result_ok: o.result_ok,
15996                 }
15997         }
15998 }
15999 impl Clone for CResult_SpliceAckDecodeErrorZ {
16000         fn clone(&self) -> Self {
16001                 if self.result_ok {
16002                         Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr {
16003                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceAck>::clone(unsafe { &*self.contents.result })))
16004                         } }
16005                 } else {
16006                         Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr {
16007                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16008                         } }
16009                 }
16010         }
16011 }
16012 #[no_mangle]
16013 /// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig`
16014 /// but with all dynamically-allocated buffers duplicated in new buffers.
16015 pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) }
16016 #[repr(C)]
16017 /// The contents of CResult_SpliceLockedDecodeErrorZ
16018 pub union CResult_SpliceLockedDecodeErrorZPtr {
16019         /// A pointer to the contents in the success state.
16020         /// Reading from this pointer when `result_ok` is not set is undefined.
16021         pub result: *mut crate::lightning::ln::msgs::SpliceLocked,
16022         /// A pointer to the contents in the error state.
16023         /// Reading from this pointer when `result_ok` is set is undefined.
16024         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16025 }
16026 #[repr(C)]
16027 /// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation,
16028 /// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
16029 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16030 pub struct CResult_SpliceLockedDecodeErrorZ {
16031         /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either
16032         /// `err` or `result` depending on the state of `result_ok`.
16033         pub contents: CResult_SpliceLockedDecodeErrorZPtr,
16034         /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state.
16035         pub result_ok: bool,
16036 }
16037 #[no_mangle]
16038 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state.
16039 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ {
16040         CResult_SpliceLockedDecodeErrorZ {
16041                 contents: CResult_SpliceLockedDecodeErrorZPtr {
16042                         result: Box::into_raw(Box::new(o)),
16043                 },
16044                 result_ok: true,
16045         }
16046 }
16047 #[no_mangle]
16048 /// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state.
16049 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ {
16050         CResult_SpliceLockedDecodeErrorZ {
16051                 contents: CResult_SpliceLockedDecodeErrorZPtr {
16052                         err: Box::into_raw(Box::new(e)),
16053                 },
16054                 result_ok: false,
16055         }
16056 }
16057 /// Checks if the given object is currently in the success state
16058 #[no_mangle]
16059 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool {
16060         o.result_ok
16061 }
16062 #[no_mangle]
16063 /// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ.
16064 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { }
16065 impl Drop for CResult_SpliceLockedDecodeErrorZ {
16066         fn drop(&mut self) {
16067                 if self.result_ok {
16068                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16069                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16070                         }
16071                 } else {
16072                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16073                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16074                         }
16075                 }
16076         }
16077 }
16078 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_SpliceLockedDecodeErrorZ {
16079         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::SpliceLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
16080                 let contents = if o.result_ok {
16081                         let result = unsafe { o.contents.result };
16082                         unsafe { o.contents.result = core::ptr::null_mut() };
16083                         CResult_SpliceLockedDecodeErrorZPtr { result }
16084                 } else {
16085                         let err = unsafe { o.contents.err };
16086                         unsafe { o.contents.err = core::ptr::null_mut(); }
16087                         CResult_SpliceLockedDecodeErrorZPtr { err }
16088                 };
16089                 Self {
16090                         contents,
16091                         result_ok: o.result_ok,
16092                 }
16093         }
16094 }
16095 impl Clone for CResult_SpliceLockedDecodeErrorZ {
16096         fn clone(&self) -> Self {
16097                 if self.result_ok {
16098                         Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr {
16099                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::SpliceLocked>::clone(unsafe { &*self.contents.result })))
16100                         } }
16101                 } else {
16102                         Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr {
16103                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16104                         } }
16105                 }
16106         }
16107 }
16108 #[no_mangle]
16109 /// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig`
16110 /// but with all dynamically-allocated buffers duplicated in new buffers.
16111 pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) }
16112 #[repr(C)]
16113 /// The contents of CResult_TxAddInputDecodeErrorZ
16114 pub union CResult_TxAddInputDecodeErrorZPtr {
16115         /// A pointer to the contents in the success state.
16116         /// Reading from this pointer when `result_ok` is not set is undefined.
16117         pub result: *mut crate::lightning::ln::msgs::TxAddInput,
16118         /// A pointer to the contents in the error state.
16119         /// Reading from this pointer when `result_ok` is set is undefined.
16120         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16121 }
16122 #[repr(C)]
16123 /// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation,
16124 /// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16126 pub struct CResult_TxAddInputDecodeErrorZ {
16127         /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either
16128         /// `err` or `result` depending on the state of `result_ok`.
16129         pub contents: CResult_TxAddInputDecodeErrorZPtr,
16130         /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state.
16131         pub result_ok: bool,
16132 }
16133 #[no_mangle]
16134 /// Creates a new CResult_TxAddInputDecodeErrorZ in the success state.
16135 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ {
16136         CResult_TxAddInputDecodeErrorZ {
16137                 contents: CResult_TxAddInputDecodeErrorZPtr {
16138                         result: Box::into_raw(Box::new(o)),
16139                 },
16140                 result_ok: true,
16141         }
16142 }
16143 #[no_mangle]
16144 /// Creates a new CResult_TxAddInputDecodeErrorZ in the error state.
16145 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ {
16146         CResult_TxAddInputDecodeErrorZ {
16147                 contents: CResult_TxAddInputDecodeErrorZPtr {
16148                         err: Box::into_raw(Box::new(e)),
16149                 },
16150                 result_ok: false,
16151         }
16152 }
16153 /// Checks if the given object is currently in the success state
16154 #[no_mangle]
16155 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool {
16156         o.result_ok
16157 }
16158 #[no_mangle]
16159 /// Frees any resources used by the CResult_TxAddInputDecodeErrorZ.
16160 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { }
16161 impl Drop for CResult_TxAddInputDecodeErrorZ {
16162         fn drop(&mut self) {
16163                 if self.result_ok {
16164                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16165                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16166                         }
16167                 } else {
16168                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16169                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16170                         }
16171                 }
16172         }
16173 }
16174 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddInputDecodeErrorZ {
16175         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16176                 let contents = if o.result_ok {
16177                         let result = unsafe { o.contents.result };
16178                         unsafe { o.contents.result = core::ptr::null_mut() };
16179                         CResult_TxAddInputDecodeErrorZPtr { result }
16180                 } else {
16181                         let err = unsafe { o.contents.err };
16182                         unsafe { o.contents.err = core::ptr::null_mut(); }
16183                         CResult_TxAddInputDecodeErrorZPtr { err }
16184                 };
16185                 Self {
16186                         contents,
16187                         result_ok: o.result_ok,
16188                 }
16189         }
16190 }
16191 impl Clone for CResult_TxAddInputDecodeErrorZ {
16192         fn clone(&self) -> Self {
16193                 if self.result_ok {
16194                         Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr {
16195                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddInput>::clone(unsafe { &*self.contents.result })))
16196                         } }
16197                 } else {
16198                         Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr {
16199                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16200                         } }
16201                 }
16202         }
16203 }
16204 #[no_mangle]
16205 /// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig`
16206 /// but with all dynamically-allocated buffers duplicated in new buffers.
16207 pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) }
16208 #[repr(C)]
16209 /// The contents of CResult_TxAddOutputDecodeErrorZ
16210 pub union CResult_TxAddOutputDecodeErrorZPtr {
16211         /// A pointer to the contents in the success state.
16212         /// Reading from this pointer when `result_ok` is not set is undefined.
16213         pub result: *mut crate::lightning::ln::msgs::TxAddOutput,
16214         /// A pointer to the contents in the error state.
16215         /// Reading from this pointer when `result_ok` is set is undefined.
16216         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16217 }
16218 #[repr(C)]
16219 /// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation,
16220 /// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16222 pub struct CResult_TxAddOutputDecodeErrorZ {
16223         /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either
16224         /// `err` or `result` depending on the state of `result_ok`.
16225         pub contents: CResult_TxAddOutputDecodeErrorZPtr,
16226         /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state.
16227         pub result_ok: bool,
16228 }
16229 #[no_mangle]
16230 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state.
16231 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ {
16232         CResult_TxAddOutputDecodeErrorZ {
16233                 contents: CResult_TxAddOutputDecodeErrorZPtr {
16234                         result: Box::into_raw(Box::new(o)),
16235                 },
16236                 result_ok: true,
16237         }
16238 }
16239 #[no_mangle]
16240 /// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state.
16241 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ {
16242         CResult_TxAddOutputDecodeErrorZ {
16243                 contents: CResult_TxAddOutputDecodeErrorZPtr {
16244                         err: Box::into_raw(Box::new(e)),
16245                 },
16246                 result_ok: false,
16247         }
16248 }
16249 /// Checks if the given object is currently in the success state
16250 #[no_mangle]
16251 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool {
16252         o.result_ok
16253 }
16254 #[no_mangle]
16255 /// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ.
16256 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { }
16257 impl Drop for CResult_TxAddOutputDecodeErrorZ {
16258         fn drop(&mut self) {
16259                 if self.result_ok {
16260                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16261                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16262                         }
16263                 } else {
16264                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16265                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16266                         }
16267                 }
16268         }
16269 }
16270 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAddOutputDecodeErrorZ {
16271         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAddOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16272                 let contents = if o.result_ok {
16273                         let result = unsafe { o.contents.result };
16274                         unsafe { o.contents.result = core::ptr::null_mut() };
16275                         CResult_TxAddOutputDecodeErrorZPtr { result }
16276                 } else {
16277                         let err = unsafe { o.contents.err };
16278                         unsafe { o.contents.err = core::ptr::null_mut(); }
16279                         CResult_TxAddOutputDecodeErrorZPtr { err }
16280                 };
16281                 Self {
16282                         contents,
16283                         result_ok: o.result_ok,
16284                 }
16285         }
16286 }
16287 impl Clone for CResult_TxAddOutputDecodeErrorZ {
16288         fn clone(&self) -> Self {
16289                 if self.result_ok {
16290                         Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr {
16291                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAddOutput>::clone(unsafe { &*self.contents.result })))
16292                         } }
16293                 } else {
16294                         Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr {
16295                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16296                         } }
16297                 }
16298         }
16299 }
16300 #[no_mangle]
16301 /// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig`
16302 /// but with all dynamically-allocated buffers duplicated in new buffers.
16303 pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) }
16304 #[repr(C)]
16305 /// The contents of CResult_TxRemoveInputDecodeErrorZ
16306 pub union CResult_TxRemoveInputDecodeErrorZPtr {
16307         /// A pointer to the contents in the success state.
16308         /// Reading from this pointer when `result_ok` is not set is undefined.
16309         pub result: *mut crate::lightning::ln::msgs::TxRemoveInput,
16310         /// A pointer to the contents in the error state.
16311         /// Reading from this pointer when `result_ok` is set is undefined.
16312         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16313 }
16314 #[repr(C)]
16315 /// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation,
16316 /// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16318 pub struct CResult_TxRemoveInputDecodeErrorZ {
16319         /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either
16320         /// `err` or `result` depending on the state of `result_ok`.
16321         pub contents: CResult_TxRemoveInputDecodeErrorZPtr,
16322         /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state.
16323         pub result_ok: bool,
16324 }
16325 #[no_mangle]
16326 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state.
16327 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ {
16328         CResult_TxRemoveInputDecodeErrorZ {
16329                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16330                         result: Box::into_raw(Box::new(o)),
16331                 },
16332                 result_ok: true,
16333         }
16334 }
16335 #[no_mangle]
16336 /// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state.
16337 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ {
16338         CResult_TxRemoveInputDecodeErrorZ {
16339                 contents: CResult_TxRemoveInputDecodeErrorZPtr {
16340                         err: Box::into_raw(Box::new(e)),
16341                 },
16342                 result_ok: false,
16343         }
16344 }
16345 /// Checks if the given object is currently in the success state
16346 #[no_mangle]
16347 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool {
16348         o.result_ok
16349 }
16350 #[no_mangle]
16351 /// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ.
16352 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { }
16353 impl Drop for CResult_TxRemoveInputDecodeErrorZ {
16354         fn drop(&mut self) {
16355                 if self.result_ok {
16356                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16357                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16358                         }
16359                 } else {
16360                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16361                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16362                         }
16363                 }
16364         }
16365 }
16366 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveInputDecodeErrorZ {
16367         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveInput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16368                 let contents = if o.result_ok {
16369                         let result = unsafe { o.contents.result };
16370                         unsafe { o.contents.result = core::ptr::null_mut() };
16371                         CResult_TxRemoveInputDecodeErrorZPtr { result }
16372                 } else {
16373                         let err = unsafe { o.contents.err };
16374                         unsafe { o.contents.err = core::ptr::null_mut(); }
16375                         CResult_TxRemoveInputDecodeErrorZPtr { err }
16376                 };
16377                 Self {
16378                         contents,
16379                         result_ok: o.result_ok,
16380                 }
16381         }
16382 }
16383 impl Clone for CResult_TxRemoveInputDecodeErrorZ {
16384         fn clone(&self) -> Self {
16385                 if self.result_ok {
16386                         Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16387                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveInput>::clone(unsafe { &*self.contents.result })))
16388                         } }
16389                 } else {
16390                         Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr {
16391                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16392                         } }
16393                 }
16394         }
16395 }
16396 #[no_mangle]
16397 /// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig`
16398 /// but with all dynamically-allocated buffers duplicated in new buffers.
16399 pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) }
16400 #[repr(C)]
16401 /// The contents of CResult_TxRemoveOutputDecodeErrorZ
16402 pub union CResult_TxRemoveOutputDecodeErrorZPtr {
16403         /// A pointer to the contents in the success state.
16404         /// Reading from this pointer when `result_ok` is not set is undefined.
16405         pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput,
16406         /// A pointer to the contents in the error state.
16407         /// Reading from this pointer when `result_ok` is set is undefined.
16408         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16409 }
16410 #[repr(C)]
16411 /// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation,
16412 /// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
16413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16414 pub struct CResult_TxRemoveOutputDecodeErrorZ {
16415         /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either
16416         /// `err` or `result` depending on the state of `result_ok`.
16417         pub contents: CResult_TxRemoveOutputDecodeErrorZPtr,
16418         /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state.
16419         pub result_ok: bool,
16420 }
16421 #[no_mangle]
16422 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state.
16423 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ {
16424         CResult_TxRemoveOutputDecodeErrorZ {
16425                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16426                         result: Box::into_raw(Box::new(o)),
16427                 },
16428                 result_ok: true,
16429         }
16430 }
16431 #[no_mangle]
16432 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state.
16433 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ {
16434         CResult_TxRemoveOutputDecodeErrorZ {
16435                 contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16436                         err: Box::into_raw(Box::new(e)),
16437                 },
16438                 result_ok: false,
16439         }
16440 }
16441 /// Checks if the given object is currently in the success state
16442 #[no_mangle]
16443 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool {
16444         o.result_ok
16445 }
16446 #[no_mangle]
16447 /// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ.
16448 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { }
16449 impl Drop for CResult_TxRemoveOutputDecodeErrorZ {
16450         fn drop(&mut self) {
16451                 if self.result_ok {
16452                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16453                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16454                         }
16455                 } else {
16456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16458                         }
16459                 }
16460         }
16461 }
16462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TxRemoveOutputDecodeErrorZ {
16463         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxRemoveOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
16464                 let contents = if o.result_ok {
16465                         let result = unsafe { o.contents.result };
16466                         unsafe { o.contents.result = core::ptr::null_mut() };
16467                         CResult_TxRemoveOutputDecodeErrorZPtr { result }
16468                 } else {
16469                         let err = unsafe { o.contents.err };
16470                         unsafe { o.contents.err = core::ptr::null_mut(); }
16471                         CResult_TxRemoveOutputDecodeErrorZPtr { err }
16472                 };
16473                 Self {
16474                         contents,
16475                         result_ok: o.result_ok,
16476                 }
16477         }
16478 }
16479 impl Clone for CResult_TxRemoveOutputDecodeErrorZ {
16480         fn clone(&self) -> Self {
16481                 if self.result_ok {
16482                         Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16483                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxRemoveOutput>::clone(unsafe { &*self.contents.result })))
16484                         } }
16485                 } else {
16486                         Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr {
16487                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16488                         } }
16489                 }
16490         }
16491 }
16492 #[no_mangle]
16493 /// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig`
16494 /// but with all dynamically-allocated buffers duplicated in new buffers.
16495 pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) }
16496 #[repr(C)]
16497 /// The contents of CResult_TxCompleteDecodeErrorZ
16498 pub union CResult_TxCompleteDecodeErrorZPtr {
16499         /// A pointer to the contents in the success state.
16500         /// Reading from this pointer when `result_ok` is not set is undefined.
16501         pub result: *mut crate::lightning::ln::msgs::TxComplete,
16502         /// A pointer to the contents in the error state.
16503         /// Reading from this pointer when `result_ok` is set is undefined.
16504         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16505 }
16506 #[repr(C)]
16507 /// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation,
16508 /// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure.
16509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16510 pub struct CResult_TxCompleteDecodeErrorZ {
16511         /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either
16512         /// `err` or `result` depending on the state of `result_ok`.
16513         pub contents: CResult_TxCompleteDecodeErrorZPtr,
16514         /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state.
16515         pub result_ok: bool,
16516 }
16517 #[no_mangle]
16518 /// Creates a new CResult_TxCompleteDecodeErrorZ in the success state.
16519 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ {
16520         CResult_TxCompleteDecodeErrorZ {
16521                 contents: CResult_TxCompleteDecodeErrorZPtr {
16522                         result: Box::into_raw(Box::new(o)),
16523                 },
16524                 result_ok: true,
16525         }
16526 }
16527 #[no_mangle]
16528 /// Creates a new CResult_TxCompleteDecodeErrorZ in the error state.
16529 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ {
16530         CResult_TxCompleteDecodeErrorZ {
16531                 contents: CResult_TxCompleteDecodeErrorZPtr {
16532                         err: Box::into_raw(Box::new(e)),
16533                 },
16534                 result_ok: false,
16535         }
16536 }
16537 /// Checks if the given object is currently in the success state
16538 #[no_mangle]
16539 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool {
16540         o.result_ok
16541 }
16542 #[no_mangle]
16543 /// Frees any resources used by the CResult_TxCompleteDecodeErrorZ.
16544 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { }
16545 impl Drop for CResult_TxCompleteDecodeErrorZ {
16546         fn drop(&mut self) {
16547                 if self.result_ok {
16548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16550                         }
16551                 } else {
16552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16554                         }
16555                 }
16556         }
16557 }
16558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCompleteDecodeErrorZ {
16559         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxComplete, crate::lightning::ln::msgs::DecodeError>) -> Self {
16560                 let contents = if o.result_ok {
16561                         let result = unsafe { o.contents.result };
16562                         unsafe { o.contents.result = core::ptr::null_mut() };
16563                         CResult_TxCompleteDecodeErrorZPtr { result }
16564                 } else {
16565                         let err = unsafe { o.contents.err };
16566                         unsafe { o.contents.err = core::ptr::null_mut(); }
16567                         CResult_TxCompleteDecodeErrorZPtr { err }
16568                 };
16569                 Self {
16570                         contents,
16571                         result_ok: o.result_ok,
16572                 }
16573         }
16574 }
16575 impl Clone for CResult_TxCompleteDecodeErrorZ {
16576         fn clone(&self) -> Self {
16577                 if self.result_ok {
16578                         Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr {
16579                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxComplete>::clone(unsafe { &*self.contents.result })))
16580                         } }
16581                 } else {
16582                         Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr {
16583                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16584                         } }
16585                 }
16586         }
16587 }
16588 #[no_mangle]
16589 /// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig`
16590 /// but with all dynamically-allocated buffers duplicated in new buffers.
16591 pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) }
16592 #[repr(C)]
16593 /// The contents of CResult_TxSignaturesDecodeErrorZ
16594 pub union CResult_TxSignaturesDecodeErrorZPtr {
16595         /// A pointer to the contents in the success state.
16596         /// Reading from this pointer when `result_ok` is not set is undefined.
16597         pub result: *mut crate::lightning::ln::msgs::TxSignatures,
16598         /// A pointer to the contents in the error state.
16599         /// Reading from this pointer when `result_ok` is set is undefined.
16600         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16601 }
16602 #[repr(C)]
16603 /// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation,
16604 /// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
16605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16606 pub struct CResult_TxSignaturesDecodeErrorZ {
16607         /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either
16608         /// `err` or `result` depending on the state of `result_ok`.
16609         pub contents: CResult_TxSignaturesDecodeErrorZPtr,
16610         /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state.
16611         pub result_ok: bool,
16612 }
16613 #[no_mangle]
16614 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state.
16615 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ {
16616         CResult_TxSignaturesDecodeErrorZ {
16617                 contents: CResult_TxSignaturesDecodeErrorZPtr {
16618                         result: Box::into_raw(Box::new(o)),
16619                 },
16620                 result_ok: true,
16621         }
16622 }
16623 #[no_mangle]
16624 /// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state.
16625 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ {
16626         CResult_TxSignaturesDecodeErrorZ {
16627                 contents: CResult_TxSignaturesDecodeErrorZPtr {
16628                         err: Box::into_raw(Box::new(e)),
16629                 },
16630                 result_ok: false,
16631         }
16632 }
16633 /// Checks if the given object is currently in the success state
16634 #[no_mangle]
16635 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool {
16636         o.result_ok
16637 }
16638 #[no_mangle]
16639 /// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ.
16640 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { }
16641 impl Drop for CResult_TxSignaturesDecodeErrorZ {
16642         fn drop(&mut self) {
16643                 if self.result_ok {
16644                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16645                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16646                         }
16647                 } else {
16648                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16649                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16650                         }
16651                 }
16652         }
16653 }
16654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_TxSignaturesDecodeErrorZ {
16655         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
16656                 let contents = if o.result_ok {
16657                         let result = unsafe { o.contents.result };
16658                         unsafe { o.contents.result = core::ptr::null_mut() };
16659                         CResult_TxSignaturesDecodeErrorZPtr { result }
16660                 } else {
16661                         let err = unsafe { o.contents.err };
16662                         unsafe { o.contents.err = core::ptr::null_mut(); }
16663                         CResult_TxSignaturesDecodeErrorZPtr { err }
16664                 };
16665                 Self {
16666                         contents,
16667                         result_ok: o.result_ok,
16668                 }
16669         }
16670 }
16671 impl Clone for CResult_TxSignaturesDecodeErrorZ {
16672         fn clone(&self) -> Self {
16673                 if self.result_ok {
16674                         Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr {
16675                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxSignatures>::clone(unsafe { &*self.contents.result })))
16676                         } }
16677                 } else {
16678                         Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr {
16679                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16680                         } }
16681                 }
16682         }
16683 }
16684 #[no_mangle]
16685 /// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig`
16686 /// but with all dynamically-allocated buffers duplicated in new buffers.
16687 pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) }
16688 #[repr(C)]
16689 /// The contents of CResult_TxInitRbfDecodeErrorZ
16690 pub union CResult_TxInitRbfDecodeErrorZPtr {
16691         /// A pointer to the contents in the success state.
16692         /// Reading from this pointer when `result_ok` is not set is undefined.
16693         pub result: *mut crate::lightning::ln::msgs::TxInitRbf,
16694         /// A pointer to the contents in the error state.
16695         /// Reading from this pointer when `result_ok` is set is undefined.
16696         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16697 }
16698 #[repr(C)]
16699 /// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation,
16700 /// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16702 pub struct CResult_TxInitRbfDecodeErrorZ {
16703         /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either
16704         /// `err` or `result` depending on the state of `result_ok`.
16705         pub contents: CResult_TxInitRbfDecodeErrorZPtr,
16706         /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state.
16707         pub result_ok: bool,
16708 }
16709 #[no_mangle]
16710 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state.
16711 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ {
16712         CResult_TxInitRbfDecodeErrorZ {
16713                 contents: CResult_TxInitRbfDecodeErrorZPtr {
16714                         result: Box::into_raw(Box::new(o)),
16715                 },
16716                 result_ok: true,
16717         }
16718 }
16719 #[no_mangle]
16720 /// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state.
16721 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ {
16722         CResult_TxInitRbfDecodeErrorZ {
16723                 contents: CResult_TxInitRbfDecodeErrorZPtr {
16724                         err: Box::into_raw(Box::new(e)),
16725                 },
16726                 result_ok: false,
16727         }
16728 }
16729 /// Checks if the given object is currently in the success state
16730 #[no_mangle]
16731 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool {
16732         o.result_ok
16733 }
16734 #[no_mangle]
16735 /// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ.
16736 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { }
16737 impl Drop for CResult_TxInitRbfDecodeErrorZ {
16738         fn drop(&mut self) {
16739                 if self.result_ok {
16740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16742                         }
16743                 } else {
16744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16746                         }
16747                 }
16748         }
16749 }
16750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxInitRbfDecodeErrorZ {
16751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxInitRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
16752                 let contents = if o.result_ok {
16753                         let result = unsafe { o.contents.result };
16754                         unsafe { o.contents.result = core::ptr::null_mut() };
16755                         CResult_TxInitRbfDecodeErrorZPtr { result }
16756                 } else {
16757                         let err = unsafe { o.contents.err };
16758                         unsafe { o.contents.err = core::ptr::null_mut(); }
16759                         CResult_TxInitRbfDecodeErrorZPtr { err }
16760                 };
16761                 Self {
16762                         contents,
16763                         result_ok: o.result_ok,
16764                 }
16765         }
16766 }
16767 impl Clone for CResult_TxInitRbfDecodeErrorZ {
16768         fn clone(&self) -> Self {
16769                 if self.result_ok {
16770                         Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr {
16771                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxInitRbf>::clone(unsafe { &*self.contents.result })))
16772                         } }
16773                 } else {
16774                         Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr {
16775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16776                         } }
16777                 }
16778         }
16779 }
16780 #[no_mangle]
16781 /// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig`
16782 /// but with all dynamically-allocated buffers duplicated in new buffers.
16783 pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) }
16784 #[repr(C)]
16785 /// The contents of CResult_TxAckRbfDecodeErrorZ
16786 pub union CResult_TxAckRbfDecodeErrorZPtr {
16787         /// A pointer to the contents in the success state.
16788         /// Reading from this pointer when `result_ok` is not set is undefined.
16789         pub result: *mut crate::lightning::ln::msgs::TxAckRbf,
16790         /// A pointer to the contents in the error state.
16791         /// Reading from this pointer when `result_ok` is set is undefined.
16792         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16793 }
16794 #[repr(C)]
16795 /// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation,
16796 /// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure.
16797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16798 pub struct CResult_TxAckRbfDecodeErrorZ {
16799         /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either
16800         /// `err` or `result` depending on the state of `result_ok`.
16801         pub contents: CResult_TxAckRbfDecodeErrorZPtr,
16802         /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state.
16803         pub result_ok: bool,
16804 }
16805 #[no_mangle]
16806 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state.
16807 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ {
16808         CResult_TxAckRbfDecodeErrorZ {
16809                 contents: CResult_TxAckRbfDecodeErrorZPtr {
16810                         result: Box::into_raw(Box::new(o)),
16811                 },
16812                 result_ok: true,
16813         }
16814 }
16815 #[no_mangle]
16816 /// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state.
16817 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ {
16818         CResult_TxAckRbfDecodeErrorZ {
16819                 contents: CResult_TxAckRbfDecodeErrorZPtr {
16820                         err: Box::into_raw(Box::new(e)),
16821                 },
16822                 result_ok: false,
16823         }
16824 }
16825 /// Checks if the given object is currently in the success state
16826 #[no_mangle]
16827 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool {
16828         o.result_ok
16829 }
16830 #[no_mangle]
16831 /// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ.
16832 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { }
16833 impl Drop for CResult_TxAckRbfDecodeErrorZ {
16834         fn drop(&mut self) {
16835                 if self.result_ok {
16836                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16837                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16838                         }
16839                 } else {
16840                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16841                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16842                         }
16843                 }
16844         }
16845 }
16846 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAckRbfDecodeErrorZ {
16847         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAckRbf, crate::lightning::ln::msgs::DecodeError>) -> Self {
16848                 let contents = if o.result_ok {
16849                         let result = unsafe { o.contents.result };
16850                         unsafe { o.contents.result = core::ptr::null_mut() };
16851                         CResult_TxAckRbfDecodeErrorZPtr { result }
16852                 } else {
16853                         let err = unsafe { o.contents.err };
16854                         unsafe { o.contents.err = core::ptr::null_mut(); }
16855                         CResult_TxAckRbfDecodeErrorZPtr { err }
16856                 };
16857                 Self {
16858                         contents,
16859                         result_ok: o.result_ok,
16860                 }
16861         }
16862 }
16863 impl Clone for CResult_TxAckRbfDecodeErrorZ {
16864         fn clone(&self) -> Self {
16865                 if self.result_ok {
16866                         Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr {
16867                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAckRbf>::clone(unsafe { &*self.contents.result })))
16868                         } }
16869                 } else {
16870                         Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr {
16871                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16872                         } }
16873                 }
16874         }
16875 }
16876 #[no_mangle]
16877 /// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig`
16878 /// but with all dynamically-allocated buffers duplicated in new buffers.
16879 pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) }
16880 #[repr(C)]
16881 /// The contents of CResult_TxAbortDecodeErrorZ
16882 pub union CResult_TxAbortDecodeErrorZPtr {
16883         /// A pointer to the contents in the success state.
16884         /// Reading from this pointer when `result_ok` is not set is undefined.
16885         pub result: *mut crate::lightning::ln::msgs::TxAbort,
16886         /// A pointer to the contents in the error state.
16887         /// Reading from this pointer when `result_ok` is set is undefined.
16888         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16889 }
16890 #[repr(C)]
16891 /// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation,
16892 /// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure.
16893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16894 pub struct CResult_TxAbortDecodeErrorZ {
16895         /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either
16896         /// `err` or `result` depending on the state of `result_ok`.
16897         pub contents: CResult_TxAbortDecodeErrorZPtr,
16898         /// Whether this CResult_TxAbortDecodeErrorZ represents a success state.
16899         pub result_ok: bool,
16900 }
16901 #[no_mangle]
16902 /// Creates a new CResult_TxAbortDecodeErrorZ in the success state.
16903 pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ {
16904         CResult_TxAbortDecodeErrorZ {
16905                 contents: CResult_TxAbortDecodeErrorZPtr {
16906                         result: Box::into_raw(Box::new(o)),
16907                 },
16908                 result_ok: true,
16909         }
16910 }
16911 #[no_mangle]
16912 /// Creates a new CResult_TxAbortDecodeErrorZ in the error state.
16913 pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ {
16914         CResult_TxAbortDecodeErrorZ {
16915                 contents: CResult_TxAbortDecodeErrorZPtr {
16916                         err: Box::into_raw(Box::new(e)),
16917                 },
16918                 result_ok: false,
16919         }
16920 }
16921 /// Checks if the given object is currently in the success state
16922 #[no_mangle]
16923 pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool {
16924         o.result_ok
16925 }
16926 #[no_mangle]
16927 /// Frees any resources used by the CResult_TxAbortDecodeErrorZ.
16928 pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { }
16929 impl Drop for CResult_TxAbortDecodeErrorZ {
16930         fn drop(&mut self) {
16931                 if self.result_ok {
16932                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16933                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16934                         }
16935                 } else {
16936                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16937                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16938                         }
16939                 }
16940         }
16941 }
16942 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>> for CResult_TxAbortDecodeErrorZ {
16943         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::TxAbort, crate::lightning::ln::msgs::DecodeError>) -> Self {
16944                 let contents = if o.result_ok {
16945                         let result = unsafe { o.contents.result };
16946                         unsafe { o.contents.result = core::ptr::null_mut() };
16947                         CResult_TxAbortDecodeErrorZPtr { result }
16948                 } else {
16949                         let err = unsafe { o.contents.err };
16950                         unsafe { o.contents.err = core::ptr::null_mut(); }
16951                         CResult_TxAbortDecodeErrorZPtr { err }
16952                 };
16953                 Self {
16954                         contents,
16955                         result_ok: o.result_ok,
16956                 }
16957         }
16958 }
16959 impl Clone for CResult_TxAbortDecodeErrorZ {
16960         fn clone(&self) -> Self {
16961                 if self.result_ok {
16962                         Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr {
16963                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::TxAbort>::clone(unsafe { &*self.contents.result })))
16964                         } }
16965                 } else {
16966                         Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr {
16967                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16968                         } }
16969                 }
16970         }
16971 }
16972 #[no_mangle]
16973 /// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig`
16974 /// but with all dynamically-allocated buffers duplicated in new buffers.
16975 pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) }
16976 #[repr(C)]
16977 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
16978 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
16979         /// A pointer to the contents in the success state.
16980         /// Reading from this pointer when `result_ok` is not set is undefined.
16981         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
16982         /// A pointer to the contents in the error state.
16983         /// Reading from this pointer when `result_ok` is set is undefined.
16984         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16985 }
16986 #[repr(C)]
16987 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
16988 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
16989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16990 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
16991         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
16992         /// `err` or `result` depending on the state of `result_ok`.
16993         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
16994         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
16995         pub result_ok: bool,
16996 }
16997 #[no_mangle]
16998 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
16999 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17000         CResult_AnnouncementSignaturesDecodeErrorZ {
17001                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17002                         result: Box::into_raw(Box::new(o)),
17003                 },
17004                 result_ok: true,
17005         }
17006 }
17007 #[no_mangle]
17008 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
17009 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
17010         CResult_AnnouncementSignaturesDecodeErrorZ {
17011                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17012                         err: Box::into_raw(Box::new(e)),
17013                 },
17014                 result_ok: false,
17015         }
17016 }
17017 /// Checks if the given object is currently in the success state
17018 #[no_mangle]
17019 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
17020         o.result_ok
17021 }
17022 #[no_mangle]
17023 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
17024 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
17025 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
17026         fn drop(&mut self) {
17027                 if self.result_ok {
17028                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17029                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17030                         }
17031                 } else {
17032                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17033                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17034                         }
17035                 }
17036         }
17037 }
17038 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
17039         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
17040                 let contents = if o.result_ok {
17041                         let result = unsafe { o.contents.result };
17042                         unsafe { o.contents.result = core::ptr::null_mut() };
17043                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
17044                 } else {
17045                         let err = unsafe { o.contents.err };
17046                         unsafe { o.contents.err = core::ptr::null_mut(); }
17047                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
17048                 };
17049                 Self {
17050                         contents,
17051                         result_ok: o.result_ok,
17052                 }
17053         }
17054 }
17055 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
17056         fn clone(&self) -> Self {
17057                 if self.result_ok {
17058                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17059                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
17060                         } }
17061                 } else {
17062                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
17063                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17064                         } }
17065                 }
17066         }
17067 }
17068 #[no_mangle]
17069 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
17070 /// but with all dynamically-allocated buffers duplicated in new buffers.
17071 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
17072 #[repr(C)]
17073 /// The contents of CResult_ChannelReestablishDecodeErrorZ
17074 pub union CResult_ChannelReestablishDecodeErrorZPtr {
17075         /// A pointer to the contents in the success state.
17076         /// Reading from this pointer when `result_ok` is not set is undefined.
17077         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
17078         /// A pointer to the contents in the error state.
17079         /// Reading from this pointer when `result_ok` is set is undefined.
17080         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17081 }
17082 #[repr(C)]
17083 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
17084 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
17085 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17086 pub struct CResult_ChannelReestablishDecodeErrorZ {
17087         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
17088         /// `err` or `result` depending on the state of `result_ok`.
17089         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
17090         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
17091         pub result_ok: bool,
17092 }
17093 #[no_mangle]
17094 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
17095 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
17096         CResult_ChannelReestablishDecodeErrorZ {
17097                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17098                         result: Box::into_raw(Box::new(o)),
17099                 },
17100                 result_ok: true,
17101         }
17102 }
17103 #[no_mangle]
17104 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
17105 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
17106         CResult_ChannelReestablishDecodeErrorZ {
17107                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
17108                         err: Box::into_raw(Box::new(e)),
17109                 },
17110                 result_ok: false,
17111         }
17112 }
17113 /// Checks if the given object is currently in the success state
17114 #[no_mangle]
17115 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
17116         o.result_ok
17117 }
17118 #[no_mangle]
17119 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
17120 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
17121 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
17122         fn drop(&mut self) {
17123                 if self.result_ok {
17124                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17125                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17126                         }
17127                 } else {
17128                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17129                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17130                         }
17131                 }
17132         }
17133 }
17134 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
17135         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
17136                 let contents = if o.result_ok {
17137                         let result = unsafe { o.contents.result };
17138                         unsafe { o.contents.result = core::ptr::null_mut() };
17139                         CResult_ChannelReestablishDecodeErrorZPtr { result }
17140                 } else {
17141                         let err = unsafe { o.contents.err };
17142                         unsafe { o.contents.err = core::ptr::null_mut(); }
17143                         CResult_ChannelReestablishDecodeErrorZPtr { err }
17144                 };
17145                 Self {
17146                         contents,
17147                         result_ok: o.result_ok,
17148                 }
17149         }
17150 }
17151 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
17152         fn clone(&self) -> Self {
17153                 if self.result_ok {
17154                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17155                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
17156                         } }
17157                 } else {
17158                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
17159                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17160                         } }
17161                 }
17162         }
17163 }
17164 #[no_mangle]
17165 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
17166 /// but with all dynamically-allocated buffers duplicated in new buffers.
17167 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
17168 #[repr(C)]
17169 /// The contents of CResult_ClosingSignedDecodeErrorZ
17170 pub union CResult_ClosingSignedDecodeErrorZPtr {
17171         /// A pointer to the contents in the success state.
17172         /// Reading from this pointer when `result_ok` is not set is undefined.
17173         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
17174         /// A pointer to the contents in the error state.
17175         /// Reading from this pointer when `result_ok` is set is undefined.
17176         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17177 }
17178 #[repr(C)]
17179 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
17180 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17182 pub struct CResult_ClosingSignedDecodeErrorZ {
17183         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
17184         /// `err` or `result` depending on the state of `result_ok`.
17185         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
17186         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
17187         pub result_ok: bool,
17188 }
17189 #[no_mangle]
17190 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
17191 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
17192         CResult_ClosingSignedDecodeErrorZ {
17193                 contents: CResult_ClosingSignedDecodeErrorZPtr {
17194                         result: Box::into_raw(Box::new(o)),
17195                 },
17196                 result_ok: true,
17197         }
17198 }
17199 #[no_mangle]
17200 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
17201 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
17202         CResult_ClosingSignedDecodeErrorZ {
17203                 contents: CResult_ClosingSignedDecodeErrorZPtr {
17204                         err: Box::into_raw(Box::new(e)),
17205                 },
17206                 result_ok: false,
17207         }
17208 }
17209 /// Checks if the given object is currently in the success state
17210 #[no_mangle]
17211 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
17212         o.result_ok
17213 }
17214 #[no_mangle]
17215 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
17216 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
17217 impl Drop for CResult_ClosingSignedDecodeErrorZ {
17218         fn drop(&mut self) {
17219                 if self.result_ok {
17220                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17221                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17222                         }
17223                 } else {
17224                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17225                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17226                         }
17227                 }
17228         }
17229 }
17230 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
17231         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17232                 let contents = if o.result_ok {
17233                         let result = unsafe { o.contents.result };
17234                         unsafe { o.contents.result = core::ptr::null_mut() };
17235                         CResult_ClosingSignedDecodeErrorZPtr { result }
17236                 } else {
17237                         let err = unsafe { o.contents.err };
17238                         unsafe { o.contents.err = core::ptr::null_mut(); }
17239                         CResult_ClosingSignedDecodeErrorZPtr { err }
17240                 };
17241                 Self {
17242                         contents,
17243                         result_ok: o.result_ok,
17244                 }
17245         }
17246 }
17247 impl Clone for CResult_ClosingSignedDecodeErrorZ {
17248         fn clone(&self) -> Self {
17249                 if self.result_ok {
17250                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
17251                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
17252                         } }
17253                 } else {
17254                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
17255                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17256                         } }
17257                 }
17258         }
17259 }
17260 #[no_mangle]
17261 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
17262 /// but with all dynamically-allocated buffers duplicated in new buffers.
17263 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
17264 #[repr(C)]
17265 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
17266 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17267         /// A pointer to the contents in the success state.
17268         /// Reading from this pointer when `result_ok` is not set is undefined.
17269         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
17270         /// A pointer to the contents in the error state.
17271         /// Reading from this pointer when `result_ok` is set is undefined.
17272         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17273 }
17274 #[repr(C)]
17275 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
17276 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
17277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17278 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
17279         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
17280         /// `err` or `result` depending on the state of `result_ok`.
17281         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
17282         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
17283         pub result_ok: bool,
17284 }
17285 #[no_mangle]
17286 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
17287 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17288         CResult_ClosingSignedFeeRangeDecodeErrorZ {
17289                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17290                         result: Box::into_raw(Box::new(o)),
17291                 },
17292                 result_ok: true,
17293         }
17294 }
17295 #[no_mangle]
17296 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
17297 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
17298         CResult_ClosingSignedFeeRangeDecodeErrorZ {
17299                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17300                         err: Box::into_raw(Box::new(e)),
17301                 },
17302                 result_ok: false,
17303         }
17304 }
17305 /// Checks if the given object is currently in the success state
17306 #[no_mangle]
17307 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
17308         o.result_ok
17309 }
17310 #[no_mangle]
17311 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
17312 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
17313 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17314         fn drop(&mut self) {
17315                 if self.result_ok {
17316                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17317                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17318                         }
17319                 } else {
17320                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17321                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17322                         }
17323                 }
17324         }
17325 }
17326 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17327         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
17328                 let contents = if o.result_ok {
17329                         let result = unsafe { o.contents.result };
17330                         unsafe { o.contents.result = core::ptr::null_mut() };
17331                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
17332                 } else {
17333                         let err = unsafe { o.contents.err };
17334                         unsafe { o.contents.err = core::ptr::null_mut(); }
17335                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
17336                 };
17337                 Self {
17338                         contents,
17339                         result_ok: o.result_ok,
17340                 }
17341         }
17342 }
17343 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
17344         fn clone(&self) -> Self {
17345                 if self.result_ok {
17346                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17347                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
17348                         } }
17349                 } else {
17350                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
17351                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17352                         } }
17353                 }
17354         }
17355 }
17356 #[no_mangle]
17357 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
17358 /// but with all dynamically-allocated buffers duplicated in new buffers.
17359 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
17360 #[repr(C)]
17361 /// The contents of CResult_CommitmentSignedDecodeErrorZ
17362 pub union CResult_CommitmentSignedDecodeErrorZPtr {
17363         /// A pointer to the contents in the success state.
17364         /// Reading from this pointer when `result_ok` is not set is undefined.
17365         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
17366         /// A pointer to the contents in the error state.
17367         /// Reading from this pointer when `result_ok` is set is undefined.
17368         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17369 }
17370 #[repr(C)]
17371 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
17372 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17374 pub struct CResult_CommitmentSignedDecodeErrorZ {
17375         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
17376         /// `err` or `result` depending on the state of `result_ok`.
17377         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
17378         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
17379         pub result_ok: bool,
17380 }
17381 #[no_mangle]
17382 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
17383 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
17384         CResult_CommitmentSignedDecodeErrorZ {
17385                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17386                         result: Box::into_raw(Box::new(o)),
17387                 },
17388                 result_ok: true,
17389         }
17390 }
17391 #[no_mangle]
17392 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
17393 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
17394         CResult_CommitmentSignedDecodeErrorZ {
17395                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
17396                         err: Box::into_raw(Box::new(e)),
17397                 },
17398                 result_ok: false,
17399         }
17400 }
17401 /// Checks if the given object is currently in the success state
17402 #[no_mangle]
17403 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
17404         o.result_ok
17405 }
17406 #[no_mangle]
17407 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
17408 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
17409 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
17410         fn drop(&mut self) {
17411                 if self.result_ok {
17412                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17413                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17414                         }
17415                 } else {
17416                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17417                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17418                         }
17419                 }
17420         }
17421 }
17422 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
17423         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17424                 let contents = if o.result_ok {
17425                         let result = unsafe { o.contents.result };
17426                         unsafe { o.contents.result = core::ptr::null_mut() };
17427                         CResult_CommitmentSignedDecodeErrorZPtr { result }
17428                 } else {
17429                         let err = unsafe { o.contents.err };
17430                         unsafe { o.contents.err = core::ptr::null_mut(); }
17431                         CResult_CommitmentSignedDecodeErrorZPtr { err }
17432                 };
17433                 Self {
17434                         contents,
17435                         result_ok: o.result_ok,
17436                 }
17437         }
17438 }
17439 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
17440         fn clone(&self) -> Self {
17441                 if self.result_ok {
17442                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17443                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
17444                         } }
17445                 } else {
17446                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
17447                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17448                         } }
17449                 }
17450         }
17451 }
17452 #[no_mangle]
17453 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
17454 /// but with all dynamically-allocated buffers duplicated in new buffers.
17455 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
17456 #[repr(C)]
17457 /// The contents of CResult_FundingCreatedDecodeErrorZ
17458 pub union CResult_FundingCreatedDecodeErrorZPtr {
17459         /// A pointer to the contents in the success state.
17460         /// Reading from this pointer when `result_ok` is not set is undefined.
17461         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
17462         /// A pointer to the contents in the error state.
17463         /// Reading from this pointer when `result_ok` is set is undefined.
17464         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17465 }
17466 #[repr(C)]
17467 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
17468 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
17469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17470 pub struct CResult_FundingCreatedDecodeErrorZ {
17471         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
17472         /// `err` or `result` depending on the state of `result_ok`.
17473         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
17474         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
17475         pub result_ok: bool,
17476 }
17477 #[no_mangle]
17478 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
17479 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
17480         CResult_FundingCreatedDecodeErrorZ {
17481                 contents: CResult_FundingCreatedDecodeErrorZPtr {
17482                         result: Box::into_raw(Box::new(o)),
17483                 },
17484                 result_ok: true,
17485         }
17486 }
17487 #[no_mangle]
17488 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
17489 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
17490         CResult_FundingCreatedDecodeErrorZ {
17491                 contents: CResult_FundingCreatedDecodeErrorZPtr {
17492                         err: Box::into_raw(Box::new(e)),
17493                 },
17494                 result_ok: false,
17495         }
17496 }
17497 /// Checks if the given object is currently in the success state
17498 #[no_mangle]
17499 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
17500         o.result_ok
17501 }
17502 #[no_mangle]
17503 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
17504 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
17505 impl Drop for CResult_FundingCreatedDecodeErrorZ {
17506         fn drop(&mut self) {
17507                 if self.result_ok {
17508                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17509                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17510                         }
17511                 } else {
17512                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17513                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17514                         }
17515                 }
17516         }
17517 }
17518 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
17519         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
17520                 let contents = if o.result_ok {
17521                         let result = unsafe { o.contents.result };
17522                         unsafe { o.contents.result = core::ptr::null_mut() };
17523                         CResult_FundingCreatedDecodeErrorZPtr { result }
17524                 } else {
17525                         let err = unsafe { o.contents.err };
17526                         unsafe { o.contents.err = core::ptr::null_mut(); }
17527                         CResult_FundingCreatedDecodeErrorZPtr { err }
17528                 };
17529                 Self {
17530                         contents,
17531                         result_ok: o.result_ok,
17532                 }
17533         }
17534 }
17535 impl Clone for CResult_FundingCreatedDecodeErrorZ {
17536         fn clone(&self) -> Self {
17537                 if self.result_ok {
17538                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
17539                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
17540                         } }
17541                 } else {
17542                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
17543                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17544                         } }
17545                 }
17546         }
17547 }
17548 #[no_mangle]
17549 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
17550 /// but with all dynamically-allocated buffers duplicated in new buffers.
17551 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
17552 #[repr(C)]
17553 /// The contents of CResult_FundingSignedDecodeErrorZ
17554 pub union CResult_FundingSignedDecodeErrorZPtr {
17555         /// A pointer to the contents in the success state.
17556         /// Reading from this pointer when `result_ok` is not set is undefined.
17557         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
17558         /// A pointer to the contents in the error state.
17559         /// Reading from this pointer when `result_ok` is set is undefined.
17560         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17561 }
17562 #[repr(C)]
17563 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
17564 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
17565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17566 pub struct CResult_FundingSignedDecodeErrorZ {
17567         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
17568         /// `err` or `result` depending on the state of `result_ok`.
17569         pub contents: CResult_FundingSignedDecodeErrorZPtr,
17570         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
17571         pub result_ok: bool,
17572 }
17573 #[no_mangle]
17574 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
17575 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
17576         CResult_FundingSignedDecodeErrorZ {
17577                 contents: CResult_FundingSignedDecodeErrorZPtr {
17578                         result: Box::into_raw(Box::new(o)),
17579                 },
17580                 result_ok: true,
17581         }
17582 }
17583 #[no_mangle]
17584 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
17585 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
17586         CResult_FundingSignedDecodeErrorZ {
17587                 contents: CResult_FundingSignedDecodeErrorZPtr {
17588                         err: Box::into_raw(Box::new(e)),
17589                 },
17590                 result_ok: false,
17591         }
17592 }
17593 /// Checks if the given object is currently in the success state
17594 #[no_mangle]
17595 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
17596         o.result_ok
17597 }
17598 #[no_mangle]
17599 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
17600 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
17601 impl Drop for CResult_FundingSignedDecodeErrorZ {
17602         fn drop(&mut self) {
17603                 if self.result_ok {
17604                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17605                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17606                         }
17607                 } else {
17608                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17609                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17610                         }
17611                 }
17612         }
17613 }
17614 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
17615         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
17616                 let contents = if o.result_ok {
17617                         let result = unsafe { o.contents.result };
17618                         unsafe { o.contents.result = core::ptr::null_mut() };
17619                         CResult_FundingSignedDecodeErrorZPtr { result }
17620                 } else {
17621                         let err = unsafe { o.contents.err };
17622                         unsafe { o.contents.err = core::ptr::null_mut(); }
17623                         CResult_FundingSignedDecodeErrorZPtr { err }
17624                 };
17625                 Self {
17626                         contents,
17627                         result_ok: o.result_ok,
17628                 }
17629         }
17630 }
17631 impl Clone for CResult_FundingSignedDecodeErrorZ {
17632         fn clone(&self) -> Self {
17633                 if self.result_ok {
17634                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
17635                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
17636                         } }
17637                 } else {
17638                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
17639                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17640                         } }
17641                 }
17642         }
17643 }
17644 #[no_mangle]
17645 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
17646 /// but with all dynamically-allocated buffers duplicated in new buffers.
17647 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
17648 #[repr(C)]
17649 /// The contents of CResult_ChannelReadyDecodeErrorZ
17650 pub union CResult_ChannelReadyDecodeErrorZPtr {
17651         /// A pointer to the contents in the success state.
17652         /// Reading from this pointer when `result_ok` is not set is undefined.
17653         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
17654         /// A pointer to the contents in the error state.
17655         /// Reading from this pointer when `result_ok` is set is undefined.
17656         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17657 }
17658 #[repr(C)]
17659 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
17660 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
17661 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17662 pub struct CResult_ChannelReadyDecodeErrorZ {
17663         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
17664         /// `err` or `result` depending on the state of `result_ok`.
17665         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
17666         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
17667         pub result_ok: bool,
17668 }
17669 #[no_mangle]
17670 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
17671 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
17672         CResult_ChannelReadyDecodeErrorZ {
17673                 contents: CResult_ChannelReadyDecodeErrorZPtr {
17674                         result: Box::into_raw(Box::new(o)),
17675                 },
17676                 result_ok: true,
17677         }
17678 }
17679 #[no_mangle]
17680 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
17681 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
17682         CResult_ChannelReadyDecodeErrorZ {
17683                 contents: CResult_ChannelReadyDecodeErrorZPtr {
17684                         err: Box::into_raw(Box::new(e)),
17685                 },
17686                 result_ok: false,
17687         }
17688 }
17689 /// Checks if the given object is currently in the success state
17690 #[no_mangle]
17691 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
17692         o.result_ok
17693 }
17694 #[no_mangle]
17695 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
17696 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
17697 impl Drop for CResult_ChannelReadyDecodeErrorZ {
17698         fn drop(&mut self) {
17699                 if self.result_ok {
17700                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17701                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17702                         }
17703                 } else {
17704                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17705                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17706                         }
17707                 }
17708         }
17709 }
17710 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
17711         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
17712                 let contents = if o.result_ok {
17713                         let result = unsafe { o.contents.result };
17714                         unsafe { o.contents.result = core::ptr::null_mut() };
17715                         CResult_ChannelReadyDecodeErrorZPtr { result }
17716                 } else {
17717                         let err = unsafe { o.contents.err };
17718                         unsafe { o.contents.err = core::ptr::null_mut(); }
17719                         CResult_ChannelReadyDecodeErrorZPtr { err }
17720                 };
17721                 Self {
17722                         contents,
17723                         result_ok: o.result_ok,
17724                 }
17725         }
17726 }
17727 impl Clone for CResult_ChannelReadyDecodeErrorZ {
17728         fn clone(&self) -> Self {
17729                 if self.result_ok {
17730                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
17731                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
17732                         } }
17733                 } else {
17734                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
17735                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17736                         } }
17737                 }
17738         }
17739 }
17740 #[no_mangle]
17741 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
17742 /// but with all dynamically-allocated buffers duplicated in new buffers.
17743 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
17744 #[repr(C)]
17745 /// The contents of CResult_InitDecodeErrorZ
17746 pub union CResult_InitDecodeErrorZPtr {
17747         /// A pointer to the contents in the success state.
17748         /// Reading from this pointer when `result_ok` is not set is undefined.
17749         pub result: *mut crate::lightning::ln::msgs::Init,
17750         /// A pointer to the contents in the error state.
17751         /// Reading from this pointer when `result_ok` is set is undefined.
17752         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17753 }
17754 #[repr(C)]
17755 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
17756 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
17757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17758 pub struct CResult_InitDecodeErrorZ {
17759         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
17760         /// `err` or `result` depending on the state of `result_ok`.
17761         pub contents: CResult_InitDecodeErrorZPtr,
17762         /// Whether this CResult_InitDecodeErrorZ represents a success state.
17763         pub result_ok: bool,
17764 }
17765 #[no_mangle]
17766 /// Creates a new CResult_InitDecodeErrorZ in the success state.
17767 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
17768         CResult_InitDecodeErrorZ {
17769                 contents: CResult_InitDecodeErrorZPtr {
17770                         result: Box::into_raw(Box::new(o)),
17771                 },
17772                 result_ok: true,
17773         }
17774 }
17775 #[no_mangle]
17776 /// Creates a new CResult_InitDecodeErrorZ in the error state.
17777 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
17778         CResult_InitDecodeErrorZ {
17779                 contents: CResult_InitDecodeErrorZPtr {
17780                         err: Box::into_raw(Box::new(e)),
17781                 },
17782                 result_ok: false,
17783         }
17784 }
17785 /// Checks if the given object is currently in the success state
17786 #[no_mangle]
17787 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
17788         o.result_ok
17789 }
17790 #[no_mangle]
17791 /// Frees any resources used by the CResult_InitDecodeErrorZ.
17792 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
17793 impl Drop for CResult_InitDecodeErrorZ {
17794         fn drop(&mut self) {
17795                 if self.result_ok {
17796                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17797                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17798                         }
17799                 } else {
17800                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17801                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17802                         }
17803                 }
17804         }
17805 }
17806 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
17807         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
17808                 let contents = if o.result_ok {
17809                         let result = unsafe { o.contents.result };
17810                         unsafe { o.contents.result = core::ptr::null_mut() };
17811                         CResult_InitDecodeErrorZPtr { result }
17812                 } else {
17813                         let err = unsafe { o.contents.err };
17814                         unsafe { o.contents.err = core::ptr::null_mut(); }
17815                         CResult_InitDecodeErrorZPtr { err }
17816                 };
17817                 Self {
17818                         contents,
17819                         result_ok: o.result_ok,
17820                 }
17821         }
17822 }
17823 impl Clone for CResult_InitDecodeErrorZ {
17824         fn clone(&self) -> Self {
17825                 if self.result_ok {
17826                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
17827                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
17828                         } }
17829                 } else {
17830                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
17831                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17832                         } }
17833                 }
17834         }
17835 }
17836 #[no_mangle]
17837 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
17838 /// but with all dynamically-allocated buffers duplicated in new buffers.
17839 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
17840 #[repr(C)]
17841 /// The contents of CResult_OpenChannelDecodeErrorZ
17842 pub union CResult_OpenChannelDecodeErrorZPtr {
17843         /// A pointer to the contents in the success state.
17844         /// Reading from this pointer when `result_ok` is not set is undefined.
17845         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
17846         /// A pointer to the contents in the error state.
17847         /// Reading from this pointer when `result_ok` is set is undefined.
17848         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17849 }
17850 #[repr(C)]
17851 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
17852 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
17853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17854 pub struct CResult_OpenChannelDecodeErrorZ {
17855         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
17856         /// `err` or `result` depending on the state of `result_ok`.
17857         pub contents: CResult_OpenChannelDecodeErrorZPtr,
17858         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
17859         pub result_ok: bool,
17860 }
17861 #[no_mangle]
17862 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
17863 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
17864         CResult_OpenChannelDecodeErrorZ {
17865                 contents: CResult_OpenChannelDecodeErrorZPtr {
17866                         result: Box::into_raw(Box::new(o)),
17867                 },
17868                 result_ok: true,
17869         }
17870 }
17871 #[no_mangle]
17872 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
17873 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
17874         CResult_OpenChannelDecodeErrorZ {
17875                 contents: CResult_OpenChannelDecodeErrorZPtr {
17876                         err: Box::into_raw(Box::new(e)),
17877                 },
17878                 result_ok: false,
17879         }
17880 }
17881 /// Checks if the given object is currently in the success state
17882 #[no_mangle]
17883 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
17884         o.result_ok
17885 }
17886 #[no_mangle]
17887 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
17888 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
17889 impl Drop for CResult_OpenChannelDecodeErrorZ {
17890         fn drop(&mut self) {
17891                 if self.result_ok {
17892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17894                         }
17895                 } else {
17896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17898                         }
17899                 }
17900         }
17901 }
17902 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
17903         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
17904                 let contents = if o.result_ok {
17905                         let result = unsafe { o.contents.result };
17906                         unsafe { o.contents.result = core::ptr::null_mut() };
17907                         CResult_OpenChannelDecodeErrorZPtr { result }
17908                 } else {
17909                         let err = unsafe { o.contents.err };
17910                         unsafe { o.contents.err = core::ptr::null_mut(); }
17911                         CResult_OpenChannelDecodeErrorZPtr { err }
17912                 };
17913                 Self {
17914                         contents,
17915                         result_ok: o.result_ok,
17916                 }
17917         }
17918 }
17919 impl Clone for CResult_OpenChannelDecodeErrorZ {
17920         fn clone(&self) -> Self {
17921                 if self.result_ok {
17922                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
17923                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
17924                         } }
17925                 } else {
17926                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
17927                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
17928                         } }
17929                 }
17930         }
17931 }
17932 #[no_mangle]
17933 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
17934 /// but with all dynamically-allocated buffers duplicated in new buffers.
17935 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
17936 #[repr(C)]
17937 /// The contents of CResult_OpenChannelV2DecodeErrorZ
17938 pub union CResult_OpenChannelV2DecodeErrorZPtr {
17939         /// A pointer to the contents in the success state.
17940         /// Reading from this pointer when `result_ok` is not set is undefined.
17941         pub result: *mut crate::lightning::ln::msgs::OpenChannelV2,
17942         /// A pointer to the contents in the error state.
17943         /// Reading from this pointer when `result_ok` is set is undefined.
17944         pub err: *mut crate::lightning::ln::msgs::DecodeError,
17945 }
17946 #[repr(C)]
17947 /// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation,
17948 /// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure.
17949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
17950 pub struct CResult_OpenChannelV2DecodeErrorZ {
17951         /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either
17952         /// `err` or `result` depending on the state of `result_ok`.
17953         pub contents: CResult_OpenChannelV2DecodeErrorZPtr,
17954         /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state.
17955         pub result_ok: bool,
17956 }
17957 #[no_mangle]
17958 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state.
17959 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ {
17960         CResult_OpenChannelV2DecodeErrorZ {
17961                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
17962                         result: Box::into_raw(Box::new(o)),
17963                 },
17964                 result_ok: true,
17965         }
17966 }
17967 #[no_mangle]
17968 /// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state.
17969 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ {
17970         CResult_OpenChannelV2DecodeErrorZ {
17971                 contents: CResult_OpenChannelV2DecodeErrorZPtr {
17972                         err: Box::into_raw(Box::new(e)),
17973                 },
17974                 result_ok: false,
17975         }
17976 }
17977 /// Checks if the given object is currently in the success state
17978 #[no_mangle]
17979 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool {
17980         o.result_ok
17981 }
17982 #[no_mangle]
17983 /// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ.
17984 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { }
17985 impl Drop for CResult_OpenChannelV2DecodeErrorZ {
17986         fn drop(&mut self) {
17987                 if self.result_ok {
17988                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
17989                                 let _ = unsafe { Box::from_raw(self.contents.result) };
17990                         }
17991                 } else {
17992                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
17993                                 let _ = unsafe { Box::from_raw(self.contents.err) };
17994                         }
17995                 }
17996         }
17997 }
17998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelV2DecodeErrorZ {
17999         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannelV2, crate::lightning::ln::msgs::DecodeError>) -> Self {
18000                 let contents = if o.result_ok {
18001                         let result = unsafe { o.contents.result };
18002                         unsafe { o.contents.result = core::ptr::null_mut() };
18003                         CResult_OpenChannelV2DecodeErrorZPtr { result }
18004                 } else {
18005                         let err = unsafe { o.contents.err };
18006                         unsafe { o.contents.err = core::ptr::null_mut(); }
18007                         CResult_OpenChannelV2DecodeErrorZPtr { err }
18008                 };
18009                 Self {
18010                         contents,
18011                         result_ok: o.result_ok,
18012                 }
18013         }
18014 }
18015 impl Clone for CResult_OpenChannelV2DecodeErrorZ {
18016         fn clone(&self) -> Self {
18017                 if self.result_ok {
18018                         Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18019                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannelV2>::clone(unsafe { &*self.contents.result })))
18020                         } }
18021                 } else {
18022                         Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr {
18023                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18024                         } }
18025                 }
18026         }
18027 }
18028 #[no_mangle]
18029 /// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig`
18030 /// but with all dynamically-allocated buffers duplicated in new buffers.
18031 pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) }
18032 #[repr(C)]
18033 /// The contents of CResult_RevokeAndACKDecodeErrorZ
18034 pub union CResult_RevokeAndACKDecodeErrorZPtr {
18035         /// A pointer to the contents in the success state.
18036         /// Reading from this pointer when `result_ok` is not set is undefined.
18037         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
18038         /// A pointer to the contents in the error state.
18039         /// Reading from this pointer when `result_ok` is set is undefined.
18040         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18041 }
18042 #[repr(C)]
18043 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
18044 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
18045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18046 pub struct CResult_RevokeAndACKDecodeErrorZ {
18047         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
18048         /// `err` or `result` depending on the state of `result_ok`.
18049         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
18050         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
18051         pub result_ok: bool,
18052 }
18053 #[no_mangle]
18054 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
18055 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
18056         CResult_RevokeAndACKDecodeErrorZ {
18057                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18058                         result: Box::into_raw(Box::new(o)),
18059                 },
18060                 result_ok: true,
18061         }
18062 }
18063 #[no_mangle]
18064 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
18065 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
18066         CResult_RevokeAndACKDecodeErrorZ {
18067                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
18068                         err: Box::into_raw(Box::new(e)),
18069                 },
18070                 result_ok: false,
18071         }
18072 }
18073 /// Checks if the given object is currently in the success state
18074 #[no_mangle]
18075 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
18076         o.result_ok
18077 }
18078 #[no_mangle]
18079 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
18080 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
18081 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
18082         fn drop(&mut self) {
18083                 if self.result_ok {
18084                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18085                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18086                         }
18087                 } else {
18088                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18089                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18090                         }
18091                 }
18092         }
18093 }
18094 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
18095         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
18096                 let contents = if o.result_ok {
18097                         let result = unsafe { o.contents.result };
18098                         unsafe { o.contents.result = core::ptr::null_mut() };
18099                         CResult_RevokeAndACKDecodeErrorZPtr { result }
18100                 } else {
18101                         let err = unsafe { o.contents.err };
18102                         unsafe { o.contents.err = core::ptr::null_mut(); }
18103                         CResult_RevokeAndACKDecodeErrorZPtr { err }
18104                 };
18105                 Self {
18106                         contents,
18107                         result_ok: o.result_ok,
18108                 }
18109         }
18110 }
18111 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
18112         fn clone(&self) -> Self {
18113                 if self.result_ok {
18114                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18115                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
18116                         } }
18117                 } else {
18118                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
18119                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18120                         } }
18121                 }
18122         }
18123 }
18124 #[no_mangle]
18125 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
18126 /// but with all dynamically-allocated buffers duplicated in new buffers.
18127 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
18128 #[repr(C)]
18129 /// The contents of CResult_ShutdownDecodeErrorZ
18130 pub union CResult_ShutdownDecodeErrorZPtr {
18131         /// A pointer to the contents in the success state.
18132         /// Reading from this pointer when `result_ok` is not set is undefined.
18133         pub result: *mut crate::lightning::ln::msgs::Shutdown,
18134         /// A pointer to the contents in the error state.
18135         /// Reading from this pointer when `result_ok` is set is undefined.
18136         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18137 }
18138 #[repr(C)]
18139 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
18140 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
18141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18142 pub struct CResult_ShutdownDecodeErrorZ {
18143         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
18144         /// `err` or `result` depending on the state of `result_ok`.
18145         pub contents: CResult_ShutdownDecodeErrorZPtr,
18146         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
18147         pub result_ok: bool,
18148 }
18149 #[no_mangle]
18150 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
18151 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
18152         CResult_ShutdownDecodeErrorZ {
18153                 contents: CResult_ShutdownDecodeErrorZPtr {
18154                         result: Box::into_raw(Box::new(o)),
18155                 },
18156                 result_ok: true,
18157         }
18158 }
18159 #[no_mangle]
18160 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
18161 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
18162         CResult_ShutdownDecodeErrorZ {
18163                 contents: CResult_ShutdownDecodeErrorZPtr {
18164                         err: Box::into_raw(Box::new(e)),
18165                 },
18166                 result_ok: false,
18167         }
18168 }
18169 /// Checks if the given object is currently in the success state
18170 #[no_mangle]
18171 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
18172         o.result_ok
18173 }
18174 #[no_mangle]
18175 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
18176 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
18177 impl Drop for CResult_ShutdownDecodeErrorZ {
18178         fn drop(&mut self) {
18179                 if self.result_ok {
18180                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18181                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18182                         }
18183                 } else {
18184                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18185                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18186                         }
18187                 }
18188         }
18189 }
18190 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
18191         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
18192                 let contents = if o.result_ok {
18193                         let result = unsafe { o.contents.result };
18194                         unsafe { o.contents.result = core::ptr::null_mut() };
18195                         CResult_ShutdownDecodeErrorZPtr { result }
18196                 } else {
18197                         let err = unsafe { o.contents.err };
18198                         unsafe { o.contents.err = core::ptr::null_mut(); }
18199                         CResult_ShutdownDecodeErrorZPtr { err }
18200                 };
18201                 Self {
18202                         contents,
18203                         result_ok: o.result_ok,
18204                 }
18205         }
18206 }
18207 impl Clone for CResult_ShutdownDecodeErrorZ {
18208         fn clone(&self) -> Self {
18209                 if self.result_ok {
18210                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
18211                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
18212                         } }
18213                 } else {
18214                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
18215                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18216                         } }
18217                 }
18218         }
18219 }
18220 #[no_mangle]
18221 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
18222 /// but with all dynamically-allocated buffers duplicated in new buffers.
18223 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
18224 #[repr(C)]
18225 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
18226 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
18227         /// A pointer to the contents in the success state.
18228         /// Reading from this pointer when `result_ok` is not set is undefined.
18229         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
18230         /// A pointer to the contents in the error state.
18231         /// Reading from this pointer when `result_ok` is set is undefined.
18232         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18233 }
18234 #[repr(C)]
18235 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
18236 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18238 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
18239         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
18240         /// `err` or `result` depending on the state of `result_ok`.
18241         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
18242         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
18243         pub result_ok: bool,
18244 }
18245 #[no_mangle]
18246 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
18247 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
18248         CResult_UpdateFailHTLCDecodeErrorZ {
18249                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18250                         result: Box::into_raw(Box::new(o)),
18251                 },
18252                 result_ok: true,
18253         }
18254 }
18255 #[no_mangle]
18256 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
18257 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
18258         CResult_UpdateFailHTLCDecodeErrorZ {
18259                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18260                         err: Box::into_raw(Box::new(e)),
18261                 },
18262                 result_ok: false,
18263         }
18264 }
18265 /// Checks if the given object is currently in the success state
18266 #[no_mangle]
18267 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
18268         o.result_ok
18269 }
18270 #[no_mangle]
18271 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
18272 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
18273 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
18274         fn drop(&mut self) {
18275                 if self.result_ok {
18276                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18277                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18278                         }
18279                 } else {
18280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18282                         }
18283                 }
18284         }
18285 }
18286 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
18287         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18288                 let contents = if o.result_ok {
18289                         let result = unsafe { o.contents.result };
18290                         unsafe { o.contents.result = core::ptr::null_mut() };
18291                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
18292                 } else {
18293                         let err = unsafe { o.contents.err };
18294                         unsafe { o.contents.err = core::ptr::null_mut(); }
18295                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
18296                 };
18297                 Self {
18298                         contents,
18299                         result_ok: o.result_ok,
18300                 }
18301         }
18302 }
18303 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
18304         fn clone(&self) -> Self {
18305                 if self.result_ok {
18306                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18307                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
18308                         } }
18309                 } else {
18310                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
18311                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18312                         } }
18313                 }
18314         }
18315 }
18316 #[no_mangle]
18317 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
18318 /// but with all dynamically-allocated buffers duplicated in new buffers.
18319 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
18320 #[repr(C)]
18321 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
18322 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18323         /// A pointer to the contents in the success state.
18324         /// Reading from this pointer when `result_ok` is not set is undefined.
18325         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
18326         /// A pointer to the contents in the error state.
18327         /// Reading from this pointer when `result_ok` is set is undefined.
18328         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18329 }
18330 #[repr(C)]
18331 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
18332 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18333 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18334 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18335         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
18336         /// `err` or `result` depending on the state of `result_ok`.
18337         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
18338         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
18339         pub result_ok: bool,
18340 }
18341 #[no_mangle]
18342 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
18343 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18344         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18345                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18346                         result: Box::into_raw(Box::new(o)),
18347                 },
18348                 result_ok: true,
18349         }
18350 }
18351 #[no_mangle]
18352 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
18353 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18354         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18355                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18356                         err: Box::into_raw(Box::new(e)),
18357                 },
18358                 result_ok: false,
18359         }
18360 }
18361 /// Checks if the given object is currently in the success state
18362 #[no_mangle]
18363 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
18364         o.result_ok
18365 }
18366 #[no_mangle]
18367 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
18368 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
18369 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18370         fn drop(&mut self) {
18371                 if self.result_ok {
18372                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18373                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18374                         }
18375                 } else {
18376                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18377                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18378                         }
18379                 }
18380         }
18381 }
18382 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18383         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18384                 let contents = if o.result_ok {
18385                         let result = unsafe { o.contents.result };
18386                         unsafe { o.contents.result = core::ptr::null_mut() };
18387                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
18388                 } else {
18389                         let err = unsafe { o.contents.err };
18390                         unsafe { o.contents.err = core::ptr::null_mut(); }
18391                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
18392                 };
18393                 Self {
18394                         contents,
18395                         result_ok: o.result_ok,
18396                 }
18397         }
18398 }
18399 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
18400         fn clone(&self) -> Self {
18401                 if self.result_ok {
18402                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18403                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
18404                         } }
18405                 } else {
18406                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
18407                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18408                         } }
18409                 }
18410         }
18411 }
18412 #[no_mangle]
18413 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
18414 /// but with all dynamically-allocated buffers duplicated in new buffers.
18415 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
18416 #[repr(C)]
18417 /// The contents of CResult_UpdateFeeDecodeErrorZ
18418 pub union CResult_UpdateFeeDecodeErrorZPtr {
18419         /// A pointer to the contents in the success state.
18420         /// Reading from this pointer when `result_ok` is not set is undefined.
18421         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
18422         /// A pointer to the contents in the error state.
18423         /// Reading from this pointer when `result_ok` is set is undefined.
18424         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18425 }
18426 #[repr(C)]
18427 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
18428 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
18429 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18430 pub struct CResult_UpdateFeeDecodeErrorZ {
18431         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
18432         /// `err` or `result` depending on the state of `result_ok`.
18433         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
18434         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
18435         pub result_ok: bool,
18436 }
18437 #[no_mangle]
18438 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
18439 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
18440         CResult_UpdateFeeDecodeErrorZ {
18441                 contents: CResult_UpdateFeeDecodeErrorZPtr {
18442                         result: Box::into_raw(Box::new(o)),
18443                 },
18444                 result_ok: true,
18445         }
18446 }
18447 #[no_mangle]
18448 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
18449 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
18450         CResult_UpdateFeeDecodeErrorZ {
18451                 contents: CResult_UpdateFeeDecodeErrorZPtr {
18452                         err: Box::into_raw(Box::new(e)),
18453                 },
18454                 result_ok: false,
18455         }
18456 }
18457 /// Checks if the given object is currently in the success state
18458 #[no_mangle]
18459 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
18460         o.result_ok
18461 }
18462 #[no_mangle]
18463 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
18464 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
18465 impl Drop for CResult_UpdateFeeDecodeErrorZ {
18466         fn drop(&mut self) {
18467                 if self.result_ok {
18468                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18469                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18470                         }
18471                 } else {
18472                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18473                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18474                         }
18475                 }
18476         }
18477 }
18478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
18479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
18480                 let contents = if o.result_ok {
18481                         let result = unsafe { o.contents.result };
18482                         unsafe { o.contents.result = core::ptr::null_mut() };
18483                         CResult_UpdateFeeDecodeErrorZPtr { result }
18484                 } else {
18485                         let err = unsafe { o.contents.err };
18486                         unsafe { o.contents.err = core::ptr::null_mut(); }
18487                         CResult_UpdateFeeDecodeErrorZPtr { err }
18488                 };
18489                 Self {
18490                         contents,
18491                         result_ok: o.result_ok,
18492                 }
18493         }
18494 }
18495 impl Clone for CResult_UpdateFeeDecodeErrorZ {
18496         fn clone(&self) -> Self {
18497                 if self.result_ok {
18498                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
18499                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
18500                         } }
18501                 } else {
18502                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
18503                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18504                         } }
18505                 }
18506         }
18507 }
18508 #[no_mangle]
18509 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
18510 /// but with all dynamically-allocated buffers duplicated in new buffers.
18511 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
18512 #[repr(C)]
18513 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
18514 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18515         /// A pointer to the contents in the success state.
18516         /// Reading from this pointer when `result_ok` is not set is undefined.
18517         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
18518         /// A pointer to the contents in the error state.
18519         /// Reading from this pointer when `result_ok` is set is undefined.
18520         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18521 }
18522 #[repr(C)]
18523 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
18524 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18526 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
18527         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
18528         /// `err` or `result` depending on the state of `result_ok`.
18529         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
18530         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
18531         pub result_ok: bool,
18532 }
18533 #[no_mangle]
18534 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
18535 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18536         CResult_UpdateFulfillHTLCDecodeErrorZ {
18537                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18538                         result: Box::into_raw(Box::new(o)),
18539                 },
18540                 result_ok: true,
18541         }
18542 }
18543 #[no_mangle]
18544 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
18545 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
18546         CResult_UpdateFulfillHTLCDecodeErrorZ {
18547                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18548                         err: Box::into_raw(Box::new(e)),
18549                 },
18550                 result_ok: false,
18551         }
18552 }
18553 /// Checks if the given object is currently in the success state
18554 #[no_mangle]
18555 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
18556         o.result_ok
18557 }
18558 #[no_mangle]
18559 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
18560 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
18561 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
18562         fn drop(&mut self) {
18563                 if self.result_ok {
18564                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18565                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18566                         }
18567                 } else {
18568                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18569                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18570                         }
18571                 }
18572         }
18573 }
18574 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
18575         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18576                 let contents = if o.result_ok {
18577                         let result = unsafe { o.contents.result };
18578                         unsafe { o.contents.result = core::ptr::null_mut() };
18579                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
18580                 } else {
18581                         let err = unsafe { o.contents.err };
18582                         unsafe { o.contents.err = core::ptr::null_mut(); }
18583                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
18584                 };
18585                 Self {
18586                         contents,
18587                         result_ok: o.result_ok,
18588                 }
18589         }
18590 }
18591 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
18592         fn clone(&self) -> Self {
18593                 if self.result_ok {
18594                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18595                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
18596                         } }
18597                 } else {
18598                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
18599                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18600                         } }
18601                 }
18602         }
18603 }
18604 #[no_mangle]
18605 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
18606 /// but with all dynamically-allocated buffers duplicated in new buffers.
18607 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
18608 #[repr(C)]
18609 /// The contents of CResult_OnionPacketDecodeErrorZ
18610 pub union CResult_OnionPacketDecodeErrorZPtr {
18611         /// A pointer to the contents in the success state.
18612         /// Reading from this pointer when `result_ok` is not set is undefined.
18613         pub result: *mut crate::lightning::ln::msgs::OnionPacket,
18614         /// A pointer to the contents in the error state.
18615         /// Reading from this pointer when `result_ok` is set is undefined.
18616         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18617 }
18618 #[repr(C)]
18619 /// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation,
18620 /// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure.
18621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18622 pub struct CResult_OnionPacketDecodeErrorZ {
18623         /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either
18624         /// `err` or `result` depending on the state of `result_ok`.
18625         pub contents: CResult_OnionPacketDecodeErrorZPtr,
18626         /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state.
18627         pub result_ok: bool,
18628 }
18629 #[no_mangle]
18630 /// Creates a new CResult_OnionPacketDecodeErrorZ in the success state.
18631 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ {
18632         CResult_OnionPacketDecodeErrorZ {
18633                 contents: CResult_OnionPacketDecodeErrorZPtr {
18634                         result: Box::into_raw(Box::new(o)),
18635                 },
18636                 result_ok: true,
18637         }
18638 }
18639 #[no_mangle]
18640 /// Creates a new CResult_OnionPacketDecodeErrorZ in the error state.
18641 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ {
18642         CResult_OnionPacketDecodeErrorZ {
18643                 contents: CResult_OnionPacketDecodeErrorZPtr {
18644                         err: Box::into_raw(Box::new(e)),
18645                 },
18646                 result_ok: false,
18647         }
18648 }
18649 /// Checks if the given object is currently in the success state
18650 #[no_mangle]
18651 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool {
18652         o.result_ok
18653 }
18654 #[no_mangle]
18655 /// Frees any resources used by the CResult_OnionPacketDecodeErrorZ.
18656 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { }
18657 impl Drop for CResult_OnionPacketDecodeErrorZ {
18658         fn drop(&mut self) {
18659                 if self.result_ok {
18660                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18661                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18662                         }
18663                 } else {
18664                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18665                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18666                         }
18667                 }
18668         }
18669 }
18670 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionPacketDecodeErrorZ {
18671         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionPacket, crate::lightning::ln::msgs::DecodeError>) -> Self {
18672                 let contents = if o.result_ok {
18673                         let result = unsafe { o.contents.result };
18674                         unsafe { o.contents.result = core::ptr::null_mut() };
18675                         CResult_OnionPacketDecodeErrorZPtr { result }
18676                 } else {
18677                         let err = unsafe { o.contents.err };
18678                         unsafe { o.contents.err = core::ptr::null_mut(); }
18679                         CResult_OnionPacketDecodeErrorZPtr { err }
18680                 };
18681                 Self {
18682                         contents,
18683                         result_ok: o.result_ok,
18684                 }
18685         }
18686 }
18687 impl Clone for CResult_OnionPacketDecodeErrorZ {
18688         fn clone(&self) -> Self {
18689                 if self.result_ok {
18690                         Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr {
18691                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionPacket>::clone(unsafe { &*self.contents.result })))
18692                         } }
18693                 } else {
18694                         Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr {
18695                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18696                         } }
18697                 }
18698         }
18699 }
18700 #[no_mangle]
18701 /// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig`
18702 /// but with all dynamically-allocated buffers duplicated in new buffers.
18703 pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) }
18704 #[repr(C)]
18705 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
18706 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
18707         /// A pointer to the contents in the success state.
18708         /// Reading from this pointer when `result_ok` is not set is undefined.
18709         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
18710         /// A pointer to the contents in the error state.
18711         /// Reading from this pointer when `result_ok` is set is undefined.
18712         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18713 }
18714 #[repr(C)]
18715 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
18716 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
18717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18718 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
18719         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
18720         /// `err` or `result` depending on the state of `result_ok`.
18721         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
18722         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
18723         pub result_ok: bool,
18724 }
18725 #[no_mangle]
18726 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
18727 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
18728         CResult_UpdateAddHTLCDecodeErrorZ {
18729                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18730                         result: Box::into_raw(Box::new(o)),
18731                 },
18732                 result_ok: true,
18733         }
18734 }
18735 #[no_mangle]
18736 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
18737 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
18738         CResult_UpdateAddHTLCDecodeErrorZ {
18739                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18740                         err: Box::into_raw(Box::new(e)),
18741                 },
18742                 result_ok: false,
18743         }
18744 }
18745 /// Checks if the given object is currently in the success state
18746 #[no_mangle]
18747 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
18748         o.result_ok
18749 }
18750 #[no_mangle]
18751 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
18752 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
18753 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
18754         fn drop(&mut self) {
18755                 if self.result_ok {
18756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18758                         }
18759                 } else {
18760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18762                         }
18763                 }
18764         }
18765 }
18766 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
18767         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
18768                 let contents = if o.result_ok {
18769                         let result = unsafe { o.contents.result };
18770                         unsafe { o.contents.result = core::ptr::null_mut() };
18771                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
18772                 } else {
18773                         let err = unsafe { o.contents.err };
18774                         unsafe { o.contents.err = core::ptr::null_mut(); }
18775                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
18776                 };
18777                 Self {
18778                         contents,
18779                         result_ok: o.result_ok,
18780                 }
18781         }
18782 }
18783 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
18784         fn clone(&self) -> Self {
18785                 if self.result_ok {
18786                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18787                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
18788                         } }
18789                 } else {
18790                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
18791                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18792                         } }
18793                 }
18794         }
18795 }
18796 #[no_mangle]
18797 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
18798 /// but with all dynamically-allocated buffers duplicated in new buffers.
18799 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
18800 #[repr(C)]
18801 /// The contents of CResult_OnionMessageDecodeErrorZ
18802 pub union CResult_OnionMessageDecodeErrorZPtr {
18803         /// A pointer to the contents in the success state.
18804         /// Reading from this pointer when `result_ok` is not set is undefined.
18805         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
18806         /// A pointer to the contents in the error state.
18807         /// Reading from this pointer when `result_ok` is set is undefined.
18808         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18809 }
18810 #[repr(C)]
18811 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
18812 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
18813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18814 pub struct CResult_OnionMessageDecodeErrorZ {
18815         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
18816         /// `err` or `result` depending on the state of `result_ok`.
18817         pub contents: CResult_OnionMessageDecodeErrorZPtr,
18818         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
18819         pub result_ok: bool,
18820 }
18821 #[no_mangle]
18822 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
18823 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
18824         CResult_OnionMessageDecodeErrorZ {
18825                 contents: CResult_OnionMessageDecodeErrorZPtr {
18826                         result: Box::into_raw(Box::new(o)),
18827                 },
18828                 result_ok: true,
18829         }
18830 }
18831 #[no_mangle]
18832 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
18833 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
18834         CResult_OnionMessageDecodeErrorZ {
18835                 contents: CResult_OnionMessageDecodeErrorZPtr {
18836                         err: Box::into_raw(Box::new(e)),
18837                 },
18838                 result_ok: false,
18839         }
18840 }
18841 /// Checks if the given object is currently in the success state
18842 #[no_mangle]
18843 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
18844         o.result_ok
18845 }
18846 #[no_mangle]
18847 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
18848 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
18849 impl Drop for CResult_OnionMessageDecodeErrorZ {
18850         fn drop(&mut self) {
18851                 if self.result_ok {
18852                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18853                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18854                         }
18855                 } else {
18856                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18857                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18858                         }
18859                 }
18860         }
18861 }
18862 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
18863         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
18864                 let contents = if o.result_ok {
18865                         let result = unsafe { o.contents.result };
18866                         unsafe { o.contents.result = core::ptr::null_mut() };
18867                         CResult_OnionMessageDecodeErrorZPtr { result }
18868                 } else {
18869                         let err = unsafe { o.contents.err };
18870                         unsafe { o.contents.err = core::ptr::null_mut(); }
18871                         CResult_OnionMessageDecodeErrorZPtr { err }
18872                 };
18873                 Self {
18874                         contents,
18875                         result_ok: o.result_ok,
18876                 }
18877         }
18878 }
18879 impl Clone for CResult_OnionMessageDecodeErrorZ {
18880         fn clone(&self) -> Self {
18881                 if self.result_ok {
18882                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
18883                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
18884                         } }
18885                 } else {
18886                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
18887                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18888                         } }
18889                 }
18890         }
18891 }
18892 #[no_mangle]
18893 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
18894 /// but with all dynamically-allocated buffers duplicated in new buffers.
18895 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
18896 #[repr(C)]
18897 /// The contents of CResult_FinalOnionHopDataDecodeErrorZ
18898 pub union CResult_FinalOnionHopDataDecodeErrorZPtr {
18899         /// A pointer to the contents in the success state.
18900         /// Reading from this pointer when `result_ok` is not set is undefined.
18901         pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData,
18902         /// A pointer to the contents in the error state.
18903         /// Reading from this pointer when `result_ok` is set is undefined.
18904         pub err: *mut crate::lightning::ln::msgs::DecodeError,
18905 }
18906 #[repr(C)]
18907 /// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation,
18908 /// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure.
18909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
18910 pub struct CResult_FinalOnionHopDataDecodeErrorZ {
18911         /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either
18912         /// `err` or `result` depending on the state of `result_ok`.
18913         pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr,
18914         /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state.
18915         pub result_ok: bool,
18916 }
18917 #[no_mangle]
18918 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state.
18919 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ {
18920         CResult_FinalOnionHopDataDecodeErrorZ {
18921                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18922                         result: Box::into_raw(Box::new(o)),
18923                 },
18924                 result_ok: true,
18925         }
18926 }
18927 #[no_mangle]
18928 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state.
18929 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ {
18930         CResult_FinalOnionHopDataDecodeErrorZ {
18931                 contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18932                         err: Box::into_raw(Box::new(e)),
18933                 },
18934                 result_ok: false,
18935         }
18936 }
18937 /// Checks if the given object is currently in the success state
18938 #[no_mangle]
18939 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool {
18940         o.result_ok
18941 }
18942 #[no_mangle]
18943 /// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ.
18944 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { }
18945 impl Drop for CResult_FinalOnionHopDataDecodeErrorZ {
18946         fn drop(&mut self) {
18947                 if self.result_ok {
18948                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
18949                                 let _ = unsafe { Box::from_raw(self.contents.result) };
18950                         }
18951                 } else {
18952                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
18953                                 let _ = unsafe { Box::from_raw(self.contents.err) };
18954                         }
18955                 }
18956         }
18957 }
18958 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>> for CResult_FinalOnionHopDataDecodeErrorZ {
18959         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FinalOnionHopData, crate::lightning::ln::msgs::DecodeError>) -> Self {
18960                 let contents = if o.result_ok {
18961                         let result = unsafe { o.contents.result };
18962                         unsafe { o.contents.result = core::ptr::null_mut() };
18963                         CResult_FinalOnionHopDataDecodeErrorZPtr { result }
18964                 } else {
18965                         let err = unsafe { o.contents.err };
18966                         unsafe { o.contents.err = core::ptr::null_mut(); }
18967                         CResult_FinalOnionHopDataDecodeErrorZPtr { err }
18968                 };
18969                 Self {
18970                         contents,
18971                         result_ok: o.result_ok,
18972                 }
18973         }
18974 }
18975 impl Clone for CResult_FinalOnionHopDataDecodeErrorZ {
18976         fn clone(&self) -> Self {
18977                 if self.result_ok {
18978                         Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18979                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FinalOnionHopData>::clone(unsafe { &*self.contents.result })))
18980                         } }
18981                 } else {
18982                         Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr {
18983                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
18984                         } }
18985                 }
18986         }
18987 }
18988 #[no_mangle]
18989 /// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig`
18990 /// but with all dynamically-allocated buffers duplicated in new buffers.
18991 pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) }
18992 #[repr(C)]
18993 /// The contents of CResult_PingDecodeErrorZ
18994 pub union CResult_PingDecodeErrorZPtr {
18995         /// A pointer to the contents in the success state.
18996         /// Reading from this pointer when `result_ok` is not set is undefined.
18997         pub result: *mut crate::lightning::ln::msgs::Ping,
18998         /// A pointer to the contents in the error state.
18999         /// Reading from this pointer when `result_ok` is set is undefined.
19000         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19001 }
19002 #[repr(C)]
19003 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
19004 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
19005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19006 pub struct CResult_PingDecodeErrorZ {
19007         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
19008         /// `err` or `result` depending on the state of `result_ok`.
19009         pub contents: CResult_PingDecodeErrorZPtr,
19010         /// Whether this CResult_PingDecodeErrorZ represents a success state.
19011         pub result_ok: bool,
19012 }
19013 #[no_mangle]
19014 /// Creates a new CResult_PingDecodeErrorZ in the success state.
19015 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
19016         CResult_PingDecodeErrorZ {
19017                 contents: CResult_PingDecodeErrorZPtr {
19018                         result: Box::into_raw(Box::new(o)),
19019                 },
19020                 result_ok: true,
19021         }
19022 }
19023 #[no_mangle]
19024 /// Creates a new CResult_PingDecodeErrorZ in the error state.
19025 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
19026         CResult_PingDecodeErrorZ {
19027                 contents: CResult_PingDecodeErrorZPtr {
19028                         err: Box::into_raw(Box::new(e)),
19029                 },
19030                 result_ok: false,
19031         }
19032 }
19033 /// Checks if the given object is currently in the success state
19034 #[no_mangle]
19035 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
19036         o.result_ok
19037 }
19038 #[no_mangle]
19039 /// Frees any resources used by the CResult_PingDecodeErrorZ.
19040 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
19041 impl Drop for CResult_PingDecodeErrorZ {
19042         fn drop(&mut self) {
19043                 if self.result_ok {
19044                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19045                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19046                         }
19047                 } else {
19048                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19049                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19050                         }
19051                 }
19052         }
19053 }
19054 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
19055         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
19056                 let contents = if o.result_ok {
19057                         let result = unsafe { o.contents.result };
19058                         unsafe { o.contents.result = core::ptr::null_mut() };
19059                         CResult_PingDecodeErrorZPtr { result }
19060                 } else {
19061                         let err = unsafe { o.contents.err };
19062                         unsafe { o.contents.err = core::ptr::null_mut(); }
19063                         CResult_PingDecodeErrorZPtr { err }
19064                 };
19065                 Self {
19066                         contents,
19067                         result_ok: o.result_ok,
19068                 }
19069         }
19070 }
19071 impl Clone for CResult_PingDecodeErrorZ {
19072         fn clone(&self) -> Self {
19073                 if self.result_ok {
19074                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
19075                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
19076                         } }
19077                 } else {
19078                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
19079                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19080                         } }
19081                 }
19082         }
19083 }
19084 #[no_mangle]
19085 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
19086 /// but with all dynamically-allocated buffers duplicated in new buffers.
19087 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
19088 #[repr(C)]
19089 /// The contents of CResult_PongDecodeErrorZ
19090 pub union CResult_PongDecodeErrorZPtr {
19091         /// A pointer to the contents in the success state.
19092         /// Reading from this pointer when `result_ok` is not set is undefined.
19093         pub result: *mut crate::lightning::ln::msgs::Pong,
19094         /// A pointer to the contents in the error state.
19095         /// Reading from this pointer when `result_ok` is set is undefined.
19096         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19097 }
19098 #[repr(C)]
19099 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
19100 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
19101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19102 pub struct CResult_PongDecodeErrorZ {
19103         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
19104         /// `err` or `result` depending on the state of `result_ok`.
19105         pub contents: CResult_PongDecodeErrorZPtr,
19106         /// Whether this CResult_PongDecodeErrorZ represents a success state.
19107         pub result_ok: bool,
19108 }
19109 #[no_mangle]
19110 /// Creates a new CResult_PongDecodeErrorZ in the success state.
19111 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
19112         CResult_PongDecodeErrorZ {
19113                 contents: CResult_PongDecodeErrorZPtr {
19114                         result: Box::into_raw(Box::new(o)),
19115                 },
19116                 result_ok: true,
19117         }
19118 }
19119 #[no_mangle]
19120 /// Creates a new CResult_PongDecodeErrorZ in the error state.
19121 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
19122         CResult_PongDecodeErrorZ {
19123                 contents: CResult_PongDecodeErrorZPtr {
19124                         err: Box::into_raw(Box::new(e)),
19125                 },
19126                 result_ok: false,
19127         }
19128 }
19129 /// Checks if the given object is currently in the success state
19130 #[no_mangle]
19131 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
19132         o.result_ok
19133 }
19134 #[no_mangle]
19135 /// Frees any resources used by the CResult_PongDecodeErrorZ.
19136 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
19137 impl Drop for CResult_PongDecodeErrorZ {
19138         fn drop(&mut self) {
19139                 if self.result_ok {
19140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19142                         }
19143                 } else {
19144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19146                         }
19147                 }
19148         }
19149 }
19150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
19151         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
19152                 let contents = if o.result_ok {
19153                         let result = unsafe { o.contents.result };
19154                         unsafe { o.contents.result = core::ptr::null_mut() };
19155                         CResult_PongDecodeErrorZPtr { result }
19156                 } else {
19157                         let err = unsafe { o.contents.err };
19158                         unsafe { o.contents.err = core::ptr::null_mut(); }
19159                         CResult_PongDecodeErrorZPtr { err }
19160                 };
19161                 Self {
19162                         contents,
19163                         result_ok: o.result_ok,
19164                 }
19165         }
19166 }
19167 impl Clone for CResult_PongDecodeErrorZ {
19168         fn clone(&self) -> Self {
19169                 if self.result_ok {
19170                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
19171                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
19172                         } }
19173                 } else {
19174                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
19175                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19176                         } }
19177                 }
19178         }
19179 }
19180 #[no_mangle]
19181 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
19182 /// but with all dynamically-allocated buffers duplicated in new buffers.
19183 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
19184 #[repr(C)]
19185 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
19186 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19187         /// A pointer to the contents in the success state.
19188         /// Reading from this pointer when `result_ok` is not set is undefined.
19189         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
19190         /// A pointer to the contents in the error state.
19191         /// Reading from this pointer when `result_ok` is set is undefined.
19192         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19193 }
19194 #[repr(C)]
19195 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19196 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19198 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19199         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
19200         /// `err` or `result` depending on the state of `result_ok`.
19201         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
19202         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
19203         pub result_ok: bool,
19204 }
19205 #[no_mangle]
19206 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
19207 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19208         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19209                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19210                         result: Box::into_raw(Box::new(o)),
19211                 },
19212                 result_ok: true,
19213         }
19214 }
19215 #[no_mangle]
19216 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
19217 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19218         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19219                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19220                         err: Box::into_raw(Box::new(e)),
19221                 },
19222                 result_ok: false,
19223         }
19224 }
19225 /// Checks if the given object is currently in the success state
19226 #[no_mangle]
19227 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
19228         o.result_ok
19229 }
19230 #[no_mangle]
19231 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
19232 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
19233 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19234         fn drop(&mut self) {
19235                 if self.result_ok {
19236                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19237                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19238                         }
19239                 } else {
19240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19242                         }
19243                 }
19244         }
19245 }
19246 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19247         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19248                 let contents = if o.result_ok {
19249                         let result = unsafe { o.contents.result };
19250                         unsafe { o.contents.result = core::ptr::null_mut() };
19251                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
19252                 } else {
19253                         let err = unsafe { o.contents.err };
19254                         unsafe { o.contents.err = core::ptr::null_mut(); }
19255                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
19256                 };
19257                 Self {
19258                         contents,
19259                         result_ok: o.result_ok,
19260                 }
19261         }
19262 }
19263 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
19264         fn clone(&self) -> Self {
19265                 if self.result_ok {
19266                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19267                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19268                         } }
19269                 } else {
19270                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
19271                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19272                         } }
19273                 }
19274         }
19275 }
19276 #[no_mangle]
19277 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19278 /// but with all dynamically-allocated buffers duplicated in new buffers.
19279 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19280 #[repr(C)]
19281 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
19282 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
19283         /// A pointer to the contents in the success state.
19284         /// Reading from this pointer when `result_ok` is not set is undefined.
19285         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
19286         /// A pointer to the contents in the error state.
19287         /// Reading from this pointer when `result_ok` is set is undefined.
19288         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19289 }
19290 #[repr(C)]
19291 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
19292 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19294 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
19295         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
19296         /// `err` or `result` depending on the state of `result_ok`.
19297         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
19298         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
19299         pub result_ok: bool,
19300 }
19301 #[no_mangle]
19302 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
19303 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
19304         CResult_ChannelAnnouncementDecodeErrorZ {
19305                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19306                         result: Box::into_raw(Box::new(o)),
19307                 },
19308                 result_ok: true,
19309         }
19310 }
19311 #[no_mangle]
19312 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
19313 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
19314         CResult_ChannelAnnouncementDecodeErrorZ {
19315                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19316                         err: Box::into_raw(Box::new(e)),
19317                 },
19318                 result_ok: false,
19319         }
19320 }
19321 /// Checks if the given object is currently in the success state
19322 #[no_mangle]
19323 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
19324         o.result_ok
19325 }
19326 #[no_mangle]
19327 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
19328 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
19329 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
19330         fn drop(&mut self) {
19331                 if self.result_ok {
19332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19334                         }
19335                 } else {
19336                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19337                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19338                         }
19339                 }
19340         }
19341 }
19342 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
19343         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19344                 let contents = if o.result_ok {
19345                         let result = unsafe { o.contents.result };
19346                         unsafe { o.contents.result = core::ptr::null_mut() };
19347                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
19348                 } else {
19349                         let err = unsafe { o.contents.err };
19350                         unsafe { o.contents.err = core::ptr::null_mut(); }
19351                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
19352                 };
19353                 Self {
19354                         contents,
19355                         result_ok: o.result_ok,
19356                 }
19357         }
19358 }
19359 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
19360         fn clone(&self) -> Self {
19361                 if self.result_ok {
19362                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19363                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
19364                         } }
19365                 } else {
19366                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
19367                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19368                         } }
19369                 }
19370         }
19371 }
19372 #[no_mangle]
19373 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
19374 /// but with all dynamically-allocated buffers duplicated in new buffers.
19375 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19376 #[repr(C)]
19377 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
19378 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19379         /// A pointer to the contents in the success state.
19380         /// Reading from this pointer when `result_ok` is not set is undefined.
19381         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
19382         /// A pointer to the contents in the error state.
19383         /// Reading from this pointer when `result_ok` is set is undefined.
19384         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19385 }
19386 #[repr(C)]
19387 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19388 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19389 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19390 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
19391         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
19392         /// `err` or `result` depending on the state of `result_ok`.
19393         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
19394         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
19395         pub result_ok: bool,
19396 }
19397 #[no_mangle]
19398 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
19399 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19400         CResult_UnsignedChannelUpdateDecodeErrorZ {
19401                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19402                         result: Box::into_raw(Box::new(o)),
19403                 },
19404                 result_ok: true,
19405         }
19406 }
19407 #[no_mangle]
19408 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
19409 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
19410         CResult_UnsignedChannelUpdateDecodeErrorZ {
19411                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19412                         err: Box::into_raw(Box::new(e)),
19413                 },
19414                 result_ok: false,
19415         }
19416 }
19417 /// Checks if the given object is currently in the success state
19418 #[no_mangle]
19419 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
19420         o.result_ok
19421 }
19422 #[no_mangle]
19423 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
19424 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
19425 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
19426         fn drop(&mut self) {
19427                 if self.result_ok {
19428                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19429                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19430                         }
19431                 } else {
19432                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19433                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19434                         }
19435                 }
19436         }
19437 }
19438 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
19439         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19440                 let contents = if o.result_ok {
19441                         let result = unsafe { o.contents.result };
19442                         unsafe { o.contents.result = core::ptr::null_mut() };
19443                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
19444                 } else {
19445                         let err = unsafe { o.contents.err };
19446                         unsafe { o.contents.err = core::ptr::null_mut(); }
19447                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
19448                 };
19449                 Self {
19450                         contents,
19451                         result_ok: o.result_ok,
19452                 }
19453         }
19454 }
19455 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
19456         fn clone(&self) -> Self {
19457                 if self.result_ok {
19458                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19459                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
19460                         } }
19461                 } else {
19462                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
19463                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19464                         } }
19465                 }
19466         }
19467 }
19468 #[no_mangle]
19469 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
19470 /// but with all dynamically-allocated buffers duplicated in new buffers.
19471 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19472 #[repr(C)]
19473 /// The contents of CResult_ChannelUpdateDecodeErrorZ
19474 pub union CResult_ChannelUpdateDecodeErrorZPtr {
19475         /// A pointer to the contents in the success state.
19476         /// Reading from this pointer when `result_ok` is not set is undefined.
19477         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
19478         /// A pointer to the contents in the error state.
19479         /// Reading from this pointer when `result_ok` is set is undefined.
19480         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19481 }
19482 #[repr(C)]
19483 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
19484 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
19485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19486 pub struct CResult_ChannelUpdateDecodeErrorZ {
19487         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
19488         /// `err` or `result` depending on the state of `result_ok`.
19489         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
19490         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
19491         pub result_ok: bool,
19492 }
19493 #[no_mangle]
19494 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
19495 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
19496         CResult_ChannelUpdateDecodeErrorZ {
19497                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19498                         result: Box::into_raw(Box::new(o)),
19499                 },
19500                 result_ok: true,
19501         }
19502 }
19503 #[no_mangle]
19504 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
19505 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
19506         CResult_ChannelUpdateDecodeErrorZ {
19507                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
19508                         err: Box::into_raw(Box::new(e)),
19509                 },
19510                 result_ok: false,
19511         }
19512 }
19513 /// Checks if the given object is currently in the success state
19514 #[no_mangle]
19515 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
19516         o.result_ok
19517 }
19518 #[no_mangle]
19519 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
19520 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
19521 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
19522         fn drop(&mut self) {
19523                 if self.result_ok {
19524                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19525                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19526                         }
19527                 } else {
19528                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19529                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19530                         }
19531                 }
19532         }
19533 }
19534 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
19535         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
19536                 let contents = if o.result_ok {
19537                         let result = unsafe { o.contents.result };
19538                         unsafe { o.contents.result = core::ptr::null_mut() };
19539                         CResult_ChannelUpdateDecodeErrorZPtr { result }
19540                 } else {
19541                         let err = unsafe { o.contents.err };
19542                         unsafe { o.contents.err = core::ptr::null_mut(); }
19543                         CResult_ChannelUpdateDecodeErrorZPtr { err }
19544                 };
19545                 Self {
19546                         contents,
19547                         result_ok: o.result_ok,
19548                 }
19549         }
19550 }
19551 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
19552         fn clone(&self) -> Self {
19553                 if self.result_ok {
19554                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19555                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
19556                         } }
19557                 } else {
19558                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
19559                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19560                         } }
19561                 }
19562         }
19563 }
19564 #[no_mangle]
19565 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
19566 /// but with all dynamically-allocated buffers duplicated in new buffers.
19567 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
19568 #[repr(C)]
19569 /// The contents of CResult_ErrorMessageDecodeErrorZ
19570 pub union CResult_ErrorMessageDecodeErrorZPtr {
19571         /// A pointer to the contents in the success state.
19572         /// Reading from this pointer when `result_ok` is not set is undefined.
19573         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
19574         /// A pointer to the contents in the error state.
19575         /// Reading from this pointer when `result_ok` is set is undefined.
19576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19577 }
19578 #[repr(C)]
19579 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
19580 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19582 pub struct CResult_ErrorMessageDecodeErrorZ {
19583         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
19584         /// `err` or `result` depending on the state of `result_ok`.
19585         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
19586         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
19587         pub result_ok: bool,
19588 }
19589 #[no_mangle]
19590 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
19591 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
19592         CResult_ErrorMessageDecodeErrorZ {
19593                 contents: CResult_ErrorMessageDecodeErrorZPtr {
19594                         result: Box::into_raw(Box::new(o)),
19595                 },
19596                 result_ok: true,
19597         }
19598 }
19599 #[no_mangle]
19600 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
19601 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
19602         CResult_ErrorMessageDecodeErrorZ {
19603                 contents: CResult_ErrorMessageDecodeErrorZPtr {
19604                         err: Box::into_raw(Box::new(e)),
19605                 },
19606                 result_ok: false,
19607         }
19608 }
19609 /// Checks if the given object is currently in the success state
19610 #[no_mangle]
19611 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
19612         o.result_ok
19613 }
19614 #[no_mangle]
19615 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
19616 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
19617 impl Drop for CResult_ErrorMessageDecodeErrorZ {
19618         fn drop(&mut self) {
19619                 if self.result_ok {
19620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19622                         }
19623                 } else {
19624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19626                         }
19627                 }
19628         }
19629 }
19630 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
19631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19632                 let contents = if o.result_ok {
19633                         let result = unsafe { o.contents.result };
19634                         unsafe { o.contents.result = core::ptr::null_mut() };
19635                         CResult_ErrorMessageDecodeErrorZPtr { result }
19636                 } else {
19637                         let err = unsafe { o.contents.err };
19638                         unsafe { o.contents.err = core::ptr::null_mut(); }
19639                         CResult_ErrorMessageDecodeErrorZPtr { err }
19640                 };
19641                 Self {
19642                         contents,
19643                         result_ok: o.result_ok,
19644                 }
19645         }
19646 }
19647 impl Clone for CResult_ErrorMessageDecodeErrorZ {
19648         fn clone(&self) -> Self {
19649                 if self.result_ok {
19650                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
19651                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
19652                         } }
19653                 } else {
19654                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
19655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19656                         } }
19657                 }
19658         }
19659 }
19660 #[no_mangle]
19661 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
19662 /// but with all dynamically-allocated buffers duplicated in new buffers.
19663 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
19664 #[repr(C)]
19665 /// The contents of CResult_WarningMessageDecodeErrorZ
19666 pub union CResult_WarningMessageDecodeErrorZPtr {
19667         /// A pointer to the contents in the success state.
19668         /// Reading from this pointer when `result_ok` is not set is undefined.
19669         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
19670         /// A pointer to the contents in the error state.
19671         /// Reading from this pointer when `result_ok` is set is undefined.
19672         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19673 }
19674 #[repr(C)]
19675 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
19676 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
19677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19678 pub struct CResult_WarningMessageDecodeErrorZ {
19679         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
19680         /// `err` or `result` depending on the state of `result_ok`.
19681         pub contents: CResult_WarningMessageDecodeErrorZPtr,
19682         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
19683         pub result_ok: bool,
19684 }
19685 #[no_mangle]
19686 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
19687 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
19688         CResult_WarningMessageDecodeErrorZ {
19689                 contents: CResult_WarningMessageDecodeErrorZPtr {
19690                         result: Box::into_raw(Box::new(o)),
19691                 },
19692                 result_ok: true,
19693         }
19694 }
19695 #[no_mangle]
19696 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
19697 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
19698         CResult_WarningMessageDecodeErrorZ {
19699                 contents: CResult_WarningMessageDecodeErrorZPtr {
19700                         err: Box::into_raw(Box::new(e)),
19701                 },
19702                 result_ok: false,
19703         }
19704 }
19705 /// Checks if the given object is currently in the success state
19706 #[no_mangle]
19707 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
19708         o.result_ok
19709 }
19710 #[no_mangle]
19711 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
19712 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
19713 impl Drop for CResult_WarningMessageDecodeErrorZ {
19714         fn drop(&mut self) {
19715                 if self.result_ok {
19716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19718                         }
19719                 } else {
19720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19722                         }
19723                 }
19724         }
19725 }
19726 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
19727         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
19728                 let contents = if o.result_ok {
19729                         let result = unsafe { o.contents.result };
19730                         unsafe { o.contents.result = core::ptr::null_mut() };
19731                         CResult_WarningMessageDecodeErrorZPtr { result }
19732                 } else {
19733                         let err = unsafe { o.contents.err };
19734                         unsafe { o.contents.err = core::ptr::null_mut(); }
19735                         CResult_WarningMessageDecodeErrorZPtr { err }
19736                 };
19737                 Self {
19738                         contents,
19739                         result_ok: o.result_ok,
19740                 }
19741         }
19742 }
19743 impl Clone for CResult_WarningMessageDecodeErrorZ {
19744         fn clone(&self) -> Self {
19745                 if self.result_ok {
19746                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
19747                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
19748                         } }
19749                 } else {
19750                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
19751                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19752                         } }
19753                 }
19754         }
19755 }
19756 #[no_mangle]
19757 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
19758 /// but with all dynamically-allocated buffers duplicated in new buffers.
19759 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
19760 #[repr(C)]
19761 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
19762 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19763         /// A pointer to the contents in the success state.
19764         /// Reading from this pointer when `result_ok` is not set is undefined.
19765         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
19766         /// A pointer to the contents in the error state.
19767         /// Reading from this pointer when `result_ok` is set is undefined.
19768         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19769 }
19770 #[repr(C)]
19771 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
19772 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19774 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19775         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
19776         /// `err` or `result` depending on the state of `result_ok`.
19777         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
19778         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
19779         pub result_ok: bool,
19780 }
19781 #[no_mangle]
19782 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
19783 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19784         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19785                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19786                         result: Box::into_raw(Box::new(o)),
19787                 },
19788                 result_ok: true,
19789         }
19790 }
19791 #[no_mangle]
19792 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
19793 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19794         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19795                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19796                         err: Box::into_raw(Box::new(e)),
19797                 },
19798                 result_ok: false,
19799         }
19800 }
19801 /// Checks if the given object is currently in the success state
19802 #[no_mangle]
19803 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
19804         o.result_ok
19805 }
19806 #[no_mangle]
19807 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
19808 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
19809 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19810         fn drop(&mut self) {
19811                 if self.result_ok {
19812                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19813                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19814                         }
19815                 } else {
19816                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19817                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19818                         }
19819                 }
19820         }
19821 }
19822 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19823         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19824                 let contents = if o.result_ok {
19825                         let result = unsafe { o.contents.result };
19826                         unsafe { o.contents.result = core::ptr::null_mut() };
19827                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
19828                 } else {
19829                         let err = unsafe { o.contents.err };
19830                         unsafe { o.contents.err = core::ptr::null_mut(); }
19831                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
19832                 };
19833                 Self {
19834                         contents,
19835                         result_ok: o.result_ok,
19836                 }
19837         }
19838 }
19839 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
19840         fn clone(&self) -> Self {
19841                 if self.result_ok {
19842                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19843                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
19844                         } }
19845                 } else {
19846                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
19847                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19848                         } }
19849                 }
19850         }
19851 }
19852 #[no_mangle]
19853 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
19854 /// but with all dynamically-allocated buffers duplicated in new buffers.
19855 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19856 #[repr(C)]
19857 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
19858 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
19859         /// A pointer to the contents in the success state.
19860         /// Reading from this pointer when `result_ok` is not set is undefined.
19861         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
19862         /// A pointer to the contents in the error state.
19863         /// Reading from this pointer when `result_ok` is set is undefined.
19864         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19865 }
19866 #[repr(C)]
19867 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
19868 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
19869 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19870 pub struct CResult_NodeAnnouncementDecodeErrorZ {
19871         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
19872         /// `err` or `result` depending on the state of `result_ok`.
19873         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
19874         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
19875         pub result_ok: bool,
19876 }
19877 #[no_mangle]
19878 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
19879 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
19880         CResult_NodeAnnouncementDecodeErrorZ {
19881                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19882                         result: Box::into_raw(Box::new(o)),
19883                 },
19884                 result_ok: true,
19885         }
19886 }
19887 #[no_mangle]
19888 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
19889 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
19890         CResult_NodeAnnouncementDecodeErrorZ {
19891                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19892                         err: Box::into_raw(Box::new(e)),
19893                 },
19894                 result_ok: false,
19895         }
19896 }
19897 /// Checks if the given object is currently in the success state
19898 #[no_mangle]
19899 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
19900         o.result_ok
19901 }
19902 #[no_mangle]
19903 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
19904 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
19905 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
19906         fn drop(&mut self) {
19907                 if self.result_ok {
19908                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
19909                                 let _ = unsafe { Box::from_raw(self.contents.result) };
19910                         }
19911                 } else {
19912                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
19913                                 let _ = unsafe { Box::from_raw(self.contents.err) };
19914                         }
19915                 }
19916         }
19917 }
19918 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
19919         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
19920                 let contents = if o.result_ok {
19921                         let result = unsafe { o.contents.result };
19922                         unsafe { o.contents.result = core::ptr::null_mut() };
19923                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
19924                 } else {
19925                         let err = unsafe { o.contents.err };
19926                         unsafe { o.contents.err = core::ptr::null_mut(); }
19927                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
19928                 };
19929                 Self {
19930                         contents,
19931                         result_ok: o.result_ok,
19932                 }
19933         }
19934 }
19935 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
19936         fn clone(&self) -> Self {
19937                 if self.result_ok {
19938                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19939                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
19940                         } }
19941                 } else {
19942                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
19943                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
19944                         } }
19945                 }
19946         }
19947 }
19948 #[no_mangle]
19949 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
19950 /// but with all dynamically-allocated buffers duplicated in new buffers.
19951 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
19952 #[repr(C)]
19953 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
19954 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
19955         /// A pointer to the contents in the success state.
19956         /// Reading from this pointer when `result_ok` is not set is undefined.
19957         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
19958         /// A pointer to the contents in the error state.
19959         /// Reading from this pointer when `result_ok` is set is undefined.
19960         pub err: *mut crate::lightning::ln::msgs::DecodeError,
19961 }
19962 #[repr(C)]
19963 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
19964 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
19965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
19966 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
19967         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
19968         /// `err` or `result` depending on the state of `result_ok`.
19969         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
19970         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
19971         pub result_ok: bool,
19972 }
19973 #[no_mangle]
19974 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
19975 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
19976         CResult_QueryShortChannelIdsDecodeErrorZ {
19977                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
19978                         result: Box::into_raw(Box::new(o)),
19979                 },
19980                 result_ok: true,
19981         }
19982 }
19983 #[no_mangle]
19984 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
19985 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
19986         CResult_QueryShortChannelIdsDecodeErrorZ {
19987                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
19988                         err: Box::into_raw(Box::new(e)),
19989                 },
19990                 result_ok: false,
19991         }
19992 }
19993 /// Checks if the given object is currently in the success state
19994 #[no_mangle]
19995 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
19996         o.result_ok
19997 }
19998 #[no_mangle]
19999 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
20000 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
20001 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
20002         fn drop(&mut self) {
20003                 if self.result_ok {
20004                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20005                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20006                         }
20007                 } else {
20008                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20009                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20010                         }
20011                 }
20012         }
20013 }
20014 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
20015         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
20016                 let contents = if o.result_ok {
20017                         let result = unsafe { o.contents.result };
20018                         unsafe { o.contents.result = core::ptr::null_mut() };
20019                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
20020                 } else {
20021                         let err = unsafe { o.contents.err };
20022                         unsafe { o.contents.err = core::ptr::null_mut(); }
20023                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
20024                 };
20025                 Self {
20026                         contents,
20027                         result_ok: o.result_ok,
20028                 }
20029         }
20030 }
20031 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
20032         fn clone(&self) -> Self {
20033                 if self.result_ok {
20034                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20035                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
20036                         } }
20037                 } else {
20038                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
20039                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20040                         } }
20041                 }
20042         }
20043 }
20044 #[no_mangle]
20045 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
20046 /// but with all dynamically-allocated buffers duplicated in new buffers.
20047 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
20048 #[repr(C)]
20049 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
20050 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20051         /// A pointer to the contents in the success state.
20052         /// Reading from this pointer when `result_ok` is not set is undefined.
20053         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
20054         /// A pointer to the contents in the error state.
20055         /// Reading from this pointer when `result_ok` is set is undefined.
20056         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20057 }
20058 #[repr(C)]
20059 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
20060 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
20061 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20062 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20063         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
20064         /// `err` or `result` depending on the state of `result_ok`.
20065         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
20066         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
20067         pub result_ok: bool,
20068 }
20069 #[no_mangle]
20070 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
20071 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20072         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20073                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20074                         result: Box::into_raw(Box::new(o)),
20075                 },
20076                 result_ok: true,
20077         }
20078 }
20079 #[no_mangle]
20080 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
20081 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20082         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20083                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20084                         err: Box::into_raw(Box::new(e)),
20085                 },
20086                 result_ok: false,
20087         }
20088 }
20089 /// Checks if the given object is currently in the success state
20090 #[no_mangle]
20091 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
20092         o.result_ok
20093 }
20094 #[no_mangle]
20095 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
20096 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
20097 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20098         fn drop(&mut self) {
20099                 if self.result_ok {
20100                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20101                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20102                         }
20103                 } else {
20104                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20105                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20106                         }
20107                 }
20108         }
20109 }
20110 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20111         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
20112                 let contents = if o.result_ok {
20113                         let result = unsafe { o.contents.result };
20114                         unsafe { o.contents.result = core::ptr::null_mut() };
20115                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
20116                 } else {
20117                         let err = unsafe { o.contents.err };
20118                         unsafe { o.contents.err = core::ptr::null_mut(); }
20119                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
20120                 };
20121                 Self {
20122                         contents,
20123                         result_ok: o.result_ok,
20124                 }
20125         }
20126 }
20127 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
20128         fn clone(&self) -> Self {
20129                 if self.result_ok {
20130                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20131                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
20132                         } }
20133                 } else {
20134                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
20135                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20136                         } }
20137                 }
20138         }
20139 }
20140 #[no_mangle]
20141 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
20142 /// but with all dynamically-allocated buffers duplicated in new buffers.
20143 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
20144 #[repr(C)]
20145 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
20146 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
20147         /// A pointer to the contents in the success state.
20148         /// Reading from this pointer when `result_ok` is not set is undefined.
20149         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
20150         /// A pointer to the contents in the error state.
20151         /// Reading from this pointer when `result_ok` is set is undefined.
20152         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20153 }
20154 #[repr(C)]
20155 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
20156 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20158 pub struct CResult_QueryChannelRangeDecodeErrorZ {
20159         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
20160         /// `err` or `result` depending on the state of `result_ok`.
20161         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
20162         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
20163         pub result_ok: bool,
20164 }
20165 #[no_mangle]
20166 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
20167 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
20168         CResult_QueryChannelRangeDecodeErrorZ {
20169                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20170                         result: Box::into_raw(Box::new(o)),
20171                 },
20172                 result_ok: true,
20173         }
20174 }
20175 #[no_mangle]
20176 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
20177 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
20178         CResult_QueryChannelRangeDecodeErrorZ {
20179                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20180                         err: Box::into_raw(Box::new(e)),
20181                 },
20182                 result_ok: false,
20183         }
20184 }
20185 /// Checks if the given object is currently in the success state
20186 #[no_mangle]
20187 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
20188         o.result_ok
20189 }
20190 #[no_mangle]
20191 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
20192 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
20193 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
20194         fn drop(&mut self) {
20195                 if self.result_ok {
20196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20198                         }
20199                 } else {
20200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20202                         }
20203                 }
20204         }
20205 }
20206 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
20207         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20208                 let contents = if o.result_ok {
20209                         let result = unsafe { o.contents.result };
20210                         unsafe { o.contents.result = core::ptr::null_mut() };
20211                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
20212                 } else {
20213                         let err = unsafe { o.contents.err };
20214                         unsafe { o.contents.err = core::ptr::null_mut(); }
20215                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
20216                 };
20217                 Self {
20218                         contents,
20219                         result_ok: o.result_ok,
20220                 }
20221         }
20222 }
20223 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
20224         fn clone(&self) -> Self {
20225                 if self.result_ok {
20226                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20227                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
20228                         } }
20229                 } else {
20230                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
20231                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20232                         } }
20233                 }
20234         }
20235 }
20236 #[no_mangle]
20237 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
20238 /// but with all dynamically-allocated buffers duplicated in new buffers.
20239 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20240 #[repr(C)]
20241 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
20242 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
20243         /// A pointer to the contents in the success state.
20244         /// Reading from this pointer when `result_ok` is not set is undefined.
20245         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
20246         /// A pointer to the contents in the error state.
20247         /// Reading from this pointer when `result_ok` is set is undefined.
20248         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20249 }
20250 #[repr(C)]
20251 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
20252 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
20253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20254 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
20255         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
20256         /// `err` or `result` depending on the state of `result_ok`.
20257         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
20258         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
20259         pub result_ok: bool,
20260 }
20261 #[no_mangle]
20262 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
20263 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
20264         CResult_ReplyChannelRangeDecodeErrorZ {
20265                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20266                         result: Box::into_raw(Box::new(o)),
20267                 },
20268                 result_ok: true,
20269         }
20270 }
20271 #[no_mangle]
20272 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
20273 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
20274         CResult_ReplyChannelRangeDecodeErrorZ {
20275                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20276                         err: Box::into_raw(Box::new(e)),
20277                 },
20278                 result_ok: false,
20279         }
20280 }
20281 /// Checks if the given object is currently in the success state
20282 #[no_mangle]
20283 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
20284         o.result_ok
20285 }
20286 #[no_mangle]
20287 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
20288 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
20289 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
20290         fn drop(&mut self) {
20291                 if self.result_ok {
20292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20294                         }
20295                 } else {
20296                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20297                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20298                         }
20299                 }
20300         }
20301 }
20302 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
20303         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
20304                 let contents = if o.result_ok {
20305                         let result = unsafe { o.contents.result };
20306                         unsafe { o.contents.result = core::ptr::null_mut() };
20307                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
20308                 } else {
20309                         let err = unsafe { o.contents.err };
20310                         unsafe { o.contents.err = core::ptr::null_mut(); }
20311                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
20312                 };
20313                 Self {
20314                         contents,
20315                         result_ok: o.result_ok,
20316                 }
20317         }
20318 }
20319 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
20320         fn clone(&self) -> Self {
20321                 if self.result_ok {
20322                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20323                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
20324                         } }
20325                 } else {
20326                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
20327                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20328                         } }
20329                 }
20330         }
20331 }
20332 #[no_mangle]
20333 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
20334 /// but with all dynamically-allocated buffers duplicated in new buffers.
20335 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
20336 #[repr(C)]
20337 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
20338 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
20339         /// A pointer to the contents in the success state.
20340         /// Reading from this pointer when `result_ok` is not set is undefined.
20341         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
20342         /// A pointer to the contents in the error state.
20343         /// Reading from this pointer when `result_ok` is set is undefined.
20344         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20345 }
20346 #[repr(C)]
20347 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
20348 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
20349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20350 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
20351         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
20352         /// `err` or `result` depending on the state of `result_ok`.
20353         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
20354         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
20355         pub result_ok: bool,
20356 }
20357 #[no_mangle]
20358 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
20359 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
20360         CResult_GossipTimestampFilterDecodeErrorZ {
20361                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20362                         result: Box::into_raw(Box::new(o)),
20363                 },
20364                 result_ok: true,
20365         }
20366 }
20367 #[no_mangle]
20368 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
20369 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
20370         CResult_GossipTimestampFilterDecodeErrorZ {
20371                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20372                         err: Box::into_raw(Box::new(e)),
20373                 },
20374                 result_ok: false,
20375         }
20376 }
20377 /// Checks if the given object is currently in the success state
20378 #[no_mangle]
20379 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
20380         o.result_ok
20381 }
20382 #[no_mangle]
20383 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
20384 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
20385 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
20386         fn drop(&mut self) {
20387                 if self.result_ok {
20388                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20389                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20390                         }
20391                 } else {
20392                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20393                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20394                         }
20395                 }
20396         }
20397 }
20398 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
20399         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
20400                 let contents = if o.result_ok {
20401                         let result = unsafe { o.contents.result };
20402                         unsafe { o.contents.result = core::ptr::null_mut() };
20403                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
20404                 } else {
20405                         let err = unsafe { o.contents.err };
20406                         unsafe { o.contents.err = core::ptr::null_mut(); }
20407                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
20408                 };
20409                 Self {
20410                         contents,
20411                         result_ok: o.result_ok,
20412                 }
20413         }
20414 }
20415 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
20416         fn clone(&self) -> Self {
20417                 if self.result_ok {
20418                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20419                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
20420                         } }
20421                 } else {
20422                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
20423                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20424                         } }
20425                 }
20426         }
20427 }
20428 #[no_mangle]
20429 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
20430 /// but with all dynamically-allocated buffers duplicated in new buffers.
20431 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
20432 #[repr(C)]
20433 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
20434 /// This corresponds to std::vector in C++
20435 pub struct CVec_PhantomRouteHintsZ {
20436         /// The elements in the array.
20437         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
20438         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
20439         /// The number of elements pointed to by `data`.
20440         pub datalen: usize
20441 }
20442 impl CVec_PhantomRouteHintsZ {
20443         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
20444                 if self.datalen == 0 { return Vec::new(); }
20445                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
20446                 self.data = core::ptr::null_mut();
20447                 self.datalen = 0;
20448                 ret
20449         }
20450         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
20451                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
20452         }
20453 }
20454 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
20455         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
20456                 let datalen = v.len();
20457                 let data = Box::into_raw(v.into_boxed_slice());
20458                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
20459         }
20460 }
20461 #[no_mangle]
20462 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
20463 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
20464 impl Drop for CVec_PhantomRouteHintsZ {
20465         fn drop(&mut self) {
20466                 if self.datalen == 0 { return; }
20467                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
20468         }
20469 }
20470 impl Clone for CVec_PhantomRouteHintsZ {
20471         fn clone(&self) -> Self {
20472                 let mut res = Vec::new();
20473                 if self.datalen == 0 { return Self::from(res); }
20474                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
20475                 Self::from(res)
20476         }
20477 }
20478 #[repr(C)]
20479 /// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ
20480 pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20481         /// A pointer to the contents in the success state.
20482         /// Reading from this pointer when `result_ok` is not set is undefined.
20483         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
20484         /// A pointer to the contents in the error state.
20485         /// Reading from this pointer when `result_ok` is set is undefined.
20486         pub err: *mut crate::lightning_invoice::SignOrCreationError,
20487 }
20488 #[repr(C)]
20489 /// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
20490 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
20491 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20492 pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ {
20493         /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either
20494         /// `err` or `result` depending on the state of `result_ok`.
20495         pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr,
20496         /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state.
20497         pub result_ok: bool,
20498 }
20499 #[no_mangle]
20500 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state.
20501 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20502         CResult_Bolt11InvoiceSignOrCreationErrorZ {
20503                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20504                         result: Box::into_raw(Box::new(o)),
20505                 },
20506                 result_ok: true,
20507         }
20508 }
20509 #[no_mangle]
20510 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state.
20511 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ {
20512         CResult_Bolt11InvoiceSignOrCreationErrorZ {
20513                 contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20514                         err: Box::into_raw(Box::new(e)),
20515                 },
20516                 result_ok: false,
20517         }
20518 }
20519 /// Checks if the given object is currently in the success state
20520 #[no_mangle]
20521 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool {
20522         o.result_ok
20523 }
20524 #[no_mangle]
20525 /// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ.
20526 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { }
20527 impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20528         fn drop(&mut self) {
20529                 if self.result_ok {
20530                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20531                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20532                         }
20533                 } else {
20534                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20535                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20536                         }
20537                 }
20538         }
20539 }
20540 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20541         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
20542                 let contents = if o.result_ok {
20543                         let result = unsafe { o.contents.result };
20544                         unsafe { o.contents.result = core::ptr::null_mut() };
20545                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result }
20546                 } else {
20547                         let err = unsafe { o.contents.err };
20548                         unsafe { o.contents.err = core::ptr::null_mut(); }
20549                         CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err }
20550                 };
20551                 Self {
20552                         contents,
20553                         result_ok: o.result_ok,
20554                 }
20555         }
20556 }
20557 impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ {
20558         fn clone(&self) -> Self {
20559                 if self.result_ok {
20560                         Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20561                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
20562                         } }
20563                 } else {
20564                         Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr {
20565                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
20566                         } }
20567                 }
20568         }
20569 }
20570 #[no_mangle]
20571 /// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig`
20572 /// but with all dynamically-allocated buffers duplicated in new buffers.
20573 pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
20574 #[repr(C)]
20575 #[derive(Clone)]
20576 /// An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not
20577 pub enum COption_InboundHTLCStateDetailsZ {
20578         /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails
20579         Some(crate::lightning::ln::channel_state::InboundHTLCStateDetails),
20580         /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing
20581         None
20582 }
20583 impl COption_InboundHTLCStateDetailsZ {
20584         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20585                 if let Self::None = self { false } else { true }
20586         }
20587         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20588                 !self.is_some()
20589         }
20590         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::InboundHTLCStateDetails {
20591                 if let Self::Some(v) = self { v } else { unreachable!() }
20592         }
20593 }
20594 #[no_mangle]
20595 /// Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails
20596 pub extern "C" fn COption_InboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> COption_InboundHTLCStateDetailsZ {
20597         COption_InboundHTLCStateDetailsZ::Some(o)
20598 }
20599 #[no_mangle]
20600 /// Constructs a new COption_InboundHTLCStateDetailsZ containing nothing
20601 pub extern "C" fn COption_InboundHTLCStateDetailsZ_none() -> COption_InboundHTLCStateDetailsZ {
20602         COption_InboundHTLCStateDetailsZ::None
20603 }
20604 #[no_mangle]
20605 /// Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state
20606 pub extern "C" fn COption_InboundHTLCStateDetailsZ_free(_res: COption_InboundHTLCStateDetailsZ) { }
20607 #[no_mangle]
20608 /// Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig`
20609 /// but with all dynamically-allocated buffers duplicated in new buffers.
20610 pub extern "C" fn COption_InboundHTLCStateDetailsZ_clone(orig: &COption_InboundHTLCStateDetailsZ) -> COption_InboundHTLCStateDetailsZ { Clone::clone(&orig) }
20611 #[repr(C)]
20612 /// The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ
20613 pub union CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20614         /// A pointer to the contents in the success state.
20615         /// Reading from this pointer when `result_ok` is not set is undefined.
20616         pub result: *mut crate::c_types::derived::COption_InboundHTLCStateDetailsZ,
20617         /// A pointer to the contents in the error state.
20618         /// Reading from this pointer when `result_ok` is set is undefined.
20619         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20620 }
20621 #[repr(C)]
20622 /// A CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation,
20623 /// containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20625 pub struct CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20626         /// The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either
20627         /// `err` or `result` depending on the state of `result_ok`.
20628         pub contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr,
20629         /// Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state.
20630         pub result_ok: bool,
20631 }
20632 #[no_mangle]
20633 /// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state.
20634 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20635         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20636                 contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20637                         result: Box::into_raw(Box::new(o)),
20638                 },
20639                 result_ok: true,
20640         }
20641 }
20642 #[no_mangle]
20643 /// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state.
20644 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20645         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20646                 contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20647                         err: Box::into_raw(Box::new(e)),
20648                 },
20649                 result_ok: false,
20650         }
20651 }
20652 /// Checks if the given object is currently in the success state
20653 #[no_mangle]
20654 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> bool {
20655         o.result_ok
20656 }
20657 #[no_mangle]
20658 /// Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ.
20659 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) { }
20660 impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20661         fn drop(&mut self) {
20662                 if self.result_ok {
20663                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20664                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20665                         }
20666                 } else {
20667                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20668                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20669                         }
20670                 }
20671         }
20672 }
20673 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_InboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20674         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_InboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20675                 let contents = if o.result_ok {
20676                         let result = unsafe { o.contents.result };
20677                         unsafe { o.contents.result = core::ptr::null_mut() };
20678                         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { result }
20679                 } else {
20680                         let err = unsafe { o.contents.err };
20681                         unsafe { o.contents.err = core::ptr::null_mut(); }
20682                         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err }
20683                 };
20684                 Self {
20685                         contents,
20686                         result_ok: o.result_ok,
20687                 }
20688         }
20689 }
20690 impl Clone for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ {
20691         fn clone(&self) -> Self {
20692                 if self.result_ok {
20693                         Self { result_ok: true, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20694                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_InboundHTLCStateDetailsZ>::clone(unsafe { &*self.contents.result })))
20695                         } }
20696                 } else {
20697                         Self { result_ok: false, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr {
20698                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20699                         } }
20700                 }
20701         }
20702 }
20703 #[no_mangle]
20704 /// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig`
20705 /// but with all dynamically-allocated buffers duplicated in new buffers.
20706 pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) }
20707 #[repr(C)]
20708 /// The contents of CResult_InboundHTLCDetailsDecodeErrorZ
20709 pub union CResult_InboundHTLCDetailsDecodeErrorZPtr {
20710         /// A pointer to the contents in the success state.
20711         /// Reading from this pointer when `result_ok` is not set is undefined.
20712         pub result: *mut crate::lightning::ln::channel_state::InboundHTLCDetails,
20713         /// A pointer to the contents in the error state.
20714         /// Reading from this pointer when `result_ok` is set is undefined.
20715         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20716 }
20717 #[repr(C)]
20718 /// A CResult_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation,
20719 /// containing a crate::lightning::ln::channel_state::InboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
20720 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20721 pub struct CResult_InboundHTLCDetailsDecodeErrorZ {
20722         /// The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either
20723         /// `err` or `result` depending on the state of `result_ok`.
20724         pub contents: CResult_InboundHTLCDetailsDecodeErrorZPtr,
20725         /// Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state.
20726         pub result_ok: bool,
20727 }
20728 #[no_mangle]
20729 /// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state.
20730 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::InboundHTLCDetails) -> CResult_InboundHTLCDetailsDecodeErrorZ {
20731         CResult_InboundHTLCDetailsDecodeErrorZ {
20732                 contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20733                         result: Box::into_raw(Box::new(o)),
20734                 },
20735                 result_ok: true,
20736         }
20737 }
20738 #[no_mangle]
20739 /// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state.
20740 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InboundHTLCDetailsDecodeErrorZ {
20741         CResult_InboundHTLCDetailsDecodeErrorZ {
20742                 contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20743                         err: Box::into_raw(Box::new(e)),
20744                 },
20745                 result_ok: false,
20746         }
20747 }
20748 /// Checks if the given object is currently in the success state
20749 #[no_mangle]
20750 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_InboundHTLCDetailsDecodeErrorZ) -> bool {
20751         o.result_ok
20752 }
20753 #[no_mangle]
20754 /// Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ.
20755 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_free(_res: CResult_InboundHTLCDetailsDecodeErrorZ) { }
20756 impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ {
20757         fn drop(&mut self) {
20758                 if self.result_ok {
20759                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20760                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20761                         }
20762                 } else {
20763                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20764                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20765                         }
20766                 }
20767         }
20768 }
20769 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::InboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_InboundHTLCDetailsDecodeErrorZ {
20770         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::InboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
20771                 let contents = if o.result_ok {
20772                         let result = unsafe { o.contents.result };
20773                         unsafe { o.contents.result = core::ptr::null_mut() };
20774                         CResult_InboundHTLCDetailsDecodeErrorZPtr { result }
20775                 } else {
20776                         let err = unsafe { o.contents.err };
20777                         unsafe { o.contents.err = core::ptr::null_mut(); }
20778                         CResult_InboundHTLCDetailsDecodeErrorZPtr { err }
20779                 };
20780                 Self {
20781                         contents,
20782                         result_ok: o.result_ok,
20783                 }
20784         }
20785 }
20786 impl Clone for CResult_InboundHTLCDetailsDecodeErrorZ {
20787         fn clone(&self) -> Self {
20788                 if self.result_ok {
20789                         Self { result_ok: true, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20790                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::InboundHTLCDetails>::clone(unsafe { &*self.contents.result })))
20791                         } }
20792                 } else {
20793                         Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr {
20794                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20795                         } }
20796                 }
20797         }
20798 }
20799 #[no_mangle]
20800 /// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig`
20801 /// but with all dynamically-allocated buffers duplicated in new buffers.
20802 pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) }
20803 #[repr(C)]
20804 #[derive(Clone)]
20805 /// An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not
20806 pub enum COption_OutboundHTLCStateDetailsZ {
20807         /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails
20808         Some(crate::lightning::ln::channel_state::OutboundHTLCStateDetails),
20809         /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing
20810         None
20811 }
20812 impl COption_OutboundHTLCStateDetailsZ {
20813         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20814                 if let Self::None = self { false } else { true }
20815         }
20816         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
20817                 !self.is_some()
20818         }
20819         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::OutboundHTLCStateDetails {
20820                 if let Self::Some(v) = self { v } else { unreachable!() }
20821         }
20822 }
20823 #[no_mangle]
20824 /// Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails
20825 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> COption_OutboundHTLCStateDetailsZ {
20826         COption_OutboundHTLCStateDetailsZ::Some(o)
20827 }
20828 #[no_mangle]
20829 /// Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing
20830 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_none() -> COption_OutboundHTLCStateDetailsZ {
20831         COption_OutboundHTLCStateDetailsZ::None
20832 }
20833 #[no_mangle]
20834 /// Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state
20835 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_free(_res: COption_OutboundHTLCStateDetailsZ) { }
20836 #[no_mangle]
20837 /// Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig`
20838 /// but with all dynamically-allocated buffers duplicated in new buffers.
20839 pub extern "C" fn COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) }
20840 #[repr(C)]
20841 /// The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ
20842 pub union CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20843         /// A pointer to the contents in the success state.
20844         /// Reading from this pointer when `result_ok` is not set is undefined.
20845         pub result: *mut crate::c_types::derived::COption_OutboundHTLCStateDetailsZ,
20846         /// A pointer to the contents in the error state.
20847         /// Reading from this pointer when `result_ok` is set is undefined.
20848         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20849 }
20850 #[repr(C)]
20851 /// A CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation,
20852 /// containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
20853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20854 pub struct CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20855         /// The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either
20856         /// `err` or `result` depending on the state of `result_ok`.
20857         pub contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr,
20858         /// Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state.
20859         pub result_ok: bool,
20860 }
20861 #[no_mangle]
20862 /// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state.
20863 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20864         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20865                 contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20866                         result: Box::into_raw(Box::new(o)),
20867                 },
20868                 result_ok: true,
20869         }
20870 }
20871 #[no_mangle]
20872 /// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state.
20873 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20874         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20875                 contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20876                         err: Box::into_raw(Box::new(e)),
20877                 },
20878                 result_ok: false,
20879         }
20880 }
20881 /// Checks if the given object is currently in the success state
20882 #[no_mangle]
20883 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> bool {
20884         o.result_ok
20885 }
20886 #[no_mangle]
20887 /// Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ.
20888 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) { }
20889 impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20890         fn drop(&mut self) {
20891                 if self.result_ok {
20892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20894                         }
20895                 } else {
20896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20898                         }
20899                 }
20900         }
20901 }
20902 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20903         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
20904                 let contents = if o.result_ok {
20905                         let result = unsafe { o.contents.result };
20906                         unsafe { o.contents.result = core::ptr::null_mut() };
20907                         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { result }
20908                 } else {
20909                         let err = unsafe { o.contents.err };
20910                         unsafe { o.contents.err = core::ptr::null_mut(); }
20911                         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err }
20912                 };
20913                 Self {
20914                         contents,
20915                         result_ok: o.result_ok,
20916                 }
20917         }
20918 }
20919 impl Clone for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ {
20920         fn clone(&self) -> Self {
20921                 if self.result_ok {
20922                         Self { result_ok: true, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20923                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_OutboundHTLCStateDetailsZ>::clone(unsafe { &*self.contents.result })))
20924                         } }
20925                 } else {
20926                         Self { result_ok: false, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr {
20927                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
20928                         } }
20929                 }
20930         }
20931 }
20932 #[no_mangle]
20933 /// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig`
20934 /// but with all dynamically-allocated buffers duplicated in new buffers.
20935 pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) }
20936 #[repr(C)]
20937 /// The contents of CResult_OutboundHTLCDetailsDecodeErrorZ
20938 pub union CResult_OutboundHTLCDetailsDecodeErrorZPtr {
20939         /// A pointer to the contents in the success state.
20940         /// Reading from this pointer when `result_ok` is not set is undefined.
20941         pub result: *mut crate::lightning::ln::channel_state::OutboundHTLCDetails,
20942         /// A pointer to the contents in the error state.
20943         /// Reading from this pointer when `result_ok` is set is undefined.
20944         pub err: *mut crate::lightning::ln::msgs::DecodeError,
20945 }
20946 #[repr(C)]
20947 /// A CResult_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation,
20948 /// containing a crate::lightning::ln::channel_state::OutboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
20949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
20950 pub struct CResult_OutboundHTLCDetailsDecodeErrorZ {
20951         /// The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either
20952         /// `err` or `result` depending on the state of `result_ok`.
20953         pub contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr,
20954         /// Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state.
20955         pub result_ok: bool,
20956 }
20957 #[no_mangle]
20958 /// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state.
20959 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::OutboundHTLCDetails) -> CResult_OutboundHTLCDetailsDecodeErrorZ {
20960         CResult_OutboundHTLCDetailsDecodeErrorZ {
20961                 contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
20962                         result: Box::into_raw(Box::new(o)),
20963                 },
20964                 result_ok: true,
20965         }
20966 }
20967 #[no_mangle]
20968 /// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state.
20969 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutboundHTLCDetailsDecodeErrorZ {
20970         CResult_OutboundHTLCDetailsDecodeErrorZ {
20971                 contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
20972                         err: Box::into_raw(Box::new(e)),
20973                 },
20974                 result_ok: false,
20975         }
20976 }
20977 /// Checks if the given object is currently in the success state
20978 #[no_mangle]
20979 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> bool {
20980         o.result_ok
20981 }
20982 #[no_mangle]
20983 /// Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ.
20984 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res: CResult_OutboundHTLCDetailsDecodeErrorZ) { }
20985 impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ {
20986         fn drop(&mut self) {
20987                 if self.result_ok {
20988                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
20989                                 let _ = unsafe { Box::from_raw(self.contents.result) };
20990                         }
20991                 } else {
20992                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
20993                                 let _ = unsafe { Box::from_raw(self.contents.err) };
20994                         }
20995                 }
20996         }
20997 }
20998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::OutboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_OutboundHTLCDetailsDecodeErrorZ {
20999         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::OutboundHTLCDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
21000                 let contents = if o.result_ok {
21001                         let result = unsafe { o.contents.result };
21002                         unsafe { o.contents.result = core::ptr::null_mut() };
21003                         CResult_OutboundHTLCDetailsDecodeErrorZPtr { result }
21004                 } else {
21005                         let err = unsafe { o.contents.err };
21006                         unsafe { o.contents.err = core::ptr::null_mut(); }
21007                         CResult_OutboundHTLCDetailsDecodeErrorZPtr { err }
21008                 };
21009                 Self {
21010                         contents,
21011                         result_ok: o.result_ok,
21012                 }
21013         }
21014 }
21015 impl Clone for CResult_OutboundHTLCDetailsDecodeErrorZ {
21016         fn clone(&self) -> Self {
21017                 if self.result_ok {
21018                         Self { result_ok: true, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
21019                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::OutboundHTLCDetails>::clone(unsafe { &*self.contents.result })))
21020                         } }
21021                 } else {
21022                         Self { result_ok: false, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr {
21023                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21024                         } }
21025                 }
21026         }
21027 }
21028 #[no_mangle]
21029 /// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig`
21030 /// but with all dynamically-allocated buffers duplicated in new buffers.
21031 pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> CResult_OutboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) }
21032 #[repr(C)]
21033 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
21034 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21035         /// A pointer to the contents in the success state.
21036         /// Reading from this pointer when `result_ok` is not set is undefined.
21037         pub result: *mut crate::lightning::ln::channel_state::CounterpartyForwardingInfo,
21038         /// A pointer to the contents in the error state.
21039         /// Reading from this pointer when `result_ok` is set is undefined.
21040         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21041 }
21042 #[repr(C)]
21043 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
21044 /// containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
21045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21046 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
21047         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
21048         /// `err` or `result` depending on the state of `result_ok`.
21049         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
21050         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
21051         pub result_ok: bool,
21052 }
21053 #[no_mangle]
21054 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
21055 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
21056         CResult_CounterpartyForwardingInfoDecodeErrorZ {
21057                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21058                         result: Box::into_raw(Box::new(o)),
21059                 },
21060                 result_ok: true,
21061         }
21062 }
21063 #[no_mangle]
21064 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
21065 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
21066         CResult_CounterpartyForwardingInfoDecodeErrorZ {
21067                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21068                         err: Box::into_raw(Box::new(e)),
21069                 },
21070                 result_ok: false,
21071         }
21072 }
21073 /// Checks if the given object is currently in the success state
21074 #[no_mangle]
21075 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
21076         o.result_ok
21077 }
21078 #[no_mangle]
21079 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
21080 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
21081 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
21082         fn drop(&mut self) {
21083                 if self.result_ok {
21084                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21085                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21086                         }
21087                 } else {
21088                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21089                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21090                         }
21091                 }
21092         }
21093 }
21094 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
21095         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
21096                 let contents = if o.result_ok {
21097                         let result = unsafe { o.contents.result };
21098                         unsafe { o.contents.result = core::ptr::null_mut() };
21099                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
21100                 } else {
21101                         let err = unsafe { o.contents.err };
21102                         unsafe { o.contents.err = core::ptr::null_mut(); }
21103                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
21104                 };
21105                 Self {
21106                         contents,
21107                         result_ok: o.result_ok,
21108                 }
21109         }
21110 }
21111 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
21112         fn clone(&self) -> Self {
21113                 if self.result_ok {
21114                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21115                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
21116                         } }
21117                 } else {
21118                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
21119                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21120                         } }
21121                 }
21122         }
21123 }
21124 #[no_mangle]
21125 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
21126 /// but with all dynamically-allocated buffers duplicated in new buffers.
21127 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
21128 #[repr(C)]
21129 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
21130 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
21131         /// A pointer to the contents in the success state.
21132         /// Reading from this pointer when `result_ok` is not set is undefined.
21133         pub result: *mut crate::lightning::ln::channel_state::ChannelCounterparty,
21134         /// A pointer to the contents in the error state.
21135         /// Reading from this pointer when `result_ok` is set is undefined.
21136         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21137 }
21138 #[repr(C)]
21139 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
21140 /// containing a crate::lightning::ln::channel_state::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
21141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21142 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
21143         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
21144         /// `err` or `result` depending on the state of `result_ok`.
21145         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
21146         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
21147         pub result_ok: bool,
21148 }
21149 #[no_mangle]
21150 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
21151 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
21152         CResult_ChannelCounterpartyDecodeErrorZ {
21153                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21154                         result: Box::into_raw(Box::new(o)),
21155                 },
21156                 result_ok: true,
21157         }
21158 }
21159 #[no_mangle]
21160 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
21161 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
21162         CResult_ChannelCounterpartyDecodeErrorZ {
21163                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21164                         err: Box::into_raw(Box::new(e)),
21165                 },
21166                 result_ok: false,
21167         }
21168 }
21169 /// Checks if the given object is currently in the success state
21170 #[no_mangle]
21171 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
21172         o.result_ok
21173 }
21174 #[no_mangle]
21175 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
21176 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
21177 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
21178         fn drop(&mut self) {
21179                 if self.result_ok {
21180                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21181                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21182                         }
21183                 } else {
21184                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21185                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21186                         }
21187                 }
21188         }
21189 }
21190 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
21191         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
21192                 let contents = if o.result_ok {
21193                         let result = unsafe { o.contents.result };
21194                         unsafe { o.contents.result = core::ptr::null_mut() };
21195                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
21196                 } else {
21197                         let err = unsafe { o.contents.err };
21198                         unsafe { o.contents.err = core::ptr::null_mut(); }
21199                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
21200                 };
21201                 Self {
21202                         contents,
21203                         result_ok: o.result_ok,
21204                 }
21205         }
21206 }
21207 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
21208         fn clone(&self) -> Self {
21209                 if self.result_ok {
21210                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21211                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
21212                         } }
21213                 } else {
21214                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
21215                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21216                         } }
21217                 }
21218         }
21219 }
21220 #[no_mangle]
21221 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
21222 /// but with all dynamically-allocated buffers duplicated in new buffers.
21223 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
21224 #[repr(C)]
21225 #[derive(Clone)]
21226 /// An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not
21227 pub enum COption_ChannelShutdownStateZ {
21228         /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState
21229         Some(crate::lightning::ln::channel_state::ChannelShutdownState),
21230         /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing
21231         None
21232 }
21233 impl COption_ChannelShutdownStateZ {
21234         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21235                 if let Self::None = self { false } else { true }
21236         }
21237         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21238                 !self.is_some()
21239         }
21240         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::ChannelShutdownState {
21241                 if let Self::Some(v) = self { v } else { unreachable!() }
21242         }
21243 }
21244 #[no_mangle]
21245 /// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState
21246 pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> COption_ChannelShutdownStateZ {
21247         COption_ChannelShutdownStateZ::Some(o)
21248 }
21249 #[no_mangle]
21250 /// Constructs a new COption_ChannelShutdownStateZ containing nothing
21251 pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ {
21252         COption_ChannelShutdownStateZ::None
21253 }
21254 #[no_mangle]
21255 /// Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state
21256 pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { }
21257 #[no_mangle]
21258 /// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
21259 /// but with all dynamically-allocated buffers duplicated in new buffers.
21260 pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) }
21261 #[repr(C)]
21262 /// A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size.
21263 /// This corresponds to std::vector in C++
21264 pub struct CVec_InboundHTLCDetailsZ {
21265         /// The elements in the array.
21266         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21267         pub data: *mut crate::lightning::ln::channel_state::InboundHTLCDetails,
21268         /// The number of elements pointed to by `data`.
21269         pub datalen: usize
21270 }
21271 impl CVec_InboundHTLCDetailsZ {
21272         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channel_state::InboundHTLCDetails> {
21273                 if self.datalen == 0 { return Vec::new(); }
21274                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21275                 self.data = core::ptr::null_mut();
21276                 self.datalen = 0;
21277                 ret
21278         }
21279         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channel_state::InboundHTLCDetails] {
21280                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21281         }
21282 }
21283 impl From<Vec<crate::lightning::ln::channel_state::InboundHTLCDetails>> for CVec_InboundHTLCDetailsZ {
21284         fn from(v: Vec<crate::lightning::ln::channel_state::InboundHTLCDetails>) -> Self {
21285                 let datalen = v.len();
21286                 let data = Box::into_raw(v.into_boxed_slice());
21287                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21288         }
21289 }
21290 #[no_mangle]
21291 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21292 pub extern "C" fn CVec_InboundHTLCDetailsZ_free(_res: CVec_InboundHTLCDetailsZ) { }
21293 impl Drop for CVec_InboundHTLCDetailsZ {
21294         fn drop(&mut self) {
21295                 if self.datalen == 0 { return; }
21296                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21297         }
21298 }
21299 impl Clone for CVec_InboundHTLCDetailsZ {
21300         fn clone(&self) -> Self {
21301                 let mut res = Vec::new();
21302                 if self.datalen == 0 { return Self::from(res); }
21303                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21304                 Self::from(res)
21305         }
21306 }
21307 #[repr(C)]
21308 /// A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size.
21309 /// This corresponds to std::vector in C++
21310 pub struct CVec_OutboundHTLCDetailsZ {
21311         /// The elements in the array.
21312         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21313         pub data: *mut crate::lightning::ln::channel_state::OutboundHTLCDetails,
21314         /// The number of elements pointed to by `data`.
21315         pub datalen: usize
21316 }
21317 impl CVec_OutboundHTLCDetailsZ {
21318         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channel_state::OutboundHTLCDetails> {
21319                 if self.datalen == 0 { return Vec::new(); }
21320                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21321                 self.data = core::ptr::null_mut();
21322                 self.datalen = 0;
21323                 ret
21324         }
21325         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channel_state::OutboundHTLCDetails] {
21326                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21327         }
21328 }
21329 impl From<Vec<crate::lightning::ln::channel_state::OutboundHTLCDetails>> for CVec_OutboundHTLCDetailsZ {
21330         fn from(v: Vec<crate::lightning::ln::channel_state::OutboundHTLCDetails>) -> Self {
21331                 let datalen = v.len();
21332                 let data = Box::into_raw(v.into_boxed_slice());
21333                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21334         }
21335 }
21336 #[no_mangle]
21337 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21338 pub extern "C" fn CVec_OutboundHTLCDetailsZ_free(_res: CVec_OutboundHTLCDetailsZ) { }
21339 impl Drop for CVec_OutboundHTLCDetailsZ {
21340         fn drop(&mut self) {
21341                 if self.datalen == 0 { return; }
21342                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21343         }
21344 }
21345 impl Clone for CVec_OutboundHTLCDetailsZ {
21346         fn clone(&self) -> Self {
21347                 let mut res = Vec::new();
21348                 if self.datalen == 0 { return Self::from(res); }
21349                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
21350                 Self::from(res)
21351         }
21352 }
21353 #[repr(C)]
21354 /// The contents of CResult_ChannelDetailsDecodeErrorZ
21355 pub union CResult_ChannelDetailsDecodeErrorZPtr {
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::channel_state::ChannelDetails,
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_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
21365 /// containing a crate::lightning::ln::channel_state::ChannelDetails 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_ChannelDetailsDecodeErrorZ {
21368         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
21369         /// `err` or `result` depending on the state of `result_ok`.
21370         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
21371         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
21372         pub result_ok: bool,
21373 }
21374 #[no_mangle]
21375 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
21376 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
21377         CResult_ChannelDetailsDecodeErrorZ {
21378                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
21379                         result: Box::into_raw(Box::new(o)),
21380                 },
21381                 result_ok: true,
21382         }
21383 }
21384 #[no_mangle]
21385 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
21386 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
21387         CResult_ChannelDetailsDecodeErrorZ {
21388                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
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_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
21397         o.result_ok
21398 }
21399 #[no_mangle]
21400 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
21401 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
21402 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
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::channel_state::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
21416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelDetails, 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_ChannelDetailsDecodeErrorZPtr { result }
21421                 } else {
21422                         let err = unsafe { o.contents.err };
21423                         unsafe { o.contents.err = core::ptr::null_mut(); }
21424                         CResult_ChannelDetailsDecodeErrorZPtr { err }
21425                 };
21426                 Self {
21427                         contents,
21428                         result_ok: o.result_ok,
21429                 }
21430         }
21431 }
21432 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
21433         fn clone(&self) -> Self {
21434                 if self.result_ok {
21435                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
21436                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::ChannelDetails>::clone(unsafe { &*self.contents.result })))
21437                         } }
21438                 } else {
21439                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
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_ChannelDetailsDecodeErrorZ which has the same data as `orig`
21447 /// but with all dynamically-allocated buffers duplicated in new buffers.
21448 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
21449 #[repr(C)]
21450 /// The contents of CResult_ChannelShutdownStateDecodeErrorZ
21451 pub union CResult_ChannelShutdownStateDecodeErrorZPtr {
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::channel_state::ChannelShutdownState,
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_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation,
21461 /// containing a crate::lightning::ln::channel_state::ChannelShutdownState 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_ChannelShutdownStateDecodeErrorZ {
21464         /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either
21465         /// `err` or `result` depending on the state of `result_ok`.
21466         pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr,
21467         /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state.
21468         pub result_ok: bool,
21469 }
21470 #[no_mangle]
21471 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state.
21472 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ {
21473         CResult_ChannelShutdownStateDecodeErrorZ {
21474                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
21475                         result: Box::into_raw(Box::new(o)),
21476                 },
21477                 result_ok: true,
21478         }
21479 }
21480 #[no_mangle]
21481 /// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state.
21482 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ {
21483         CResult_ChannelShutdownStateDecodeErrorZ {
21484                 contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
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_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool {
21493         o.result_ok
21494 }
21495 #[no_mangle]
21496 /// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ.
21497 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { }
21498 impl Drop for CResult_ChannelShutdownStateDecodeErrorZ {
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::channel_state::ChannelShutdownState, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelShutdownStateDecodeErrorZ {
21512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_state::ChannelShutdownState, 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_ChannelShutdownStateDecodeErrorZPtr { result }
21517                 } else {
21518                         let err = unsafe { o.contents.err };
21519                         unsafe { o.contents.err = core::ptr::null_mut(); }
21520                         CResult_ChannelShutdownStateDecodeErrorZPtr { err }
21521                 };
21522                 Self {
21523                         contents,
21524                         result_ok: o.result_ok,
21525                 }
21526         }
21527 }
21528 impl Clone for CResult_ChannelShutdownStateDecodeErrorZ {
21529         fn clone(&self) -> Self {
21530                 if self.result_ok {
21531                         Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
21532                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_state::ChannelShutdownState>::clone(unsafe { &*self.contents.result })))
21533                         } }
21534                 } else {
21535                         Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr {
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_ChannelShutdownStateDecodeErrorZ which has the same data as `orig`
21543 /// but with all dynamically-allocated buffers duplicated in new buffers.
21544 pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) }
21545 #[repr(C)]
21546 /// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
21547 /// This corresponds to std::vector in C++
21548 pub struct CVec_FutureZ {
21549         /// The elements in the array.
21550         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
21551         pub data: *mut crate::lightning::util::wakers::Future,
21552         /// The number of elements pointed to by `data`.
21553         pub datalen: usize
21554 }
21555 impl CVec_FutureZ {
21556         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::wakers::Future> {
21557                 if self.datalen == 0 { return Vec::new(); }
21558                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
21559                 self.data = core::ptr::null_mut();
21560                 self.datalen = 0;
21561                 ret
21562         }
21563         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] {
21564                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
21565         }
21566 }
21567 impl From<Vec<crate::lightning::util::wakers::Future>> for CVec_FutureZ {
21568         fn from(v: Vec<crate::lightning::util::wakers::Future>) -> Self {
21569                 let datalen = v.len();
21570                 let data = Box::into_raw(v.into_boxed_slice());
21571                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
21572         }
21573 }
21574 #[no_mangle]
21575 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
21576 pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { }
21577 impl Drop for CVec_FutureZ {
21578         fn drop(&mut self) {
21579                 if self.datalen == 0 { return; }
21580                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
21581         }
21582 }
21583 #[repr(C)]
21584 /// The contents of CResult_OffersMessageDecodeErrorZ
21585 pub union CResult_OffersMessageDecodeErrorZPtr {
21586         /// A pointer to the contents in the success state.
21587         /// Reading from this pointer when `result_ok` is not set is undefined.
21588         pub result: *mut crate::lightning::onion_message::offers::OffersMessage,
21589         /// A pointer to the contents in the error state.
21590         /// Reading from this pointer when `result_ok` is set is undefined.
21591         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21592 }
21593 #[repr(C)]
21594 /// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation,
21595 /// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
21596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21597 pub struct CResult_OffersMessageDecodeErrorZ {
21598         /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either
21599         /// `err` or `result` depending on the state of `result_ok`.
21600         pub contents: CResult_OffersMessageDecodeErrorZPtr,
21601         /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state.
21602         pub result_ok: bool,
21603 }
21604 #[no_mangle]
21605 /// Creates a new CResult_OffersMessageDecodeErrorZ in the success state.
21606 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ {
21607         CResult_OffersMessageDecodeErrorZ {
21608                 contents: CResult_OffersMessageDecodeErrorZPtr {
21609                         result: Box::into_raw(Box::new(o)),
21610                 },
21611                 result_ok: true,
21612         }
21613 }
21614 #[no_mangle]
21615 /// Creates a new CResult_OffersMessageDecodeErrorZ in the error state.
21616 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ {
21617         CResult_OffersMessageDecodeErrorZ {
21618                 contents: CResult_OffersMessageDecodeErrorZPtr {
21619                         err: Box::into_raw(Box::new(e)),
21620                 },
21621                 result_ok: false,
21622         }
21623 }
21624 /// Checks if the given object is currently in the success state
21625 #[no_mangle]
21626 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool {
21627         o.result_ok
21628 }
21629 #[no_mangle]
21630 /// Frees any resources used by the CResult_OffersMessageDecodeErrorZ.
21631 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { }
21632 impl Drop for CResult_OffersMessageDecodeErrorZ {
21633         fn drop(&mut self) {
21634                 if self.result_ok {
21635                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21636                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21637                         }
21638                 } else {
21639                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21640                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21641                         }
21642                 }
21643         }
21644 }
21645 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OffersMessageDecodeErrorZ {
21646         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::offers::OffersMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
21647                 let contents = if o.result_ok {
21648                         let result = unsafe { o.contents.result };
21649                         unsafe { o.contents.result = core::ptr::null_mut() };
21650                         CResult_OffersMessageDecodeErrorZPtr { result }
21651                 } else {
21652                         let err = unsafe { o.contents.err };
21653                         unsafe { o.contents.err = core::ptr::null_mut(); }
21654                         CResult_OffersMessageDecodeErrorZPtr { err }
21655                 };
21656                 Self {
21657                         contents,
21658                         result_ok: o.result_ok,
21659                 }
21660         }
21661 }
21662 impl Clone for CResult_OffersMessageDecodeErrorZ {
21663         fn clone(&self) -> Self {
21664                 if self.result_ok {
21665                         Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr {
21666                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::offers::OffersMessage>::clone(unsafe { &*self.contents.result })))
21667                         } }
21668                 } else {
21669                         Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr {
21670                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21671                         } }
21672                 }
21673         }
21674 }
21675 #[no_mangle]
21676 /// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig`
21677 /// but with all dynamically-allocated buffers duplicated in new buffers.
21678 pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) }
21679 #[repr(C)]
21680 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
21681 pub enum COption_HTLCClaimZ {
21682         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
21683         Some(crate::lightning::ln::chan_utils::HTLCClaim),
21684         /// When we're in this state, this COption_HTLCClaimZ contains nothing
21685         None
21686 }
21687 impl COption_HTLCClaimZ {
21688         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
21689                 if let Self::None = self { false } else { true }
21690         }
21691         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
21692                 !self.is_some()
21693         }
21694         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
21695                 if let Self::Some(v) = self { v } else { unreachable!() }
21696         }
21697 }
21698 #[no_mangle]
21699 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
21700 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
21701         COption_HTLCClaimZ::Some(o)
21702 }
21703 #[no_mangle]
21704 /// Constructs a new COption_HTLCClaimZ containing nothing
21705 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
21706         COption_HTLCClaimZ::None
21707 }
21708 #[no_mangle]
21709 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
21710 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
21711 #[repr(C)]
21712 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
21713 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21714         /// A pointer to the contents in the success state.
21715         /// Reading from this pointer when `result_ok` is not set is undefined.
21716         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
21717         /// A pointer to the contents in the error state.
21718         /// Reading from this pointer when `result_ok` is set is undefined.
21719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21720 }
21721 #[repr(C)]
21722 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
21723 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
21724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21725 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21726         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
21727         /// `err` or `result` depending on the state of `result_ok`.
21728         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
21729         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
21730         pub result_ok: bool,
21731 }
21732 #[no_mangle]
21733 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
21734 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21735         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21736                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21737                         result: Box::into_raw(Box::new(o)),
21738                 },
21739                 result_ok: true,
21740         }
21741 }
21742 #[no_mangle]
21743 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
21744 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21745         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21746                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21747                         err: Box::into_raw(Box::new(e)),
21748                 },
21749                 result_ok: false,
21750         }
21751 }
21752 /// Checks if the given object is currently in the success state
21753 #[no_mangle]
21754 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
21755         o.result_ok
21756 }
21757 #[no_mangle]
21758 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
21759 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
21760 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21761         fn drop(&mut self) {
21762                 if self.result_ok {
21763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21765                         }
21766                 } else {
21767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21769                         }
21770                 }
21771         }
21772 }
21773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
21775                 let contents = if o.result_ok {
21776                         let result = unsafe { o.contents.result };
21777                         unsafe { o.contents.result = core::ptr::null_mut() };
21778                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
21779                 } else {
21780                         let err = unsafe { o.contents.err };
21781                         unsafe { o.contents.err = core::ptr::null_mut(); }
21782                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
21783                 };
21784                 Self {
21785                         contents,
21786                         result_ok: o.result_ok,
21787                 }
21788         }
21789 }
21790 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
21791         fn clone(&self) -> Self {
21792                 if self.result_ok {
21793                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
21795                         } }
21796                 } else {
21797                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
21798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21799                         } }
21800                 }
21801         }
21802 }
21803 #[no_mangle]
21804 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
21805 /// but with all dynamically-allocated buffers duplicated in new buffers.
21806 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
21807 #[repr(C)]
21808 /// The contents of CResult_TxCreationKeysDecodeErrorZ
21809 pub union CResult_TxCreationKeysDecodeErrorZPtr {
21810         /// A pointer to the contents in the success state.
21811         /// Reading from this pointer when `result_ok` is not set is undefined.
21812         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
21813         /// A pointer to the contents in the error state.
21814         /// Reading from this pointer when `result_ok` is set is undefined.
21815         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21816 }
21817 #[repr(C)]
21818 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
21819 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21820 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21821 pub struct CResult_TxCreationKeysDecodeErrorZ {
21822         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
21823         /// `err` or `result` depending on the state of `result_ok`.
21824         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
21825         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
21826         pub result_ok: bool,
21827 }
21828 #[no_mangle]
21829 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
21830 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
21831         CResult_TxCreationKeysDecodeErrorZ {
21832                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21833                         result: Box::into_raw(Box::new(o)),
21834                 },
21835                 result_ok: true,
21836         }
21837 }
21838 #[no_mangle]
21839 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
21840 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
21841         CResult_TxCreationKeysDecodeErrorZ {
21842                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
21843                         err: Box::into_raw(Box::new(e)),
21844                 },
21845                 result_ok: false,
21846         }
21847 }
21848 /// Checks if the given object is currently in the success state
21849 #[no_mangle]
21850 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
21851         o.result_ok
21852 }
21853 #[no_mangle]
21854 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
21855 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
21856 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
21857         fn drop(&mut self) {
21858                 if self.result_ok {
21859                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21860                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21861                         }
21862                 } else {
21863                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21864                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21865                         }
21866                 }
21867         }
21868 }
21869 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
21870         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21871                 let contents = if o.result_ok {
21872                         let result = unsafe { o.contents.result };
21873                         unsafe { o.contents.result = core::ptr::null_mut() };
21874                         CResult_TxCreationKeysDecodeErrorZPtr { result }
21875                 } else {
21876                         let err = unsafe { o.contents.err };
21877                         unsafe { o.contents.err = core::ptr::null_mut(); }
21878                         CResult_TxCreationKeysDecodeErrorZPtr { err }
21879                 };
21880                 Self {
21881                         contents,
21882                         result_ok: o.result_ok,
21883                 }
21884         }
21885 }
21886 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
21887         fn clone(&self) -> Self {
21888                 if self.result_ok {
21889                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21890                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
21891                         } }
21892                 } else {
21893                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
21894                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21895                         } }
21896                 }
21897         }
21898 }
21899 #[no_mangle]
21900 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
21901 /// but with all dynamically-allocated buffers duplicated in new buffers.
21902 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
21903 #[repr(C)]
21904 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
21905 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
21906         /// A pointer to the contents in the success state.
21907         /// Reading from this pointer when `result_ok` is not set is undefined.
21908         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
21909         /// A pointer to the contents in the error state.
21910         /// Reading from this pointer when `result_ok` is set is undefined.
21911         pub err: *mut crate::lightning::ln::msgs::DecodeError,
21912 }
21913 #[repr(C)]
21914 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
21915 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
21916 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
21917 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
21918         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
21919         /// `err` or `result` depending on the state of `result_ok`.
21920         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
21921         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
21922         pub result_ok: bool,
21923 }
21924 #[no_mangle]
21925 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
21926 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
21927         CResult_ChannelPublicKeysDecodeErrorZ {
21928                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21929                         result: Box::into_raw(Box::new(o)),
21930                 },
21931                 result_ok: true,
21932         }
21933 }
21934 #[no_mangle]
21935 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
21936 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
21937         CResult_ChannelPublicKeysDecodeErrorZ {
21938                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21939                         err: Box::into_raw(Box::new(e)),
21940                 },
21941                 result_ok: false,
21942         }
21943 }
21944 /// Checks if the given object is currently in the success state
21945 #[no_mangle]
21946 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
21947         o.result_ok
21948 }
21949 #[no_mangle]
21950 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
21951 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
21952 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
21953         fn drop(&mut self) {
21954                 if self.result_ok {
21955                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
21956                                 let _ = unsafe { Box::from_raw(self.contents.result) };
21957                         }
21958                 } else {
21959                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
21960                                 let _ = unsafe { Box::from_raw(self.contents.err) };
21961                         }
21962                 }
21963         }
21964 }
21965 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
21966         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
21967                 let contents = if o.result_ok {
21968                         let result = unsafe { o.contents.result };
21969                         unsafe { o.contents.result = core::ptr::null_mut() };
21970                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
21971                 } else {
21972                         let err = unsafe { o.contents.err };
21973                         unsafe { o.contents.err = core::ptr::null_mut(); }
21974                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
21975                 };
21976                 Self {
21977                         contents,
21978                         result_ok: o.result_ok,
21979                 }
21980         }
21981 }
21982 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
21983         fn clone(&self) -> Self {
21984                 if self.result_ok {
21985                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21986                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
21987                         } }
21988                 } else {
21989                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
21990                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
21991                         } }
21992                 }
21993         }
21994 }
21995 #[no_mangle]
21996 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
21997 /// but with all dynamically-allocated buffers duplicated in new buffers.
21998 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
21999 #[repr(C)]
22000 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
22001 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22002         /// A pointer to the contents in the success state.
22003         /// Reading from this pointer when `result_ok` is not set is undefined.
22004         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
22005         /// A pointer to the contents in the error state.
22006         /// Reading from this pointer when `result_ok` is set is undefined.
22007         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22008 }
22009 #[repr(C)]
22010 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
22011 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
22012 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22013 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
22014         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
22015         /// `err` or `result` depending on the state of `result_ok`.
22016         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
22017         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
22018         pub result_ok: bool,
22019 }
22020 #[no_mangle]
22021 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
22022 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
22023         CResult_HTLCOutputInCommitmentDecodeErrorZ {
22024                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22025                         result: Box::into_raw(Box::new(o)),
22026                 },
22027                 result_ok: true,
22028         }
22029 }
22030 #[no_mangle]
22031 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
22032 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
22033         CResult_HTLCOutputInCommitmentDecodeErrorZ {
22034                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22035                         err: Box::into_raw(Box::new(e)),
22036                 },
22037                 result_ok: false,
22038         }
22039 }
22040 /// Checks if the given object is currently in the success state
22041 #[no_mangle]
22042 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
22043         o.result_ok
22044 }
22045 #[no_mangle]
22046 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
22047 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
22048 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
22049         fn drop(&mut self) {
22050                 if self.result_ok {
22051                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22052                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22053                         }
22054                 } else {
22055                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22056                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22057                         }
22058                 }
22059         }
22060 }
22061 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
22062         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
22063                 let contents = if o.result_ok {
22064                         let result = unsafe { o.contents.result };
22065                         unsafe { o.contents.result = core::ptr::null_mut() };
22066                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
22067                 } else {
22068                         let err = unsafe { o.contents.err };
22069                         unsafe { o.contents.err = core::ptr::null_mut(); }
22070                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
22071                 };
22072                 Self {
22073                         contents,
22074                         result_ok: o.result_ok,
22075                 }
22076         }
22077 }
22078 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
22079         fn clone(&self) -> Self {
22080                 if self.result_ok {
22081                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22082                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
22083                         } }
22084                 } else {
22085                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
22086                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22087                         } }
22088                 }
22089         }
22090 }
22091 #[no_mangle]
22092 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
22093 /// but with all dynamically-allocated buffers duplicated in new buffers.
22094 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
22095 #[repr(C)]
22096 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
22097 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22098         /// A pointer to the contents in the success state.
22099         /// Reading from this pointer when `result_ok` is not set is undefined.
22100         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
22101         /// A pointer to the contents in the error state.
22102         /// Reading from this pointer when `result_ok` is set is undefined.
22103         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22104 }
22105 #[repr(C)]
22106 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
22107 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
22108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22109 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22110         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
22111         /// `err` or `result` depending on the state of `result_ok`.
22112         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
22113         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
22114         pub result_ok: bool,
22115 }
22116 #[no_mangle]
22117 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
22118 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22119         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22120                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22121                         result: Box::into_raw(Box::new(o)),
22122                 },
22123                 result_ok: true,
22124         }
22125 }
22126 #[no_mangle]
22127 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
22128 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22129         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22130                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22131                         err: Box::into_raw(Box::new(e)),
22132                 },
22133                 result_ok: false,
22134         }
22135 }
22136 /// Checks if the given object is currently in the success state
22137 #[no_mangle]
22138 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
22139         o.result_ok
22140 }
22141 #[no_mangle]
22142 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
22143 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
22144 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22145         fn drop(&mut self) {
22146                 if self.result_ok {
22147                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22148                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22149                         }
22150                 } else {
22151                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22152                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22153                         }
22154                 }
22155         }
22156 }
22157 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22158         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
22159                 let contents = if o.result_ok {
22160                         let result = unsafe { o.contents.result };
22161                         unsafe { o.contents.result = core::ptr::null_mut() };
22162                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
22163                 } else {
22164                         let err = unsafe { o.contents.err };
22165                         unsafe { o.contents.err = core::ptr::null_mut(); }
22166                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
22167                 };
22168                 Self {
22169                         contents,
22170                         result_ok: o.result_ok,
22171                 }
22172         }
22173 }
22174 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
22175         fn clone(&self) -> Self {
22176                 if self.result_ok {
22177                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22178                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
22179                         } }
22180                 } else {
22181                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
22182                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22183                         } }
22184                 }
22185         }
22186 }
22187 #[no_mangle]
22188 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
22189 /// but with all dynamically-allocated buffers duplicated in new buffers.
22190 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
22191 #[repr(C)]
22192 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
22193 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
22194         /// A pointer to the contents in the success state.
22195         /// Reading from this pointer when `result_ok` is not set is undefined.
22196         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
22197         /// A pointer to the contents in the error state.
22198         /// Reading from this pointer when `result_ok` is set is undefined.
22199         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22200 }
22201 #[repr(C)]
22202 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
22203 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
22204 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22205 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
22206         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
22207         /// `err` or `result` depending on the state of `result_ok`.
22208         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
22209         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
22210         pub result_ok: bool,
22211 }
22212 #[no_mangle]
22213 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
22214 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
22215         CResult_ChannelTransactionParametersDecodeErrorZ {
22216                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22217                         result: Box::into_raw(Box::new(o)),
22218                 },
22219                 result_ok: true,
22220         }
22221 }
22222 #[no_mangle]
22223 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
22224 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
22225         CResult_ChannelTransactionParametersDecodeErrorZ {
22226                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22227                         err: Box::into_raw(Box::new(e)),
22228                 },
22229                 result_ok: false,
22230         }
22231 }
22232 /// Checks if the given object is currently in the success state
22233 #[no_mangle]
22234 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
22235         o.result_ok
22236 }
22237 #[no_mangle]
22238 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
22239 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
22240 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
22241         fn drop(&mut self) {
22242                 if self.result_ok {
22243                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22244                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22245                         }
22246                 } else {
22247                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22248                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22249                         }
22250                 }
22251         }
22252 }
22253 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
22254         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
22255                 let contents = if o.result_ok {
22256                         let result = unsafe { o.contents.result };
22257                         unsafe { o.contents.result = core::ptr::null_mut() };
22258                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
22259                 } else {
22260                         let err = unsafe { o.contents.err };
22261                         unsafe { o.contents.err = core::ptr::null_mut(); }
22262                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
22263                 };
22264                 Self {
22265                         contents,
22266                         result_ok: o.result_ok,
22267                 }
22268         }
22269 }
22270 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
22271         fn clone(&self) -> Self {
22272                 if self.result_ok {
22273                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22274                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
22275                         } }
22276                 } else {
22277                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
22278                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22279                         } }
22280                 }
22281         }
22282 }
22283 #[no_mangle]
22284 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
22285 /// but with all dynamically-allocated buffers duplicated in new buffers.
22286 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
22287 #[repr(C)]
22288 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
22289 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22290         /// A pointer to the contents in the success state.
22291         /// Reading from this pointer when `result_ok` is not set is undefined.
22292         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
22293         /// A pointer to the contents in the error state.
22294         /// Reading from this pointer when `result_ok` is set is undefined.
22295         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22296 }
22297 #[repr(C)]
22298 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22299 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22300 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22301 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
22302         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
22303         /// `err` or `result` depending on the state of `result_ok`.
22304         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
22305         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
22306         pub result_ok: bool,
22307 }
22308 #[no_mangle]
22309 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
22310 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
22311         CResult_HolderCommitmentTransactionDecodeErrorZ {
22312                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22313                         result: Box::into_raw(Box::new(o)),
22314                 },
22315                 result_ok: true,
22316         }
22317 }
22318 #[no_mangle]
22319 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
22320 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
22321         CResult_HolderCommitmentTransactionDecodeErrorZ {
22322                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22323                         err: Box::into_raw(Box::new(e)),
22324                 },
22325                 result_ok: false,
22326         }
22327 }
22328 /// Checks if the given object is currently in the success state
22329 #[no_mangle]
22330 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
22331         o.result_ok
22332 }
22333 #[no_mangle]
22334 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
22335 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
22336 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
22337         fn drop(&mut self) {
22338                 if self.result_ok {
22339                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22340                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22341                         }
22342                 } else {
22343                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22344                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22345                         }
22346                 }
22347         }
22348 }
22349 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
22350         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22351                 let contents = if o.result_ok {
22352                         let result = unsafe { o.contents.result };
22353                         unsafe { o.contents.result = core::ptr::null_mut() };
22354                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
22355                 } else {
22356                         let err = unsafe { o.contents.err };
22357                         unsafe { o.contents.err = core::ptr::null_mut(); }
22358                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
22359                 };
22360                 Self {
22361                         contents,
22362                         result_ok: o.result_ok,
22363                 }
22364         }
22365 }
22366 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
22367         fn clone(&self) -> Self {
22368                 if self.result_ok {
22369                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22370                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22371                         } }
22372                 } else {
22373                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
22374                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22375                         } }
22376                 }
22377         }
22378 }
22379 #[no_mangle]
22380 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
22381 /// but with all dynamically-allocated buffers duplicated in new buffers.
22382 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22383 #[repr(C)]
22384 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
22385 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22386         /// A pointer to the contents in the success state.
22387         /// Reading from this pointer when `result_ok` is not set is undefined.
22388         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
22389         /// A pointer to the contents in the error state.
22390         /// Reading from this pointer when `result_ok` is set is undefined.
22391         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22392 }
22393 #[repr(C)]
22394 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22395 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22397 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
22398         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
22399         /// `err` or `result` depending on the state of `result_ok`.
22400         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
22401         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
22402         pub result_ok: bool,
22403 }
22404 #[no_mangle]
22405 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
22406 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
22407         CResult_BuiltCommitmentTransactionDecodeErrorZ {
22408                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22409                         result: Box::into_raw(Box::new(o)),
22410                 },
22411                 result_ok: true,
22412         }
22413 }
22414 #[no_mangle]
22415 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
22416 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
22417         CResult_BuiltCommitmentTransactionDecodeErrorZ {
22418                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22419                         err: Box::into_raw(Box::new(e)),
22420                 },
22421                 result_ok: false,
22422         }
22423 }
22424 /// Checks if the given object is currently in the success state
22425 #[no_mangle]
22426 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
22427         o.result_ok
22428 }
22429 #[no_mangle]
22430 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
22431 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
22432 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
22433         fn drop(&mut self) {
22434                 if self.result_ok {
22435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22437                         }
22438                 } else {
22439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22441                         }
22442                 }
22443         }
22444 }
22445 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
22446         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22447                 let contents = if o.result_ok {
22448                         let result = unsafe { o.contents.result };
22449                         unsafe { o.contents.result = core::ptr::null_mut() };
22450                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
22451                 } else {
22452                         let err = unsafe { o.contents.err };
22453                         unsafe { o.contents.err = core::ptr::null_mut(); }
22454                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
22455                 };
22456                 Self {
22457                         contents,
22458                         result_ok: o.result_ok,
22459                 }
22460         }
22461 }
22462 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
22463         fn clone(&self) -> Self {
22464                 if self.result_ok {
22465                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22466                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22467                         } }
22468                 } else {
22469                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
22470                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22471                         } }
22472                 }
22473         }
22474 }
22475 #[no_mangle]
22476 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
22477 /// but with all dynamically-allocated buffers duplicated in new buffers.
22478 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22479 #[repr(C)]
22480 /// The contents of CResult_TrustedClosingTransactionNoneZ
22481 pub union CResult_TrustedClosingTransactionNoneZPtr {
22482         /// A pointer to the contents in the success state.
22483         /// Reading from this pointer when `result_ok` is not set is undefined.
22484         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
22485         /// Note that this value is always NULL, as there are no contents in the Err variant
22486         pub err: *mut core::ffi::c_void,
22487 }
22488 #[repr(C)]
22489 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
22490 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
22491 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22492 pub struct CResult_TrustedClosingTransactionNoneZ {
22493         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
22494         /// `err` or `result` depending on the state of `result_ok`.
22495         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
22496         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
22497         pub result_ok: bool,
22498 }
22499 #[no_mangle]
22500 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
22501 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
22502         CResult_TrustedClosingTransactionNoneZ {
22503                 contents: CResult_TrustedClosingTransactionNoneZPtr {
22504                         result: Box::into_raw(Box::new(o)),
22505                 },
22506                 result_ok: true,
22507         }
22508 }
22509 #[no_mangle]
22510 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
22511 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
22512         CResult_TrustedClosingTransactionNoneZ {
22513                 contents: CResult_TrustedClosingTransactionNoneZPtr {
22514                         err: core::ptr::null_mut(),
22515                 },
22516                 result_ok: false,
22517         }
22518 }
22519 /// Checks if the given object is currently in the success state
22520 #[no_mangle]
22521 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
22522         o.result_ok
22523 }
22524 #[no_mangle]
22525 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
22526 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
22527 impl Drop for CResult_TrustedClosingTransactionNoneZ {
22528         fn drop(&mut self) {
22529                 if self.result_ok {
22530                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22531                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22532                         }
22533                 } else {
22534                 }
22535         }
22536 }
22537 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
22538         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
22539                 let contents = if o.result_ok {
22540                         let result = unsafe { o.contents.result };
22541                         unsafe { o.contents.result = core::ptr::null_mut() };
22542                         CResult_TrustedClosingTransactionNoneZPtr { result }
22543                 } else {
22544                         let _ = unsafe { Box::from_raw(o.contents.err) };
22545                         o.contents.err = core::ptr::null_mut();
22546                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
22547                 };
22548                 Self {
22549                         contents,
22550                         result_ok: o.result_ok,
22551                 }
22552         }
22553 }
22554 #[repr(C)]
22555 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
22556 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
22557         /// A pointer to the contents in the success state.
22558         /// Reading from this pointer when `result_ok` is not set is undefined.
22559         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
22560         /// A pointer to the contents in the error state.
22561         /// Reading from this pointer when `result_ok` is set is undefined.
22562         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22563 }
22564 #[repr(C)]
22565 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
22566 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
22567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22568 pub struct CResult_CommitmentTransactionDecodeErrorZ {
22569         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
22570         /// `err` or `result` depending on the state of `result_ok`.
22571         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
22572         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
22573         pub result_ok: bool,
22574 }
22575 #[no_mangle]
22576 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
22577 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
22578         CResult_CommitmentTransactionDecodeErrorZ {
22579                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22580                         result: Box::into_raw(Box::new(o)),
22581                 },
22582                 result_ok: true,
22583         }
22584 }
22585 #[no_mangle]
22586 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
22587 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
22588         CResult_CommitmentTransactionDecodeErrorZ {
22589                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22590                         err: Box::into_raw(Box::new(e)),
22591                 },
22592                 result_ok: false,
22593         }
22594 }
22595 /// Checks if the given object is currently in the success state
22596 #[no_mangle]
22597 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
22598         o.result_ok
22599 }
22600 #[no_mangle]
22601 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
22602 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
22603 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
22604         fn drop(&mut self) {
22605                 if self.result_ok {
22606                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22607                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22608                         }
22609                 } else {
22610                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22611                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22612                         }
22613                 }
22614         }
22615 }
22616 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
22617         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
22618                 let contents = if o.result_ok {
22619                         let result = unsafe { o.contents.result };
22620                         unsafe { o.contents.result = core::ptr::null_mut() };
22621                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
22622                 } else {
22623                         let err = unsafe { o.contents.err };
22624                         unsafe { o.contents.err = core::ptr::null_mut(); }
22625                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
22626                 };
22627                 Self {
22628                         contents,
22629                         result_ok: o.result_ok,
22630                 }
22631         }
22632 }
22633 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
22634         fn clone(&self) -> Self {
22635                 if self.result_ok {
22636                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22637                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
22638                         } }
22639                 } else {
22640                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
22641                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22642                         } }
22643                 }
22644         }
22645 }
22646 #[no_mangle]
22647 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
22648 /// but with all dynamically-allocated buffers duplicated in new buffers.
22649 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
22650 #[repr(C)]
22651 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
22652 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
22653         /// A pointer to the contents in the success state.
22654         /// Reading from this pointer when `result_ok` is not set is undefined.
22655         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
22656         /// Note that this value is always NULL, as there are no contents in the Err variant
22657         pub err: *mut core::ffi::c_void,
22658 }
22659 #[repr(C)]
22660 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
22661 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
22662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22663 pub struct CResult_TrustedCommitmentTransactionNoneZ {
22664         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
22665         /// `err` or `result` depending on the state of `result_ok`.
22666         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
22667         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
22668         pub result_ok: bool,
22669 }
22670 #[no_mangle]
22671 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
22672 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
22673         CResult_TrustedCommitmentTransactionNoneZ {
22674                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22675                         result: Box::into_raw(Box::new(o)),
22676                 },
22677                 result_ok: true,
22678         }
22679 }
22680 #[no_mangle]
22681 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
22682 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
22683         CResult_TrustedCommitmentTransactionNoneZ {
22684                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
22685                         err: core::ptr::null_mut(),
22686                 },
22687                 result_ok: false,
22688         }
22689 }
22690 /// Checks if the given object is currently in the success state
22691 #[no_mangle]
22692 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
22693         o.result_ok
22694 }
22695 #[no_mangle]
22696 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
22697 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
22698 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
22699         fn drop(&mut self) {
22700                 if self.result_ok {
22701                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22702                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22703                         }
22704                 } else {
22705                 }
22706         }
22707 }
22708 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
22709         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
22710                 let contents = if o.result_ok {
22711                         let result = unsafe { o.contents.result };
22712                         unsafe { o.contents.result = core::ptr::null_mut() };
22713                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
22714                 } else {
22715                         let _ = unsafe { Box::from_raw(o.contents.err) };
22716                         o.contents.err = core::ptr::null_mut();
22717                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
22718                 };
22719                 Self {
22720                         contents,
22721                         result_ok: o.result_ok,
22722                 }
22723         }
22724 }
22725 #[repr(C)]
22726 /// The contents of CResult_CVec_ECDSASignatureZNoneZ
22727 pub union CResult_CVec_ECDSASignatureZNoneZPtr {
22728         /// A pointer to the contents in the success state.
22729         /// Reading from this pointer when `result_ok` is not set is undefined.
22730         pub result: *mut crate::c_types::derived::CVec_ECDSASignatureZ,
22731         /// Note that this value is always NULL, as there are no contents in the Err variant
22732         pub err: *mut core::ffi::c_void,
22733 }
22734 #[repr(C)]
22735 /// A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation,
22736 /// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure.
22737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22738 pub struct CResult_CVec_ECDSASignatureZNoneZ {
22739         /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either
22740         /// `err` or `result` depending on the state of `result_ok`.
22741         pub contents: CResult_CVec_ECDSASignatureZNoneZPtr,
22742         /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state.
22743         pub result_ok: bool,
22744 }
22745 #[no_mangle]
22746 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state.
22747 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ {
22748         CResult_CVec_ECDSASignatureZNoneZ {
22749                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22750                         result: Box::into_raw(Box::new(o)),
22751                 },
22752                 result_ok: true,
22753         }
22754 }
22755 #[no_mangle]
22756 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state.
22757 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ {
22758         CResult_CVec_ECDSASignatureZNoneZ {
22759                 contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22760                         err: core::ptr::null_mut(),
22761                 },
22762                 result_ok: false,
22763         }
22764 }
22765 /// Checks if the given object is currently in the success state
22766 #[no_mangle]
22767 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool {
22768         o.result_ok
22769 }
22770 #[no_mangle]
22771 /// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ.
22772 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { }
22773 impl Drop for CResult_CVec_ECDSASignatureZNoneZ {
22774         fn drop(&mut self) {
22775                 if self.result_ok {
22776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22778                         }
22779                 } else {
22780                 }
22781         }
22782 }
22783 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>> for CResult_CVec_ECDSASignatureZNoneZ {
22784         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_ECDSASignatureZ, ()>) -> Self {
22785                 let contents = if o.result_ok {
22786                         let result = unsafe { o.contents.result };
22787                         unsafe { o.contents.result = core::ptr::null_mut() };
22788                         CResult_CVec_ECDSASignatureZNoneZPtr { result }
22789                 } else {
22790                         let _ = unsafe { Box::from_raw(o.contents.err) };
22791                         o.contents.err = core::ptr::null_mut();
22792                         CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() }
22793                 };
22794                 Self {
22795                         contents,
22796                         result_ok: o.result_ok,
22797                 }
22798         }
22799 }
22800 impl Clone for CResult_CVec_ECDSASignatureZNoneZ {
22801         fn clone(&self) -> Self {
22802                 if self.result_ok {
22803                         Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22804                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_ECDSASignatureZ>::clone(unsafe { &*self.contents.result })))
22805                         } }
22806                 } else {
22807                         Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr {
22808                                 err: core::ptr::null_mut()
22809                         } }
22810                 }
22811         }
22812 }
22813 #[no_mangle]
22814 /// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig`
22815 /// but with all dynamically-allocated buffers duplicated in new buffers.
22816 pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) }
22817 #[repr(C)]
22818 #[derive(Clone)]
22819 /// An enum which can either contain a usize or not
22820 pub enum COption_usizeZ {
22821         /// When we're in this state, this COption_usizeZ contains a usize
22822         Some(usize),
22823         /// When we're in this state, this COption_usizeZ contains nothing
22824         None
22825 }
22826 impl COption_usizeZ {
22827         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
22828                 if let Self::None = self { false } else { true }
22829         }
22830         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
22831                 !self.is_some()
22832         }
22833         #[allow(unused)] pub(crate) fn take(mut self) -> usize {
22834                 if let Self::Some(v) = self { v } else { unreachable!() }
22835         }
22836 }
22837 #[no_mangle]
22838 /// Constructs a new COption_usizeZ containing a usize
22839 pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ {
22840         COption_usizeZ::Some(o)
22841 }
22842 #[no_mangle]
22843 /// Constructs a new COption_usizeZ containing nothing
22844 pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ {
22845         COption_usizeZ::None
22846 }
22847 #[no_mangle]
22848 /// Frees any resources associated with the usize, if we are in the Some state
22849 pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { }
22850 #[no_mangle]
22851 /// Creates a new COption_usizeZ which has the same data as `orig`
22852 /// but with all dynamically-allocated buffers duplicated in new buffers.
22853 pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) }
22854 #[repr(C)]
22855 /// The contents of CResult_ShutdownScriptDecodeErrorZ
22856 pub union CResult_ShutdownScriptDecodeErrorZPtr {
22857         /// A pointer to the contents in the success state.
22858         /// Reading from this pointer when `result_ok` is not set is undefined.
22859         pub result: *mut crate::lightning::ln::script::ShutdownScript,
22860         /// A pointer to the contents in the error state.
22861         /// Reading from this pointer when `result_ok` is set is undefined.
22862         pub err: *mut crate::lightning::ln::msgs::DecodeError,
22863 }
22864 #[repr(C)]
22865 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
22866 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
22867 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22868 pub struct CResult_ShutdownScriptDecodeErrorZ {
22869         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
22870         /// `err` or `result` depending on the state of `result_ok`.
22871         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
22872         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
22873         pub result_ok: bool,
22874 }
22875 #[no_mangle]
22876 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
22877 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
22878         CResult_ShutdownScriptDecodeErrorZ {
22879                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22880                         result: Box::into_raw(Box::new(o)),
22881                 },
22882                 result_ok: true,
22883         }
22884 }
22885 #[no_mangle]
22886 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
22887 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
22888         CResult_ShutdownScriptDecodeErrorZ {
22889                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
22890                         err: Box::into_raw(Box::new(e)),
22891                 },
22892                 result_ok: false,
22893         }
22894 }
22895 /// Checks if the given object is currently in the success state
22896 #[no_mangle]
22897 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
22898         o.result_ok
22899 }
22900 #[no_mangle]
22901 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
22902 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
22903 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
22904         fn drop(&mut self) {
22905                 if self.result_ok {
22906                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
22907                                 let _ = unsafe { Box::from_raw(self.contents.result) };
22908                         }
22909                 } else {
22910                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
22911                                 let _ = unsafe { Box::from_raw(self.contents.err) };
22912                         }
22913                 }
22914         }
22915 }
22916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
22917         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
22918                 let contents = if o.result_ok {
22919                         let result = unsafe { o.contents.result };
22920                         unsafe { o.contents.result = core::ptr::null_mut() };
22921                         CResult_ShutdownScriptDecodeErrorZPtr { result }
22922                 } else {
22923                         let err = unsafe { o.contents.err };
22924                         unsafe { o.contents.err = core::ptr::null_mut(); }
22925                         CResult_ShutdownScriptDecodeErrorZPtr { err }
22926                 };
22927                 Self {
22928                         contents,
22929                         result_ok: o.result_ok,
22930                 }
22931         }
22932 }
22933 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
22934         fn clone(&self) -> Self {
22935                 if self.result_ok {
22936                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22937                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
22938                         } }
22939                 } else {
22940                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
22941                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
22942                         } }
22943                 }
22944         }
22945 }
22946 #[no_mangle]
22947 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
22948 /// but with all dynamically-allocated buffers duplicated in new buffers.
22949 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
22950 #[repr(C)]
22951 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
22952 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22953         /// A pointer to the contents in the success state.
22954         /// Reading from this pointer when `result_ok` is not set is undefined.
22955         pub result: *mut crate::lightning::ln::script::ShutdownScript,
22956         /// A pointer to the contents in the error state.
22957         /// Reading from this pointer when `result_ok` is set is undefined.
22958         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
22959 }
22960 #[repr(C)]
22961 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
22962 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
22963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22964 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
22965         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
22966         /// `err` or `result` depending on the state of `result_ok`.
22967         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
22968         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
22969         pub result_ok: bool,
22970 }
22971 #[no_mangle]
22972 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
22973 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22974         CResult_ShutdownScriptInvalidShutdownScriptZ {
22975                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22976                         result: Box::into_raw(Box::new(o)),
22977                 },
22978                 result_ok: true,
22979         }
22980 }
22981 #[no_mangle]
22982 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
22983 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
22984         CResult_ShutdownScriptInvalidShutdownScriptZ {
22985                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
22986                         err: Box::into_raw(Box::new(e)),
22987                 },
22988                 result_ok: false,
22989         }
22990 }
22991 /// Checks if the given object is currently in the success state
22992 #[no_mangle]
22993 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
22994         o.result_ok
22995 }
22996 #[no_mangle]
22997 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
22998 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
22999 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
23000         fn drop(&mut self) {
23001                 if self.result_ok {
23002                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23003                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23004                         }
23005                 } else {
23006                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23007                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23008                         }
23009                 }
23010         }
23011 }
23012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
23013         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
23014                 let contents = if o.result_ok {
23015                         let result = unsafe { o.contents.result };
23016                         unsafe { o.contents.result = core::ptr::null_mut() };
23017                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
23018                 } else {
23019                         let err = unsafe { o.contents.err };
23020                         unsafe { o.contents.err = core::ptr::null_mut(); }
23021                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
23022                 };
23023                 Self {
23024                         contents,
23025                         result_ok: o.result_ok,
23026                 }
23027         }
23028 }
23029 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
23030         fn clone(&self) -> Self {
23031                 if self.result_ok {
23032                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
23033                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
23034                         } }
23035                 } else {
23036                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
23037                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
23038                         } }
23039                 }
23040         }
23041 }
23042 #[no_mangle]
23043 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
23044 /// but with all dynamically-allocated buffers duplicated in new buffers.
23045 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
23046 #[repr(C)]
23047 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
23048 /// This corresponds to std::vector in C++
23049 pub struct CVec_TransactionZ {
23050         /// The elements in the array.
23051         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23052         pub data: *mut crate::c_types::Transaction,
23053         /// The number of elements pointed to by `data`.
23054         pub datalen: usize
23055 }
23056 impl CVec_TransactionZ {
23057         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
23058                 if self.datalen == 0 { return Vec::new(); }
23059                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23060                 self.data = core::ptr::null_mut();
23061                 self.datalen = 0;
23062                 ret
23063         }
23064         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
23065                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23066         }
23067 }
23068 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
23069         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
23070                 let datalen = v.len();
23071                 let data = Box::into_raw(v.into_boxed_slice());
23072                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23073         }
23074 }
23075 #[no_mangle]
23076 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23077 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
23078 impl Drop for CVec_TransactionZ {
23079         fn drop(&mut self) {
23080                 if self.datalen == 0 { return; }
23081                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23082         }
23083 }
23084 impl Clone for CVec_TransactionZ {
23085         fn clone(&self) -> Self {
23086                 let mut res = Vec::new();
23087                 if self.datalen == 0 { return Self::from(res); }
23088                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23089                 Self::from(res)
23090         }
23091 }
23092 #[repr(C)]
23093 /// The contents of CResult_PaymentPurposeDecodeErrorZ
23094 pub union CResult_PaymentPurposeDecodeErrorZPtr {
23095         /// A pointer to the contents in the success state.
23096         /// Reading from this pointer when `result_ok` is not set is undefined.
23097         pub result: *mut crate::lightning::events::PaymentPurpose,
23098         /// A pointer to the contents in the error state.
23099         /// Reading from this pointer when `result_ok` is set is undefined.
23100         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23101 }
23102 #[repr(C)]
23103 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
23104 /// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
23105 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23106 pub struct CResult_PaymentPurposeDecodeErrorZ {
23107         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
23108         /// `err` or `result` depending on the state of `result_ok`.
23109         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
23110         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
23111         pub result_ok: bool,
23112 }
23113 #[no_mangle]
23114 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
23115 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
23116         CResult_PaymentPurposeDecodeErrorZ {
23117                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
23118                         result: Box::into_raw(Box::new(o)),
23119                 },
23120                 result_ok: true,
23121         }
23122 }
23123 #[no_mangle]
23124 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
23125 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
23126         CResult_PaymentPurposeDecodeErrorZ {
23127                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
23128                         err: Box::into_raw(Box::new(e)),
23129                 },
23130                 result_ok: false,
23131         }
23132 }
23133 /// Checks if the given object is currently in the success state
23134 #[no_mangle]
23135 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
23136         o.result_ok
23137 }
23138 #[no_mangle]
23139 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
23140 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
23141 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
23142         fn drop(&mut self) {
23143                 if self.result_ok {
23144                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23145                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23146                         }
23147                 } else {
23148                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23149                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23150                         }
23151                 }
23152         }
23153 }
23154 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
23155         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
23156                 let contents = if o.result_ok {
23157                         let result = unsafe { o.contents.result };
23158                         unsafe { o.contents.result = core::ptr::null_mut() };
23159                         CResult_PaymentPurposeDecodeErrorZPtr { result }
23160                 } else {
23161                         let err = unsafe { o.contents.err };
23162                         unsafe { o.contents.err = core::ptr::null_mut(); }
23163                         CResult_PaymentPurposeDecodeErrorZPtr { err }
23164                 };
23165                 Self {
23166                         contents,
23167                         result_ok: o.result_ok,
23168                 }
23169         }
23170 }
23171 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
23172         fn clone(&self) -> Self {
23173                 if self.result_ok {
23174                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
23175                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
23176                         } }
23177                 } else {
23178                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
23179                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23180                         } }
23181                 }
23182         }
23183 }
23184 #[no_mangle]
23185 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
23186 /// but with all dynamically-allocated buffers duplicated in new buffers.
23187 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
23188 #[repr(C)]
23189 /// The contents of CResult_ClaimedHTLCDecodeErrorZ
23190 pub union CResult_ClaimedHTLCDecodeErrorZPtr {
23191         /// A pointer to the contents in the success state.
23192         /// Reading from this pointer when `result_ok` is not set is undefined.
23193         pub result: *mut crate::lightning::events::ClaimedHTLC,
23194         /// A pointer to the contents in the error state.
23195         /// Reading from this pointer when `result_ok` is set is undefined.
23196         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23197 }
23198 #[repr(C)]
23199 /// A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation,
23200 /// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
23201 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23202 pub struct CResult_ClaimedHTLCDecodeErrorZ {
23203         /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either
23204         /// `err` or `result` depending on the state of `result_ok`.
23205         pub contents: CResult_ClaimedHTLCDecodeErrorZPtr,
23206         /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state.
23207         pub result_ok: bool,
23208 }
23209 #[no_mangle]
23210 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state.
23211 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ {
23212         CResult_ClaimedHTLCDecodeErrorZ {
23213                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23214                         result: Box::into_raw(Box::new(o)),
23215                 },
23216                 result_ok: true,
23217         }
23218 }
23219 #[no_mangle]
23220 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state.
23221 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ {
23222         CResult_ClaimedHTLCDecodeErrorZ {
23223                 contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23224                         err: Box::into_raw(Box::new(e)),
23225                 },
23226                 result_ok: false,
23227         }
23228 }
23229 /// Checks if the given object is currently in the success state
23230 #[no_mangle]
23231 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool {
23232         o.result_ok
23233 }
23234 #[no_mangle]
23235 /// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ.
23236 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { }
23237 impl Drop for CResult_ClaimedHTLCDecodeErrorZ {
23238         fn drop(&mut self) {
23239                 if self.result_ok {
23240                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23241                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23242                         }
23243                 } else {
23244                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23245                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23246                         }
23247                 }
23248         }
23249 }
23250 impl From<crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_ClaimedHTLCDecodeErrorZ {
23251         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::ClaimedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
23252                 let contents = if o.result_ok {
23253                         let result = unsafe { o.contents.result };
23254                         unsafe { o.contents.result = core::ptr::null_mut() };
23255                         CResult_ClaimedHTLCDecodeErrorZPtr { result }
23256                 } else {
23257                         let err = unsafe { o.contents.err };
23258                         unsafe { o.contents.err = core::ptr::null_mut(); }
23259                         CResult_ClaimedHTLCDecodeErrorZPtr { err }
23260                 };
23261                 Self {
23262                         contents,
23263                         result_ok: o.result_ok,
23264                 }
23265         }
23266 }
23267 impl Clone for CResult_ClaimedHTLCDecodeErrorZ {
23268         fn clone(&self) -> Self {
23269                 if self.result_ok {
23270                         Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23271                                 result: Box::into_raw(Box::new(<crate::lightning::events::ClaimedHTLC>::clone(unsafe { &*self.contents.result })))
23272                         } }
23273                 } else {
23274                         Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr {
23275                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23276                         } }
23277                 }
23278         }
23279 }
23280 #[no_mangle]
23281 /// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig`
23282 /// but with all dynamically-allocated buffers duplicated in new buffers.
23283 pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) }
23284 #[repr(C)]
23285 #[derive(Clone)]
23286 /// An enum which can either contain a crate::lightning::events::PathFailure or not
23287 pub enum COption_PathFailureZ {
23288         /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
23289         Some(crate::lightning::events::PathFailure),
23290         /// When we're in this state, this COption_PathFailureZ contains nothing
23291         None
23292 }
23293 impl COption_PathFailureZ {
23294         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23295                 if let Self::None = self { false } else { true }
23296         }
23297         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23298                 !self.is_some()
23299         }
23300         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure {
23301                 if let Self::Some(v) = self { v } else { unreachable!() }
23302         }
23303 }
23304 #[no_mangle]
23305 /// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
23306 pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ {
23307         COption_PathFailureZ::Some(o)
23308 }
23309 #[no_mangle]
23310 /// Constructs a new COption_PathFailureZ containing nothing
23311 pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ {
23312         COption_PathFailureZ::None
23313 }
23314 #[no_mangle]
23315 /// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
23316 pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { }
23317 #[no_mangle]
23318 /// Creates a new COption_PathFailureZ which has the same data as `orig`
23319 /// but with all dynamically-allocated buffers duplicated in new buffers.
23320 pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) }
23321 #[repr(C)]
23322 /// The contents of CResult_COption_PathFailureZDecodeErrorZ
23323 pub union CResult_COption_PathFailureZDecodeErrorZPtr {
23324         /// A pointer to the contents in the success state.
23325         /// Reading from this pointer when `result_ok` is not set is undefined.
23326         pub result: *mut crate::c_types::derived::COption_PathFailureZ,
23327         /// A pointer to the contents in the error state.
23328         /// Reading from this pointer when `result_ok` is set is undefined.
23329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23330 }
23331 #[repr(C)]
23332 /// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
23333 /// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23335 pub struct CResult_COption_PathFailureZDecodeErrorZ {
23336         /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
23337         /// `err` or `result` depending on the state of `result_ok`.
23338         pub contents: CResult_COption_PathFailureZDecodeErrorZPtr,
23339         /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
23340         pub result_ok: bool,
23341 }
23342 #[no_mangle]
23343 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
23344 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ {
23345         CResult_COption_PathFailureZDecodeErrorZ {
23346                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23347                         result: Box::into_raw(Box::new(o)),
23348                 },
23349                 result_ok: true,
23350         }
23351 }
23352 #[no_mangle]
23353 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
23354 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ {
23355         CResult_COption_PathFailureZDecodeErrorZ {
23356                 contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23357                         err: Box::into_raw(Box::new(e)),
23358                 },
23359                 result_ok: false,
23360         }
23361 }
23362 /// Checks if the given object is currently in the success state
23363 #[no_mangle]
23364 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool {
23365         o.result_ok
23366 }
23367 #[no_mangle]
23368 /// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
23369 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { }
23370 impl Drop for CResult_COption_PathFailureZDecodeErrorZ {
23371         fn drop(&mut self) {
23372                 if self.result_ok {
23373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23375                         }
23376                 } else {
23377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23379                         }
23380                 }
23381         }
23382 }
23383 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_PathFailureZDecodeErrorZ {
23384         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_PathFailureZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23385                 let contents = if o.result_ok {
23386                         let result = unsafe { o.contents.result };
23387                         unsafe { o.contents.result = core::ptr::null_mut() };
23388                         CResult_COption_PathFailureZDecodeErrorZPtr { result }
23389                 } else {
23390                         let err = unsafe { o.contents.err };
23391                         unsafe { o.contents.err = core::ptr::null_mut(); }
23392                         CResult_COption_PathFailureZDecodeErrorZPtr { err }
23393                 };
23394                 Self {
23395                         contents,
23396                         result_ok: o.result_ok,
23397                 }
23398         }
23399 }
23400 impl Clone for CResult_COption_PathFailureZDecodeErrorZ {
23401         fn clone(&self) -> Self {
23402                 if self.result_ok {
23403                         Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23404                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_PathFailureZ>::clone(unsafe { &*self.contents.result })))
23405                         } }
23406                 } else {
23407                         Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr {
23408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23409                         } }
23410                 }
23411         }
23412 }
23413 #[no_mangle]
23414 /// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
23415 /// but with all dynamically-allocated buffers duplicated in new buffers.
23416 pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) }
23417 #[repr(C)]
23418 #[derive(Clone)]
23419 /// An enum which can either contain a crate::lightning::events::ClosureReason or not
23420 pub enum COption_ClosureReasonZ {
23421         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
23422         Some(crate::lightning::events::ClosureReason),
23423         /// When we're in this state, this COption_ClosureReasonZ contains nothing
23424         None
23425 }
23426 impl COption_ClosureReasonZ {
23427         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23428                 if let Self::None = self { false } else { true }
23429         }
23430         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23431                 !self.is_some()
23432         }
23433         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason {
23434                 if let Self::Some(v) = self { v } else { unreachable!() }
23435         }
23436 }
23437 #[no_mangle]
23438 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason
23439 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ {
23440         COption_ClosureReasonZ::Some(o)
23441 }
23442 #[no_mangle]
23443 /// Constructs a new COption_ClosureReasonZ containing nothing
23444 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
23445         COption_ClosureReasonZ::None
23446 }
23447 #[no_mangle]
23448 /// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state
23449 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
23450 #[no_mangle]
23451 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
23452 /// but with all dynamically-allocated buffers duplicated in new buffers.
23453 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
23454 #[repr(C)]
23455 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
23456 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
23457         /// A pointer to the contents in the success state.
23458         /// Reading from this pointer when `result_ok` is not set is undefined.
23459         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
23460         /// A pointer to the contents in the error state.
23461         /// Reading from this pointer when `result_ok` is set is undefined.
23462         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23463 }
23464 #[repr(C)]
23465 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
23466 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23467 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23468 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
23469         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
23470         /// `err` or `result` depending on the state of `result_ok`.
23471         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
23472         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
23473         pub result_ok: bool,
23474 }
23475 #[no_mangle]
23476 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
23477 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
23478         CResult_COption_ClosureReasonZDecodeErrorZ {
23479                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23480                         result: Box::into_raw(Box::new(o)),
23481                 },
23482                 result_ok: true,
23483         }
23484 }
23485 #[no_mangle]
23486 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
23487 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
23488         CResult_COption_ClosureReasonZDecodeErrorZ {
23489                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23490                         err: Box::into_raw(Box::new(e)),
23491                 },
23492                 result_ok: false,
23493         }
23494 }
23495 /// Checks if the given object is currently in the success state
23496 #[no_mangle]
23497 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
23498         o.result_ok
23499 }
23500 #[no_mangle]
23501 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
23502 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
23503 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
23504         fn drop(&mut self) {
23505                 if self.result_ok {
23506                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23507                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23508                         }
23509                 } else {
23510                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23511                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23512                         }
23513                 }
23514         }
23515 }
23516 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
23517         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23518                 let contents = if o.result_ok {
23519                         let result = unsafe { o.contents.result };
23520                         unsafe { o.contents.result = core::ptr::null_mut() };
23521                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
23522                 } else {
23523                         let err = unsafe { o.contents.err };
23524                         unsafe { o.contents.err = core::ptr::null_mut(); }
23525                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
23526                 };
23527                 Self {
23528                         contents,
23529                         result_ok: o.result_ok,
23530                 }
23531         }
23532 }
23533 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
23534         fn clone(&self) -> Self {
23535                 if self.result_ok {
23536                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23537                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
23538                         } }
23539                 } else {
23540                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
23541                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23542                         } }
23543                 }
23544         }
23545 }
23546 #[no_mangle]
23547 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
23548 /// but with all dynamically-allocated buffers duplicated in new buffers.
23549 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
23550 #[repr(C)]
23551 #[derive(Clone)]
23552 /// An enum which can either contain a crate::lightning::events::HTLCDestination or not
23553 pub enum COption_HTLCDestinationZ {
23554         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
23555         Some(crate::lightning::events::HTLCDestination),
23556         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
23557         None
23558 }
23559 impl COption_HTLCDestinationZ {
23560         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23561                 if let Self::None = self { false } else { true }
23562         }
23563         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23564                 !self.is_some()
23565         }
23566         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination {
23567                 if let Self::Some(v) = self { v } else { unreachable!() }
23568         }
23569 }
23570 #[no_mangle]
23571 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
23572 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ {
23573         COption_HTLCDestinationZ::Some(o)
23574 }
23575 #[no_mangle]
23576 /// Constructs a new COption_HTLCDestinationZ containing nothing
23577 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
23578         COption_HTLCDestinationZ::None
23579 }
23580 #[no_mangle]
23581 /// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
23582 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
23583 #[no_mangle]
23584 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
23585 /// but with all dynamically-allocated buffers duplicated in new buffers.
23586 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
23587 #[repr(C)]
23588 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
23589 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23590         /// A pointer to the contents in the success state.
23591         /// Reading from this pointer when `result_ok` is not set is undefined.
23592         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
23593         /// A pointer to the contents in the error state.
23594         /// Reading from this pointer when `result_ok` is set is undefined.
23595         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23596 }
23597 #[repr(C)]
23598 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
23599 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23601 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
23602         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
23603         /// `err` or `result` depending on the state of `result_ok`.
23604         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
23605         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
23606         pub result_ok: bool,
23607 }
23608 #[no_mangle]
23609 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
23610 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23611         CResult_COption_HTLCDestinationZDecodeErrorZ {
23612                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23613                         result: Box::into_raw(Box::new(o)),
23614                 },
23615                 result_ok: true,
23616         }
23617 }
23618 #[no_mangle]
23619 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
23620 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
23621         CResult_COption_HTLCDestinationZDecodeErrorZ {
23622                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23623                         err: Box::into_raw(Box::new(e)),
23624                 },
23625                 result_ok: false,
23626         }
23627 }
23628 /// Checks if the given object is currently in the success state
23629 #[no_mangle]
23630 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
23631         o.result_ok
23632 }
23633 #[no_mangle]
23634 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
23635 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
23636 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
23637         fn drop(&mut self) {
23638                 if self.result_ok {
23639                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23640                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23641                         }
23642                 } else {
23643                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23644                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23645                         }
23646                 }
23647         }
23648 }
23649 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
23650         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
23651                 let contents = if o.result_ok {
23652                         let result = unsafe { o.contents.result };
23653                         unsafe { o.contents.result = core::ptr::null_mut() };
23654                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
23655                 } else {
23656                         let err = unsafe { o.contents.err };
23657                         unsafe { o.contents.err = core::ptr::null_mut(); }
23658                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
23659                 };
23660                 Self {
23661                         contents,
23662                         result_ok: o.result_ok,
23663                 }
23664         }
23665 }
23666 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
23667         fn clone(&self) -> Self {
23668                 if self.result_ok {
23669                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23670                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
23671                         } }
23672                 } else {
23673                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
23674                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23675                         } }
23676                 }
23677         }
23678 }
23679 #[no_mangle]
23680 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
23681 /// but with all dynamically-allocated buffers duplicated in new buffers.
23682 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
23683 #[repr(C)]
23684 /// The contents of CResult_PaymentFailureReasonDecodeErrorZ
23685 pub union CResult_PaymentFailureReasonDecodeErrorZPtr {
23686         /// A pointer to the contents in the success state.
23687         /// Reading from this pointer when `result_ok` is not set is undefined.
23688         pub result: *mut crate::lightning::events::PaymentFailureReason,
23689         /// A pointer to the contents in the error state.
23690         /// Reading from this pointer when `result_ok` is set is undefined.
23691         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23692 }
23693 #[repr(C)]
23694 /// A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
23695 /// containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure.
23696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23697 pub struct CResult_PaymentFailureReasonDecodeErrorZ {
23698         /// The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
23699         /// `err` or `result` depending on the state of `result_ok`.
23700         pub contents: CResult_PaymentFailureReasonDecodeErrorZPtr,
23701         /// Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
23702         pub result_ok: bool,
23703 }
23704 #[no_mangle]
23705 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
23706 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::PaymentFailureReason) -> CResult_PaymentFailureReasonDecodeErrorZ {
23707         CResult_PaymentFailureReasonDecodeErrorZ {
23708                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23709                         result: Box::into_raw(Box::new(o)),
23710                 },
23711                 result_ok: true,
23712         }
23713 }
23714 #[no_mangle]
23715 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
23716 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentFailureReasonDecodeErrorZ {
23717         CResult_PaymentFailureReasonDecodeErrorZ {
23718                 contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23719                         err: Box::into_raw(Box::new(e)),
23720                 },
23721                 result_ok: false,
23722         }
23723 }
23724 /// Checks if the given object is currently in the success state
23725 #[no_mangle]
23726 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o: &CResult_PaymentFailureReasonDecodeErrorZ) -> bool {
23727         o.result_ok
23728 }
23729 #[no_mangle]
23730 /// Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
23731 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_free(_res: CResult_PaymentFailureReasonDecodeErrorZ) { }
23732 impl Drop for CResult_PaymentFailureReasonDecodeErrorZ {
23733         fn drop(&mut self) {
23734                 if self.result_ok {
23735                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23736                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23737                         }
23738                 } else {
23739                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23740                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23741                         }
23742                 }
23743         }
23744 }
23745 impl From<crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentFailureReasonDecodeErrorZ {
23746         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::events::PaymentFailureReason, crate::lightning::ln::msgs::DecodeError>) -> Self {
23747                 let contents = if o.result_ok {
23748                         let result = unsafe { o.contents.result };
23749                         unsafe { o.contents.result = core::ptr::null_mut() };
23750                         CResult_PaymentFailureReasonDecodeErrorZPtr { result }
23751                 } else {
23752                         let err = unsafe { o.contents.err };
23753                         unsafe { o.contents.err = core::ptr::null_mut(); }
23754                         CResult_PaymentFailureReasonDecodeErrorZPtr { err }
23755                 };
23756                 Self {
23757                         contents,
23758                         result_ok: o.result_ok,
23759                 }
23760         }
23761 }
23762 impl Clone for CResult_PaymentFailureReasonDecodeErrorZ {
23763         fn clone(&self) -> Self {
23764                 if self.result_ok {
23765                         Self { result_ok: true, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23766                                 result: Box::into_raw(Box::new(<crate::lightning::events::PaymentFailureReason>::clone(unsafe { &*self.contents.result })))
23767                         } }
23768                 } else {
23769                         Self { result_ok: false, contents: CResult_PaymentFailureReasonDecodeErrorZPtr {
23770                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
23771                         } }
23772                 }
23773         }
23774 }
23775 #[no_mangle]
23776 /// Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
23777 /// but with all dynamically-allocated buffers duplicated in new buffers.
23778 pub extern "C" fn CResult_PaymentFailureReasonDecodeErrorZ_clone(orig: &CResult_PaymentFailureReasonDecodeErrorZ) -> CResult_PaymentFailureReasonDecodeErrorZ { Clone::clone(&orig) }
23779 #[repr(C)]
23780 #[derive(Clone)]
23781 /// An enum which can either contain a crate::c_types::U128 or not
23782 pub enum COption_U128Z {
23783         /// When we're in this state, this COption_U128Z contains a crate::c_types::U128
23784         Some(crate::c_types::U128),
23785         /// When we're in this state, this COption_U128Z contains nothing
23786         None
23787 }
23788 impl COption_U128Z {
23789         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23790                 if let Self::None = self { false } else { true }
23791         }
23792         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23793                 !self.is_some()
23794         }
23795         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
23796                 if let Self::Some(v) = self { v } else { unreachable!() }
23797         }
23798 }
23799 #[no_mangle]
23800 /// Constructs a new COption_U128Z containing a crate::c_types::U128
23801 pub extern "C" fn COption_U128Z_some(o: crate::c_types::U128) -> COption_U128Z {
23802         COption_U128Z::Some(o)
23803 }
23804 #[no_mangle]
23805 /// Constructs a new COption_U128Z containing nothing
23806 pub extern "C" fn COption_U128Z_none() -> COption_U128Z {
23807         COption_U128Z::None
23808 }
23809 #[no_mangle]
23810 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
23811 pub extern "C" fn COption_U128Z_free(_res: COption_U128Z) { }
23812 #[no_mangle]
23813 /// Creates a new COption_U128Z which has the same data as `orig`
23814 /// but with all dynamically-allocated buffers duplicated in new buffers.
23815 pub extern "C" fn COption_U128Z_clone(orig: &COption_U128Z) -> COption_U128Z { Clone::clone(&orig) }
23816 #[repr(C)]
23817 /// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size.
23818 /// This corresponds to std::vector in C++
23819 pub struct CVec_ClaimedHTLCZ {
23820         /// The elements in the array.
23821         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
23822         pub data: *mut crate::lightning::events::ClaimedHTLC,
23823         /// The number of elements pointed to by `data`.
23824         pub datalen: usize
23825 }
23826 impl CVec_ClaimedHTLCZ {
23827         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::events::ClaimedHTLC> {
23828                 if self.datalen == 0 { return Vec::new(); }
23829                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
23830                 self.data = core::ptr::null_mut();
23831                 self.datalen = 0;
23832                 ret
23833         }
23834         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] {
23835                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
23836         }
23837 }
23838 impl From<Vec<crate::lightning::events::ClaimedHTLC>> for CVec_ClaimedHTLCZ {
23839         fn from(v: Vec<crate::lightning::events::ClaimedHTLC>) -> Self {
23840                 let datalen = v.len();
23841                 let data = Box::into_raw(v.into_boxed_slice());
23842                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
23843         }
23844 }
23845 #[no_mangle]
23846 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
23847 pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { }
23848 impl Drop for CVec_ClaimedHTLCZ {
23849         fn drop(&mut self) {
23850                 if self.datalen == 0 { return; }
23851                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
23852         }
23853 }
23854 impl Clone for CVec_ClaimedHTLCZ {
23855         fn clone(&self) -> Self {
23856                 let mut res = Vec::new();
23857                 if self.datalen == 0 { return Self::from(res); }
23858                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
23859                 Self::from(res)
23860         }
23861 }
23862 #[repr(C)]
23863 #[derive(Clone)]
23864 /// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
23865 pub enum COption_PaymentFailureReasonZ {
23866         /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
23867         Some(crate::lightning::events::PaymentFailureReason),
23868         /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing
23869         None
23870 }
23871 impl COption_PaymentFailureReasonZ {
23872         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23873                 if let Self::None = self { false } else { true }
23874         }
23875         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23876                 !self.is_some()
23877         }
23878         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason {
23879                 if let Self::Some(v) = self { v } else { unreachable!() }
23880         }
23881 }
23882 #[no_mangle]
23883 /// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
23884 pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ {
23885         COption_PaymentFailureReasonZ::Some(o)
23886 }
23887 #[no_mangle]
23888 /// Constructs a new COption_PaymentFailureReasonZ containing nothing
23889 pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ {
23890         COption_PaymentFailureReasonZ::None
23891 }
23892 #[no_mangle]
23893 /// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
23894 pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { }
23895 #[no_mangle]
23896 /// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
23897 /// but with all dynamically-allocated buffers duplicated in new buffers.
23898 pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) }
23899 #[repr(C)]
23900 #[derive(Clone)]
23901 /// An enum which can either contain a crate::lightning::events::Event or not
23902 pub enum COption_EventZ {
23903         /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
23904         Some(crate::lightning::events::Event),
23905         /// When we're in this state, this COption_EventZ contains nothing
23906         None
23907 }
23908 impl COption_EventZ {
23909         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
23910                 if let Self::None = self { false } else { true }
23911         }
23912         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23913                 !self.is_some()
23914         }
23915         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event {
23916                 if let Self::Some(v) = self { v } else { unreachable!() }
23917         }
23918 }
23919 #[no_mangle]
23920 /// Constructs a new COption_EventZ containing a crate::lightning::events::Event
23921 pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ {
23922         COption_EventZ::Some(o)
23923 }
23924 #[no_mangle]
23925 /// Constructs a new COption_EventZ containing nothing
23926 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
23927         COption_EventZ::None
23928 }
23929 #[no_mangle]
23930 /// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state
23931 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
23932 #[no_mangle]
23933 /// Creates a new COption_EventZ which has the same data as `orig`
23934 /// but with all dynamically-allocated buffers duplicated in new buffers.
23935 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
23936 #[repr(C)]
23937 /// The contents of CResult_COption_EventZDecodeErrorZ
23938 pub union CResult_COption_EventZDecodeErrorZPtr {
23939         /// A pointer to the contents in the success state.
23940         /// Reading from this pointer when `result_ok` is not set is undefined.
23941         pub result: *mut crate::c_types::derived::COption_EventZ,
23942         /// A pointer to the contents in the error state.
23943         /// Reading from this pointer when `result_ok` is set is undefined.
23944         pub err: *mut crate::lightning::ln::msgs::DecodeError,
23945 }
23946 #[repr(C)]
23947 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
23948 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
23949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
23950 pub struct CResult_COption_EventZDecodeErrorZ {
23951         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
23952         /// `err` or `result` depending on the state of `result_ok`.
23953         pub contents: CResult_COption_EventZDecodeErrorZPtr,
23954         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
23955         pub result_ok: bool,
23956 }
23957 #[no_mangle]
23958 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
23959 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
23960         CResult_COption_EventZDecodeErrorZ {
23961                 contents: CResult_COption_EventZDecodeErrorZPtr {
23962                         result: Box::into_raw(Box::new(o)),
23963                 },
23964                 result_ok: true,
23965         }
23966 }
23967 #[no_mangle]
23968 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
23969 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
23970         CResult_COption_EventZDecodeErrorZ {
23971                 contents: CResult_COption_EventZDecodeErrorZPtr {
23972                         err: Box::into_raw(Box::new(e)),
23973                 },
23974                 result_ok: false,
23975         }
23976 }
23977 /// Checks if the given object is currently in the success state
23978 #[no_mangle]
23979 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
23980         o.result_ok
23981 }
23982 #[no_mangle]
23983 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
23984 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
23985 impl Drop for CResult_COption_EventZDecodeErrorZ {
23986         fn drop(&mut self) {
23987                 if self.result_ok {
23988                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
23989                                 let _ = unsafe { Box::from_raw(self.contents.result) };
23990                         }
23991                 } else {
23992                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
23993                                 let _ = unsafe { Box::from_raw(self.contents.err) };
23994                         }
23995                 }
23996         }
23997 }
23998 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
23999         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
24000                 let contents = if o.result_ok {
24001                         let result = unsafe { o.contents.result };
24002                         unsafe { o.contents.result = core::ptr::null_mut() };
24003                         CResult_COption_EventZDecodeErrorZPtr { result }
24004                 } else {
24005                         let err = unsafe { o.contents.err };
24006                         unsafe { o.contents.err = core::ptr::null_mut(); }
24007                         CResult_COption_EventZDecodeErrorZPtr { err }
24008                 };
24009                 Self {
24010                         contents,
24011                         result_ok: o.result_ok,
24012                 }
24013         }
24014 }
24015 impl Clone for CResult_COption_EventZDecodeErrorZ {
24016         fn clone(&self) -> Self {
24017                 if self.result_ok {
24018                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
24019                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
24020                         } }
24021                 } else {
24022                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
24023                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
24024                         } }
24025                 }
24026         }
24027 }
24028 #[no_mangle]
24029 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
24030 /// but with all dynamically-allocated buffers duplicated in new buffers.
24031 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
24032 #[repr(C)]
24033 /// The contents of CResult_ElectrumSyncClientTxSyncErrorZ
24034 pub union CResult_ElectrumSyncClientTxSyncErrorZPtr {
24035         /// A pointer to the contents in the success state.
24036         /// Reading from this pointer when `result_ok` is not set is undefined.
24037         pub result: *mut crate::lightning_transaction_sync::electrum::ElectrumSyncClient,
24038         /// A pointer to the contents in the error state.
24039         /// Reading from this pointer when `result_ok` is set is undefined.
24040         pub err: *mut crate::lightning_transaction_sync::error::TxSyncError,
24041 }
24042 #[repr(C)]
24043 /// A CResult_ElectrumSyncClientTxSyncErrorZ represents the result of a fallible operation,
24044 /// containing a crate::lightning_transaction_sync::electrum::ElectrumSyncClient on success and a crate::lightning_transaction_sync::error::TxSyncError on failure.
24045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24046 pub struct CResult_ElectrumSyncClientTxSyncErrorZ {
24047         /// The contents of this CResult_ElectrumSyncClientTxSyncErrorZ, accessible via either
24048         /// `err` or `result` depending on the state of `result_ok`.
24049         pub contents: CResult_ElectrumSyncClientTxSyncErrorZPtr,
24050         /// Whether this CResult_ElectrumSyncClientTxSyncErrorZ represents a success state.
24051         pub result_ok: bool,
24052 }
24053 #[no_mangle]
24054 /// Creates a new CResult_ElectrumSyncClientTxSyncErrorZ in the success state.
24055 pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_ok(o: crate::lightning_transaction_sync::electrum::ElectrumSyncClient) -> CResult_ElectrumSyncClientTxSyncErrorZ {
24056         CResult_ElectrumSyncClientTxSyncErrorZ {
24057                 contents: CResult_ElectrumSyncClientTxSyncErrorZPtr {
24058                         result: Box::into_raw(Box::new(o)),
24059                 },
24060                 result_ok: true,
24061         }
24062 }
24063 #[no_mangle]
24064 /// Creates a new CResult_ElectrumSyncClientTxSyncErrorZ in the error state.
24065 pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_err(e: crate::lightning_transaction_sync::error::TxSyncError) -> CResult_ElectrumSyncClientTxSyncErrorZ {
24066         CResult_ElectrumSyncClientTxSyncErrorZ {
24067                 contents: CResult_ElectrumSyncClientTxSyncErrorZPtr {
24068                         err: Box::into_raw(Box::new(e)),
24069                 },
24070                 result_ok: false,
24071         }
24072 }
24073 /// Checks if the given object is currently in the success state
24074 #[no_mangle]
24075 pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_is_ok(o: &CResult_ElectrumSyncClientTxSyncErrorZ) -> bool {
24076         o.result_ok
24077 }
24078 #[no_mangle]
24079 /// Frees any resources used by the CResult_ElectrumSyncClientTxSyncErrorZ.
24080 pub extern "C" fn CResult_ElectrumSyncClientTxSyncErrorZ_free(_res: CResult_ElectrumSyncClientTxSyncErrorZ) { }
24081 impl Drop for CResult_ElectrumSyncClientTxSyncErrorZ {
24082         fn drop(&mut self) {
24083                 if self.result_ok {
24084                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24085                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24086                         }
24087                 } else {
24088                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24089                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24090                         }
24091                 }
24092         }
24093 }
24094 impl From<crate::c_types::CResultTempl<crate::lightning_transaction_sync::electrum::ElectrumSyncClient, crate::lightning_transaction_sync::error::TxSyncError>> for CResult_ElectrumSyncClientTxSyncErrorZ {
24095         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_transaction_sync::electrum::ElectrumSyncClient, crate::lightning_transaction_sync::error::TxSyncError>) -> Self {
24096                 let contents = if o.result_ok {
24097                         let result = unsafe { o.contents.result };
24098                         unsafe { o.contents.result = core::ptr::null_mut() };
24099                         CResult_ElectrumSyncClientTxSyncErrorZPtr { result }
24100                 } else {
24101                         let err = unsafe { o.contents.err };
24102                         unsafe { o.contents.err = core::ptr::null_mut(); }
24103                         CResult_ElectrumSyncClientTxSyncErrorZPtr { err }
24104                 };
24105                 Self {
24106                         contents,
24107                         result_ok: o.result_ok,
24108                 }
24109         }
24110 }
24111 #[repr(C)]
24112 /// A dynamically-allocated array of crate::lightning::chain::Confirms of arbitrary size.
24113 /// This corresponds to std::vector in C++
24114 pub struct CVec_ConfirmZ {
24115         /// The elements in the array.
24116         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
24117         pub data: *mut crate::lightning::chain::Confirm,
24118         /// The number of elements pointed to by `data`.
24119         pub datalen: usize
24120 }
24121 impl CVec_ConfirmZ {
24122         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::Confirm> {
24123                 if self.datalen == 0 { return Vec::new(); }
24124                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24125                 self.data = core::ptr::null_mut();
24126                 self.datalen = 0;
24127                 ret
24128         }
24129         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::Confirm] {
24130                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
24131         }
24132 }
24133 impl From<Vec<crate::lightning::chain::Confirm>> for CVec_ConfirmZ {
24134         fn from(v: Vec<crate::lightning::chain::Confirm>) -> Self {
24135                 let datalen = v.len();
24136                 let data = Box::into_raw(v.into_boxed_slice());
24137                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
24138         }
24139 }
24140 #[no_mangle]
24141 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
24142 pub extern "C" fn CVec_ConfirmZ_free(_res: CVec_ConfirmZ) { }
24143 impl Drop for CVec_ConfirmZ {
24144         fn drop(&mut self) {
24145                 if self.datalen == 0 { return; }
24146                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
24147         }
24148 }
24149 #[repr(C)]
24150 /// The contents of CResult_NoneTxSyncErrorZ
24151 pub union CResult_NoneTxSyncErrorZPtr {
24152         /// Note that this value is always NULL, as there are no contents in the OK variant
24153         pub result: *mut core::ffi::c_void,
24154         /// A pointer to the contents in the error state.
24155         /// Reading from this pointer when `result_ok` is set is undefined.
24156         pub err: *mut crate::lightning_transaction_sync::error::TxSyncError,
24157 }
24158 #[repr(C)]
24159 /// A CResult_NoneTxSyncErrorZ represents the result of a fallible operation,
24160 /// containing a () on success and a crate::lightning_transaction_sync::error::TxSyncError on failure.
24161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24162 pub struct CResult_NoneTxSyncErrorZ {
24163         /// The contents of this CResult_NoneTxSyncErrorZ, accessible via either
24164         /// `err` or `result` depending on the state of `result_ok`.
24165         pub contents: CResult_NoneTxSyncErrorZPtr,
24166         /// Whether this CResult_NoneTxSyncErrorZ represents a success state.
24167         pub result_ok: bool,
24168 }
24169 #[no_mangle]
24170 /// Creates a new CResult_NoneTxSyncErrorZ in the success state.
24171 pub extern "C" fn CResult_NoneTxSyncErrorZ_ok() -> CResult_NoneTxSyncErrorZ {
24172         CResult_NoneTxSyncErrorZ {
24173                 contents: CResult_NoneTxSyncErrorZPtr {
24174                         result: core::ptr::null_mut(),
24175                 },
24176                 result_ok: true,
24177         }
24178 }
24179 #[no_mangle]
24180 /// Creates a new CResult_NoneTxSyncErrorZ in the error state.
24181 pub extern "C" fn CResult_NoneTxSyncErrorZ_err(e: crate::lightning_transaction_sync::error::TxSyncError) -> CResult_NoneTxSyncErrorZ {
24182         CResult_NoneTxSyncErrorZ {
24183                 contents: CResult_NoneTxSyncErrorZPtr {
24184                         err: Box::into_raw(Box::new(e)),
24185                 },
24186                 result_ok: false,
24187         }
24188 }
24189 /// Checks if the given object is currently in the success state
24190 #[no_mangle]
24191 pub extern "C" fn CResult_NoneTxSyncErrorZ_is_ok(o: &CResult_NoneTxSyncErrorZ) -> bool {
24192         o.result_ok
24193 }
24194 #[no_mangle]
24195 /// Frees any resources used by the CResult_NoneTxSyncErrorZ.
24196 pub extern "C" fn CResult_NoneTxSyncErrorZ_free(_res: CResult_NoneTxSyncErrorZ) { }
24197 impl Drop for CResult_NoneTxSyncErrorZ {
24198         fn drop(&mut self) {
24199                 if self.result_ok {
24200                 } else {
24201                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24202                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24203                         }
24204                 }
24205         }
24206 }
24207 impl From<crate::c_types::CResultTempl<(), crate::lightning_transaction_sync::error::TxSyncError>> for CResult_NoneTxSyncErrorZ {
24208         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_transaction_sync::error::TxSyncError>) -> Self {
24209                 let contents = if o.result_ok {
24210                         let _ = unsafe { Box::from_raw(o.contents.result) };
24211                         o.contents.result = core::ptr::null_mut();
24212                         CResult_NoneTxSyncErrorZPtr { result: core::ptr::null_mut() }
24213                 } else {
24214                         let err = unsafe { o.contents.err };
24215                         unsafe { o.contents.err = core::ptr::null_mut(); }
24216                         CResult_NoneTxSyncErrorZPtr { err }
24217                 };
24218                 Self {
24219                         contents,
24220                         result_ok: o.result_ok,
24221                 }
24222         }
24223 }
24224 #[repr(C)]
24225 /// The contents of CResult_SiPrefixBolt11ParseErrorZ
24226 pub union CResult_SiPrefixBolt11ParseErrorZPtr {
24227         /// A pointer to the contents in the success state.
24228         /// Reading from this pointer when `result_ok` is not set is undefined.
24229         pub result: *mut crate::lightning_invoice::SiPrefix,
24230         /// A pointer to the contents in the error state.
24231         /// Reading from this pointer when `result_ok` is set is undefined.
24232         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
24233 }
24234 #[repr(C)]
24235 /// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation,
24236 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure.
24237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24238 pub struct CResult_SiPrefixBolt11ParseErrorZ {
24239         /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either
24240         /// `err` or `result` depending on the state of `result_ok`.
24241         pub contents: CResult_SiPrefixBolt11ParseErrorZPtr,
24242         /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state.
24243         pub result_ok: bool,
24244 }
24245 #[no_mangle]
24246 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state.
24247 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ {
24248         CResult_SiPrefixBolt11ParseErrorZ {
24249                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24250                         result: Box::into_raw(Box::new(o)),
24251                 },
24252                 result_ok: true,
24253         }
24254 }
24255 #[no_mangle]
24256 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state.
24257 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ {
24258         CResult_SiPrefixBolt11ParseErrorZ {
24259                 contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24260                         err: Box::into_raw(Box::new(e)),
24261                 },
24262                 result_ok: false,
24263         }
24264 }
24265 /// Checks if the given object is currently in the success state
24266 #[no_mangle]
24267 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool {
24268         o.result_ok
24269 }
24270 #[no_mangle]
24271 /// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ.
24272 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { }
24273 impl Drop for CResult_SiPrefixBolt11ParseErrorZ {
24274         fn drop(&mut self) {
24275                 if self.result_ok {
24276                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24277                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24278                         }
24279                 } else {
24280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24282                         }
24283                 }
24284         }
24285 }
24286 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>> for CResult_SiPrefixBolt11ParseErrorZ {
24287         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::Bolt11ParseError>) -> Self {
24288                 let contents = if o.result_ok {
24289                         let result = unsafe { o.contents.result };
24290                         unsafe { o.contents.result = core::ptr::null_mut() };
24291                         CResult_SiPrefixBolt11ParseErrorZPtr { result }
24292                 } else {
24293                         let err = unsafe { o.contents.err };
24294                         unsafe { o.contents.err = core::ptr::null_mut(); }
24295                         CResult_SiPrefixBolt11ParseErrorZPtr { err }
24296                 };
24297                 Self {
24298                         contents,
24299                         result_ok: o.result_ok,
24300                 }
24301         }
24302 }
24303 impl Clone for CResult_SiPrefixBolt11ParseErrorZ {
24304         fn clone(&self) -> Self {
24305                 if self.result_ok {
24306                         Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24307                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
24308                         } }
24309                 } else {
24310                         Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr {
24311                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
24312                         } }
24313                 }
24314         }
24315 }
24316 #[no_mangle]
24317 /// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig`
24318 /// but with all dynamically-allocated buffers duplicated in new buffers.
24319 pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) }
24320 #[repr(C)]
24321 /// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ
24322 pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24323         /// A pointer to the contents in the success state.
24324         /// Reading from this pointer when `result_ok` is not set is undefined.
24325         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
24326         /// A pointer to the contents in the error state.
24327         /// Reading from this pointer when `result_ok` is set is undefined.
24328         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
24329 }
24330 #[repr(C)]
24331 /// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
24332 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
24333 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24334 pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24335         /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either
24336         /// `err` or `result` depending on the state of `result_ok`.
24337         pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr,
24338         /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state.
24339         pub result_ok: bool,
24340 }
24341 #[no_mangle]
24342 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state.
24343 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24344         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24345                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24346                         result: Box::into_raw(Box::new(o)),
24347                 },
24348                 result_ok: true,
24349         }
24350 }
24351 #[no_mangle]
24352 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state.
24353 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24354         CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24355                 contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24356                         err: Box::into_raw(Box::new(e)),
24357                 },
24358                 result_ok: false,
24359         }
24360 }
24361 /// Checks if the given object is currently in the success state
24362 #[no_mangle]
24363 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool {
24364         o.result_ok
24365 }
24366 #[no_mangle]
24367 /// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ.
24368 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { }
24369 impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24370         fn drop(&mut self) {
24371                 if self.result_ok {
24372                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24373                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24374                         }
24375                 } else {
24376                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24377                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24378                         }
24379                 }
24380         }
24381 }
24382 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24383         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
24384                 let contents = if o.result_ok {
24385                         let result = unsafe { o.contents.result };
24386                         unsafe { o.contents.result = core::ptr::null_mut() };
24387                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result }
24388                 } else {
24389                         let err = unsafe { o.contents.err };
24390                         unsafe { o.contents.err = core::ptr::null_mut(); }
24391                         CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err }
24392                 };
24393                 Self {
24394                         contents,
24395                         result_ok: o.result_ok,
24396                 }
24397         }
24398 }
24399 impl Clone for CResult_Bolt11InvoiceParseOrSemanticErrorZ {
24400         fn clone(&self) -> Self {
24401                 if self.result_ok {
24402                         Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24403                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
24404                         } }
24405                 } else {
24406                         Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr {
24407                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
24408                         } }
24409                 }
24410         }
24411 }
24412 #[no_mangle]
24413 /// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig`
24414 /// but with all dynamically-allocated buffers duplicated in new buffers.
24415 pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
24416 #[repr(C)]
24417 /// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ
24418 pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24419         /// A pointer to the contents in the success state.
24420         /// Reading from this pointer when `result_ok` is not set is undefined.
24421         pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice,
24422         /// A pointer to the contents in the error state.
24423         /// Reading from this pointer when `result_ok` is set is undefined.
24424         pub err: *mut crate::lightning_invoice::Bolt11ParseError,
24425 }
24426 #[repr(C)]
24427 /// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation,
24428 /// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure.
24429 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24430 pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24431         /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either
24432         /// `err` or `result` depending on the state of `result_ok`.
24433         pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr,
24434         /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state.
24435         pub result_ok: bool,
24436 }
24437 #[no_mangle]
24438 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state.
24439 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24440         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24441                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24442                         result: Box::into_raw(Box::new(o)),
24443                 },
24444                 result_ok: true,
24445         }
24446 }
24447 #[no_mangle]
24448 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state.
24449 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24450         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24451                 contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24452                         err: Box::into_raw(Box::new(e)),
24453                 },
24454                 result_ok: false,
24455         }
24456 }
24457 /// Checks if the given object is currently in the success state
24458 #[no_mangle]
24459 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool {
24460         o.result_ok
24461 }
24462 #[no_mangle]
24463 /// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ.
24464 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { }
24465 impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24466         fn drop(&mut self) {
24467                 if self.result_ok {
24468                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24469                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24470                         }
24471                 } else {
24472                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24473                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24474                         }
24475                 }
24476         }
24477 }
24478 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawBolt11Invoice, crate::lightning_invoice::Bolt11ParseError>) -> Self {
24480                 let contents = if o.result_ok {
24481                         let result = unsafe { o.contents.result };
24482                         unsafe { o.contents.result = core::ptr::null_mut() };
24483                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result }
24484                 } else {
24485                         let err = unsafe { o.contents.err };
24486                         unsafe { o.contents.err = core::ptr::null_mut(); }
24487                         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err }
24488                 };
24489                 Self {
24490                         contents,
24491                         result_ok: o.result_ok,
24492                 }
24493         }
24494 }
24495 impl Clone for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ {
24496         fn clone(&self) -> Self {
24497                 if self.result_ok {
24498                         Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24499                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawBolt11Invoice>::clone(unsafe { &*self.contents.result })))
24500                         } }
24501                 } else {
24502                         Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr {
24503                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11ParseError>::clone(unsafe { &*self.contents.err })))
24504                         } }
24505                 }
24506         }
24507 }
24508 #[no_mangle]
24509 /// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig`
24510 /// but with all dynamically-allocated buffers duplicated in new buffers.
24511 pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) }
24512 #[repr(C)]
24513 /// A tuple of 3 elements. See the individual fields for the types contained.
24514 pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24515         /// The element at position 0
24516         pub a: crate::lightning_invoice::RawBolt11Invoice,
24517         /// The element at position 1
24518         pub b: crate::c_types::ThirtyTwoBytes,
24519         /// The element at position 2
24520         pub c: crate::lightning_invoice::Bolt11InvoiceSignature,
24521 }
24522 impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24523         fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self {
24524                 Self {
24525                         a: tup.0,
24526                         b: tup.1,
24527                         c: tup.2,
24528                 }
24529         }
24530 }
24531 impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24532         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) {
24533                 (self.a, self.b, self.c)
24534         }
24535 }
24536 impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ {
24537         fn clone(&self) -> Self {
24538                 Self {
24539                         a: Clone::clone(&self.a),
24540                         b: Clone::clone(&self.b),
24541                         c: Clone::clone(&self.c),
24542                 }
24543         }
24544 }
24545 #[no_mangle]
24546 /// Creates a new tuple which has the same data as `orig`
24547 /// but with all dynamically-allocated buffers duplicated in new buffers.
24548 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) }
24549 /// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements.
24550 #[no_mangle]
24551 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 {
24552         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, }
24553 }
24554
24555 #[no_mangle]
24556 /// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ.
24557 pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { }
24558 #[repr(C)]
24559 /// The contents of CResult_PayeePubKeySecp256k1ErrorZ
24560 pub union CResult_PayeePubKeySecp256k1ErrorZPtr {
24561         /// A pointer to the contents in the success state.
24562         /// Reading from this pointer when `result_ok` is not set is undefined.
24563         pub result: *mut crate::lightning_invoice::PayeePubKey,
24564         /// A pointer to the contents in the error state.
24565         /// Reading from this pointer when `result_ok` is set is undefined.
24566         pub err: *mut crate::c_types::Secp256k1Error,
24567 }
24568 #[repr(C)]
24569 /// A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation,
24570 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
24571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24572 pub struct CResult_PayeePubKeySecp256k1ErrorZ {
24573         /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either
24574         /// `err` or `result` depending on the state of `result_ok`.
24575         pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr,
24576         /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state.
24577         pub result_ok: bool,
24578 }
24579 #[no_mangle]
24580 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state.
24581 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ {
24582         CResult_PayeePubKeySecp256k1ErrorZ {
24583                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24584                         result: Box::into_raw(Box::new(o)),
24585                 },
24586                 result_ok: true,
24587         }
24588 }
24589 #[no_mangle]
24590 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state.
24591 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ {
24592         CResult_PayeePubKeySecp256k1ErrorZ {
24593                 contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24594                         err: Box::into_raw(Box::new(e)),
24595                 },
24596                 result_ok: false,
24597         }
24598 }
24599 /// Checks if the given object is currently in the success state
24600 #[no_mangle]
24601 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool {
24602         o.result_ok
24603 }
24604 #[no_mangle]
24605 /// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ.
24606 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { }
24607 impl Drop for CResult_PayeePubKeySecp256k1ErrorZ {
24608         fn drop(&mut self) {
24609                 if self.result_ok {
24610                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24611                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24612                         }
24613                 } else {
24614                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24615                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24616                         }
24617                 }
24618         }
24619 }
24620 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeySecp256k1ErrorZ {
24621         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
24622                 let contents = if o.result_ok {
24623                         let result = unsafe { o.contents.result };
24624                         unsafe { o.contents.result = core::ptr::null_mut() };
24625                         CResult_PayeePubKeySecp256k1ErrorZPtr { result }
24626                 } else {
24627                         let err = unsafe { o.contents.err };
24628                         unsafe { o.contents.err = core::ptr::null_mut(); }
24629                         CResult_PayeePubKeySecp256k1ErrorZPtr { err }
24630                 };
24631                 Self {
24632                         contents,
24633                         result_ok: o.result_ok,
24634                 }
24635         }
24636 }
24637 impl Clone for CResult_PayeePubKeySecp256k1ErrorZ {
24638         fn clone(&self) -> Self {
24639                 if self.result_ok {
24640                         Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24641                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
24642                         } }
24643                 } else {
24644                         Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr {
24645                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
24646                         } }
24647                 }
24648         }
24649 }
24650 #[no_mangle]
24651 /// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig`
24652 /// but with all dynamically-allocated buffers duplicated in new buffers.
24653 pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) }
24654 #[repr(C)]
24655 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
24656 /// This corresponds to std::vector in C++
24657 pub struct CVec_PrivateRouteZ {
24658         /// The elements in the array.
24659         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
24660         pub data: *mut crate::lightning_invoice::PrivateRoute,
24661         /// The number of elements pointed to by `data`.
24662         pub datalen: usize
24663 }
24664 impl CVec_PrivateRouteZ {
24665         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
24666                 if self.datalen == 0 { return Vec::new(); }
24667                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
24668                 self.data = core::ptr::null_mut();
24669                 self.datalen = 0;
24670                 ret
24671         }
24672         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
24673                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
24674         }
24675 }
24676 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
24677         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
24678                 let datalen = v.len();
24679                 let data = Box::into_raw(v.into_boxed_slice());
24680                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
24681         }
24682 }
24683 #[no_mangle]
24684 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
24685 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
24686 impl Drop for CVec_PrivateRouteZ {
24687         fn drop(&mut self) {
24688                 if self.datalen == 0 { return; }
24689                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
24690         }
24691 }
24692 impl Clone for CVec_PrivateRouteZ {
24693         fn clone(&self) -> Self {
24694                 let mut res = Vec::new();
24695                 if self.datalen == 0 { return Self::from(res); }
24696                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
24697                 Self::from(res)
24698         }
24699 }
24700 #[repr(C)]
24701 /// The contents of CResult_PositiveTimestampCreationErrorZ
24702 pub union CResult_PositiveTimestampCreationErrorZPtr {
24703         /// A pointer to the contents in the success state.
24704         /// Reading from this pointer when `result_ok` is not set is undefined.
24705         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
24706         /// A pointer to the contents in the error state.
24707         /// Reading from this pointer when `result_ok` is set is undefined.
24708         pub err: *mut crate::lightning_invoice::CreationError,
24709 }
24710 #[repr(C)]
24711 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
24712 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
24713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24714 pub struct CResult_PositiveTimestampCreationErrorZ {
24715         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
24716         /// `err` or `result` depending on the state of `result_ok`.
24717         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
24718         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
24719         pub result_ok: bool,
24720 }
24721 #[no_mangle]
24722 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
24723 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
24724         CResult_PositiveTimestampCreationErrorZ {
24725                 contents: CResult_PositiveTimestampCreationErrorZPtr {
24726                         result: Box::into_raw(Box::new(o)),
24727                 },
24728                 result_ok: true,
24729         }
24730 }
24731 #[no_mangle]
24732 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
24733 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
24734         CResult_PositiveTimestampCreationErrorZ {
24735                 contents: CResult_PositiveTimestampCreationErrorZPtr {
24736                         err: Box::into_raw(Box::new(e)),
24737                 },
24738                 result_ok: false,
24739         }
24740 }
24741 /// Checks if the given object is currently in the success state
24742 #[no_mangle]
24743 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
24744         o.result_ok
24745 }
24746 #[no_mangle]
24747 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
24748 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
24749 impl Drop for CResult_PositiveTimestampCreationErrorZ {
24750         fn drop(&mut self) {
24751                 if self.result_ok {
24752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24754                         }
24755                 } else {
24756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24758                         }
24759                 }
24760         }
24761 }
24762 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
24763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
24764                 let contents = if o.result_ok {
24765                         let result = unsafe { o.contents.result };
24766                         unsafe { o.contents.result = core::ptr::null_mut() };
24767                         CResult_PositiveTimestampCreationErrorZPtr { result }
24768                 } else {
24769                         let err = unsafe { o.contents.err };
24770                         unsafe { o.contents.err = core::ptr::null_mut(); }
24771                         CResult_PositiveTimestampCreationErrorZPtr { err }
24772                 };
24773                 Self {
24774                         contents,
24775                         result_ok: o.result_ok,
24776                 }
24777         }
24778 }
24779 impl Clone for CResult_PositiveTimestampCreationErrorZ {
24780         fn clone(&self) -> Self {
24781                 if self.result_ok {
24782                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
24783                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
24784                         } }
24785                 } else {
24786                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
24787                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
24788                         } }
24789                 }
24790         }
24791 }
24792 #[no_mangle]
24793 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
24794 /// but with all dynamically-allocated buffers duplicated in new buffers.
24795 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
24796 #[repr(C)]
24797 /// The contents of CResult_NoneBolt11SemanticErrorZ
24798 pub union CResult_NoneBolt11SemanticErrorZPtr {
24799         /// Note that this value is always NULL, as there are no contents in the OK variant
24800         pub result: *mut core::ffi::c_void,
24801         /// A pointer to the contents in the error state.
24802         /// Reading from this pointer when `result_ok` is set is undefined.
24803         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24804 }
24805 #[repr(C)]
24806 /// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation,
24807 /// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24809 pub struct CResult_NoneBolt11SemanticErrorZ {
24810         /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either
24811         /// `err` or `result` depending on the state of `result_ok`.
24812         pub contents: CResult_NoneBolt11SemanticErrorZPtr,
24813         /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state.
24814         pub result_ok: bool,
24815 }
24816 #[no_mangle]
24817 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
24818 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ {
24819         CResult_NoneBolt11SemanticErrorZ {
24820                 contents: CResult_NoneBolt11SemanticErrorZPtr {
24821                         result: core::ptr::null_mut(),
24822                 },
24823                 result_ok: true,
24824         }
24825 }
24826 #[no_mangle]
24827 /// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
24828 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ {
24829         CResult_NoneBolt11SemanticErrorZ {
24830                 contents: CResult_NoneBolt11SemanticErrorZPtr {
24831                         err: Box::into_raw(Box::new(e)),
24832                 },
24833                 result_ok: false,
24834         }
24835 }
24836 /// Checks if the given object is currently in the success state
24837 #[no_mangle]
24838 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool {
24839         o.result_ok
24840 }
24841 #[no_mangle]
24842 /// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ.
24843 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { }
24844 impl Drop for CResult_NoneBolt11SemanticErrorZ {
24845         fn drop(&mut self) {
24846                 if self.result_ok {
24847                 } else {
24848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24850                         }
24851                 }
24852         }
24853 }
24854 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>> for CResult_NoneBolt11SemanticErrorZ {
24855         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24856                 let contents = if o.result_ok {
24857                         let _ = unsafe { Box::from_raw(o.contents.result) };
24858                         o.contents.result = core::ptr::null_mut();
24859                         CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() }
24860                 } else {
24861                         let err = unsafe { o.contents.err };
24862                         unsafe { o.contents.err = core::ptr::null_mut(); }
24863                         CResult_NoneBolt11SemanticErrorZPtr { err }
24864                 };
24865                 Self {
24866                         contents,
24867                         result_ok: o.result_ok,
24868                 }
24869         }
24870 }
24871 impl Clone for CResult_NoneBolt11SemanticErrorZ {
24872         fn clone(&self) -> Self {
24873                 if self.result_ok {
24874                         Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr {
24875                                 result: core::ptr::null_mut()
24876                         } }
24877                 } else {
24878                         Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr {
24879                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24880                         } }
24881                 }
24882         }
24883 }
24884 #[no_mangle]
24885 /// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
24886 /// but with all dynamically-allocated buffers duplicated in new buffers.
24887 pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) }
24888 #[repr(C)]
24889 /// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ
24890 pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24891         /// A pointer to the contents in the success state.
24892         /// Reading from this pointer when `result_ok` is not set is undefined.
24893         pub result: *mut crate::lightning_invoice::Bolt11Invoice,
24894         /// A pointer to the contents in the error state.
24895         /// Reading from this pointer when `result_ok` is set is undefined.
24896         pub err: *mut crate::lightning_invoice::Bolt11SemanticError,
24897 }
24898 #[repr(C)]
24899 /// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation,
24900 /// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure.
24901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24902 pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24903         /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either
24904         /// `err` or `result` depending on the state of `result_ok`.
24905         pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr,
24906         /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state.
24907         pub result_ok: bool,
24908 }
24909 #[no_mangle]
24910 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state.
24911 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24912         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24913                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24914                         result: Box::into_raw(Box::new(o)),
24915                 },
24916                 result_ok: true,
24917         }
24918 }
24919 #[no_mangle]
24920 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state.
24921 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24922         CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24923                 contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24924                         err: Box::into_raw(Box::new(e)),
24925                 },
24926                 result_ok: false,
24927         }
24928 }
24929 /// Checks if the given object is currently in the success state
24930 #[no_mangle]
24931 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool {
24932         o.result_ok
24933 }
24934 #[no_mangle]
24935 /// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ.
24936 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { }
24937 impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24938         fn drop(&mut self) {
24939                 if self.result_ok {
24940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
24941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
24942                         }
24943                 } else {
24944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
24945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
24946                         }
24947                 }
24948         }
24949 }
24950 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>> for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Bolt11Invoice, crate::lightning_invoice::Bolt11SemanticError>) -> Self {
24952                 let contents = if o.result_ok {
24953                         let result = unsafe { o.contents.result };
24954                         unsafe { o.contents.result = core::ptr::null_mut() };
24955                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result }
24956                 } else {
24957                         let err = unsafe { o.contents.err };
24958                         unsafe { o.contents.err = core::ptr::null_mut(); }
24959                         CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err }
24960                 };
24961                 Self {
24962                         contents,
24963                         result_ok: o.result_ok,
24964                 }
24965         }
24966 }
24967 impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ {
24968         fn clone(&self) -> Self {
24969                 if self.result_ok {
24970                         Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24971                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11Invoice>::clone(unsafe { &*self.contents.result })))
24972                         } }
24973                 } else {
24974                         Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr {
24975                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::Bolt11SemanticError>::clone(unsafe { &*self.contents.err })))
24976                         } }
24977                 }
24978         }
24979 }
24980 #[no_mangle]
24981 /// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig`
24982 /// but with all dynamically-allocated buffers duplicated in new buffers.
24983 pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) }
24984 #[repr(C)]
24985 /// The contents of CResult_DescriptionCreationErrorZ
24986 pub union CResult_DescriptionCreationErrorZPtr {
24987         /// A pointer to the contents in the success state.
24988         /// Reading from this pointer when `result_ok` is not set is undefined.
24989         pub result: *mut crate::lightning_invoice::Description,
24990         /// A pointer to the contents in the error state.
24991         /// Reading from this pointer when `result_ok` is set is undefined.
24992         pub err: *mut crate::lightning_invoice::CreationError,
24993 }
24994 #[repr(C)]
24995 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
24996 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
24997 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24998 pub struct CResult_DescriptionCreationErrorZ {
24999         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
25000         /// `err` or `result` depending on the state of `result_ok`.
25001         pub contents: CResult_DescriptionCreationErrorZPtr,
25002         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
25003         pub result_ok: bool,
25004 }
25005 #[no_mangle]
25006 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
25007 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
25008         CResult_DescriptionCreationErrorZ {
25009                 contents: CResult_DescriptionCreationErrorZPtr {
25010                         result: Box::into_raw(Box::new(o)),
25011                 },
25012                 result_ok: true,
25013         }
25014 }
25015 #[no_mangle]
25016 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
25017 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
25018         CResult_DescriptionCreationErrorZ {
25019                 contents: CResult_DescriptionCreationErrorZPtr {
25020                         err: Box::into_raw(Box::new(e)),
25021                 },
25022                 result_ok: false,
25023         }
25024 }
25025 /// Checks if the given object is currently in the success state
25026 #[no_mangle]
25027 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
25028         o.result_ok
25029 }
25030 #[no_mangle]
25031 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
25032 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
25033 impl Drop for CResult_DescriptionCreationErrorZ {
25034         fn drop(&mut self) {
25035                 if self.result_ok {
25036                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25037                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25038                         }
25039                 } else {
25040                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25041                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25042                         }
25043                 }
25044         }
25045 }
25046 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
25047         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
25048                 let contents = if o.result_ok {
25049                         let result = unsafe { o.contents.result };
25050                         unsafe { o.contents.result = core::ptr::null_mut() };
25051                         CResult_DescriptionCreationErrorZPtr { result }
25052                 } else {
25053                         let err = unsafe { o.contents.err };
25054                         unsafe { o.contents.err = core::ptr::null_mut(); }
25055                         CResult_DescriptionCreationErrorZPtr { err }
25056                 };
25057                 Self {
25058                         contents,
25059                         result_ok: o.result_ok,
25060                 }
25061         }
25062 }
25063 impl Clone for CResult_DescriptionCreationErrorZ {
25064         fn clone(&self) -> Self {
25065                 if self.result_ok {
25066                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
25067                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
25068                         } }
25069                 } else {
25070                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
25071                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
25072                         } }
25073                 }
25074         }
25075 }
25076 #[no_mangle]
25077 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
25078 /// but with all dynamically-allocated buffers duplicated in new buffers.
25079 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
25080 #[repr(C)]
25081 /// The contents of CResult_PrivateRouteCreationErrorZ
25082 pub union CResult_PrivateRouteCreationErrorZPtr {
25083         /// A pointer to the contents in the success state.
25084         /// Reading from this pointer when `result_ok` is not set is undefined.
25085         pub result: *mut crate::lightning_invoice::PrivateRoute,
25086         /// A pointer to the contents in the error state.
25087         /// Reading from this pointer when `result_ok` is set is undefined.
25088         pub err: *mut crate::lightning_invoice::CreationError,
25089 }
25090 #[repr(C)]
25091 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
25092 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
25093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25094 pub struct CResult_PrivateRouteCreationErrorZ {
25095         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
25096         /// `err` or `result` depending on the state of `result_ok`.
25097         pub contents: CResult_PrivateRouteCreationErrorZPtr,
25098         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
25099         pub result_ok: bool,
25100 }
25101 #[no_mangle]
25102 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
25103 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
25104         CResult_PrivateRouteCreationErrorZ {
25105                 contents: CResult_PrivateRouteCreationErrorZPtr {
25106                         result: Box::into_raw(Box::new(o)),
25107                 },
25108                 result_ok: true,
25109         }
25110 }
25111 #[no_mangle]
25112 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
25113 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
25114         CResult_PrivateRouteCreationErrorZ {
25115                 contents: CResult_PrivateRouteCreationErrorZPtr {
25116                         err: Box::into_raw(Box::new(e)),
25117                 },
25118                 result_ok: false,
25119         }
25120 }
25121 /// Checks if the given object is currently in the success state
25122 #[no_mangle]
25123 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
25124         o.result_ok
25125 }
25126 #[no_mangle]
25127 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
25128 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
25129 impl Drop for CResult_PrivateRouteCreationErrorZ {
25130         fn drop(&mut self) {
25131                 if self.result_ok {
25132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25134                         }
25135                 } else {
25136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25138                         }
25139                 }
25140         }
25141 }
25142 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
25143         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
25144                 let contents = if o.result_ok {
25145                         let result = unsafe { o.contents.result };
25146                         unsafe { o.contents.result = core::ptr::null_mut() };
25147                         CResult_PrivateRouteCreationErrorZPtr { result }
25148                 } else {
25149                         let err = unsafe { o.contents.err };
25150                         unsafe { o.contents.err = core::ptr::null_mut(); }
25151                         CResult_PrivateRouteCreationErrorZPtr { err }
25152                 };
25153                 Self {
25154                         contents,
25155                         result_ok: o.result_ok,
25156                 }
25157         }
25158 }
25159 impl Clone for CResult_PrivateRouteCreationErrorZ {
25160         fn clone(&self) -> Self {
25161                 if self.result_ok {
25162                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
25163                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
25164                         } }
25165                 } else {
25166                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
25167                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
25168                         } }
25169                 }
25170         }
25171 }
25172 #[no_mangle]
25173 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
25174 /// but with all dynamically-allocated buffers duplicated in new buffers.
25175 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
25176 #[repr(C)]
25177 /// The contents of CResult_OutPointDecodeErrorZ
25178 pub union CResult_OutPointDecodeErrorZPtr {
25179         /// A pointer to the contents in the success state.
25180         /// Reading from this pointer when `result_ok` is not set is undefined.
25181         pub result: *mut crate::lightning::chain::transaction::OutPoint,
25182         /// A pointer to the contents in the error state.
25183         /// Reading from this pointer when `result_ok` is set is undefined.
25184         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25185 }
25186 #[repr(C)]
25187 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
25188 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
25189 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25190 pub struct CResult_OutPointDecodeErrorZ {
25191         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
25192         /// `err` or `result` depending on the state of `result_ok`.
25193         pub contents: CResult_OutPointDecodeErrorZPtr,
25194         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
25195         pub result_ok: bool,
25196 }
25197 #[no_mangle]
25198 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
25199 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
25200         CResult_OutPointDecodeErrorZ {
25201                 contents: CResult_OutPointDecodeErrorZPtr {
25202                         result: Box::into_raw(Box::new(o)),
25203                 },
25204                 result_ok: true,
25205         }
25206 }
25207 #[no_mangle]
25208 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
25209 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
25210         CResult_OutPointDecodeErrorZ {
25211                 contents: CResult_OutPointDecodeErrorZPtr {
25212                         err: Box::into_raw(Box::new(e)),
25213                 },
25214                 result_ok: false,
25215         }
25216 }
25217 /// Checks if the given object is currently in the success state
25218 #[no_mangle]
25219 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
25220         o.result_ok
25221 }
25222 #[no_mangle]
25223 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
25224 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
25225 impl Drop for CResult_OutPointDecodeErrorZ {
25226         fn drop(&mut self) {
25227                 if self.result_ok {
25228                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25229                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25230                         }
25231                 } else {
25232                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25233                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25234                         }
25235                 }
25236         }
25237 }
25238 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
25239         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
25240                 let contents = if o.result_ok {
25241                         let result = unsafe { o.contents.result };
25242                         unsafe { o.contents.result = core::ptr::null_mut() };
25243                         CResult_OutPointDecodeErrorZPtr { result }
25244                 } else {
25245                         let err = unsafe { o.contents.err };
25246                         unsafe { o.contents.err = core::ptr::null_mut(); }
25247                         CResult_OutPointDecodeErrorZPtr { err }
25248                 };
25249                 Self {
25250                         contents,
25251                         result_ok: o.result_ok,
25252                 }
25253         }
25254 }
25255 impl Clone for CResult_OutPointDecodeErrorZ {
25256         fn clone(&self) -> Self {
25257                 if self.result_ok {
25258                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
25259                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
25260                         } }
25261                 } else {
25262                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
25263                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25264                         } }
25265                 }
25266         }
25267 }
25268 #[no_mangle]
25269 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
25270 /// but with all dynamically-allocated buffers duplicated in new buffers.
25271 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
25272 #[repr(C)]
25273 /// The contents of CResult_BigSizeDecodeErrorZ
25274 pub union CResult_BigSizeDecodeErrorZPtr {
25275         /// A pointer to the contents in the success state.
25276         /// Reading from this pointer when `result_ok` is not set is undefined.
25277         pub result: *mut crate::lightning::util::ser::BigSize,
25278         /// A pointer to the contents in the error state.
25279         /// Reading from this pointer when `result_ok` is set is undefined.
25280         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25281 }
25282 #[repr(C)]
25283 /// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation,
25284 /// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure.
25285 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25286 pub struct CResult_BigSizeDecodeErrorZ {
25287         /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either
25288         /// `err` or `result` depending on the state of `result_ok`.
25289         pub contents: CResult_BigSizeDecodeErrorZPtr,
25290         /// Whether this CResult_BigSizeDecodeErrorZ represents a success state.
25291         pub result_ok: bool,
25292 }
25293 #[no_mangle]
25294 /// Creates a new CResult_BigSizeDecodeErrorZ in the success state.
25295 pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ {
25296         CResult_BigSizeDecodeErrorZ {
25297                 contents: CResult_BigSizeDecodeErrorZPtr {
25298                         result: Box::into_raw(Box::new(o)),
25299                 },
25300                 result_ok: true,
25301         }
25302 }
25303 #[no_mangle]
25304 /// Creates a new CResult_BigSizeDecodeErrorZ in the error state.
25305 pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ {
25306         CResult_BigSizeDecodeErrorZ {
25307                 contents: CResult_BigSizeDecodeErrorZPtr {
25308                         err: Box::into_raw(Box::new(e)),
25309                 },
25310                 result_ok: false,
25311         }
25312 }
25313 /// Checks if the given object is currently in the success state
25314 #[no_mangle]
25315 pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool {
25316         o.result_ok
25317 }
25318 #[no_mangle]
25319 /// Frees any resources used by the CResult_BigSizeDecodeErrorZ.
25320 pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { }
25321 impl Drop for CResult_BigSizeDecodeErrorZ {
25322         fn drop(&mut self) {
25323                 if self.result_ok {
25324                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25325                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25326                         }
25327                 } else {
25328                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25329                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25330                         }
25331                 }
25332         }
25333 }
25334 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>> for CResult_BigSizeDecodeErrorZ {
25335         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::BigSize, crate::lightning::ln::msgs::DecodeError>) -> Self {
25336                 let contents = if o.result_ok {
25337                         let result = unsafe { o.contents.result };
25338                         unsafe { o.contents.result = core::ptr::null_mut() };
25339                         CResult_BigSizeDecodeErrorZPtr { result }
25340                 } else {
25341                         let err = unsafe { o.contents.err };
25342                         unsafe { o.contents.err = core::ptr::null_mut(); }
25343                         CResult_BigSizeDecodeErrorZPtr { err }
25344                 };
25345                 Self {
25346                         contents,
25347                         result_ok: o.result_ok,
25348                 }
25349         }
25350 }
25351 impl Clone for CResult_BigSizeDecodeErrorZ {
25352         fn clone(&self) -> Self {
25353                 if self.result_ok {
25354                         Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr {
25355                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::BigSize>::clone(unsafe { &*self.contents.result })))
25356                         } }
25357                 } else {
25358                         Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr {
25359                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25360                         } }
25361                 }
25362         }
25363 }
25364 #[no_mangle]
25365 /// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig`
25366 /// but with all dynamically-allocated buffers duplicated in new buffers.
25367 pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) }
25368 #[repr(C)]
25369 /// The contents of CResult_HostnameDecodeErrorZ
25370 pub union CResult_HostnameDecodeErrorZPtr {
25371         /// A pointer to the contents in the success state.
25372         /// Reading from this pointer when `result_ok` is not set is undefined.
25373         pub result: *mut crate::lightning::util::ser::Hostname,
25374         /// A pointer to the contents in the error state.
25375         /// Reading from this pointer when `result_ok` is set is undefined.
25376         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25377 }
25378 #[repr(C)]
25379 /// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation,
25380 /// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure.
25381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25382 pub struct CResult_HostnameDecodeErrorZ {
25383         /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either
25384         /// `err` or `result` depending on the state of `result_ok`.
25385         pub contents: CResult_HostnameDecodeErrorZPtr,
25386         /// Whether this CResult_HostnameDecodeErrorZ represents a success state.
25387         pub result_ok: bool,
25388 }
25389 #[no_mangle]
25390 /// Creates a new CResult_HostnameDecodeErrorZ in the success state.
25391 pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ {
25392         CResult_HostnameDecodeErrorZ {
25393                 contents: CResult_HostnameDecodeErrorZPtr {
25394                         result: Box::into_raw(Box::new(o)),
25395                 },
25396                 result_ok: true,
25397         }
25398 }
25399 #[no_mangle]
25400 /// Creates a new CResult_HostnameDecodeErrorZ in the error state.
25401 pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ {
25402         CResult_HostnameDecodeErrorZ {
25403                 contents: CResult_HostnameDecodeErrorZPtr {
25404                         err: Box::into_raw(Box::new(e)),
25405                 },
25406                 result_ok: false,
25407         }
25408 }
25409 /// Checks if the given object is currently in the success state
25410 #[no_mangle]
25411 pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool {
25412         o.result_ok
25413 }
25414 #[no_mangle]
25415 /// Frees any resources used by the CResult_HostnameDecodeErrorZ.
25416 pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { }
25417 impl Drop for CResult_HostnameDecodeErrorZ {
25418         fn drop(&mut self) {
25419                 if self.result_ok {
25420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25422                         }
25423                 } else {
25424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25426                         }
25427                 }
25428         }
25429 }
25430 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>> for CResult_HostnameDecodeErrorZ {
25431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::Hostname, crate::lightning::ln::msgs::DecodeError>) -> Self {
25432                 let contents = if o.result_ok {
25433                         let result = unsafe { o.contents.result };
25434                         unsafe { o.contents.result = core::ptr::null_mut() };
25435                         CResult_HostnameDecodeErrorZPtr { result }
25436                 } else {
25437                         let err = unsafe { o.contents.err };
25438                         unsafe { o.contents.err = core::ptr::null_mut(); }
25439                         CResult_HostnameDecodeErrorZPtr { err }
25440                 };
25441                 Self {
25442                         contents,
25443                         result_ok: o.result_ok,
25444                 }
25445         }
25446 }
25447 impl Clone for CResult_HostnameDecodeErrorZ {
25448         fn clone(&self) -> Self {
25449                 if self.result_ok {
25450                         Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr {
25451                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::Hostname>::clone(unsafe { &*self.contents.result })))
25452                         } }
25453                 } else {
25454                         Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr {
25455                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25456                         } }
25457                 }
25458         }
25459 }
25460 #[no_mangle]
25461 /// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig`
25462 /// but with all dynamically-allocated buffers duplicated in new buffers.
25463 pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) }
25464 #[repr(C)]
25465 /// The contents of CResult_TransactionU16LenLimitedNoneZ
25466 pub union CResult_TransactionU16LenLimitedNoneZPtr {
25467         /// A pointer to the contents in the success state.
25468         /// Reading from this pointer when `result_ok` is not set is undefined.
25469         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
25470         /// Note that this value is always NULL, as there are no contents in the Err variant
25471         pub err: *mut core::ffi::c_void,
25472 }
25473 #[repr(C)]
25474 /// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation,
25475 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure.
25476 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25477 pub struct CResult_TransactionU16LenLimitedNoneZ {
25478         /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either
25479         /// `err` or `result` depending on the state of `result_ok`.
25480         pub contents: CResult_TransactionU16LenLimitedNoneZPtr,
25481         /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state.
25482         pub result_ok: bool,
25483 }
25484 #[no_mangle]
25485 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state.
25486 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ {
25487         CResult_TransactionU16LenLimitedNoneZ {
25488                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
25489                         result: Box::into_raw(Box::new(o)),
25490                 },
25491                 result_ok: true,
25492         }
25493 }
25494 #[no_mangle]
25495 /// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state.
25496 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ {
25497         CResult_TransactionU16LenLimitedNoneZ {
25498                 contents: CResult_TransactionU16LenLimitedNoneZPtr {
25499                         err: core::ptr::null_mut(),
25500                 },
25501                 result_ok: false,
25502         }
25503 }
25504 /// Checks if the given object is currently in the success state
25505 #[no_mangle]
25506 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool {
25507         o.result_ok
25508 }
25509 #[no_mangle]
25510 /// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ.
25511 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { }
25512 impl Drop for CResult_TransactionU16LenLimitedNoneZ {
25513         fn drop(&mut self) {
25514                 if self.result_ok {
25515                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25516                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25517                         }
25518                 } else {
25519                 }
25520         }
25521 }
25522 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>> for CResult_TransactionU16LenLimitedNoneZ {
25523         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, ()>) -> Self {
25524                 let contents = if o.result_ok {
25525                         let result = unsafe { o.contents.result };
25526                         unsafe { o.contents.result = core::ptr::null_mut() };
25527                         CResult_TransactionU16LenLimitedNoneZPtr { result }
25528                 } else {
25529                         let _ = unsafe { Box::from_raw(o.contents.err) };
25530                         o.contents.err = core::ptr::null_mut();
25531                         CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() }
25532                 };
25533                 Self {
25534                         contents,
25535                         result_ok: o.result_ok,
25536                 }
25537         }
25538 }
25539 impl Clone for CResult_TransactionU16LenLimitedNoneZ {
25540         fn clone(&self) -> Self {
25541                 if self.result_ok {
25542                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr {
25543                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
25544                         } }
25545                 } else {
25546                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr {
25547                                 err: core::ptr::null_mut()
25548                         } }
25549                 }
25550         }
25551 }
25552 #[no_mangle]
25553 /// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig`
25554 /// but with all dynamically-allocated buffers duplicated in new buffers.
25555 pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) }
25556 #[repr(C)]
25557 /// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ
25558 pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25559         /// A pointer to the contents in the success state.
25560         /// Reading from this pointer when `result_ok` is not set is undefined.
25561         pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited,
25562         /// A pointer to the contents in the error state.
25563         /// Reading from this pointer when `result_ok` is set is undefined.
25564         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25565 }
25566 #[repr(C)]
25567 /// A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation,
25568 /// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure.
25569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25570 pub struct CResult_TransactionU16LenLimitedDecodeErrorZ {
25571         /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either
25572         /// `err` or `result` depending on the state of `result_ok`.
25573         pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr,
25574         /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state.
25575         pub result_ok: bool,
25576 }
25577 #[no_mangle]
25578 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state.
25579 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
25580         CResult_TransactionU16LenLimitedDecodeErrorZ {
25581                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25582                         result: Box::into_raw(Box::new(o)),
25583                 },
25584                 result_ok: true,
25585         }
25586 }
25587 #[no_mangle]
25588 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state.
25589 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ {
25590         CResult_TransactionU16LenLimitedDecodeErrorZ {
25591                 contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25592                         err: Box::into_raw(Box::new(e)),
25593                 },
25594                 result_ok: false,
25595         }
25596 }
25597 /// Checks if the given object is currently in the success state
25598 #[no_mangle]
25599 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool {
25600         o.result_ok
25601 }
25602 #[no_mangle]
25603 /// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ.
25604 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { }
25605 impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ {
25606         fn drop(&mut self) {
25607                 if self.result_ok {
25608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25610                         }
25611                 } else {
25612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25614                         }
25615                 }
25616         }
25617 }
25618 impl From<crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>> for CResult_TransactionU16LenLimitedDecodeErrorZ {
25619         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::ser::TransactionU16LenLimited, crate::lightning::ln::msgs::DecodeError>) -> Self {
25620                 let contents = if o.result_ok {
25621                         let result = unsafe { o.contents.result };
25622                         unsafe { o.contents.result = core::ptr::null_mut() };
25623                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { result }
25624                 } else {
25625                         let err = unsafe { o.contents.err };
25626                         unsafe { o.contents.err = core::ptr::null_mut(); }
25627                         CResult_TransactionU16LenLimitedDecodeErrorZPtr { err }
25628                 };
25629                 Self {
25630                         contents,
25631                         result_ok: o.result_ok,
25632                 }
25633         }
25634 }
25635 impl Clone for CResult_TransactionU16LenLimitedDecodeErrorZ {
25636         fn clone(&self) -> Self {
25637                 if self.result_ok {
25638                         Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25639                                 result: Box::into_raw(Box::new(<crate::lightning::util::ser::TransactionU16LenLimited>::clone(unsafe { &*self.contents.result })))
25640                         } }
25641                 } else {
25642                         Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr {
25643                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25644                         } }
25645                 }
25646         }
25647 }
25648 #[no_mangle]
25649 /// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig`
25650 /// but with all dynamically-allocated buffers duplicated in new buffers.
25651 pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) }
25652 #[repr(C)]
25653 /// The contents of CResult_UntrustedStringDecodeErrorZ
25654 pub union CResult_UntrustedStringDecodeErrorZPtr {
25655         /// A pointer to the contents in the success state.
25656         /// Reading from this pointer when `result_ok` is not set is undefined.
25657         pub result: *mut crate::lightning::util::string::UntrustedString,
25658         /// A pointer to the contents in the error state.
25659         /// Reading from this pointer when `result_ok` is set is undefined.
25660         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25661 }
25662 #[repr(C)]
25663 /// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
25664 /// containing a crate::lightning::util::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure.
25665 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25666 pub struct CResult_UntrustedStringDecodeErrorZ {
25667         /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
25668         /// `err` or `result` depending on the state of `result_ok`.
25669         pub contents: CResult_UntrustedStringDecodeErrorZPtr,
25670         /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
25671         pub result_ok: bool,
25672 }
25673 #[no_mangle]
25674 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
25675 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning::util::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ {
25676         CResult_UntrustedStringDecodeErrorZ {
25677                 contents: CResult_UntrustedStringDecodeErrorZPtr {
25678                         result: Box::into_raw(Box::new(o)),
25679                 },
25680                 result_ok: true,
25681         }
25682 }
25683 #[no_mangle]
25684 /// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
25685 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ {
25686         CResult_UntrustedStringDecodeErrorZ {
25687                 contents: CResult_UntrustedStringDecodeErrorZPtr {
25688                         err: Box::into_raw(Box::new(e)),
25689                 },
25690                 result_ok: false,
25691         }
25692 }
25693 /// Checks if the given object is currently in the success state
25694 #[no_mangle]
25695 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool {
25696         o.result_ok
25697 }
25698 #[no_mangle]
25699 /// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
25700 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { }
25701 impl Drop for CResult_UntrustedStringDecodeErrorZ {
25702         fn drop(&mut self) {
25703                 if self.result_ok {
25704                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25705                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25706                         }
25707                 } else {
25708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25710                         }
25711                 }
25712         }
25713 }
25714 impl From<crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>> for CResult_UntrustedStringDecodeErrorZ {
25715         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::string::UntrustedString, crate::lightning::ln::msgs::DecodeError>) -> Self {
25716                 let contents = if o.result_ok {
25717                         let result = unsafe { o.contents.result };
25718                         unsafe { o.contents.result = core::ptr::null_mut() };
25719                         CResult_UntrustedStringDecodeErrorZPtr { result }
25720                 } else {
25721                         let err = unsafe { o.contents.err };
25722                         unsafe { o.contents.err = core::ptr::null_mut(); }
25723                         CResult_UntrustedStringDecodeErrorZPtr { err }
25724                 };
25725                 Self {
25726                         contents,
25727                         result_ok: o.result_ok,
25728                 }
25729         }
25730 }
25731 impl Clone for CResult_UntrustedStringDecodeErrorZ {
25732         fn clone(&self) -> Self {
25733                 if self.result_ok {
25734                         Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr {
25735                                 result: Box::into_raw(Box::new(<crate::lightning::util::string::UntrustedString>::clone(unsafe { &*self.contents.result })))
25736                         } }
25737                 } else {
25738                         Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr {
25739                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25740                         } }
25741                 }
25742         }
25743 }
25744 #[no_mangle]
25745 /// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
25746 /// but with all dynamically-allocated buffers duplicated in new buffers.
25747 pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) }
25748 #[repr(C)]
25749 /// The contents of CResult_ChannelIdDecodeErrorZ
25750 pub union CResult_ChannelIdDecodeErrorZPtr {
25751         /// A pointer to the contents in the success state.
25752         /// Reading from this pointer when `result_ok` is not set is undefined.
25753         pub result: *mut crate::lightning::ln::types::ChannelId,
25754         /// A pointer to the contents in the error state.
25755         /// Reading from this pointer when `result_ok` is set is undefined.
25756         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25757 }
25758 #[repr(C)]
25759 /// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation,
25760 /// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure.
25761 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25762 pub struct CResult_ChannelIdDecodeErrorZ {
25763         /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either
25764         /// `err` or `result` depending on the state of `result_ok`.
25765         pub contents: CResult_ChannelIdDecodeErrorZPtr,
25766         /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state.
25767         pub result_ok: bool,
25768 }
25769 #[no_mangle]
25770 /// Creates a new CResult_ChannelIdDecodeErrorZ in the success state.
25771 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ {
25772         CResult_ChannelIdDecodeErrorZ {
25773                 contents: CResult_ChannelIdDecodeErrorZPtr {
25774                         result: Box::into_raw(Box::new(o)),
25775                 },
25776                 result_ok: true,
25777         }
25778 }
25779 #[no_mangle]
25780 /// Creates a new CResult_ChannelIdDecodeErrorZ in the error state.
25781 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ {
25782         CResult_ChannelIdDecodeErrorZ {
25783                 contents: CResult_ChannelIdDecodeErrorZPtr {
25784                         err: Box::into_raw(Box::new(e)),
25785                 },
25786                 result_ok: false,
25787         }
25788 }
25789 /// Checks if the given object is currently in the success state
25790 #[no_mangle]
25791 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool {
25792         o.result_ok
25793 }
25794 #[no_mangle]
25795 /// Frees any resources used by the CResult_ChannelIdDecodeErrorZ.
25796 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { }
25797 impl Drop for CResult_ChannelIdDecodeErrorZ {
25798         fn drop(&mut self) {
25799                 if self.result_ok {
25800                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25801                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25802                         }
25803                 } else {
25804                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25805                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25806                         }
25807                 }
25808         }
25809 }
25810 impl From<crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelIdDecodeErrorZ {
25811         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::types::ChannelId, crate::lightning::ln::msgs::DecodeError>) -> Self {
25812                 let contents = if o.result_ok {
25813                         let result = unsafe { o.contents.result };
25814                         unsafe { o.contents.result = core::ptr::null_mut() };
25815                         CResult_ChannelIdDecodeErrorZPtr { result }
25816                 } else {
25817                         let err = unsafe { o.contents.err };
25818                         unsafe { o.contents.err = core::ptr::null_mut(); }
25819                         CResult_ChannelIdDecodeErrorZPtr { err }
25820                 };
25821                 Self {
25822                         contents,
25823                         result_ok: o.result_ok,
25824                 }
25825         }
25826 }
25827 impl Clone for CResult_ChannelIdDecodeErrorZ {
25828         fn clone(&self) -> Self {
25829                 if self.result_ok {
25830                         Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr {
25831                                 result: Box::into_raw(Box::new(<crate::lightning::ln::types::ChannelId>::clone(unsafe { &*self.contents.result })))
25832                         } }
25833                 } else {
25834                         Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr {
25835                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25836                         } }
25837                 }
25838         }
25839 }
25840 #[no_mangle]
25841 /// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig`
25842 /// but with all dynamically-allocated buffers duplicated in new buffers.
25843 pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) }
25844 #[repr(C)]
25845 /// A tuple of 2 elements. See the individual fields for the types contained.
25846 pub struct C2Tuple__u832u16Z {
25847         /// The element at position 0
25848         pub a: crate::c_types::ThirtyTwoBytes,
25849         /// The element at position 1
25850         pub b: u16,
25851 }
25852 impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z {
25853         fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self {
25854                 Self {
25855                         a: tup.0,
25856                         b: tup.1,
25857                 }
25858         }
25859 }
25860 impl C2Tuple__u832u16Z {
25861         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) {
25862                 (self.a, self.b)
25863         }
25864 }
25865 impl Clone for C2Tuple__u832u16Z {
25866         fn clone(&self) -> Self {
25867                 Self {
25868                         a: Clone::clone(&self.a),
25869                         b: Clone::clone(&self.b),
25870                 }
25871         }
25872 }
25873 #[no_mangle]
25874 /// Creates a new tuple which has the same data as `orig`
25875 /// but with all dynamically-allocated buffers duplicated in new buffers.
25876 pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) }
25877 /// Creates a new C2Tuple__u832u16Z from the contained elements.
25878 #[no_mangle]
25879 pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z {
25880         C2Tuple__u832u16Z { a, b, }
25881 }
25882
25883 #[no_mangle]
25884 /// Frees any resources used by the C2Tuple__u832u16Z.
25885 pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { }
25886 #[repr(C)]
25887 /// The contents of CResult_PaymentRelayDecodeErrorZ
25888 pub union CResult_PaymentRelayDecodeErrorZPtr {
25889         /// A pointer to the contents in the success state.
25890         /// Reading from this pointer when `result_ok` is not set is undefined.
25891         pub result: *mut crate::lightning::blinded_path::payment::PaymentRelay,
25892         /// A pointer to the contents in the error state.
25893         /// Reading from this pointer when `result_ok` is set is undefined.
25894         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25895 }
25896 #[repr(C)]
25897 /// A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation,
25898 /// containing a crate::lightning::blinded_path::payment::PaymentRelay on success and a crate::lightning::ln::msgs::DecodeError on failure.
25899 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25900 pub struct CResult_PaymentRelayDecodeErrorZ {
25901         /// The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either
25902         /// `err` or `result` depending on the state of `result_ok`.
25903         pub contents: CResult_PaymentRelayDecodeErrorZPtr,
25904         /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state.
25905         pub result_ok: bool,
25906 }
25907 #[no_mangle]
25908 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the success state.
25909 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentRelay) -> CResult_PaymentRelayDecodeErrorZ {
25910         CResult_PaymentRelayDecodeErrorZ {
25911                 contents: CResult_PaymentRelayDecodeErrorZPtr {
25912                         result: Box::into_raw(Box::new(o)),
25913                 },
25914                 result_ok: true,
25915         }
25916 }
25917 #[no_mangle]
25918 /// Creates a new CResult_PaymentRelayDecodeErrorZ in the error state.
25919 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentRelayDecodeErrorZ {
25920         CResult_PaymentRelayDecodeErrorZ {
25921                 contents: CResult_PaymentRelayDecodeErrorZPtr {
25922                         err: Box::into_raw(Box::new(e)),
25923                 },
25924                 result_ok: false,
25925         }
25926 }
25927 /// Checks if the given object is currently in the success state
25928 #[no_mangle]
25929 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool {
25930         o.result_ok
25931 }
25932 #[no_mangle]
25933 /// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ.
25934 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { }
25935 impl Drop for CResult_PaymentRelayDecodeErrorZ {
25936         fn drop(&mut self) {
25937                 if self.result_ok {
25938                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
25939                                 let _ = unsafe { Box::from_raw(self.contents.result) };
25940                         }
25941                 } else {
25942                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
25943                                 let _ = unsafe { Box::from_raw(self.contents.err) };
25944                         }
25945                 }
25946         }
25947 }
25948 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentRelayDecodeErrorZ {
25949         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentRelay, crate::lightning::ln::msgs::DecodeError>) -> Self {
25950                 let contents = if o.result_ok {
25951                         let result = unsafe { o.contents.result };
25952                         unsafe { o.contents.result = core::ptr::null_mut() };
25953                         CResult_PaymentRelayDecodeErrorZPtr { result }
25954                 } else {
25955                         let err = unsafe { o.contents.err };
25956                         unsafe { o.contents.err = core::ptr::null_mut(); }
25957                         CResult_PaymentRelayDecodeErrorZPtr { err }
25958                 };
25959                 Self {
25960                         contents,
25961                         result_ok: o.result_ok,
25962                 }
25963         }
25964 }
25965 impl Clone for CResult_PaymentRelayDecodeErrorZ {
25966         fn clone(&self) -> Self {
25967                 if self.result_ok {
25968                         Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr {
25969                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentRelay>::clone(unsafe { &*self.contents.result })))
25970                         } }
25971                 } else {
25972                         Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr {
25973                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
25974                         } }
25975                 }
25976         }
25977 }
25978 #[no_mangle]
25979 /// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig`
25980 /// but with all dynamically-allocated buffers duplicated in new buffers.
25981 pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) }
25982 #[repr(C)]
25983 /// The contents of CResult_PaymentConstraintsDecodeErrorZ
25984 pub union CResult_PaymentConstraintsDecodeErrorZPtr {
25985         /// A pointer to the contents in the success state.
25986         /// Reading from this pointer when `result_ok` is not set is undefined.
25987         pub result: *mut crate::lightning::blinded_path::payment::PaymentConstraints,
25988         /// A pointer to the contents in the error state.
25989         /// Reading from this pointer when `result_ok` is set is undefined.
25990         pub err: *mut crate::lightning::ln::msgs::DecodeError,
25991 }
25992 #[repr(C)]
25993 /// A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation,
25994 /// containing a crate::lightning::blinded_path::payment::PaymentConstraints on success and a crate::lightning::ln::msgs::DecodeError on failure.
25995 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
25996 pub struct CResult_PaymentConstraintsDecodeErrorZ {
25997         /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either
25998         /// `err` or `result` depending on the state of `result_ok`.
25999         pub contents: CResult_PaymentConstraintsDecodeErrorZPtr,
26000         /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state.
26001         pub result_ok: bool,
26002 }
26003 #[no_mangle]
26004 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state.
26005 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentConstraints) -> CResult_PaymentConstraintsDecodeErrorZ {
26006         CResult_PaymentConstraintsDecodeErrorZ {
26007                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
26008                         result: Box::into_raw(Box::new(o)),
26009                 },
26010                 result_ok: true,
26011         }
26012 }
26013 #[no_mangle]
26014 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state.
26015 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentConstraintsDecodeErrorZ {
26016         CResult_PaymentConstraintsDecodeErrorZ {
26017                 contents: CResult_PaymentConstraintsDecodeErrorZPtr {
26018                         err: Box::into_raw(Box::new(e)),
26019                 },
26020                 result_ok: false,
26021         }
26022 }
26023 /// Checks if the given object is currently in the success state
26024 #[no_mangle]
26025 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool {
26026         o.result_ok
26027 }
26028 #[no_mangle]
26029 /// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ.
26030 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { }
26031 impl Drop for CResult_PaymentConstraintsDecodeErrorZ {
26032         fn drop(&mut self) {
26033                 if self.result_ok {
26034                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26035                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26036                         }
26037                 } else {
26038                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26039                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26040                         }
26041                 }
26042         }
26043 }
26044 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentConstraintsDecodeErrorZ {
26045         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentConstraints, crate::lightning::ln::msgs::DecodeError>) -> Self {
26046                 let contents = if o.result_ok {
26047                         let result = unsafe { o.contents.result };
26048                         unsafe { o.contents.result = core::ptr::null_mut() };
26049                         CResult_PaymentConstraintsDecodeErrorZPtr { result }
26050                 } else {
26051                         let err = unsafe { o.contents.err };
26052                         unsafe { o.contents.err = core::ptr::null_mut(); }
26053                         CResult_PaymentConstraintsDecodeErrorZPtr { err }
26054                 };
26055                 Self {
26056                         contents,
26057                         result_ok: o.result_ok,
26058                 }
26059         }
26060 }
26061 impl Clone for CResult_PaymentConstraintsDecodeErrorZ {
26062         fn clone(&self) -> Self {
26063                 if self.result_ok {
26064                         Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
26065                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentConstraints>::clone(unsafe { &*self.contents.result })))
26066                         } }
26067                 } else {
26068                         Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr {
26069                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26070                         } }
26071                 }
26072         }
26073 }
26074 #[no_mangle]
26075 /// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig`
26076 /// but with all dynamically-allocated buffers duplicated in new buffers.
26077 pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) }
26078 #[repr(C)]
26079 /// The contents of CResult_PaymentContextDecodeErrorZ
26080 pub union CResult_PaymentContextDecodeErrorZPtr {
26081         /// A pointer to the contents in the success state.
26082         /// Reading from this pointer when `result_ok` is not set is undefined.
26083         pub result: *mut crate::lightning::blinded_path::payment::PaymentContext,
26084         /// A pointer to the contents in the error state.
26085         /// Reading from this pointer when `result_ok` is set is undefined.
26086         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26087 }
26088 #[repr(C)]
26089 /// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation,
26090 /// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
26091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26092 pub struct CResult_PaymentContextDecodeErrorZ {
26093         /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either
26094         /// `err` or `result` depending on the state of `result_ok`.
26095         pub contents: CResult_PaymentContextDecodeErrorZPtr,
26096         /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state.
26097         pub result_ok: bool,
26098 }
26099 #[no_mangle]
26100 /// Creates a new CResult_PaymentContextDecodeErrorZ in the success state.
26101 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ {
26102         CResult_PaymentContextDecodeErrorZ {
26103                 contents: CResult_PaymentContextDecodeErrorZPtr {
26104                         result: Box::into_raw(Box::new(o)),
26105                 },
26106                 result_ok: true,
26107         }
26108 }
26109 #[no_mangle]
26110 /// Creates a new CResult_PaymentContextDecodeErrorZ in the error state.
26111 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ {
26112         CResult_PaymentContextDecodeErrorZ {
26113                 contents: CResult_PaymentContextDecodeErrorZPtr {
26114                         err: Box::into_raw(Box::new(e)),
26115                 },
26116                 result_ok: false,
26117         }
26118 }
26119 /// Checks if the given object is currently in the success state
26120 #[no_mangle]
26121 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool {
26122         o.result_ok
26123 }
26124 #[no_mangle]
26125 /// Frees any resources used by the CResult_PaymentContextDecodeErrorZ.
26126 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { }
26127 impl Drop for CResult_PaymentContextDecodeErrorZ {
26128         fn drop(&mut self) {
26129                 if self.result_ok {
26130                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26131                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26132                         }
26133                 } else {
26134                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26135                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26136                         }
26137                 }
26138         }
26139 }
26140 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentContextDecodeErrorZ {
26141         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::PaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26142                 let contents = if o.result_ok {
26143                         let result = unsafe { o.contents.result };
26144                         unsafe { o.contents.result = core::ptr::null_mut() };
26145                         CResult_PaymentContextDecodeErrorZPtr { result }
26146                 } else {
26147                         let err = unsafe { o.contents.err };
26148                         unsafe { o.contents.err = core::ptr::null_mut(); }
26149                         CResult_PaymentContextDecodeErrorZPtr { err }
26150                 };
26151                 Self {
26152                         contents,
26153                         result_ok: o.result_ok,
26154                 }
26155         }
26156 }
26157 impl Clone for CResult_PaymentContextDecodeErrorZ {
26158         fn clone(&self) -> Self {
26159                 if self.result_ok {
26160                         Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr {
26161                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::PaymentContext>::clone(unsafe { &*self.contents.result })))
26162                         } }
26163                 } else {
26164                         Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr {
26165                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26166                         } }
26167                 }
26168         }
26169 }
26170 #[no_mangle]
26171 /// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig`
26172 /// but with all dynamically-allocated buffers duplicated in new buffers.
26173 pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) }
26174 #[repr(C)]
26175 /// The contents of CResult_UnknownPaymentContextDecodeErrorZ
26176 pub union CResult_UnknownPaymentContextDecodeErrorZPtr {
26177         /// A pointer to the contents in the success state.
26178         /// Reading from this pointer when `result_ok` is not set is undefined.
26179         pub result: *mut crate::lightning::blinded_path::payment::UnknownPaymentContext,
26180         /// A pointer to the contents in the error state.
26181         /// Reading from this pointer when `result_ok` is set is undefined.
26182         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26183 }
26184 #[repr(C)]
26185 /// A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation,
26186 /// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
26187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26188 pub struct CResult_UnknownPaymentContextDecodeErrorZ {
26189         /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either
26190         /// `err` or `result` depending on the state of `result_ok`.
26191         pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr,
26192         /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state.
26193         pub result_ok: bool,
26194 }
26195 #[no_mangle]
26196 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state.
26197 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ {
26198         CResult_UnknownPaymentContextDecodeErrorZ {
26199                 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26200                         result: Box::into_raw(Box::new(o)),
26201                 },
26202                 result_ok: true,
26203         }
26204 }
26205 #[no_mangle]
26206 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state.
26207 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ {
26208         CResult_UnknownPaymentContextDecodeErrorZ {
26209                 contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26210                         err: Box::into_raw(Box::new(e)),
26211                 },
26212                 result_ok: false,
26213         }
26214 }
26215 /// Checks if the given object is currently in the success state
26216 #[no_mangle]
26217 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool {
26218         o.result_ok
26219 }
26220 #[no_mangle]
26221 /// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ.
26222 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { }
26223 impl Drop for CResult_UnknownPaymentContextDecodeErrorZ {
26224         fn drop(&mut self) {
26225                 if self.result_ok {
26226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26228                         }
26229                 } else {
26230                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26231                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26232                         }
26233                 }
26234         }
26235 }
26236 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>> for CResult_UnknownPaymentContextDecodeErrorZ {
26237         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::UnknownPaymentContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26238                 let contents = if o.result_ok {
26239                         let result = unsafe { o.contents.result };
26240                         unsafe { o.contents.result = core::ptr::null_mut() };
26241                         CResult_UnknownPaymentContextDecodeErrorZPtr { result }
26242                 } else {
26243                         let err = unsafe { o.contents.err };
26244                         unsafe { o.contents.err = core::ptr::null_mut(); }
26245                         CResult_UnknownPaymentContextDecodeErrorZPtr { err }
26246                 };
26247                 Self {
26248                         contents,
26249                         result_ok: o.result_ok,
26250                 }
26251         }
26252 }
26253 impl Clone for CResult_UnknownPaymentContextDecodeErrorZ {
26254         fn clone(&self) -> Self {
26255                 if self.result_ok {
26256                         Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26257                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::UnknownPaymentContext>::clone(unsafe { &*self.contents.result })))
26258                         } }
26259                 } else {
26260                         Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr {
26261                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26262                         } }
26263                 }
26264         }
26265 }
26266 #[no_mangle]
26267 /// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig`
26268 /// but with all dynamically-allocated buffers duplicated in new buffers.
26269 pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) }
26270 #[repr(C)]
26271 /// The contents of CResult_Bolt12OfferContextDecodeErrorZ
26272 pub union CResult_Bolt12OfferContextDecodeErrorZPtr {
26273         /// A pointer to the contents in the success state.
26274         /// Reading from this pointer when `result_ok` is not set is undefined.
26275         pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext,
26276         /// A pointer to the contents in the error state.
26277         /// Reading from this pointer when `result_ok` is set is undefined.
26278         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26279 }
26280 #[repr(C)]
26281 /// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation,
26282 /// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
26283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26284 pub struct CResult_Bolt12OfferContextDecodeErrorZ {
26285         /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either
26286         /// `err` or `result` depending on the state of `result_ok`.
26287         pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr,
26288         /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state.
26289         pub result_ok: bool,
26290 }
26291 #[no_mangle]
26292 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state.
26293 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ {
26294         CResult_Bolt12OfferContextDecodeErrorZ {
26295                 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26296                         result: Box::into_raw(Box::new(o)),
26297                 },
26298                 result_ok: true,
26299         }
26300 }
26301 #[no_mangle]
26302 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state.
26303 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ {
26304         CResult_Bolt12OfferContextDecodeErrorZ {
26305                 contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26306                         err: Box::into_raw(Box::new(e)),
26307                 },
26308                 result_ok: false,
26309         }
26310 }
26311 /// Checks if the given object is currently in the success state
26312 #[no_mangle]
26313 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool {
26314         o.result_ok
26315 }
26316 #[no_mangle]
26317 /// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ.
26318 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { }
26319 impl Drop for CResult_Bolt12OfferContextDecodeErrorZ {
26320         fn drop(&mut self) {
26321                 if self.result_ok {
26322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26324                         }
26325                 } else {
26326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26328                         }
26329                 }
26330         }
26331 }
26332 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12OfferContextDecodeErrorZ {
26333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12OfferContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26334                 let contents = if o.result_ok {
26335                         let result = unsafe { o.contents.result };
26336                         unsafe { o.contents.result = core::ptr::null_mut() };
26337                         CResult_Bolt12OfferContextDecodeErrorZPtr { result }
26338                 } else {
26339                         let err = unsafe { o.contents.err };
26340                         unsafe { o.contents.err = core::ptr::null_mut(); }
26341                         CResult_Bolt12OfferContextDecodeErrorZPtr { err }
26342                 };
26343                 Self {
26344                         contents,
26345                         result_ok: o.result_ok,
26346                 }
26347         }
26348 }
26349 impl Clone for CResult_Bolt12OfferContextDecodeErrorZ {
26350         fn clone(&self) -> Self {
26351                 if self.result_ok {
26352                         Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26353                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12OfferContext>::clone(unsafe { &*self.contents.result })))
26354                         } }
26355                 } else {
26356                         Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr {
26357                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26358                         } }
26359                 }
26360         }
26361 }
26362 #[no_mangle]
26363 /// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig`
26364 /// but with all dynamically-allocated buffers duplicated in new buffers.
26365 pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) }
26366 #[repr(C)]
26367 /// The contents of CResult_Bolt12RefundContextDecodeErrorZ
26368 pub union CResult_Bolt12RefundContextDecodeErrorZPtr {
26369         /// A pointer to the contents in the success state.
26370         /// Reading from this pointer when `result_ok` is not set is undefined.
26371         pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext,
26372         /// A pointer to the contents in the error state.
26373         /// Reading from this pointer when `result_ok` is set is undefined.
26374         pub err: *mut crate::lightning::ln::msgs::DecodeError,
26375 }
26376 #[repr(C)]
26377 /// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation,
26378 /// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure.
26379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26380 pub struct CResult_Bolt12RefundContextDecodeErrorZ {
26381         /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either
26382         /// `err` or `result` depending on the state of `result_ok`.
26383         pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr,
26384         /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state.
26385         pub result_ok: bool,
26386 }
26387 #[no_mangle]
26388 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state.
26389 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ {
26390         CResult_Bolt12RefundContextDecodeErrorZ {
26391                 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26392                         result: Box::into_raw(Box::new(o)),
26393                 },
26394                 result_ok: true,
26395         }
26396 }
26397 #[no_mangle]
26398 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state.
26399 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ {
26400         CResult_Bolt12RefundContextDecodeErrorZ {
26401                 contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26402                         err: Box::into_raw(Box::new(e)),
26403                 },
26404                 result_ok: false,
26405         }
26406 }
26407 /// Checks if the given object is currently in the success state
26408 #[no_mangle]
26409 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool {
26410         o.result_ok
26411 }
26412 #[no_mangle]
26413 /// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ.
26414 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { }
26415 impl Drop for CResult_Bolt12RefundContextDecodeErrorZ {
26416         fn drop(&mut self) {
26417                 if self.result_ok {
26418                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26419                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26420                         }
26421                 } else {
26422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26424                         }
26425                 }
26426         }
26427 }
26428 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>> for CResult_Bolt12RefundContextDecodeErrorZ {
26429         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::payment::Bolt12RefundContext, crate::lightning::ln::msgs::DecodeError>) -> Self {
26430                 let contents = if o.result_ok {
26431                         let result = unsafe { o.contents.result };
26432                         unsafe { o.contents.result = core::ptr::null_mut() };
26433                         CResult_Bolt12RefundContextDecodeErrorZPtr { result }
26434                 } else {
26435                         let err = unsafe { o.contents.err };
26436                         unsafe { o.contents.err = core::ptr::null_mut(); }
26437                         CResult_Bolt12RefundContextDecodeErrorZPtr { err }
26438                 };
26439                 Self {
26440                         contents,
26441                         result_ok: o.result_ok,
26442                 }
26443         }
26444 }
26445 impl Clone for CResult_Bolt12RefundContextDecodeErrorZ {
26446         fn clone(&self) -> Self {
26447                 if self.result_ok {
26448                         Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26449                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::payment::Bolt12RefundContext>::clone(unsafe { &*self.contents.result })))
26450                         } }
26451                 } else {
26452                         Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr {
26453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
26454                         } }
26455                 }
26456         }
26457 }
26458 #[no_mangle]
26459 /// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig`
26460 /// but with all dynamically-allocated buffers duplicated in new buffers.
26461 pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) }
26462 #[repr(C)]
26463 /// The contents of CResult_StrSecp256k1ErrorZ
26464 pub union CResult_StrSecp256k1ErrorZPtr {
26465         /// A pointer to the contents in the success state.
26466         /// Reading from this pointer when `result_ok` is not set is undefined.
26467         pub result: *mut crate::c_types::Str,
26468         /// A pointer to the contents in the error state.
26469         /// Reading from this pointer when `result_ok` is set is undefined.
26470         pub err: *mut crate::c_types::Secp256k1Error,
26471 }
26472 #[repr(C)]
26473 /// A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation,
26474 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
26475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26476 pub struct CResult_StrSecp256k1ErrorZ {
26477         /// The contents of this CResult_StrSecp256k1ErrorZ, accessible via either
26478         /// `err` or `result` depending on the state of `result_ok`.
26479         pub contents: CResult_StrSecp256k1ErrorZPtr,
26480         /// Whether this CResult_StrSecp256k1ErrorZ represents a success state.
26481         pub result_ok: bool,
26482 }
26483 #[no_mangle]
26484 /// Creates a new CResult_StrSecp256k1ErrorZ in the success state.
26485 pub extern "C" fn CResult_StrSecp256k1ErrorZ_ok(o: crate::c_types::Str) -> CResult_StrSecp256k1ErrorZ {
26486         CResult_StrSecp256k1ErrorZ {
26487                 contents: CResult_StrSecp256k1ErrorZPtr {
26488                         result: Box::into_raw(Box::new(o)),
26489                 },
26490                 result_ok: true,
26491         }
26492 }
26493 #[no_mangle]
26494 /// Creates a new CResult_StrSecp256k1ErrorZ in the error state.
26495 pub extern "C" fn CResult_StrSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StrSecp256k1ErrorZ {
26496         CResult_StrSecp256k1ErrorZ {
26497                 contents: CResult_StrSecp256k1ErrorZPtr {
26498                         err: Box::into_raw(Box::new(e)),
26499                 },
26500                 result_ok: false,
26501         }
26502 }
26503 /// Checks if the given object is currently in the success state
26504 #[no_mangle]
26505 pub extern "C" fn CResult_StrSecp256k1ErrorZ_is_ok(o: &CResult_StrSecp256k1ErrorZ) -> bool {
26506         o.result_ok
26507 }
26508 #[no_mangle]
26509 /// Frees any resources used by the CResult_StrSecp256k1ErrorZ.
26510 pub extern "C" fn CResult_StrSecp256k1ErrorZ_free(_res: CResult_StrSecp256k1ErrorZ) { }
26511 impl Drop for CResult_StrSecp256k1ErrorZ {
26512         fn drop(&mut self) {
26513                 if self.result_ok {
26514                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26515                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26516                         }
26517                 } else {
26518                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26519                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26520                         }
26521                 }
26522         }
26523 }
26524 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StrSecp256k1ErrorZ {
26525         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
26526                 let contents = if o.result_ok {
26527                         let result = unsafe { o.contents.result };
26528                         unsafe { o.contents.result = core::ptr::null_mut() };
26529                         CResult_StrSecp256k1ErrorZPtr { result }
26530                 } else {
26531                         let err = unsafe { o.contents.err };
26532                         unsafe { o.contents.err = core::ptr::null_mut(); }
26533                         CResult_StrSecp256k1ErrorZPtr { err }
26534                 };
26535                 Self {
26536                         contents,
26537                         result_ok: o.result_ok,
26538                 }
26539         }
26540 }
26541 impl Clone for CResult_StrSecp256k1ErrorZ {
26542         fn clone(&self) -> Self {
26543                 if self.result_ok {
26544                         Self { result_ok: true, contents: CResult_StrSecp256k1ErrorZPtr {
26545                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
26546                         } }
26547                 } else {
26548                         Self { result_ok: false, contents: CResult_StrSecp256k1ErrorZPtr {
26549                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
26550                         } }
26551                 }
26552         }
26553 }
26554 #[no_mangle]
26555 /// Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig`
26556 /// but with all dynamically-allocated buffers duplicated in new buffers.
26557 pub extern "C" fn CResult_StrSecp256k1ErrorZ_clone(orig: &CResult_StrSecp256k1ErrorZ) -> CResult_StrSecp256k1ErrorZ { Clone::clone(&orig) }
26558 #[repr(C)]
26559 /// A tuple of 3 elements. See the individual fields for the types contained.
26560 pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26561         /// The element at position 0
26562         pub a: crate::c_types::ThirtyTwoBytes,
26563         /// The element at position 1
26564         pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields,
26565         /// The element at position 2
26566         pub c: crate::lightning::routing::router::RouteParameters,
26567 }
26568 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26569         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self {
26570                 Self {
26571                         a: tup.0,
26572                         b: tup.1,
26573                         c: tup.2,
26574                 }
26575         }
26576 }
26577 impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26578         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) {
26579                 (self.a, self.b, self.c)
26580         }
26581 }
26582 impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ {
26583         fn clone(&self) -> Self {
26584                 Self {
26585                         a: Clone::clone(&self.a),
26586                         b: Clone::clone(&self.b),
26587                         c: Clone::clone(&self.c),
26588                 }
26589         }
26590 }
26591 #[no_mangle]
26592 /// Creates a new tuple which has the same data as `orig`
26593 /// but with all dynamically-allocated buffers duplicated in new buffers.
26594 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) }
26595 /// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements.
26596 #[no_mangle]
26597 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 {
26598         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, }
26599 }
26600
26601 #[no_mangle]
26602 /// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ.
26603 pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { }
26604 #[repr(C)]
26605 /// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ
26606 pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26607         /// A pointer to the contents in the success state.
26608         /// Reading from this pointer when `result_ok` is not set is undefined.
26609         pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ,
26610         /// Note that this value is always NULL, as there are no contents in the Err variant
26611         pub err: *mut core::ffi::c_void,
26612 }
26613 #[repr(C)]
26614 /// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation,
26615 /// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure.
26616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26617 pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26618         /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either
26619         /// `err` or `result` depending on the state of `result_ok`.
26620         pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr,
26621         /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state.
26622         pub result_ok: bool,
26623 }
26624 #[no_mangle]
26625 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state.
26626 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26627         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26628                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26629                         result: Box::into_raw(Box::new(o)),
26630                 },
26631                 result_ok: true,
26632         }
26633 }
26634 #[no_mangle]
26635 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state.
26636 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26637         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26638                 contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26639                         err: core::ptr::null_mut(),
26640                 },
26641                 result_ok: false,
26642         }
26643 }
26644 /// Checks if the given object is currently in the success state
26645 #[no_mangle]
26646 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool {
26647         o.result_ok
26648 }
26649 #[no_mangle]
26650 /// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.
26651 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { }
26652 impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26653         fn drop(&mut self) {
26654                 if self.result_ok {
26655                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26656                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26657                         }
26658                 } else {
26659                 }
26660         }
26661 }
26662 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26663         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, ()>) -> Self {
26664                 let contents = if o.result_ok {
26665                         let result = unsafe { o.contents.result };
26666                         unsafe { o.contents.result = core::ptr::null_mut() };
26667                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result }
26668                 } else {
26669                         let _ = unsafe { Box::from_raw(o.contents.err) };
26670                         o.contents.err = core::ptr::null_mut();
26671                         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() }
26672                 };
26673                 Self {
26674                         contents,
26675                         result_ok: o.result_ok,
26676                 }
26677         }
26678 }
26679 impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ {
26680         fn clone(&self) -> Self {
26681                 if self.result_ok {
26682                         Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26683                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ>::clone(unsafe { &*self.contents.result })))
26684                         } }
26685                 } else {
26686                         Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr {
26687                                 err: core::ptr::null_mut()
26688                         } }
26689                 }
26690         }
26691 }
26692 #[no_mangle]
26693 /// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig`
26694 /// but with all dynamically-allocated buffers duplicated in new buffers.
26695 pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) }
26696 #[repr(C)]
26697 /// The contents of CResult_TxOutUtxoLookupErrorZ
26698 pub union CResult_TxOutUtxoLookupErrorZPtr {
26699         /// A pointer to the contents in the success state.
26700         /// Reading from this pointer when `result_ok` is not set is undefined.
26701         pub result: *mut crate::c_types::TxOut,
26702         /// A pointer to the contents in the error state.
26703         /// Reading from this pointer when `result_ok` is set is undefined.
26704         pub err: *mut crate::lightning::routing::utxo::UtxoLookupError,
26705 }
26706 #[repr(C)]
26707 /// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation,
26708 /// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure.
26709 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26710 pub struct CResult_TxOutUtxoLookupErrorZ {
26711         /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either
26712         /// `err` or `result` depending on the state of `result_ok`.
26713         pub contents: CResult_TxOutUtxoLookupErrorZPtr,
26714         /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state.
26715         pub result_ok: bool,
26716 }
26717 #[no_mangle]
26718 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
26719 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ {
26720         CResult_TxOutUtxoLookupErrorZ {
26721                 contents: CResult_TxOutUtxoLookupErrorZPtr {
26722                         result: Box::into_raw(Box::new(o)),
26723                 },
26724                 result_ok: true,
26725         }
26726 }
26727 #[no_mangle]
26728 /// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
26729 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ {
26730         CResult_TxOutUtxoLookupErrorZ {
26731                 contents: CResult_TxOutUtxoLookupErrorZPtr {
26732                         err: Box::into_raw(Box::new(e)),
26733                 },
26734                 result_ok: false,
26735         }
26736 }
26737 /// Checks if the given object is currently in the success state
26738 #[no_mangle]
26739 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool {
26740         o.result_ok
26741 }
26742 #[no_mangle]
26743 /// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
26744 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { }
26745 impl Drop for CResult_TxOutUtxoLookupErrorZ {
26746         fn drop(&mut self) {
26747                 if self.result_ok {
26748                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26749                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26750                         }
26751                 } else {
26752                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26753                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26754                         }
26755                 }
26756         }
26757 }
26758 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>> for CResult_TxOutUtxoLookupErrorZ {
26759         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::routing::utxo::UtxoLookupError>) -> Self {
26760                 let contents = if o.result_ok {
26761                         let result = unsafe { o.contents.result };
26762                         unsafe { o.contents.result = core::ptr::null_mut() };
26763                         CResult_TxOutUtxoLookupErrorZPtr { result }
26764                 } else {
26765                         let err = unsafe { o.contents.err };
26766                         unsafe { o.contents.err = core::ptr::null_mut(); }
26767                         CResult_TxOutUtxoLookupErrorZPtr { err }
26768                 };
26769                 Self {
26770                         contents,
26771                         result_ok: o.result_ok,
26772                 }
26773         }
26774 }
26775 impl Clone for CResult_TxOutUtxoLookupErrorZ {
26776         fn clone(&self) -> Self {
26777                 if self.result_ok {
26778                         Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr {
26779                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
26780                         } }
26781                 } else {
26782                         Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr {
26783                                 err: Box::into_raw(Box::new(<crate::lightning::routing::utxo::UtxoLookupError>::clone(unsafe { &*self.contents.err })))
26784                         } }
26785                 }
26786         }
26787 }
26788 #[no_mangle]
26789 /// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
26790 /// but with all dynamically-allocated buffers duplicated in new buffers.
26791 pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) }
26792 #[repr(C)]
26793 /// A tuple of 3 elements. See the individual fields for the types contained.
26794 pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26795         /// The element at position 0
26796         pub a: crate::c_types::PublicKey,
26797         /// The element at position 1
26798         pub b: crate::lightning::ln::msgs::OnionMessage,
26799         /// The element at position 2
26800         pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ,
26801 }
26802 impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26803         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self {
26804                 Self {
26805                         a: tup.0,
26806                         b: tup.1,
26807                         c: tup.2,
26808                 }
26809         }
26810 }
26811 impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26812         #[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) {
26813                 (self.a, self.b, self.c)
26814         }
26815 }
26816 impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ {
26817         fn clone(&self) -> Self {
26818                 Self {
26819                         a: Clone::clone(&self.a),
26820                         b: Clone::clone(&self.b),
26821                         c: Clone::clone(&self.c),
26822                 }
26823         }
26824 }
26825 #[no_mangle]
26826 /// Creates a new tuple which has the same data as `orig`
26827 /// but with all dynamically-allocated buffers duplicated in new buffers.
26828 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) }
26829 /// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements.
26830 #[no_mangle]
26831 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 {
26832         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, }
26833 }
26834
26835 #[no_mangle]
26836 /// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ.
26837 pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { }
26838 #[repr(C)]
26839 /// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ
26840 pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26841         /// A pointer to the contents in the success state.
26842         /// Reading from this pointer when `result_ok` is not set is undefined.
26843         pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ,
26844         /// A pointer to the contents in the error state.
26845         /// Reading from this pointer when `result_ok` is set is undefined.
26846         pub err: *mut crate::lightning::onion_message::messenger::SendError,
26847 }
26848 #[repr(C)]
26849 /// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation,
26850 /// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure.
26851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26852 pub struct CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26853         /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either
26854         /// `err` or `result` depending on the state of `result_ok`.
26855         pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr,
26856         /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state.
26857         pub result_ok: bool,
26858 }
26859 #[no_mangle]
26860 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state.
26861 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26862         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26863                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26864                         result: Box::into_raw(Box::new(o)),
26865                 },
26866                 result_ok: true,
26867         }
26868 }
26869 #[no_mangle]
26870 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state.
26871 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26872         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26873                 contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26874                         err: Box::into_raw(Box::new(e)),
26875                 },
26876                 result_ok: false,
26877         }
26878 }
26879 /// Checks if the given object is currently in the success state
26880 #[no_mangle]
26881 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool {
26882         o.result_ok
26883 }
26884 #[no_mangle]
26885 /// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.
26886 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { }
26887 impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26888         fn drop(&mut self) {
26889                 if self.result_ok {
26890                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26891                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26892                         }
26893                 } else {
26894                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
26895                                 let _ = unsafe { Box::from_raw(self.contents.err) };
26896                         }
26897                 }
26898         }
26899 }
26900 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 {
26901         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, crate::lightning::onion_message::messenger::SendError>) -> Self {
26902                 let contents = if o.result_ok {
26903                         let result = unsafe { o.contents.result };
26904                         unsafe { o.contents.result = core::ptr::null_mut() };
26905                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result }
26906                 } else {
26907                         let err = unsafe { o.contents.err };
26908                         unsafe { o.contents.err = core::ptr::null_mut(); }
26909                         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err }
26910                 };
26911                 Self {
26912                         contents,
26913                         result_ok: o.result_ok,
26914                 }
26915         }
26916 }
26917 impl Clone for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ {
26918         fn clone(&self) -> Self {
26919                 if self.result_ok {
26920                         Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26921                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ>::clone(unsafe { &*self.contents.result })))
26922                         } }
26923                 } else {
26924                         Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr {
26925                                 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
26926                         } }
26927                 }
26928         }
26929 }
26930 #[no_mangle]
26931 /// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig`
26932 /// but with all dynamically-allocated buffers duplicated in new buffers.
26933 pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) }
26934 #[repr(C)]
26935 /// The contents of CResult_PeeledOnionNoneZ
26936 pub union CResult_PeeledOnionNoneZPtr {
26937         /// A pointer to the contents in the success state.
26938         /// Reading from this pointer when `result_ok` is not set is undefined.
26939         pub result: *mut crate::lightning::onion_message::messenger::PeeledOnion,
26940         /// Note that this value is always NULL, as there are no contents in the Err variant
26941         pub err: *mut core::ffi::c_void,
26942 }
26943 #[repr(C)]
26944 /// A CResult_PeeledOnionNoneZ represents the result of a fallible operation,
26945 /// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure.
26946 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
26947 pub struct CResult_PeeledOnionNoneZ {
26948         /// The contents of this CResult_PeeledOnionNoneZ, accessible via either
26949         /// `err` or `result` depending on the state of `result_ok`.
26950         pub contents: CResult_PeeledOnionNoneZPtr,
26951         /// Whether this CResult_PeeledOnionNoneZ represents a success state.
26952         pub result_ok: bool,
26953 }
26954 #[no_mangle]
26955 /// Creates a new CResult_PeeledOnionNoneZ in the success state.
26956 pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ {
26957         CResult_PeeledOnionNoneZ {
26958                 contents: CResult_PeeledOnionNoneZPtr {
26959                         result: Box::into_raw(Box::new(o)),
26960                 },
26961                 result_ok: true,
26962         }
26963 }
26964 #[no_mangle]
26965 /// Creates a new CResult_PeeledOnionNoneZ in the error state.
26966 pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ {
26967         CResult_PeeledOnionNoneZ {
26968                 contents: CResult_PeeledOnionNoneZPtr {
26969                         err: core::ptr::null_mut(),
26970                 },
26971                 result_ok: false,
26972         }
26973 }
26974 /// Checks if the given object is currently in the success state
26975 #[no_mangle]
26976 pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool {
26977         o.result_ok
26978 }
26979 #[no_mangle]
26980 /// Frees any resources used by the CResult_PeeledOnionNoneZ.
26981 pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { }
26982 impl Drop for CResult_PeeledOnionNoneZ {
26983         fn drop(&mut self) {
26984                 if self.result_ok {
26985                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
26986                                 let _ = unsafe { Box::from_raw(self.contents.result) };
26987                         }
26988                 } else {
26989                 }
26990         }
26991 }
26992 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>> for CResult_PeeledOnionNoneZ {
26993         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::PeeledOnion, ()>) -> Self {
26994                 let contents = if o.result_ok {
26995                         let result = unsafe { o.contents.result };
26996                         unsafe { o.contents.result = core::ptr::null_mut() };
26997                         CResult_PeeledOnionNoneZPtr { result }
26998                 } else {
26999                         let _ = unsafe { Box::from_raw(o.contents.err) };
27000                         o.contents.err = core::ptr::null_mut();
27001                         CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() }
27002                 };
27003                 Self {
27004                         contents,
27005                         result_ok: o.result_ok,
27006                 }
27007         }
27008 }
27009 impl Clone for CResult_PeeledOnionNoneZ {
27010         fn clone(&self) -> Self {
27011                 if self.result_ok {
27012                         Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr {
27013                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::PeeledOnion>::clone(unsafe { &*self.contents.result })))
27014                         } }
27015                 } else {
27016                         Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr {
27017                                 err: core::ptr::null_mut()
27018                         } }
27019                 }
27020         }
27021 }
27022 #[no_mangle]
27023 /// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig`
27024 /// but with all dynamically-allocated buffers duplicated in new buffers.
27025 pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) }
27026 #[repr(C)]
27027 /// The contents of CResult_SendSuccessSendErrorZ
27028 pub union CResult_SendSuccessSendErrorZPtr {
27029         /// A pointer to the contents in the success state.
27030         /// Reading from this pointer when `result_ok` is not set is undefined.
27031         pub result: *mut crate::lightning::onion_message::messenger::SendSuccess,
27032         /// A pointer to the contents in the error state.
27033         /// Reading from this pointer when `result_ok` is set is undefined.
27034         pub err: *mut crate::lightning::onion_message::messenger::SendError,
27035 }
27036 #[repr(C)]
27037 /// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation,
27038 /// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure.
27039 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27040 pub struct CResult_SendSuccessSendErrorZ {
27041         /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either
27042         /// `err` or `result` depending on the state of `result_ok`.
27043         pub contents: CResult_SendSuccessSendErrorZPtr,
27044         /// Whether this CResult_SendSuccessSendErrorZ represents a success state.
27045         pub result_ok: bool,
27046 }
27047 #[no_mangle]
27048 /// Creates a new CResult_SendSuccessSendErrorZ in the success state.
27049 pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ {
27050         CResult_SendSuccessSendErrorZ {
27051                 contents: CResult_SendSuccessSendErrorZPtr {
27052                         result: Box::into_raw(Box::new(o)),
27053                 },
27054                 result_ok: true,
27055         }
27056 }
27057 #[no_mangle]
27058 /// Creates a new CResult_SendSuccessSendErrorZ in the error state.
27059 pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ {
27060         CResult_SendSuccessSendErrorZ {
27061                 contents: CResult_SendSuccessSendErrorZPtr {
27062                         err: Box::into_raw(Box::new(e)),
27063                 },
27064                 result_ok: false,
27065         }
27066 }
27067 /// Checks if the given object is currently in the success state
27068 #[no_mangle]
27069 pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool {
27070         o.result_ok
27071 }
27072 #[no_mangle]
27073 /// Frees any resources used by the CResult_SendSuccessSendErrorZ.
27074 pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { }
27075 impl Drop for CResult_SendSuccessSendErrorZ {
27076         fn drop(&mut self) {
27077                 if self.result_ok {
27078                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27079                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27080                         }
27081                 } else {
27082                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27083                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27084                         }
27085                 }
27086         }
27087 }
27088 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>> for CResult_SendSuccessSendErrorZ {
27089         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::messenger::SendSuccess, crate::lightning::onion_message::messenger::SendError>) -> Self {
27090                 let contents = if o.result_ok {
27091                         let result = unsafe { o.contents.result };
27092                         unsafe { o.contents.result = core::ptr::null_mut() };
27093                         CResult_SendSuccessSendErrorZPtr { result }
27094                 } else {
27095                         let err = unsafe { o.contents.err };
27096                         unsafe { o.contents.err = core::ptr::null_mut(); }
27097                         CResult_SendSuccessSendErrorZPtr { err }
27098                 };
27099                 Self {
27100                         contents,
27101                         result_ok: o.result_ok,
27102                 }
27103         }
27104 }
27105 impl Clone for CResult_SendSuccessSendErrorZ {
27106         fn clone(&self) -> Self {
27107                 if self.result_ok {
27108                         Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr {
27109                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendSuccess>::clone(unsafe { &*self.contents.result })))
27110                         } }
27111                 } else {
27112                         Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr {
27113                                 err: Box::into_raw(Box::new(<crate::lightning::onion_message::messenger::SendError>::clone(unsafe { &*self.contents.err })))
27114                         } }
27115                 }
27116         }
27117 }
27118 #[no_mangle]
27119 /// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig`
27120 /// but with all dynamically-allocated buffers duplicated in new buffers.
27121 pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) }
27122 #[repr(C)]
27123 /// The contents of CResult_BlindedPathNoneZ
27124 pub union CResult_BlindedPathNoneZPtr {
27125         /// A pointer to the contents in the success state.
27126         /// Reading from this pointer when `result_ok` is not set is undefined.
27127         pub result: *mut crate::lightning::blinded_path::BlindedPath,
27128         /// Note that this value is always NULL, as there are no contents in the Err variant
27129         pub err: *mut core::ffi::c_void,
27130 }
27131 #[repr(C)]
27132 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
27133 /// containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
27134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27135 pub struct CResult_BlindedPathNoneZ {
27136         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
27137         /// `err` or `result` depending on the state of `result_ok`.
27138         pub contents: CResult_BlindedPathNoneZPtr,
27139         /// Whether this CResult_BlindedPathNoneZ represents a success state.
27140         pub result_ok: bool,
27141 }
27142 #[no_mangle]
27143 /// Creates a new CResult_BlindedPathNoneZ in the success state.
27144 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
27145         CResult_BlindedPathNoneZ {
27146                 contents: CResult_BlindedPathNoneZPtr {
27147                         result: Box::into_raw(Box::new(o)),
27148                 },
27149                 result_ok: true,
27150         }
27151 }
27152 #[no_mangle]
27153 /// Creates a new CResult_BlindedPathNoneZ in the error state.
27154 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
27155         CResult_BlindedPathNoneZ {
27156                 contents: CResult_BlindedPathNoneZPtr {
27157                         err: core::ptr::null_mut(),
27158                 },
27159                 result_ok: false,
27160         }
27161 }
27162 /// Checks if the given object is currently in the success state
27163 #[no_mangle]
27164 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
27165         o.result_ok
27166 }
27167 #[no_mangle]
27168 /// Frees any resources used by the CResult_BlindedPathNoneZ.
27169 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
27170 impl Drop for CResult_BlindedPathNoneZ {
27171         fn drop(&mut self) {
27172                 if self.result_ok {
27173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27175                         }
27176                 } else {
27177                 }
27178         }
27179 }
27180 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
27181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, ()>) -> Self {
27182                 let contents = if o.result_ok {
27183                         let result = unsafe { o.contents.result };
27184                         unsafe { o.contents.result = core::ptr::null_mut() };
27185                         CResult_BlindedPathNoneZPtr { result }
27186                 } else {
27187                         let _ = unsafe { Box::from_raw(o.contents.err) };
27188                         o.contents.err = core::ptr::null_mut();
27189                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
27190                 };
27191                 Self {
27192                         contents,
27193                         result_ok: o.result_ok,
27194                 }
27195         }
27196 }
27197 impl Clone for CResult_BlindedPathNoneZ {
27198         fn clone(&self) -> Self {
27199                 if self.result_ok {
27200                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
27201                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
27202                         } }
27203                 } else {
27204                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
27205                                 err: core::ptr::null_mut()
27206                         } }
27207                 }
27208         }
27209 }
27210 #[no_mangle]
27211 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
27212 /// but with all dynamically-allocated buffers duplicated in new buffers.
27213 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
27214 #[repr(C)]
27215 /// The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ
27216 pub union CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27217         /// A pointer to the contents in the success state.
27218         /// Reading from this pointer when `result_ok` is not set is undefined.
27219         pub result: *mut crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ,
27220         /// Note that this value is always NULL, as there are no contents in the Err variant
27221         pub err: *mut core::ffi::c_void,
27222 }
27223 #[repr(C)]
27224 /// A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation,
27225 /// containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure.
27226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27227 pub struct CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27228         /// The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either
27229         /// `err` or `result` depending on the state of `result_ok`.
27230         pub contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr,
27231         /// Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state.
27232         pub result_ok: bool,
27233 }
27234 #[no_mangle]
27235 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state.
27236 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o: crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27237         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27238                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27239                         result: Box::into_raw(Box::new(o)),
27240                 },
27241                 result_ok: true,
27242         }
27243 }
27244 #[no_mangle]
27245 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state.
27246 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27247         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27248                 contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27249                         err: core::ptr::null_mut(),
27250                 },
27251                 result_ok: false,
27252         }
27253 }
27254 /// Checks if the given object is currently in the success state
27255 #[no_mangle]
27256 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> bool {
27257         o.result_ok
27258 }
27259 #[no_mangle]
27260 /// Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.
27261 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) { }
27262 impl Drop for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27263         fn drop(&mut self) {
27264                 if self.result_ok {
27265                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27266                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27267                         }
27268                 } else {
27269                 }
27270         }
27271 }
27272 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>> for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27273         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ, ()>) -> Self {
27274                 let contents = if o.result_ok {
27275                         let result = unsafe { o.contents.result };
27276                         unsafe { o.contents.result = core::ptr::null_mut() };
27277                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { result }
27278                 } else {
27279                         let _ = unsafe { Box::from_raw(o.contents.err) };
27280                         o.contents.err = core::ptr::null_mut();
27281                         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { err: core::ptr::null_mut() }
27282                 };
27283                 Self {
27284                         contents,
27285                         result_ok: o.result_ok,
27286                 }
27287         }
27288 }
27289 impl Clone for CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
27290         fn clone(&self) -> Self {
27291                 if self.result_ok {
27292                         Self { result_ok: true, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27293                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ>::clone(unsafe { &*self.contents.result })))
27294                         } }
27295                 } else {
27296                         Self { result_ok: false, contents: CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr {
27297                                 err: core::ptr::null_mut()
27298                         } }
27299                 }
27300         }
27301 }
27302 #[no_mangle]
27303 /// Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig`
27304 /// but with all dynamically-allocated buffers duplicated in new buffers.
27305 pub extern "C" fn CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig: &CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ) -> CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { Clone::clone(&orig) }
27306 #[repr(C)]
27307 /// A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size.
27308 /// This corresponds to std::vector in C++
27309 pub struct CVec_ForwardNodeZ {
27310         /// The elements in the array.
27311         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27312         pub data: *mut crate::lightning::blinded_path::payment::ForwardNode,
27313         /// The number of elements pointed to by `data`.
27314         pub datalen: usize
27315 }
27316 impl CVec_ForwardNodeZ {
27317         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::blinded_path::payment::ForwardNode> {
27318                 if self.datalen == 0 { return Vec::new(); }
27319                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27320                 self.data = core::ptr::null_mut();
27321                 self.datalen = 0;
27322                 ret
27323         }
27324         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::ForwardNode] {
27325                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27326         }
27327 }
27328 impl From<Vec<crate::lightning::blinded_path::payment::ForwardNode>> for CVec_ForwardNodeZ {
27329         fn from(v: Vec<crate::lightning::blinded_path::payment::ForwardNode>) -> Self {
27330                 let datalen = v.len();
27331                 let data = Box::into_raw(v.into_boxed_slice());
27332                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27333         }
27334 }
27335 #[no_mangle]
27336 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27337 pub extern "C" fn CVec_ForwardNodeZ_free(_res: CVec_ForwardNodeZ) { }
27338 impl Drop for CVec_ForwardNodeZ {
27339         fn drop(&mut self) {
27340                 if self.datalen == 0 { return; }
27341                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27342         }
27343 }
27344 impl Clone for CVec_ForwardNodeZ {
27345         fn clone(&self) -> Self {
27346                 let mut res = Vec::new();
27347                 if self.datalen == 0 { return Self::from(res); }
27348                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27349                 Self::from(res)
27350         }
27351 }
27352 #[repr(C)]
27353 /// The contents of CResult_BlindedPathDecodeErrorZ
27354 pub union CResult_BlindedPathDecodeErrorZPtr {
27355         /// A pointer to the contents in the success state.
27356         /// Reading from this pointer when `result_ok` is not set is undefined.
27357         pub result: *mut crate::lightning::blinded_path::BlindedPath,
27358         /// A pointer to the contents in the error state.
27359         /// Reading from this pointer when `result_ok` is set is undefined.
27360         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27361 }
27362 #[repr(C)]
27363 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
27364 /// containing a crate::lightning::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
27365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27366 pub struct CResult_BlindedPathDecodeErrorZ {
27367         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
27368         /// `err` or `result` depending on the state of `result_ok`.
27369         pub contents: CResult_BlindedPathDecodeErrorZPtr,
27370         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
27371         pub result_ok: bool,
27372 }
27373 #[no_mangle]
27374 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
27375 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
27376         CResult_BlindedPathDecodeErrorZ {
27377                 contents: CResult_BlindedPathDecodeErrorZPtr {
27378                         result: Box::into_raw(Box::new(o)),
27379                 },
27380                 result_ok: true,
27381         }
27382 }
27383 #[no_mangle]
27384 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
27385 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
27386         CResult_BlindedPathDecodeErrorZ {
27387                 contents: CResult_BlindedPathDecodeErrorZPtr {
27388                         err: Box::into_raw(Box::new(e)),
27389                 },
27390                 result_ok: false,
27391         }
27392 }
27393 /// Checks if the given object is currently in the success state
27394 #[no_mangle]
27395 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
27396         o.result_ok
27397 }
27398 #[no_mangle]
27399 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
27400 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
27401 impl Drop for CResult_BlindedPathDecodeErrorZ {
27402         fn drop(&mut self) {
27403                 if self.result_ok {
27404                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27405                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27406                         }
27407                 } else {
27408                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27409                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27410                         }
27411                 }
27412         }
27413 }
27414 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
27415         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
27416                 let contents = if o.result_ok {
27417                         let result = unsafe { o.contents.result };
27418                         unsafe { o.contents.result = core::ptr::null_mut() };
27419                         CResult_BlindedPathDecodeErrorZPtr { result }
27420                 } else {
27421                         let err = unsafe { o.contents.err };
27422                         unsafe { o.contents.err = core::ptr::null_mut(); }
27423                         CResult_BlindedPathDecodeErrorZPtr { err }
27424                 };
27425                 Self {
27426                         contents,
27427                         result_ok: o.result_ok,
27428                 }
27429         }
27430 }
27431 impl Clone for CResult_BlindedPathDecodeErrorZ {
27432         fn clone(&self) -> Self {
27433                 if self.result_ok {
27434                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
27435                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
27436                         } }
27437                 } else {
27438                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
27439                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27440                         } }
27441                 }
27442         }
27443 }
27444 #[no_mangle]
27445 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
27446 /// but with all dynamically-allocated buffers duplicated in new buffers.
27447 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
27448 #[repr(C)]
27449 /// The contents of CResult_BlindedHopDecodeErrorZ
27450 pub union CResult_BlindedHopDecodeErrorZPtr {
27451         /// A pointer to the contents in the success state.
27452         /// Reading from this pointer when `result_ok` is not set is undefined.
27453         pub result: *mut crate::lightning::blinded_path::BlindedHop,
27454         /// A pointer to the contents in the error state.
27455         /// Reading from this pointer when `result_ok` is set is undefined.
27456         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27457 }
27458 #[repr(C)]
27459 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
27460 /// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
27461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27462 pub struct CResult_BlindedHopDecodeErrorZ {
27463         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
27464         /// `err` or `result` depending on the state of `result_ok`.
27465         pub contents: CResult_BlindedHopDecodeErrorZPtr,
27466         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
27467         pub result_ok: bool,
27468 }
27469 #[no_mangle]
27470 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
27471 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
27472         CResult_BlindedHopDecodeErrorZ {
27473                 contents: CResult_BlindedHopDecodeErrorZPtr {
27474                         result: Box::into_raw(Box::new(o)),
27475                 },
27476                 result_ok: true,
27477         }
27478 }
27479 #[no_mangle]
27480 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
27481 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
27482         CResult_BlindedHopDecodeErrorZ {
27483                 contents: CResult_BlindedHopDecodeErrorZPtr {
27484                         err: Box::into_raw(Box::new(e)),
27485                 },
27486                 result_ok: false,
27487         }
27488 }
27489 /// Checks if the given object is currently in the success state
27490 #[no_mangle]
27491 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
27492         o.result_ok
27493 }
27494 #[no_mangle]
27495 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
27496 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
27497 impl Drop for CResult_BlindedHopDecodeErrorZ {
27498         fn drop(&mut self) {
27499                 if self.result_ok {
27500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27502                         }
27503                 } else {
27504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27506                         }
27507                 }
27508         }
27509 }
27510 impl From<crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
27511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
27512                 let contents = if o.result_ok {
27513                         let result = unsafe { o.contents.result };
27514                         unsafe { o.contents.result = core::ptr::null_mut() };
27515                         CResult_BlindedHopDecodeErrorZPtr { result }
27516                 } else {
27517                         let err = unsafe { o.contents.err };
27518                         unsafe { o.contents.err = core::ptr::null_mut(); }
27519                         CResult_BlindedHopDecodeErrorZPtr { err }
27520                 };
27521                 Self {
27522                         contents,
27523                         result_ok: o.result_ok,
27524                 }
27525         }
27526 }
27527 impl Clone for CResult_BlindedHopDecodeErrorZ {
27528         fn clone(&self) -> Self {
27529                 if self.result_ok {
27530                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
27531                                 result: Box::into_raw(Box::new(<crate::lightning::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
27532                         } }
27533                 } else {
27534                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
27535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27536                         } }
27537                 }
27538         }
27539 }
27540 #[no_mangle]
27541 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
27542 /// but with all dynamically-allocated buffers duplicated in new buffers.
27543 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
27544 #[repr(C)]
27545 /// The contents of CResult_InvoiceErrorDecodeErrorZ
27546 pub union CResult_InvoiceErrorDecodeErrorZPtr {
27547         /// A pointer to the contents in the success state.
27548         /// Reading from this pointer when `result_ok` is not set is undefined.
27549         pub result: *mut crate::lightning::offers::invoice_error::InvoiceError,
27550         /// A pointer to the contents in the error state.
27551         /// Reading from this pointer when `result_ok` is set is undefined.
27552         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27553 }
27554 #[repr(C)]
27555 /// A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation,
27556 /// containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure.
27557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27558 pub struct CResult_InvoiceErrorDecodeErrorZ {
27559         /// The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either
27560         /// `err` or `result` depending on the state of `result_ok`.
27561         pub contents: CResult_InvoiceErrorDecodeErrorZPtr,
27562         /// Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state.
27563         pub result_ok: bool,
27564 }
27565 #[no_mangle]
27566 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state.
27567 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_ok(o: crate::lightning::offers::invoice_error::InvoiceError) -> CResult_InvoiceErrorDecodeErrorZ {
27568         CResult_InvoiceErrorDecodeErrorZ {
27569                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
27570                         result: Box::into_raw(Box::new(o)),
27571                 },
27572                 result_ok: true,
27573         }
27574 }
27575 #[no_mangle]
27576 /// Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state.
27577 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceErrorDecodeErrorZ {
27578         CResult_InvoiceErrorDecodeErrorZ {
27579                 contents: CResult_InvoiceErrorDecodeErrorZPtr {
27580                         err: Box::into_raw(Box::new(e)),
27581                 },
27582                 result_ok: false,
27583         }
27584 }
27585 /// Checks if the given object is currently in the success state
27586 #[no_mangle]
27587 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_is_ok(o: &CResult_InvoiceErrorDecodeErrorZ) -> bool {
27588         o.result_ok
27589 }
27590 #[no_mangle]
27591 /// Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ.
27592 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_free(_res: CResult_InvoiceErrorDecodeErrorZ) { }
27593 impl Drop for CResult_InvoiceErrorDecodeErrorZ {
27594         fn drop(&mut self) {
27595                 if self.result_ok {
27596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27598                         }
27599                 } else {
27600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27602                         }
27603                 }
27604         }
27605 }
27606 impl From<crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceErrorDecodeErrorZ {
27607         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::offers::invoice_error::InvoiceError, crate::lightning::ln::msgs::DecodeError>) -> Self {
27608                 let contents = if o.result_ok {
27609                         let result = unsafe { o.contents.result };
27610                         unsafe { o.contents.result = core::ptr::null_mut() };
27611                         CResult_InvoiceErrorDecodeErrorZPtr { result }
27612                 } else {
27613                         let err = unsafe { o.contents.err };
27614                         unsafe { o.contents.err = core::ptr::null_mut(); }
27615                         CResult_InvoiceErrorDecodeErrorZPtr { err }
27616                 };
27617                 Self {
27618                         contents,
27619                         result_ok: o.result_ok,
27620                 }
27621         }
27622 }
27623 impl Clone for CResult_InvoiceErrorDecodeErrorZ {
27624         fn clone(&self) -> Self {
27625                 if self.result_ok {
27626                         Self { result_ok: true, contents: CResult_InvoiceErrorDecodeErrorZPtr {
27627                                 result: Box::into_raw(Box::new(<crate::lightning::offers::invoice_error::InvoiceError>::clone(unsafe { &*self.contents.result })))
27628                         } }
27629                 } else {
27630                         Self { result_ok: false, contents: CResult_InvoiceErrorDecodeErrorZPtr {
27631                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27632                         } }
27633                 }
27634         }
27635 }
27636 #[no_mangle]
27637 /// Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig`
27638 /// but with all dynamically-allocated buffers duplicated in new buffers.
27639 pub extern "C" fn CResult_InvoiceErrorDecodeErrorZ_clone(orig: &CResult_InvoiceErrorDecodeErrorZ) -> CResult_InvoiceErrorDecodeErrorZ { Clone::clone(&orig) }
27640 #[repr(C)]
27641 /// The contents of CResult_TrackedSpendableOutputDecodeErrorZ
27642 pub union CResult_TrackedSpendableOutputDecodeErrorZPtr {
27643         /// A pointer to the contents in the success state.
27644         /// Reading from this pointer when `result_ok` is not set is undefined.
27645         pub result: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
27646         /// A pointer to the contents in the error state.
27647         /// Reading from this pointer when `result_ok` is set is undefined.
27648         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27649 }
27650 #[repr(C)]
27651 /// A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation,
27652 /// containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure.
27653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27654 pub struct CResult_TrackedSpendableOutputDecodeErrorZ {
27655         /// The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either
27656         /// `err` or `result` depending on the state of `result_ok`.
27657         pub contents: CResult_TrackedSpendableOutputDecodeErrorZPtr,
27658         /// Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state.
27659         pub result_ok: bool,
27660 }
27661 #[no_mangle]
27662 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state.
27663 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_ok(o: crate::lightning::util::sweep::TrackedSpendableOutput) -> CResult_TrackedSpendableOutputDecodeErrorZ {
27664         CResult_TrackedSpendableOutputDecodeErrorZ {
27665                 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27666                         result: Box::into_raw(Box::new(o)),
27667                 },
27668                 result_ok: true,
27669         }
27670 }
27671 #[no_mangle]
27672 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state.
27673 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrackedSpendableOutputDecodeErrorZ {
27674         CResult_TrackedSpendableOutputDecodeErrorZ {
27675                 contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27676                         err: Box::into_raw(Box::new(e)),
27677                 },
27678                 result_ok: false,
27679         }
27680 }
27681 /// Checks if the given object is currently in the success state
27682 #[no_mangle]
27683 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o: &CResult_TrackedSpendableOutputDecodeErrorZ) -> bool {
27684         o.result_ok
27685 }
27686 #[no_mangle]
27687 /// Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ.
27688 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_free(_res: CResult_TrackedSpendableOutputDecodeErrorZ) { }
27689 impl Drop for CResult_TrackedSpendableOutputDecodeErrorZ {
27690         fn drop(&mut self) {
27691                 if self.result_ok {
27692                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27693                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27694                         }
27695                 } else {
27696                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27697                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27698                         }
27699                 }
27700         }
27701 }
27702 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>> for CResult_TrackedSpendableOutputDecodeErrorZ {
27703         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::TrackedSpendableOutput, crate::lightning::ln::msgs::DecodeError>) -> Self {
27704                 let contents = if o.result_ok {
27705                         let result = unsafe { o.contents.result };
27706                         unsafe { o.contents.result = core::ptr::null_mut() };
27707                         CResult_TrackedSpendableOutputDecodeErrorZPtr { result }
27708                 } else {
27709                         let err = unsafe { o.contents.err };
27710                         unsafe { o.contents.err = core::ptr::null_mut(); }
27711                         CResult_TrackedSpendableOutputDecodeErrorZPtr { err }
27712                 };
27713                 Self {
27714                         contents,
27715                         result_ok: o.result_ok,
27716                 }
27717         }
27718 }
27719 impl Clone for CResult_TrackedSpendableOutputDecodeErrorZ {
27720         fn clone(&self) -> Self {
27721                 if self.result_ok {
27722                         Self { result_ok: true, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27723                                 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::TrackedSpendableOutput>::clone(unsafe { &*self.contents.result })))
27724                         } }
27725                 } else {
27726                         Self { result_ok: false, contents: CResult_TrackedSpendableOutputDecodeErrorZPtr {
27727                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27728                         } }
27729                 }
27730         }
27731 }
27732 #[no_mangle]
27733 /// Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig`
27734 /// but with all dynamically-allocated buffers duplicated in new buffers.
27735 pub extern "C" fn CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig: &CResult_TrackedSpendableOutputDecodeErrorZ) -> CResult_TrackedSpendableOutputDecodeErrorZ { Clone::clone(&orig) }
27736 #[repr(C)]
27737 /// The contents of CResult_OutputSpendStatusDecodeErrorZ
27738 pub union CResult_OutputSpendStatusDecodeErrorZPtr {
27739         /// A pointer to the contents in the success state.
27740         /// Reading from this pointer when `result_ok` is not set is undefined.
27741         pub result: *mut crate::lightning::util::sweep::OutputSpendStatus,
27742         /// A pointer to the contents in the error state.
27743         /// Reading from this pointer when `result_ok` is set is undefined.
27744         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27745 }
27746 #[repr(C)]
27747 /// A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation,
27748 /// containing a crate::lightning::util::sweep::OutputSpendStatus on success and a crate::lightning::ln::msgs::DecodeError on failure.
27749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27750 pub struct CResult_OutputSpendStatusDecodeErrorZ {
27751         /// The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either
27752         /// `err` or `result` depending on the state of `result_ok`.
27753         pub contents: CResult_OutputSpendStatusDecodeErrorZPtr,
27754         /// Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state.
27755         pub result_ok: bool,
27756 }
27757 #[no_mangle]
27758 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state.
27759 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSpendStatus) -> CResult_OutputSpendStatusDecodeErrorZ {
27760         CResult_OutputSpendStatusDecodeErrorZ {
27761                 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27762                         result: Box::into_raw(Box::new(o)),
27763                 },
27764                 result_ok: true,
27765         }
27766 }
27767 #[no_mangle]
27768 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state.
27769 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSpendStatusDecodeErrorZ {
27770         CResult_OutputSpendStatusDecodeErrorZ {
27771                 contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27772                         err: Box::into_raw(Box::new(e)),
27773                 },
27774                 result_ok: false,
27775         }
27776 }
27777 /// Checks if the given object is currently in the success state
27778 #[no_mangle]
27779 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_is_ok(o: &CResult_OutputSpendStatusDecodeErrorZ) -> bool {
27780         o.result_ok
27781 }
27782 #[no_mangle]
27783 /// Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ.
27784 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_free(_res: CResult_OutputSpendStatusDecodeErrorZ) { }
27785 impl Drop for CResult_OutputSpendStatusDecodeErrorZ {
27786         fn drop(&mut self) {
27787                 if self.result_ok {
27788                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27789                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27790                         }
27791                 } else {
27792                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27793                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27794                         }
27795                 }
27796         }
27797 }
27798 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSpendStatusDecodeErrorZ {
27799         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSpendStatus, crate::lightning::ln::msgs::DecodeError>) -> Self {
27800                 let contents = if o.result_ok {
27801                         let result = unsafe { o.contents.result };
27802                         unsafe { o.contents.result = core::ptr::null_mut() };
27803                         CResult_OutputSpendStatusDecodeErrorZPtr { result }
27804                 } else {
27805                         let err = unsafe { o.contents.err };
27806                         unsafe { o.contents.err = core::ptr::null_mut(); }
27807                         CResult_OutputSpendStatusDecodeErrorZPtr { err }
27808                 };
27809                 Self {
27810                         contents,
27811                         result_ok: o.result_ok,
27812                 }
27813         }
27814 }
27815 impl Clone for CResult_OutputSpendStatusDecodeErrorZ {
27816         fn clone(&self) -> Self {
27817                 if self.result_ok {
27818                         Self { result_ok: true, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27819                                 result: Box::into_raw(Box::new(<crate::lightning::util::sweep::OutputSpendStatus>::clone(unsafe { &*self.contents.result })))
27820                         } }
27821                 } else {
27822                         Self { result_ok: false, contents: CResult_OutputSpendStatusDecodeErrorZPtr {
27823                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
27824                         } }
27825                 }
27826         }
27827 }
27828 #[no_mangle]
27829 /// Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig`
27830 /// but with all dynamically-allocated buffers duplicated in new buffers.
27831 pub extern "C" fn CResult_OutputSpendStatusDecodeErrorZ_clone(orig: &CResult_OutputSpendStatusDecodeErrorZ) -> CResult_OutputSpendStatusDecodeErrorZ { Clone::clone(&orig) }
27832 #[repr(C)]
27833 /// An enum which can either contain a crate::lightning::chain::Filter or not
27834 pub enum COption_FilterZ {
27835         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
27836         Some(crate::lightning::chain::Filter),
27837         /// When we're in this state, this COption_FilterZ contains nothing
27838         None
27839 }
27840 impl COption_FilterZ {
27841         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
27842                 if let Self::None = self { false } else { true }
27843         }
27844         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
27845                 !self.is_some()
27846         }
27847         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
27848                 if let Self::Some(v) = self { v } else { unreachable!() }
27849         }
27850 }
27851 #[no_mangle]
27852 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
27853 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
27854         COption_FilterZ::Some(o)
27855 }
27856 #[no_mangle]
27857 /// Constructs a new COption_FilterZ containing nothing
27858 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
27859         COption_FilterZ::None
27860 }
27861 #[no_mangle]
27862 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
27863 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
27864 #[repr(C)]
27865 /// A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size.
27866 /// This corresponds to std::vector in C++
27867 pub struct CVec_TrackedSpendableOutputZ {
27868         /// The elements in the array.
27869         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
27870         pub data: *mut crate::lightning::util::sweep::TrackedSpendableOutput,
27871         /// The number of elements pointed to by `data`.
27872         pub datalen: usize
27873 }
27874 impl CVec_TrackedSpendableOutputZ {
27875         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::sweep::TrackedSpendableOutput> {
27876                 if self.datalen == 0 { return Vec::new(); }
27877                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
27878                 self.data = core::ptr::null_mut();
27879                 self.datalen = 0;
27880                 ret
27881         }
27882         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::sweep::TrackedSpendableOutput] {
27883                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
27884         }
27885 }
27886 impl From<Vec<crate::lightning::util::sweep::TrackedSpendableOutput>> for CVec_TrackedSpendableOutputZ {
27887         fn from(v: Vec<crate::lightning::util::sweep::TrackedSpendableOutput>) -> Self {
27888                 let datalen = v.len();
27889                 let data = Box::into_raw(v.into_boxed_slice());
27890                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
27891         }
27892 }
27893 #[no_mangle]
27894 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
27895 pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableOutputZ) { }
27896 impl Drop for CVec_TrackedSpendableOutputZ {
27897         fn drop(&mut self) {
27898                 if self.datalen == 0 { return; }
27899                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
27900         }
27901 }
27902 impl Clone for CVec_TrackedSpendableOutputZ {
27903         fn clone(&self) -> Self {
27904                 let mut res = Vec::new();
27905                 if self.datalen == 0 { return Self::from(res); }
27906                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
27907                 Self::from(res)
27908         }
27909 }
27910 #[repr(C)]
27911 /// The contents of CResult_OutputSweeperDecodeErrorZ
27912 pub union CResult_OutputSweeperDecodeErrorZPtr {
27913         /// A pointer to the contents in the success state.
27914         /// Reading from this pointer when `result_ok` is not set is undefined.
27915         pub result: *mut crate::lightning::util::sweep::OutputSweeper,
27916         /// A pointer to the contents in the error state.
27917         /// Reading from this pointer when `result_ok` is set is undefined.
27918         pub err: *mut crate::lightning::ln::msgs::DecodeError,
27919 }
27920 #[repr(C)]
27921 /// A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation,
27922 /// containing a crate::lightning::util::sweep::OutputSweeper on success and a crate::lightning::ln::msgs::DecodeError on failure.
27923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
27924 pub struct CResult_OutputSweeperDecodeErrorZ {
27925         /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either
27926         /// `err` or `result` depending on the state of `result_ok`.
27927         pub contents: CResult_OutputSweeperDecodeErrorZPtr,
27928         /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state.
27929         pub result_ok: bool,
27930 }
27931 #[no_mangle]
27932 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
27933 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ {
27934         CResult_OutputSweeperDecodeErrorZ {
27935                 contents: CResult_OutputSweeperDecodeErrorZPtr {
27936                         result: Box::into_raw(Box::new(o)),
27937                 },
27938                 result_ok: true,
27939         }
27940 }
27941 #[no_mangle]
27942 /// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
27943 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ {
27944         CResult_OutputSweeperDecodeErrorZ {
27945                 contents: CResult_OutputSweeperDecodeErrorZPtr {
27946                         err: Box::into_raw(Box::new(e)),
27947                 },
27948                 result_ok: false,
27949         }
27950 }
27951 /// Checks if the given object is currently in the success state
27952 #[no_mangle]
27953 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool {
27954         o.result_ok
27955 }
27956 #[no_mangle]
27957 /// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ.
27958 pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { }
27959 impl Drop for CResult_OutputSweeperDecodeErrorZ {
27960         fn drop(&mut self) {
27961                 if self.result_ok {
27962                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
27963                                 let _ = unsafe { Box::from_raw(self.contents.result) };
27964                         }
27965                 } else {
27966                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
27967                                 let _ = unsafe { Box::from_raw(self.contents.err) };
27968                         }
27969                 }
27970         }
27971 }
27972 impl From<crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>> for CResult_OutputSweeperDecodeErrorZ {
27973         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::sweep::OutputSweeper, crate::lightning::ln::msgs::DecodeError>) -> Self {
27974                 let contents = if o.result_ok {
27975                         let result = unsafe { o.contents.result };
27976                         unsafe { o.contents.result = core::ptr::null_mut() };
27977                         CResult_OutputSweeperDecodeErrorZPtr { result }
27978                 } else {
27979                         let err = unsafe { o.contents.err };
27980                         unsafe { o.contents.err = core::ptr::null_mut(); }
27981                         CResult_OutputSweeperDecodeErrorZPtr { err }
27982                 };
27983                 Self {
27984                         contents,
27985                         result_ok: o.result_ok,
27986                 }
27987         }
27988 }
27989 #[repr(C)]
27990 /// A tuple of 2 elements. See the individual fields for the types contained.
27991 pub struct C2Tuple_BestBlockOutputSweeperZ {
27992         /// The element at position 0
27993         pub a: crate::lightning::chain::BestBlock,
27994         /// The element at position 1
27995         pub b: crate::lightning::util::sweep::OutputSweeper,
27996 }
27997 impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ {
27998         fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self {
27999                 Self {
28000                         a: tup.0,
28001                         b: tup.1,
28002                 }
28003         }
28004 }
28005 impl C2Tuple_BestBlockOutputSweeperZ {
28006         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) {
28007                 (self.a, self.b)
28008         }
28009 }
28010 /// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements.
28011 #[no_mangle]
28012 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ {
28013         C2Tuple_BestBlockOutputSweeperZ { a, b, }
28014 }
28015
28016 #[no_mangle]
28017 /// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ.
28018 pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { }
28019 #[repr(C)]
28020 /// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ
28021 pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
28022         /// A pointer to the contents in the success state.
28023         /// Reading from this pointer when `result_ok` is not set is undefined.
28024         pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ,
28025         /// A pointer to the contents in the error state.
28026         /// Reading from this pointer when `result_ok` is set is undefined.
28027         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28028 }
28029 #[repr(C)]
28030 /// A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation,
28031 /// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
28032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28033 pub struct CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28034         /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either
28035         /// `err` or `result` depending on the state of `result_ok`.
28036         pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr,
28037         /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state.
28038         pub result_ok: bool,
28039 }
28040 #[no_mangle]
28041 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state.
28042 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28043         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28044                 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
28045                         result: Box::into_raw(Box::new(o)),
28046                 },
28047                 result_ok: true,
28048         }
28049 }
28050 #[no_mangle]
28051 /// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state.
28052 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28053         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28054                 contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr {
28055                         err: Box::into_raw(Box::new(e)),
28056                 },
28057                 result_ok: false,
28058         }
28059 }
28060 /// Checks if the given object is currently in the success state
28061 #[no_mangle]
28062 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool {
28063         o.result_ok
28064 }
28065 #[no_mangle]
28066 /// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ.
28067 pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { }
28068 impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28069         fn drop(&mut self) {
28070                 if self.result_ok {
28071                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28072                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28073                         }
28074                 } else {
28075                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28076                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28077                         }
28078                 }
28079         }
28080 }
28081 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ {
28082         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
28083                 let contents = if o.result_ok {
28084                         let result = unsafe { o.contents.result };
28085                         unsafe { o.contents.result = core::ptr::null_mut() };
28086                         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { result }
28087                 } else {
28088                         let err = unsafe { o.contents.err };
28089                         unsafe { o.contents.err = core::ptr::null_mut(); }
28090                         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err }
28091                 };
28092                 Self {
28093                         contents,
28094                         result_ok: o.result_ok,
28095                 }
28096         }
28097 }
28098 #[repr(C)]
28099 /// The contents of CResult_DelayedPaymentBasepointDecodeErrorZ
28100 pub union CResult_DelayedPaymentBasepointDecodeErrorZPtr {
28101         /// A pointer to the contents in the success state.
28102         /// Reading from this pointer when `result_ok` is not set is undefined.
28103         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentBasepoint,
28104         /// A pointer to the contents in the error state.
28105         /// Reading from this pointer when `result_ok` is set is undefined.
28106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28107 }
28108 #[repr(C)]
28109 /// A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation,
28110 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
28111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28112 pub struct CResult_DelayedPaymentBasepointDecodeErrorZ {
28113         /// The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either
28114         /// `err` or `result` depending on the state of `result_ok`.
28115         pub contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr,
28116         /// Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state.
28117         pub result_ok: bool,
28118 }
28119 #[no_mangle]
28120 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state.
28121 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
28122         CResult_DelayedPaymentBasepointDecodeErrorZ {
28123                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
28124                         result: Box::into_raw(Box::new(o)),
28125                 },
28126                 result_ok: true,
28127         }
28128 }
28129 #[no_mangle]
28130 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state.
28131 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentBasepointDecodeErrorZ {
28132         CResult_DelayedPaymentBasepointDecodeErrorZ {
28133                 contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
28134                         err: Box::into_raw(Box::new(e)),
28135                 },
28136                 result_ok: false,
28137         }
28138 }
28139 /// Checks if the given object is currently in the success state
28140 #[no_mangle]
28141 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> bool {
28142         o.result_ok
28143 }
28144 #[no_mangle]
28145 /// Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ.
28146 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res: CResult_DelayedPaymentBasepointDecodeErrorZ) { }
28147 impl Drop for CResult_DelayedPaymentBasepointDecodeErrorZ {
28148         fn drop(&mut self) {
28149                 if self.result_ok {
28150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28152                         }
28153                 } else {
28154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28156                         }
28157                 }
28158         }
28159 }
28160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentBasepointDecodeErrorZ {
28161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
28162                 let contents = if o.result_ok {
28163                         let result = unsafe { o.contents.result };
28164                         unsafe { o.contents.result = core::ptr::null_mut() };
28165                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { result }
28166                 } else {
28167                         let err = unsafe { o.contents.err };
28168                         unsafe { o.contents.err = core::ptr::null_mut(); }
28169                         CResult_DelayedPaymentBasepointDecodeErrorZPtr { err }
28170                 };
28171                 Self {
28172                         contents,
28173                         result_ok: o.result_ok,
28174                 }
28175         }
28176 }
28177 impl Clone for CResult_DelayedPaymentBasepointDecodeErrorZ {
28178         fn clone(&self) -> Self {
28179                 if self.result_ok {
28180                         Self { result_ok: true, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
28181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentBasepoint>::clone(unsafe { &*self.contents.result })))
28182                         } }
28183                 } else {
28184                         Self { result_ok: false, contents: CResult_DelayedPaymentBasepointDecodeErrorZPtr {
28185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28186                         } }
28187                 }
28188         }
28189 }
28190 #[no_mangle]
28191 /// Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig`
28192 /// but with all dynamically-allocated buffers duplicated in new buffers.
28193 pub extern "C" fn CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig: &CResult_DelayedPaymentBasepointDecodeErrorZ) -> CResult_DelayedPaymentBasepointDecodeErrorZ { Clone::clone(&orig) }
28194 #[repr(C)]
28195 /// The contents of CResult_DelayedPaymentKeyDecodeErrorZ
28196 pub union CResult_DelayedPaymentKeyDecodeErrorZPtr {
28197         /// A pointer to the contents in the success state.
28198         /// Reading from this pointer when `result_ok` is not set is undefined.
28199         pub result: *mut crate::lightning::ln::channel_keys::DelayedPaymentKey,
28200         /// A pointer to the contents in the error state.
28201         /// Reading from this pointer when `result_ok` is set is undefined.
28202         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28203 }
28204 #[repr(C)]
28205 /// A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation,
28206 /// containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
28207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28208 pub struct CResult_DelayedPaymentKeyDecodeErrorZ {
28209         /// The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either
28210         /// `err` or `result` depending on the state of `result_ok`.
28211         pub contents: CResult_DelayedPaymentKeyDecodeErrorZPtr,
28212         /// Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state.
28213         pub result_ok: bool,
28214 }
28215 #[no_mangle]
28216 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state.
28217 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::DelayedPaymentKey) -> CResult_DelayedPaymentKeyDecodeErrorZ {
28218         CResult_DelayedPaymentKeyDecodeErrorZ {
28219                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28220                         result: Box::into_raw(Box::new(o)),
28221                 },
28222                 result_ok: true,
28223         }
28224 }
28225 #[no_mangle]
28226 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state.
28227 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentKeyDecodeErrorZ {
28228         CResult_DelayedPaymentKeyDecodeErrorZ {
28229                 contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28230                         err: Box::into_raw(Box::new(e)),
28231                 },
28232                 result_ok: false,
28233         }
28234 }
28235 /// Checks if the given object is currently in the success state
28236 #[no_mangle]
28237 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentKeyDecodeErrorZ) -> bool {
28238         o.result_ok
28239 }
28240 #[no_mangle]
28241 /// Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ.
28242 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_free(_res: CResult_DelayedPaymentKeyDecodeErrorZ) { }
28243 impl Drop for CResult_DelayedPaymentKeyDecodeErrorZ {
28244         fn drop(&mut self) {
28245                 if self.result_ok {
28246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28248                         }
28249                 } else {
28250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28252                         }
28253                 }
28254         }
28255 }
28256 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentKeyDecodeErrorZ {
28257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::DelayedPaymentKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
28258                 let contents = if o.result_ok {
28259                         let result = unsafe { o.contents.result };
28260                         unsafe { o.contents.result = core::ptr::null_mut() };
28261                         CResult_DelayedPaymentKeyDecodeErrorZPtr { result }
28262                 } else {
28263                         let err = unsafe { o.contents.err };
28264                         unsafe { o.contents.err = core::ptr::null_mut(); }
28265                         CResult_DelayedPaymentKeyDecodeErrorZPtr { err }
28266                 };
28267                 Self {
28268                         contents,
28269                         result_ok: o.result_ok,
28270                 }
28271         }
28272 }
28273 impl Clone for CResult_DelayedPaymentKeyDecodeErrorZ {
28274         fn clone(&self) -> Self {
28275                 if self.result_ok {
28276                         Self { result_ok: true, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28277                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::DelayedPaymentKey>::clone(unsafe { &*self.contents.result })))
28278                         } }
28279                 } else {
28280                         Self { result_ok: false, contents: CResult_DelayedPaymentKeyDecodeErrorZPtr {
28281                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28282                         } }
28283                 }
28284         }
28285 }
28286 #[no_mangle]
28287 /// Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig`
28288 /// but with all dynamically-allocated buffers duplicated in new buffers.
28289 pub extern "C" fn CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig: &CResult_DelayedPaymentKeyDecodeErrorZ) -> CResult_DelayedPaymentKeyDecodeErrorZ { Clone::clone(&orig) }
28290 #[repr(C)]
28291 /// The contents of CResult_HtlcBasepointDecodeErrorZ
28292 pub union CResult_HtlcBasepointDecodeErrorZPtr {
28293         /// A pointer to the contents in the success state.
28294         /// Reading from this pointer when `result_ok` is not set is undefined.
28295         pub result: *mut crate::lightning::ln::channel_keys::HtlcBasepoint,
28296         /// A pointer to the contents in the error state.
28297         /// Reading from this pointer when `result_ok` is set is undefined.
28298         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28299 }
28300 #[repr(C)]
28301 /// A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation,
28302 /// containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
28303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28304 pub struct CResult_HtlcBasepointDecodeErrorZ {
28305         /// The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either
28306         /// `err` or `result` depending on the state of `result_ok`.
28307         pub contents: CResult_HtlcBasepointDecodeErrorZPtr,
28308         /// Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state.
28309         pub result_ok: bool,
28310 }
28311 #[no_mangle]
28312 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state.
28313 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcBasepoint) -> CResult_HtlcBasepointDecodeErrorZ {
28314         CResult_HtlcBasepointDecodeErrorZ {
28315                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
28316                         result: Box::into_raw(Box::new(o)),
28317                 },
28318                 result_ok: true,
28319         }
28320 }
28321 #[no_mangle]
28322 /// Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state.
28323 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcBasepointDecodeErrorZ {
28324         CResult_HtlcBasepointDecodeErrorZ {
28325                 contents: CResult_HtlcBasepointDecodeErrorZPtr {
28326                         err: Box::into_raw(Box::new(e)),
28327                 },
28328                 result_ok: false,
28329         }
28330 }
28331 /// Checks if the given object is currently in the success state
28332 #[no_mangle]
28333 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_is_ok(o: &CResult_HtlcBasepointDecodeErrorZ) -> bool {
28334         o.result_ok
28335 }
28336 #[no_mangle]
28337 /// Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ.
28338 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_free(_res: CResult_HtlcBasepointDecodeErrorZ) { }
28339 impl Drop for CResult_HtlcBasepointDecodeErrorZ {
28340         fn drop(&mut self) {
28341                 if self.result_ok {
28342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28344                         }
28345                 } else {
28346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28348                         }
28349                 }
28350         }
28351 }
28352 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcBasepointDecodeErrorZ {
28353         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
28354                 let contents = if o.result_ok {
28355                         let result = unsafe { o.contents.result };
28356                         unsafe { o.contents.result = core::ptr::null_mut() };
28357                         CResult_HtlcBasepointDecodeErrorZPtr { result }
28358                 } else {
28359                         let err = unsafe { o.contents.err };
28360                         unsafe { o.contents.err = core::ptr::null_mut(); }
28361                         CResult_HtlcBasepointDecodeErrorZPtr { err }
28362                 };
28363                 Self {
28364                         contents,
28365                         result_ok: o.result_ok,
28366                 }
28367         }
28368 }
28369 impl Clone for CResult_HtlcBasepointDecodeErrorZ {
28370         fn clone(&self) -> Self {
28371                 if self.result_ok {
28372                         Self { result_ok: true, contents: CResult_HtlcBasepointDecodeErrorZPtr {
28373                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcBasepoint>::clone(unsafe { &*self.contents.result })))
28374                         } }
28375                 } else {
28376                         Self { result_ok: false, contents: CResult_HtlcBasepointDecodeErrorZPtr {
28377                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28378                         } }
28379                 }
28380         }
28381 }
28382 #[no_mangle]
28383 /// Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig`
28384 /// but with all dynamically-allocated buffers duplicated in new buffers.
28385 pub extern "C" fn CResult_HtlcBasepointDecodeErrorZ_clone(orig: &CResult_HtlcBasepointDecodeErrorZ) -> CResult_HtlcBasepointDecodeErrorZ { Clone::clone(&orig) }
28386 #[repr(C)]
28387 /// The contents of CResult_HtlcKeyDecodeErrorZ
28388 pub union CResult_HtlcKeyDecodeErrorZPtr {
28389         /// A pointer to the contents in the success state.
28390         /// Reading from this pointer when `result_ok` is not set is undefined.
28391         pub result: *mut crate::lightning::ln::channel_keys::HtlcKey,
28392         /// A pointer to the contents in the error state.
28393         /// Reading from this pointer when `result_ok` is set is undefined.
28394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28395 }
28396 #[repr(C)]
28397 /// A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation,
28398 /// containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
28399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28400 pub struct CResult_HtlcKeyDecodeErrorZ {
28401         /// The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either
28402         /// `err` or `result` depending on the state of `result_ok`.
28403         pub contents: CResult_HtlcKeyDecodeErrorZPtr,
28404         /// Whether this CResult_HtlcKeyDecodeErrorZ represents a success state.
28405         pub result_ok: bool,
28406 }
28407 #[no_mangle]
28408 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the success state.
28409 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::HtlcKey) -> CResult_HtlcKeyDecodeErrorZ {
28410         CResult_HtlcKeyDecodeErrorZ {
28411                 contents: CResult_HtlcKeyDecodeErrorZPtr {
28412                         result: Box::into_raw(Box::new(o)),
28413                 },
28414                 result_ok: true,
28415         }
28416 }
28417 #[no_mangle]
28418 /// Creates a new CResult_HtlcKeyDecodeErrorZ in the error state.
28419 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HtlcKeyDecodeErrorZ {
28420         CResult_HtlcKeyDecodeErrorZ {
28421                 contents: CResult_HtlcKeyDecodeErrorZPtr {
28422                         err: Box::into_raw(Box::new(e)),
28423                 },
28424                 result_ok: false,
28425         }
28426 }
28427 /// Checks if the given object is currently in the success state
28428 #[no_mangle]
28429 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_is_ok(o: &CResult_HtlcKeyDecodeErrorZ) -> bool {
28430         o.result_ok
28431 }
28432 #[no_mangle]
28433 /// Frees any resources used by the CResult_HtlcKeyDecodeErrorZ.
28434 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_free(_res: CResult_HtlcKeyDecodeErrorZ) { }
28435 impl Drop for CResult_HtlcKeyDecodeErrorZ {
28436         fn drop(&mut self) {
28437                 if self.result_ok {
28438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28440                         }
28441                 } else {
28442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28444                         }
28445                 }
28446         }
28447 }
28448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>> for CResult_HtlcKeyDecodeErrorZ {
28449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::HtlcKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
28450                 let contents = if o.result_ok {
28451                         let result = unsafe { o.contents.result };
28452                         unsafe { o.contents.result = core::ptr::null_mut() };
28453                         CResult_HtlcKeyDecodeErrorZPtr { result }
28454                 } else {
28455                         let err = unsafe { o.contents.err };
28456                         unsafe { o.contents.err = core::ptr::null_mut(); }
28457                         CResult_HtlcKeyDecodeErrorZPtr { err }
28458                 };
28459                 Self {
28460                         contents,
28461                         result_ok: o.result_ok,
28462                 }
28463         }
28464 }
28465 impl Clone for CResult_HtlcKeyDecodeErrorZ {
28466         fn clone(&self) -> Self {
28467                 if self.result_ok {
28468                         Self { result_ok: true, contents: CResult_HtlcKeyDecodeErrorZPtr {
28469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::HtlcKey>::clone(unsafe { &*self.contents.result })))
28470                         } }
28471                 } else {
28472                         Self { result_ok: false, contents: CResult_HtlcKeyDecodeErrorZPtr {
28473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28474                         } }
28475                 }
28476         }
28477 }
28478 #[no_mangle]
28479 /// Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig`
28480 /// but with all dynamically-allocated buffers duplicated in new buffers.
28481 pub extern "C" fn CResult_HtlcKeyDecodeErrorZ_clone(orig: &CResult_HtlcKeyDecodeErrorZ) -> CResult_HtlcKeyDecodeErrorZ { Clone::clone(&orig) }
28482 #[repr(C)]
28483 /// The contents of CResult_RevocationBasepointDecodeErrorZ
28484 pub union CResult_RevocationBasepointDecodeErrorZPtr {
28485         /// A pointer to the contents in the success state.
28486         /// Reading from this pointer when `result_ok` is not set is undefined.
28487         pub result: *mut crate::lightning::ln::channel_keys::RevocationBasepoint,
28488         /// A pointer to the contents in the error state.
28489         /// Reading from this pointer when `result_ok` is set is undefined.
28490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28491 }
28492 #[repr(C)]
28493 /// A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation,
28494 /// containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
28495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28496 pub struct CResult_RevocationBasepointDecodeErrorZ {
28497         /// The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either
28498         /// `err` or `result` depending on the state of `result_ok`.
28499         pub contents: CResult_RevocationBasepointDecodeErrorZPtr,
28500         /// Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state.
28501         pub result_ok: bool,
28502 }
28503 #[no_mangle]
28504 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state.
28505 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationBasepoint) -> CResult_RevocationBasepointDecodeErrorZ {
28506         CResult_RevocationBasepointDecodeErrorZ {
28507                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
28508                         result: Box::into_raw(Box::new(o)),
28509                 },
28510                 result_ok: true,
28511         }
28512 }
28513 #[no_mangle]
28514 /// Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state.
28515 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationBasepointDecodeErrorZ {
28516         CResult_RevocationBasepointDecodeErrorZ {
28517                 contents: CResult_RevocationBasepointDecodeErrorZPtr {
28518                         err: Box::into_raw(Box::new(e)),
28519                 },
28520                 result_ok: false,
28521         }
28522 }
28523 /// Checks if the given object is currently in the success state
28524 #[no_mangle]
28525 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_is_ok(o: &CResult_RevocationBasepointDecodeErrorZ) -> bool {
28526         o.result_ok
28527 }
28528 #[no_mangle]
28529 /// Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ.
28530 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_free(_res: CResult_RevocationBasepointDecodeErrorZ) { }
28531 impl Drop for CResult_RevocationBasepointDecodeErrorZ {
28532         fn drop(&mut self) {
28533                 if self.result_ok {
28534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28536                         }
28537                 } else {
28538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28540                         }
28541                 }
28542         }
28543 }
28544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationBasepointDecodeErrorZ {
28545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationBasepoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
28546                 let contents = if o.result_ok {
28547                         let result = unsafe { o.contents.result };
28548                         unsafe { o.contents.result = core::ptr::null_mut() };
28549                         CResult_RevocationBasepointDecodeErrorZPtr { result }
28550                 } else {
28551                         let err = unsafe { o.contents.err };
28552                         unsafe { o.contents.err = core::ptr::null_mut(); }
28553                         CResult_RevocationBasepointDecodeErrorZPtr { err }
28554                 };
28555                 Self {
28556                         contents,
28557                         result_ok: o.result_ok,
28558                 }
28559         }
28560 }
28561 impl Clone for CResult_RevocationBasepointDecodeErrorZ {
28562         fn clone(&self) -> Self {
28563                 if self.result_ok {
28564                         Self { result_ok: true, contents: CResult_RevocationBasepointDecodeErrorZPtr {
28565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationBasepoint>::clone(unsafe { &*self.contents.result })))
28566                         } }
28567                 } else {
28568                         Self { result_ok: false, contents: CResult_RevocationBasepointDecodeErrorZPtr {
28569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28570                         } }
28571                 }
28572         }
28573 }
28574 #[no_mangle]
28575 /// Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig`
28576 /// but with all dynamically-allocated buffers duplicated in new buffers.
28577 pub extern "C" fn CResult_RevocationBasepointDecodeErrorZ_clone(orig: &CResult_RevocationBasepointDecodeErrorZ) -> CResult_RevocationBasepointDecodeErrorZ { Clone::clone(&orig) }
28578 #[repr(C)]
28579 /// The contents of CResult_RevocationKeyDecodeErrorZ
28580 pub union CResult_RevocationKeyDecodeErrorZPtr {
28581         /// A pointer to the contents in the success state.
28582         /// Reading from this pointer when `result_ok` is not set is undefined.
28583         pub result: *mut crate::lightning::ln::channel_keys::RevocationKey,
28584         /// A pointer to the contents in the error state.
28585         /// Reading from this pointer when `result_ok` is set is undefined.
28586         pub err: *mut crate::lightning::ln::msgs::DecodeError,
28587 }
28588 #[repr(C)]
28589 /// A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation,
28590 /// containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure.
28591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28592 pub struct CResult_RevocationKeyDecodeErrorZ {
28593         /// The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either
28594         /// `err` or `result` depending on the state of `result_ok`.
28595         pub contents: CResult_RevocationKeyDecodeErrorZPtr,
28596         /// Whether this CResult_RevocationKeyDecodeErrorZ represents a success state.
28597         pub result_ok: bool,
28598 }
28599 #[no_mangle]
28600 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the success state.
28601 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_ok(o: crate::lightning::ln::channel_keys::RevocationKey) -> CResult_RevocationKeyDecodeErrorZ {
28602         CResult_RevocationKeyDecodeErrorZ {
28603                 contents: CResult_RevocationKeyDecodeErrorZPtr {
28604                         result: Box::into_raw(Box::new(o)),
28605                 },
28606                 result_ok: true,
28607         }
28608 }
28609 #[no_mangle]
28610 /// Creates a new CResult_RevocationKeyDecodeErrorZ in the error state.
28611 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevocationKeyDecodeErrorZ {
28612         CResult_RevocationKeyDecodeErrorZ {
28613                 contents: CResult_RevocationKeyDecodeErrorZPtr {
28614                         err: Box::into_raw(Box::new(e)),
28615                 },
28616                 result_ok: false,
28617         }
28618 }
28619 /// Checks if the given object is currently in the success state
28620 #[no_mangle]
28621 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_is_ok(o: &CResult_RevocationKeyDecodeErrorZ) -> bool {
28622         o.result_ok
28623 }
28624 #[no_mangle]
28625 /// Frees any resources used by the CResult_RevocationKeyDecodeErrorZ.
28626 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_free(_res: CResult_RevocationKeyDecodeErrorZ) { }
28627 impl Drop for CResult_RevocationKeyDecodeErrorZ {
28628         fn drop(&mut self) {
28629                 if self.result_ok {
28630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28632                         }
28633                 } else {
28634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
28635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
28636                         }
28637                 }
28638         }
28639 }
28640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>> for CResult_RevocationKeyDecodeErrorZ {
28641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channel_keys::RevocationKey, crate::lightning::ln::msgs::DecodeError>) -> Self {
28642                 let contents = if o.result_ok {
28643                         let result = unsafe { o.contents.result };
28644                         unsafe { o.contents.result = core::ptr::null_mut() };
28645                         CResult_RevocationKeyDecodeErrorZPtr { result }
28646                 } else {
28647                         let err = unsafe { o.contents.err };
28648                         unsafe { o.contents.err = core::ptr::null_mut(); }
28649                         CResult_RevocationKeyDecodeErrorZPtr { err }
28650                 };
28651                 Self {
28652                         contents,
28653                         result_ok: o.result_ok,
28654                 }
28655         }
28656 }
28657 impl Clone for CResult_RevocationKeyDecodeErrorZ {
28658         fn clone(&self) -> Self {
28659                 if self.result_ok {
28660                         Self { result_ok: true, contents: CResult_RevocationKeyDecodeErrorZPtr {
28661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channel_keys::RevocationKey>::clone(unsafe { &*self.contents.result })))
28662                         } }
28663                 } else {
28664                         Self { result_ok: false, contents: CResult_RevocationKeyDecodeErrorZPtr {
28665                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
28666                         } }
28667                 }
28668         }
28669 }
28670 #[no_mangle]
28671 /// Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig`
28672 /// but with all dynamically-allocated buffers duplicated in new buffers.
28673 pub extern "C" fn CResult_RevocationKeyDecodeErrorZ_clone(orig: &CResult_RevocationKeyDecodeErrorZ) -> CResult_RevocationKeyDecodeErrorZ { Clone::clone(&orig) }
28674 #[repr(C)]
28675 /// The contents of CResult_LockedChannelMonitorNoneZ
28676 pub union CResult_LockedChannelMonitorNoneZPtr {
28677         /// A pointer to the contents in the success state.
28678         /// Reading from this pointer when `result_ok` is not set is undefined.
28679         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
28680         /// Note that this value is always NULL, as there are no contents in the Err variant
28681         pub err: *mut core::ffi::c_void,
28682 }
28683 #[repr(C)]
28684 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
28685 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
28686 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
28687 pub struct CResult_LockedChannelMonitorNoneZ {
28688         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
28689         /// `err` or `result` depending on the state of `result_ok`.
28690         pub contents: CResult_LockedChannelMonitorNoneZPtr,
28691         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
28692         pub result_ok: bool,
28693 }
28694 #[no_mangle]
28695 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
28696 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
28697         CResult_LockedChannelMonitorNoneZ {
28698                 contents: CResult_LockedChannelMonitorNoneZPtr {
28699                         result: Box::into_raw(Box::new(o)),
28700                 },
28701                 result_ok: true,
28702         }
28703 }
28704 #[no_mangle]
28705 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
28706 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
28707         CResult_LockedChannelMonitorNoneZ {
28708                 contents: CResult_LockedChannelMonitorNoneZPtr {
28709                         err: core::ptr::null_mut(),
28710                 },
28711                 result_ok: false,
28712         }
28713 }
28714 /// Checks if the given object is currently in the success state
28715 #[no_mangle]
28716 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
28717         o.result_ok
28718 }
28719 #[no_mangle]
28720 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
28721 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
28722 impl Drop for CResult_LockedChannelMonitorNoneZ {
28723         fn drop(&mut self) {
28724                 if self.result_ok {
28725                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
28726                                 let _ = unsafe { Box::from_raw(self.contents.result) };
28727                         }
28728                 } else {
28729                 }
28730         }
28731 }
28732 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
28733         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
28734                 let contents = if o.result_ok {
28735                         let result = unsafe { o.contents.result };
28736                         unsafe { o.contents.result = core::ptr::null_mut() };
28737                         CResult_LockedChannelMonitorNoneZPtr { result }
28738                 } else {
28739                         let _ = unsafe { Box::from_raw(o.contents.err) };
28740                         o.contents.err = core::ptr::null_mut();
28741                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
28742                 };
28743                 Self {
28744                         contents,
28745                         result_ok: o.result_ok,
28746                 }
28747         }
28748 }
28749 #[repr(C)]
28750 /// A tuple of 2 elements. See the individual fields for the types contained.
28751 pub struct C2Tuple_OutPointChannelIdZ {
28752         /// The element at position 0
28753         pub a: crate::lightning::chain::transaction::OutPoint,
28754         /// The element at position 1
28755         pub b: crate::lightning::ln::types::ChannelId,
28756 }
28757 impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)> for C2Tuple_OutPointChannelIdZ {
28758         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self {
28759                 Self {
28760                         a: tup.0,
28761                         b: tup.1,
28762                 }
28763         }
28764 }
28765 impl C2Tuple_OutPointChannelIdZ {
28766         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) {
28767                 (self.a, self.b)
28768         }
28769 }
28770 impl Clone for C2Tuple_OutPointChannelIdZ {
28771         fn clone(&self) -> Self {
28772                 Self {
28773                         a: Clone::clone(&self.a),
28774                         b: Clone::clone(&self.b),
28775                 }
28776         }
28777 }
28778 #[no_mangle]
28779 /// Creates a new tuple which has the same data as `orig`
28780 /// but with all dynamically-allocated buffers duplicated in new buffers.
28781 pub extern "C" fn C2Tuple_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) }
28782 /// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements.
28783 #[no_mangle]
28784 pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ {
28785         C2Tuple_OutPointChannelIdZ { a, b, }
28786 }
28787
28788 #[no_mangle]
28789 /// Frees any resources used by the C2Tuple_OutPointChannelIdZ.
28790 pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { }
28791 #[repr(C)]
28792 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size.
28793 /// This corresponds to std::vector in C++
28794 pub struct CVec_C2Tuple_OutPointChannelIdZZ {
28795         /// The elements in the array.
28796         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28797         pub data: *mut crate::c_types::derived::C2Tuple_OutPointChannelIdZ,
28798         /// The number of elements pointed to by `data`.
28799         pub datalen: usize
28800 }
28801 impl CVec_C2Tuple_OutPointChannelIdZZ {
28802         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ> {
28803                 if self.datalen == 0 { return Vec::new(); }
28804                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28805                 self.data = core::ptr::null_mut();
28806                 self.datalen = 0;
28807                 ret
28808         }
28809         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointChannelIdZ] {
28810                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28811         }
28812 }
28813 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>> for CVec_C2Tuple_OutPointChannelIdZZ {
28814         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointChannelIdZ>) -> Self {
28815                 let datalen = v.len();
28816                 let data = Box::into_raw(v.into_boxed_slice());
28817                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28818         }
28819 }
28820 #[no_mangle]
28821 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28822 pub extern "C" fn CVec_C2Tuple_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { }
28823 impl Drop for CVec_C2Tuple_OutPointChannelIdZZ {
28824         fn drop(&mut self) {
28825                 if self.datalen == 0 { return; }
28826                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28827         }
28828 }
28829 impl Clone for CVec_C2Tuple_OutPointChannelIdZZ {
28830         fn clone(&self) -> Self {
28831                 let mut res = Vec::new();
28832                 if self.datalen == 0 { return Self::from(res); }
28833                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28834                 Self::from(res)
28835         }
28836 }
28837 #[repr(C)]
28838 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
28839 /// This corresponds to std::vector in C++
28840 pub struct CVec_MonitorUpdateIdZ {
28841         /// The elements in the array.
28842         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28843         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
28844         /// The number of elements pointed to by `data`.
28845         pub datalen: usize
28846 }
28847 impl CVec_MonitorUpdateIdZ {
28848         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
28849                 if self.datalen == 0 { return Vec::new(); }
28850                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28851                 self.data = core::ptr::null_mut();
28852                 self.datalen = 0;
28853                 ret
28854         }
28855         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
28856                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28857         }
28858 }
28859 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
28860         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
28861                 let datalen = v.len();
28862                 let data = Box::into_raw(v.into_boxed_slice());
28863                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28864         }
28865 }
28866 #[no_mangle]
28867 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28868 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
28869 impl Drop for CVec_MonitorUpdateIdZ {
28870         fn drop(&mut self) {
28871                 if self.datalen == 0 { return; }
28872                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28873         }
28874 }
28875 impl Clone for CVec_MonitorUpdateIdZ {
28876         fn clone(&self) -> Self {
28877                 let mut res = Vec::new();
28878                 if self.datalen == 0 { return Self::from(res); }
28879                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28880                 Self::from(res)
28881         }
28882 }
28883 #[repr(C)]
28884 /// A tuple of 2 elements. See the individual fields for the types contained.
28885 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28886         /// The element at position 0
28887         pub a: crate::lightning::chain::transaction::OutPoint,
28888         /// The element at position 1
28889         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
28890 }
28891 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28892         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
28893                 Self {
28894                         a: tup.0,
28895                         b: tup.1,
28896                 }
28897         }
28898 }
28899 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28900         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
28901                 (self.a, self.b)
28902         }
28903 }
28904 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28905         fn clone(&self) -> Self {
28906                 Self {
28907                         a: Clone::clone(&self.a),
28908                         b: Clone::clone(&self.b),
28909                 }
28910         }
28911 }
28912 #[no_mangle]
28913 /// Creates a new tuple which has the same data as `orig`
28914 /// but with all dynamically-allocated buffers duplicated in new buffers.
28915 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
28916 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
28917 #[no_mangle]
28918 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
28919         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
28920 }
28921
28922 #[no_mangle]
28923 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
28924 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
28925 #[repr(C)]
28926 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
28927 /// This corresponds to std::vector in C++
28928 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28929         /// The elements in the array.
28930         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
28931         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
28932         /// The number of elements pointed to by `data`.
28933         pub datalen: usize
28934 }
28935 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28936         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
28937                 if self.datalen == 0 { return Vec::new(); }
28938                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
28939                 self.data = core::ptr::null_mut();
28940                 self.datalen = 0;
28941                 ret
28942         }
28943         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
28944                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
28945         }
28946 }
28947 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28948         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
28949                 let datalen = v.len();
28950                 let data = Box::into_raw(v.into_boxed_slice());
28951                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
28952         }
28953 }
28954 #[no_mangle]
28955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
28956 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
28957 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28958         fn drop(&mut self) {
28959                 if self.datalen == 0 { return; }
28960                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
28961         }
28962 }
28963 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
28964         fn clone(&self) -> Self {
28965                 let mut res = Vec::new();
28966                 if self.datalen == 0 { return Self::from(res); }
28967                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
28968                 Self::from(res)
28969         }
28970 }