Update auto-generated bindings to 0.0.113
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
12 pub enum COption_HTLCClaimZ {
13         /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
14         Some(crate::lightning::ln::chan_utils::HTLCClaim),
15         /// When we're in this state, this COption_HTLCClaimZ contains nothing
16         None
17 }
18 impl COption_HTLCClaimZ {
19         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
20                 if let Self::None = self { false } else { true }
21         }
22         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
23                 !self.is_some()
24         }
25         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim {
26                 if let Self::Some(v) = self { v } else { unreachable!() }
27         }
28 }
29 #[no_mangle]
30 /// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
31 pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ {
32         COption_HTLCClaimZ::Some(o)
33 }
34 #[no_mangle]
35 /// Constructs a new COption_HTLCClaimZ containing nothing
36 pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ {
37         COption_HTLCClaimZ::None
38 }
39 #[no_mangle]
40 /// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state
41 pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { }
42 #[repr(C)]
43 /// The contents of CResult_NoneNoneZ
44 pub union CResult_NoneNoneZPtr {
45         /// Note that this value is always NULL, as there are no contents in the OK variant
46         pub result: *mut core::ffi::c_void,
47         /// Note that this value is always NULL, as there are no contents in the Err variant
48         pub err: *mut core::ffi::c_void,
49 }
50 #[repr(C)]
51 /// A CResult_NoneNoneZ represents the result of a fallible operation,
52 /// containing a () on success and a () on failure.
53 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
54 pub struct CResult_NoneNoneZ {
55         /// The contents of this CResult_NoneNoneZ, accessible via either
56         /// `err` or `result` depending on the state of `result_ok`.
57         pub contents: CResult_NoneNoneZPtr,
58         /// Whether this CResult_NoneNoneZ represents a success state.
59         pub result_ok: bool,
60 }
61 #[no_mangle]
62 /// Creates a new CResult_NoneNoneZ in the success state.
63 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
64         CResult_NoneNoneZ {
65                 contents: CResult_NoneNoneZPtr {
66                         result: core::ptr::null_mut(),
67                 },
68                 result_ok: true,
69         }
70 }
71 #[no_mangle]
72 /// Creates a new CResult_NoneNoneZ in the error state.
73 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
74         CResult_NoneNoneZ {
75                 contents: CResult_NoneNoneZPtr {
76                         err: core::ptr::null_mut(),
77                 },
78                 result_ok: false,
79         }
80 }
81 /// Checks if the given object is currently in the success state
82 #[no_mangle]
83 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
84         o.result_ok
85 }
86 #[no_mangle]
87 /// Frees any resources used by the CResult_NoneNoneZ.
88 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
89 impl Drop for CResult_NoneNoneZ {
90         fn drop(&mut self) {
91                 if self.result_ok {
92                 } else {
93                 }
94         }
95 }
96 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
97         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
98                 let contents = if o.result_ok {
99                         let _ = unsafe { Box::from_raw(o.contents.result) };
100                         o.contents.result = core::ptr::null_mut();
101                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
102                 } else {
103                         let _ = unsafe { Box::from_raw(o.contents.err) };
104                         o.contents.err = core::ptr::null_mut();
105                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
106                 };
107                 Self {
108                         contents,
109                         result_ok: o.result_ok,
110                 }
111         }
112 }
113 impl Clone for CResult_NoneNoneZ {
114         fn clone(&self) -> Self {
115                 if self.result_ok {
116                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
117                                 result: core::ptr::null_mut()
118                         } }
119                 } else {
120                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
121                                 err: core::ptr::null_mut()
122                         } }
123                 }
124         }
125 }
126 #[no_mangle]
127 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
128 /// but with all dynamically-allocated buffers duplicated in new buffers.
129 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
130 #[repr(C)]
131 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
132 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
133         /// A pointer to the contents in the success state.
134         /// Reading from this pointer when `result_ok` is not set is undefined.
135         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
136         /// A pointer to the contents in the error state.
137         /// Reading from this pointer when `result_ok` is set is undefined.
138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
139 }
140 #[repr(C)]
141 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
142 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
144 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
145         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
146         /// `err` or `result` depending on the state of `result_ok`.
147         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
148         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
149         pub result_ok: bool,
150 }
151 #[no_mangle]
152 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
153 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
154         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
155                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
156                         result: Box::into_raw(Box::new(o)),
157                 },
158                 result_ok: true,
159         }
160 }
161 #[no_mangle]
162 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
163 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
164         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
165                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
166                         err: Box::into_raw(Box::new(e)),
167                 },
168                 result_ok: false,
169         }
170 }
171 /// Checks if the given object is currently in the success state
172 #[no_mangle]
173 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
174         o.result_ok
175 }
176 #[no_mangle]
177 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
178 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
179 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
180         fn drop(&mut self) {
181                 if self.result_ok {
182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
184                         }
185                 } else {
186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
188                         }
189                 }
190         }
191 }
192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
194                 let contents = if o.result_ok {
195                         let result = unsafe { o.contents.result };
196                         unsafe { o.contents.result = core::ptr::null_mut() };
197                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
198                 } else {
199                         let err = unsafe { o.contents.err };
200                         unsafe { o.contents.err = core::ptr::null_mut(); }
201                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
202                 };
203                 Self {
204                         contents,
205                         result_ok: o.result_ok,
206                 }
207         }
208 }
209 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
210         fn clone(&self) -> Self {
211                 if self.result_ok {
212                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
214                         } }
215                 } else {
216                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
218                         } }
219                 }
220         }
221 }
222 #[no_mangle]
223 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
224 /// but with all dynamically-allocated buffers duplicated in new buffers.
225 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
226 #[repr(C)]
227 /// The contents of CResult_TxCreationKeysDecodeErrorZ
228 pub union CResult_TxCreationKeysDecodeErrorZPtr {
229         /// A pointer to the contents in the success state.
230         /// Reading from this pointer when `result_ok` is not set is undefined.
231         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
232         /// A pointer to the contents in the error state.
233         /// Reading from this pointer when `result_ok` is set is undefined.
234         pub err: *mut crate::lightning::ln::msgs::DecodeError,
235 }
236 #[repr(C)]
237 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
238 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
240 pub struct CResult_TxCreationKeysDecodeErrorZ {
241         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
242         /// `err` or `result` depending on the state of `result_ok`.
243         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
244         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
245         pub result_ok: bool,
246 }
247 #[no_mangle]
248 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
249 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
250         CResult_TxCreationKeysDecodeErrorZ {
251                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
252                         result: Box::into_raw(Box::new(o)),
253                 },
254                 result_ok: true,
255         }
256 }
257 #[no_mangle]
258 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
259 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
260         CResult_TxCreationKeysDecodeErrorZ {
261                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
262                         err: Box::into_raw(Box::new(e)),
263                 },
264                 result_ok: false,
265         }
266 }
267 /// Checks if the given object is currently in the success state
268 #[no_mangle]
269 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
270         o.result_ok
271 }
272 #[no_mangle]
273 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
274 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
275 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
276         fn drop(&mut self) {
277                 if self.result_ok {
278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
280                         }
281                 } else {
282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
284                         }
285                 }
286         }
287 }
288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
290                 let contents = if o.result_ok {
291                         let result = unsafe { o.contents.result };
292                         unsafe { o.contents.result = core::ptr::null_mut() };
293                         CResult_TxCreationKeysDecodeErrorZPtr { result }
294                 } else {
295                         let err = unsafe { o.contents.err };
296                         unsafe { o.contents.err = core::ptr::null_mut(); }
297                         CResult_TxCreationKeysDecodeErrorZPtr { err }
298                 };
299                 Self {
300                         contents,
301                         result_ok: o.result_ok,
302                 }
303         }
304 }
305 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
306         fn clone(&self) -> Self {
307                 if self.result_ok {
308                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
309                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
310                         } }
311                 } else {
312                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
314                         } }
315                 }
316         }
317 }
318 #[no_mangle]
319 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
320 /// but with all dynamically-allocated buffers duplicated in new buffers.
321 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
322 #[repr(C)]
323 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
324 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
325         /// A pointer to the contents in the success state.
326         /// Reading from this pointer when `result_ok` is not set is undefined.
327         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
328         /// A pointer to the contents in the error state.
329         /// Reading from this pointer when `result_ok` is set is undefined.
330         pub err: *mut crate::lightning::ln::msgs::DecodeError,
331 }
332 #[repr(C)]
333 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
334 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
336 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
337         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
338         /// `err` or `result` depending on the state of `result_ok`.
339         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
340         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
341         pub result_ok: bool,
342 }
343 #[no_mangle]
344 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
345 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
346         CResult_ChannelPublicKeysDecodeErrorZ {
347                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
348                         result: Box::into_raw(Box::new(o)),
349                 },
350                 result_ok: true,
351         }
352 }
353 #[no_mangle]
354 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
355 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
356         CResult_ChannelPublicKeysDecodeErrorZ {
357                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
358                         err: Box::into_raw(Box::new(e)),
359                 },
360                 result_ok: false,
361         }
362 }
363 /// Checks if the given object is currently in the success state
364 #[no_mangle]
365 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
366         o.result_ok
367 }
368 #[no_mangle]
369 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
370 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
371 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
372         fn drop(&mut self) {
373                 if self.result_ok {
374                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
375                                 let _ = unsafe { Box::from_raw(self.contents.result) };
376                         }
377                 } else {
378                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
379                                 let _ = unsafe { Box::from_raw(self.contents.err) };
380                         }
381                 }
382         }
383 }
384 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
385         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
386                 let contents = if o.result_ok {
387                         let result = unsafe { o.contents.result };
388                         unsafe { o.contents.result = core::ptr::null_mut() };
389                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
390                 } else {
391                         let err = unsafe { o.contents.err };
392                         unsafe { o.contents.err = core::ptr::null_mut(); }
393                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
394                 };
395                 Self {
396                         contents,
397                         result_ok: o.result_ok,
398                 }
399         }
400 }
401 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
402         fn clone(&self) -> Self {
403                 if self.result_ok {
404                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
405                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
406                         } }
407                 } else {
408                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
409                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
410                         } }
411                 }
412         }
413 }
414 #[no_mangle]
415 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
416 /// but with all dynamically-allocated buffers duplicated in new buffers.
417 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
418 #[repr(C)]
419 #[derive(Clone)]
420 /// An enum which can either contain a u32 or not
421 pub enum COption_u32Z {
422         /// When we're in this state, this COption_u32Z contains a u32
423         Some(u32),
424         /// When we're in this state, this COption_u32Z contains nothing
425         None
426 }
427 impl COption_u32Z {
428         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
429                 if let Self::None = self { false } else { true }
430         }
431         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
432                 !self.is_some()
433         }
434         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
435                 if let Self::Some(v) = self { v } else { unreachable!() }
436         }
437 }
438 #[no_mangle]
439 /// Constructs a new COption_u32Z containing a u32
440 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
441         COption_u32Z::Some(o)
442 }
443 #[no_mangle]
444 /// Constructs a new COption_u32Z containing nothing
445 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
446         COption_u32Z::None
447 }
448 #[no_mangle]
449 /// Frees any resources associated with the u32, if we are in the Some state
450 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
451 #[no_mangle]
452 /// Creates a new COption_u32Z which has the same data as `orig`
453 /// but with all dynamically-allocated buffers duplicated in new buffers.
454 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
455 #[repr(C)]
456 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
457 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
458         /// A pointer to the contents in the success state.
459         /// Reading from this pointer when `result_ok` is not set is undefined.
460         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
461         /// A pointer to the contents in the error state.
462         /// Reading from this pointer when `result_ok` is set is undefined.
463         pub err: *mut crate::lightning::ln::msgs::DecodeError,
464 }
465 #[repr(C)]
466 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
467 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
469 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
470         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
471         /// `err` or `result` depending on the state of `result_ok`.
472         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
473         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
474         pub result_ok: bool,
475 }
476 #[no_mangle]
477 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
478 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
479         CResult_HTLCOutputInCommitmentDecodeErrorZ {
480                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
481                         result: Box::into_raw(Box::new(o)),
482                 },
483                 result_ok: true,
484         }
485 }
486 #[no_mangle]
487 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
488 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
489         CResult_HTLCOutputInCommitmentDecodeErrorZ {
490                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
491                         err: Box::into_raw(Box::new(e)),
492                 },
493                 result_ok: false,
494         }
495 }
496 /// Checks if the given object is currently in the success state
497 #[no_mangle]
498 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
499         o.result_ok
500 }
501 #[no_mangle]
502 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
503 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
504 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
505         fn drop(&mut self) {
506                 if self.result_ok {
507                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
508                                 let _ = unsafe { Box::from_raw(self.contents.result) };
509                         }
510                 } else {
511                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
512                                 let _ = unsafe { Box::from_raw(self.contents.err) };
513                         }
514                 }
515         }
516 }
517 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
518         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
519                 let contents = if o.result_ok {
520                         let result = unsafe { o.contents.result };
521                         unsafe { o.contents.result = core::ptr::null_mut() };
522                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
523                 } else {
524                         let err = unsafe { o.contents.err };
525                         unsafe { o.contents.err = core::ptr::null_mut(); }
526                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
527                 };
528                 Self {
529                         contents,
530                         result_ok: o.result_ok,
531                 }
532         }
533 }
534 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
535         fn clone(&self) -> Self {
536                 if self.result_ok {
537                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
538                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
539                         } }
540                 } else {
541                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
542                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
543                         } }
544                 }
545         }
546 }
547 #[no_mangle]
548 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
549 /// but with all dynamically-allocated buffers duplicated in new buffers.
550 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
551 #[repr(C)]
552 /// An enum which can either contain a  or not
553 pub enum COption_NoneZ {
554         /// When we're in this state, this COption_NoneZ contains a 
555         Some,
556         /// When we're in this state, this COption_NoneZ contains nothing
557         None
558 }
559 impl COption_NoneZ {
560         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
561                 if let Self::None = self { false } else { true }
562         }
563         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
564                 !self.is_some()
565         }
566 }
567 #[no_mangle]
568 /// Constructs a new COption_NoneZ containing a 
569 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
570         COption_NoneZ::Some
571 }
572 #[no_mangle]
573 /// Constructs a new COption_NoneZ containing nothing
574 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
575         COption_NoneZ::None
576 }
577 #[no_mangle]
578 /// Frees any resources associated with the , if we are in the Some state
579 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
580 #[repr(C)]
581 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
582 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
583         /// A pointer to the contents in the success state.
584         /// Reading from this pointer when `result_ok` is not set is undefined.
585         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
586         /// A pointer to the contents in the error state.
587         /// Reading from this pointer when `result_ok` is set is undefined.
588         pub err: *mut crate::lightning::ln::msgs::DecodeError,
589 }
590 #[repr(C)]
591 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
592 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
593 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
594 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
595         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
596         /// `err` or `result` depending on the state of `result_ok`.
597         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
598         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
599         pub result_ok: bool,
600 }
601 #[no_mangle]
602 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
603 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
604         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
605                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
606                         result: Box::into_raw(Box::new(o)),
607                 },
608                 result_ok: true,
609         }
610 }
611 #[no_mangle]
612 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
613 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
614         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
615                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
616                         err: Box::into_raw(Box::new(e)),
617                 },
618                 result_ok: false,
619         }
620 }
621 /// Checks if the given object is currently in the success state
622 #[no_mangle]
623 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
624         o.result_ok
625 }
626 #[no_mangle]
627 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
628 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
629 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
630         fn drop(&mut self) {
631                 if self.result_ok {
632                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
633                                 let _ = unsafe { Box::from_raw(self.contents.result) };
634                         }
635                 } else {
636                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
637                                 let _ = unsafe { Box::from_raw(self.contents.err) };
638                         }
639                 }
640         }
641 }
642 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
643         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
644                 let contents = if o.result_ok {
645                         let result = unsafe { o.contents.result };
646                         unsafe { o.contents.result = core::ptr::null_mut() };
647                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
648                 } else {
649                         let err = unsafe { o.contents.err };
650                         unsafe { o.contents.err = core::ptr::null_mut(); }
651                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
652                 };
653                 Self {
654                         contents,
655                         result_ok: o.result_ok,
656                 }
657         }
658 }
659 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660         fn clone(&self) -> Self {
661                 if self.result_ok {
662                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
663                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
664                         } }
665                 } else {
666                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
667                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
668                         } }
669                 }
670         }
671 }
672 #[no_mangle]
673 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
674 /// but with all dynamically-allocated buffers duplicated in new buffers.
675 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
676 #[repr(C)]
677 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
678 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
679         /// A pointer to the contents in the success state.
680         /// Reading from this pointer when `result_ok` is not set is undefined.
681         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
682         /// A pointer to the contents in the error state.
683         /// Reading from this pointer when `result_ok` is set is undefined.
684         pub err: *mut crate::lightning::ln::msgs::DecodeError,
685 }
686 #[repr(C)]
687 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
688 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
689 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
690 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
691         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
692         /// `err` or `result` depending on the state of `result_ok`.
693         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
694         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
695         pub result_ok: bool,
696 }
697 #[no_mangle]
698 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
699 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
700         CResult_ChannelTransactionParametersDecodeErrorZ {
701                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
702                         result: Box::into_raw(Box::new(o)),
703                 },
704                 result_ok: true,
705         }
706 }
707 #[no_mangle]
708 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
709 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
710         CResult_ChannelTransactionParametersDecodeErrorZ {
711                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
712                         err: Box::into_raw(Box::new(e)),
713                 },
714                 result_ok: false,
715         }
716 }
717 /// Checks if the given object is currently in the success state
718 #[no_mangle]
719 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
720         o.result_ok
721 }
722 #[no_mangle]
723 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
724 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
725 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
726         fn drop(&mut self) {
727                 if self.result_ok {
728                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
729                                 let _ = unsafe { Box::from_raw(self.contents.result) };
730                         }
731                 } else {
732                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
733                                 let _ = unsafe { Box::from_raw(self.contents.err) };
734                         }
735                 }
736         }
737 }
738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
739         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
740                 let contents = if o.result_ok {
741                         let result = unsafe { o.contents.result };
742                         unsafe { o.contents.result = core::ptr::null_mut() };
743                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
744                 } else {
745                         let err = unsafe { o.contents.err };
746                         unsafe { o.contents.err = core::ptr::null_mut(); }
747                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
748                 };
749                 Self {
750                         contents,
751                         result_ok: o.result_ok,
752                 }
753         }
754 }
755 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
756         fn clone(&self) -> Self {
757                 if self.result_ok {
758                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
759                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
760                         } }
761                 } else {
762                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
763                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
764                         } }
765                 }
766         }
767 }
768 #[no_mangle]
769 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
770 /// but with all dynamically-allocated buffers duplicated in new buffers.
771 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
772 #[repr(C)]
773 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
774 /// This corresponds to std::vector in C++
775 pub struct CVec_SignatureZ {
776         /// The elements in the array.
777         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
778         pub data: *mut crate::c_types::Signature,
779         /// The number of elements pointed to by `data`.
780         pub datalen: usize
781 }
782 impl CVec_SignatureZ {
783         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
784                 if self.datalen == 0 { return Vec::new(); }
785                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
786                 self.data = core::ptr::null_mut();
787                 self.datalen = 0;
788                 ret
789         }
790         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
791                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
792         }
793 }
794 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
795         fn from(v: Vec<crate::c_types::Signature>) -> Self {
796                 let datalen = v.len();
797                 let data = Box::into_raw(v.into_boxed_slice());
798                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
799         }
800 }
801 #[no_mangle]
802 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
803 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
804 impl Drop for CVec_SignatureZ {
805         fn drop(&mut self) {
806                 if self.datalen == 0 { return; }
807                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
808         }
809 }
810 impl Clone for CVec_SignatureZ {
811         fn clone(&self) -> Self {
812                 let mut res = Vec::new();
813                 if self.datalen == 0 { return Self::from(res); }
814                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
815                 Self::from(res)
816         }
817 }
818 #[repr(C)]
819 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
820 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
821         /// A pointer to the contents in the success state.
822         /// Reading from this pointer when `result_ok` is not set is undefined.
823         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
824         /// A pointer to the contents in the error state.
825         /// Reading from this pointer when `result_ok` is set is undefined.
826         pub err: *mut crate::lightning::ln::msgs::DecodeError,
827 }
828 #[repr(C)]
829 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
830 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
832 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
833         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
834         /// `err` or `result` depending on the state of `result_ok`.
835         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
836         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
837         pub result_ok: bool,
838 }
839 #[no_mangle]
840 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
841 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
842         CResult_HolderCommitmentTransactionDecodeErrorZ {
843                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
844                         result: Box::into_raw(Box::new(o)),
845                 },
846                 result_ok: true,
847         }
848 }
849 #[no_mangle]
850 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
851 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
852         CResult_HolderCommitmentTransactionDecodeErrorZ {
853                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
854                         err: Box::into_raw(Box::new(e)),
855                 },
856                 result_ok: false,
857         }
858 }
859 /// Checks if the given object is currently in the success state
860 #[no_mangle]
861 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
862         o.result_ok
863 }
864 #[no_mangle]
865 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
866 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
867 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
868         fn drop(&mut self) {
869                 if self.result_ok {
870                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
871                                 let _ = unsafe { Box::from_raw(self.contents.result) };
872                         }
873                 } else {
874                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
875                                 let _ = unsafe { Box::from_raw(self.contents.err) };
876                         }
877                 }
878         }
879 }
880 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
881         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
882                 let contents = if o.result_ok {
883                         let result = unsafe { o.contents.result };
884                         unsafe { o.contents.result = core::ptr::null_mut() };
885                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
886                 } else {
887                         let err = unsafe { o.contents.err };
888                         unsafe { o.contents.err = core::ptr::null_mut(); }
889                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
890                 };
891                 Self {
892                         contents,
893                         result_ok: o.result_ok,
894                 }
895         }
896 }
897 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
898         fn clone(&self) -> Self {
899                 if self.result_ok {
900                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
901                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
902                         } }
903                 } else {
904                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
905                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
906                         } }
907                 }
908         }
909 }
910 #[no_mangle]
911 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
912 /// but with all dynamically-allocated buffers duplicated in new buffers.
913 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
914 #[repr(C)]
915 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
916 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
917         /// A pointer to the contents in the success state.
918         /// Reading from this pointer when `result_ok` is not set is undefined.
919         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
920         /// A pointer to the contents in the error state.
921         /// Reading from this pointer when `result_ok` is set is undefined.
922         pub err: *mut crate::lightning::ln::msgs::DecodeError,
923 }
924 #[repr(C)]
925 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
926 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
928 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
929         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
930         /// `err` or `result` depending on the state of `result_ok`.
931         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
932         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
933         pub result_ok: bool,
934 }
935 #[no_mangle]
936 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
937 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
938         CResult_BuiltCommitmentTransactionDecodeErrorZ {
939                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
940                         result: Box::into_raw(Box::new(o)),
941                 },
942                 result_ok: true,
943         }
944 }
945 #[no_mangle]
946 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
947 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
948         CResult_BuiltCommitmentTransactionDecodeErrorZ {
949                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
950                         err: Box::into_raw(Box::new(e)),
951                 },
952                 result_ok: false,
953         }
954 }
955 /// Checks if the given object is currently in the success state
956 #[no_mangle]
957 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
958         o.result_ok
959 }
960 #[no_mangle]
961 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
962 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
963 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
964         fn drop(&mut self) {
965                 if self.result_ok {
966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
968                         }
969                 } else {
970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
972                         }
973                 }
974         }
975 }
976 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
977         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
978                 let contents = if o.result_ok {
979                         let result = unsafe { o.contents.result };
980                         unsafe { o.contents.result = core::ptr::null_mut() };
981                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
982                 } else {
983                         let err = unsafe { o.contents.err };
984                         unsafe { o.contents.err = core::ptr::null_mut(); }
985                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
986                 };
987                 Self {
988                         contents,
989                         result_ok: o.result_ok,
990                 }
991         }
992 }
993 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
994         fn clone(&self) -> Self {
995                 if self.result_ok {
996                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
997                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
998                         } }
999                 } else {
1000                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1001                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1002                         } }
1003                 }
1004         }
1005 }
1006 #[no_mangle]
1007 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1008 /// but with all dynamically-allocated buffers duplicated in new buffers.
1009 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1010 #[repr(C)]
1011 /// The contents of CResult_TrustedClosingTransactionNoneZ
1012 pub union CResult_TrustedClosingTransactionNoneZPtr {
1013         /// A pointer to the contents in the success state.
1014         /// Reading from this pointer when `result_ok` is not set is undefined.
1015         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1016         /// Note that this value is always NULL, as there are no contents in the Err variant
1017         pub err: *mut core::ffi::c_void,
1018 }
1019 #[repr(C)]
1020 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1021 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1023 pub struct CResult_TrustedClosingTransactionNoneZ {
1024         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1025         /// `err` or `result` depending on the state of `result_ok`.
1026         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1027         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1028         pub result_ok: bool,
1029 }
1030 #[no_mangle]
1031 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1032 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1033         CResult_TrustedClosingTransactionNoneZ {
1034                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1035                         result: Box::into_raw(Box::new(o)),
1036                 },
1037                 result_ok: true,
1038         }
1039 }
1040 #[no_mangle]
1041 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1042 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1043         CResult_TrustedClosingTransactionNoneZ {
1044                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1045                         err: core::ptr::null_mut(),
1046                 },
1047                 result_ok: false,
1048         }
1049 }
1050 /// Checks if the given object is currently in the success state
1051 #[no_mangle]
1052 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1053         o.result_ok
1054 }
1055 #[no_mangle]
1056 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1057 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1058 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1059         fn drop(&mut self) {
1060                 if self.result_ok {
1061                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1062                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1063                         }
1064                 } else {
1065                 }
1066         }
1067 }
1068 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1069         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1070                 let contents = if o.result_ok {
1071                         let result = unsafe { o.contents.result };
1072                         unsafe { o.contents.result = core::ptr::null_mut() };
1073                         CResult_TrustedClosingTransactionNoneZPtr { result }
1074                 } else {
1075                         let _ = unsafe { Box::from_raw(o.contents.err) };
1076                         o.contents.err = core::ptr::null_mut();
1077                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1078                 };
1079                 Self {
1080                         contents,
1081                         result_ok: o.result_ok,
1082                 }
1083         }
1084 }
1085 #[repr(C)]
1086 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1087 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1088         /// A pointer to the contents in the success state.
1089         /// Reading from this pointer when `result_ok` is not set is undefined.
1090         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1091         /// A pointer to the contents in the error state.
1092         /// Reading from this pointer when `result_ok` is set is undefined.
1093         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1094 }
1095 #[repr(C)]
1096 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1097 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1099 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1100         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1101         /// `err` or `result` depending on the state of `result_ok`.
1102         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1103         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1104         pub result_ok: bool,
1105 }
1106 #[no_mangle]
1107 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1108 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1109         CResult_CommitmentTransactionDecodeErrorZ {
1110                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1111                         result: Box::into_raw(Box::new(o)),
1112                 },
1113                 result_ok: true,
1114         }
1115 }
1116 #[no_mangle]
1117 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1118 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1119         CResult_CommitmentTransactionDecodeErrorZ {
1120                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1121                         err: Box::into_raw(Box::new(e)),
1122                 },
1123                 result_ok: false,
1124         }
1125 }
1126 /// Checks if the given object is currently in the success state
1127 #[no_mangle]
1128 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1129         o.result_ok
1130 }
1131 #[no_mangle]
1132 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1133 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1134 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1135         fn drop(&mut self) {
1136                 if self.result_ok {
1137                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1138                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1139                         }
1140                 } else {
1141                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1142                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1143                         }
1144                 }
1145         }
1146 }
1147 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1148         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1149                 let contents = if o.result_ok {
1150                         let result = unsafe { o.contents.result };
1151                         unsafe { o.contents.result = core::ptr::null_mut() };
1152                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1153                 } else {
1154                         let err = unsafe { o.contents.err };
1155                         unsafe { o.contents.err = core::ptr::null_mut(); }
1156                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1157                 };
1158                 Self {
1159                         contents,
1160                         result_ok: o.result_ok,
1161                 }
1162         }
1163 }
1164 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1165         fn clone(&self) -> Self {
1166                 if self.result_ok {
1167                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1168                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1169                         } }
1170                 } else {
1171                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1172                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1173                         } }
1174                 }
1175         }
1176 }
1177 #[no_mangle]
1178 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1179 /// but with all dynamically-allocated buffers duplicated in new buffers.
1180 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1181 #[repr(C)]
1182 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1183 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1184         /// A pointer to the contents in the success state.
1185         /// Reading from this pointer when `result_ok` is not set is undefined.
1186         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1187         /// Note that this value is always NULL, as there are no contents in the Err variant
1188         pub err: *mut core::ffi::c_void,
1189 }
1190 #[repr(C)]
1191 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1192 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1194 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1195         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1196         /// `err` or `result` depending on the state of `result_ok`.
1197         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1198         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1199         pub result_ok: bool,
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1203 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1204         CResult_TrustedCommitmentTransactionNoneZ {
1205                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1206                         result: Box::into_raw(Box::new(o)),
1207                 },
1208                 result_ok: true,
1209         }
1210 }
1211 #[no_mangle]
1212 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1213 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1214         CResult_TrustedCommitmentTransactionNoneZ {
1215                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1216                         err: core::ptr::null_mut(),
1217                 },
1218                 result_ok: false,
1219         }
1220 }
1221 /// Checks if the given object is currently in the success state
1222 #[no_mangle]
1223 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1224         o.result_ok
1225 }
1226 #[no_mangle]
1227 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1228 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1229 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1230         fn drop(&mut self) {
1231                 if self.result_ok {
1232                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1233                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1234                         }
1235                 } else {
1236                 }
1237         }
1238 }
1239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1240         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1241                 let contents = if o.result_ok {
1242                         let result = unsafe { o.contents.result };
1243                         unsafe { o.contents.result = core::ptr::null_mut() };
1244                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1245                 } else {
1246                         let _ = unsafe { Box::from_raw(o.contents.err) };
1247                         o.contents.err = core::ptr::null_mut();
1248                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1249                 };
1250                 Self {
1251                         contents,
1252                         result_ok: o.result_ok,
1253                 }
1254         }
1255 }
1256 #[repr(C)]
1257 /// The contents of CResult_CVec_SignatureZNoneZ
1258 pub union CResult_CVec_SignatureZNoneZPtr {
1259         /// A pointer to the contents in the success state.
1260         /// Reading from this pointer when `result_ok` is not set is undefined.
1261         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1262         /// Note that this value is always NULL, as there are no contents in the Err variant
1263         pub err: *mut core::ffi::c_void,
1264 }
1265 #[repr(C)]
1266 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1267 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1269 pub struct CResult_CVec_SignatureZNoneZ {
1270         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1271         /// `err` or `result` depending on the state of `result_ok`.
1272         pub contents: CResult_CVec_SignatureZNoneZPtr,
1273         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1274         pub result_ok: bool,
1275 }
1276 #[no_mangle]
1277 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1278 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1279         CResult_CVec_SignatureZNoneZ {
1280                 contents: CResult_CVec_SignatureZNoneZPtr {
1281                         result: Box::into_raw(Box::new(o)),
1282                 },
1283                 result_ok: true,
1284         }
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1288 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1289         CResult_CVec_SignatureZNoneZ {
1290                 contents: CResult_CVec_SignatureZNoneZPtr {
1291                         err: core::ptr::null_mut(),
1292                 },
1293                 result_ok: false,
1294         }
1295 }
1296 /// Checks if the given object is currently in the success state
1297 #[no_mangle]
1298 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1299         o.result_ok
1300 }
1301 #[no_mangle]
1302 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1303 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1304 impl Drop for CResult_CVec_SignatureZNoneZ {
1305         fn drop(&mut self) {
1306                 if self.result_ok {
1307                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1308                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1309                         }
1310                 } else {
1311                 }
1312         }
1313 }
1314 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1315         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1316                 let contents = if o.result_ok {
1317                         let result = unsafe { o.contents.result };
1318                         unsafe { o.contents.result = core::ptr::null_mut() };
1319                         CResult_CVec_SignatureZNoneZPtr { result }
1320                 } else {
1321                         let _ = unsafe { Box::from_raw(o.contents.err) };
1322                         o.contents.err = core::ptr::null_mut();
1323                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1324                 };
1325                 Self {
1326                         contents,
1327                         result_ok: o.result_ok,
1328                 }
1329         }
1330 }
1331 impl Clone for CResult_CVec_SignatureZNoneZ {
1332         fn clone(&self) -> Self {
1333                 if self.result_ok {
1334                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1335                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1336                         } }
1337                 } else {
1338                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1339                                 err: core::ptr::null_mut()
1340                         } }
1341                 }
1342         }
1343 }
1344 #[no_mangle]
1345 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1346 /// but with all dynamically-allocated buffers duplicated in new buffers.
1347 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1348 #[repr(C)]
1349 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1350 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1351         /// A pointer to the contents in the success state.
1352         /// Reading from this pointer when `result_ok` is not set is undefined.
1353         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1354         /// A pointer to the contents in the error state.
1355         /// Reading from this pointer when `result_ok` is set is undefined.
1356         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1357 }
1358 #[repr(C)]
1359 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1360 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1362 pub struct CResult_ShutdownScriptDecodeErrorZ {
1363         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1364         /// `err` or `result` depending on the state of `result_ok`.
1365         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1366         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1367         pub result_ok: bool,
1368 }
1369 #[no_mangle]
1370 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1371 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1372         CResult_ShutdownScriptDecodeErrorZ {
1373                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1374                         result: Box::into_raw(Box::new(o)),
1375                 },
1376                 result_ok: true,
1377         }
1378 }
1379 #[no_mangle]
1380 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1381 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1382         CResult_ShutdownScriptDecodeErrorZ {
1383                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1384                         err: Box::into_raw(Box::new(e)),
1385                 },
1386                 result_ok: false,
1387         }
1388 }
1389 /// Checks if the given object is currently in the success state
1390 #[no_mangle]
1391 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1392         o.result_ok
1393 }
1394 #[no_mangle]
1395 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1396 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1397 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1398         fn drop(&mut self) {
1399                 if self.result_ok {
1400                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1401                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1402                         }
1403                 } else {
1404                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1405                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1406                         }
1407                 }
1408         }
1409 }
1410 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1411         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1412                 let contents = if o.result_ok {
1413                         let result = unsafe { o.contents.result };
1414                         unsafe { o.contents.result = core::ptr::null_mut() };
1415                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1416                 } else {
1417                         let err = unsafe { o.contents.err };
1418                         unsafe { o.contents.err = core::ptr::null_mut(); }
1419                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1420                 };
1421                 Self {
1422                         contents,
1423                         result_ok: o.result_ok,
1424                 }
1425         }
1426 }
1427 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1428         fn clone(&self) -> Self {
1429                 if self.result_ok {
1430                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1431                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1432                         } }
1433                 } else {
1434                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1435                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1436                         } }
1437                 }
1438         }
1439 }
1440 #[no_mangle]
1441 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1442 /// but with all dynamically-allocated buffers duplicated in new buffers.
1443 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1444 #[repr(C)]
1445 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1446 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1447         /// A pointer to the contents in the success state.
1448         /// Reading from this pointer when `result_ok` is not set is undefined.
1449         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1450         /// A pointer to the contents in the error state.
1451         /// Reading from this pointer when `result_ok` is set is undefined.
1452         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1453 }
1454 #[repr(C)]
1455 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1456 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1458 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1459         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1460         /// `err` or `result` depending on the state of `result_ok`.
1461         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1462         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1463         pub result_ok: bool,
1464 }
1465 #[no_mangle]
1466 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1467 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1468         CResult_ShutdownScriptInvalidShutdownScriptZ {
1469                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1470                         result: Box::into_raw(Box::new(o)),
1471                 },
1472                 result_ok: true,
1473         }
1474 }
1475 #[no_mangle]
1476 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1477 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1478         CResult_ShutdownScriptInvalidShutdownScriptZ {
1479                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1480                         err: Box::into_raw(Box::new(e)),
1481                 },
1482                 result_ok: false,
1483         }
1484 }
1485 /// Checks if the given object is currently in the success state
1486 #[no_mangle]
1487 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1488         o.result_ok
1489 }
1490 #[no_mangle]
1491 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1492 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1493 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1494         fn drop(&mut self) {
1495                 if self.result_ok {
1496                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1497                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1498                         }
1499                 } else {
1500                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1501                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1502                         }
1503                 }
1504         }
1505 }
1506 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1507         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1508                 let contents = if o.result_ok {
1509                         let result = unsafe { o.contents.result };
1510                         unsafe { o.contents.result = core::ptr::null_mut() };
1511                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1512                 } else {
1513                         let err = unsafe { o.contents.err };
1514                         unsafe { o.contents.err = core::ptr::null_mut(); }
1515                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1516                 };
1517                 Self {
1518                         contents,
1519                         result_ok: o.result_ok,
1520                 }
1521         }
1522 }
1523 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1524         fn clone(&self) -> Self {
1525                 if self.result_ok {
1526                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1527                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1528                         } }
1529                 } else {
1530                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1531                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1532                         } }
1533                 }
1534         }
1535 }
1536 #[no_mangle]
1537 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1538 /// but with all dynamically-allocated buffers duplicated in new buffers.
1539 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1540 #[repr(C)]
1541 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1542 /// This corresponds to std::vector in C++
1543 pub struct CVec_PublicKeyZ {
1544         /// The elements in the array.
1545         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1546         pub data: *mut crate::c_types::PublicKey,
1547         /// The number of elements pointed to by `data`.
1548         pub datalen: usize
1549 }
1550 impl CVec_PublicKeyZ {
1551         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1552                 if self.datalen == 0 { return Vec::new(); }
1553                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1554                 self.data = core::ptr::null_mut();
1555                 self.datalen = 0;
1556                 ret
1557         }
1558         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1559                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1560         }
1561 }
1562 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1563         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1564                 let datalen = v.len();
1565                 let data = Box::into_raw(v.into_boxed_slice());
1566                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1567         }
1568 }
1569 #[no_mangle]
1570 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1571 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1572 impl Drop for CVec_PublicKeyZ {
1573         fn drop(&mut self) {
1574                 if self.datalen == 0 { return; }
1575                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1576         }
1577 }
1578 impl Clone for CVec_PublicKeyZ {
1579         fn clone(&self) -> Self {
1580                 let mut res = Vec::new();
1581                 if self.datalen == 0 { return Self::from(res); }
1582                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1583                 Self::from(res)
1584         }
1585 }
1586 #[repr(C)]
1587 /// The contents of CResult_BlindedPathNoneZ
1588 pub union CResult_BlindedPathNoneZPtr {
1589         /// A pointer to the contents in the success state.
1590         /// Reading from this pointer when `result_ok` is not set is undefined.
1591         pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1592         /// Note that this value is always NULL, as there are no contents in the Err variant
1593         pub err: *mut core::ffi::c_void,
1594 }
1595 #[repr(C)]
1596 /// A CResult_BlindedPathNoneZ represents the result of a fallible operation,
1597 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
1598 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1599 pub struct CResult_BlindedPathNoneZ {
1600         /// The contents of this CResult_BlindedPathNoneZ, accessible via either
1601         /// `err` or `result` depending on the state of `result_ok`.
1602         pub contents: CResult_BlindedPathNoneZPtr,
1603         /// Whether this CResult_BlindedPathNoneZ represents a success state.
1604         pub result_ok: bool,
1605 }
1606 #[no_mangle]
1607 /// Creates a new CResult_BlindedPathNoneZ in the success state.
1608 pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ {
1609         CResult_BlindedPathNoneZ {
1610                 contents: CResult_BlindedPathNoneZPtr {
1611                         result: Box::into_raw(Box::new(o)),
1612                 },
1613                 result_ok: true,
1614         }
1615 }
1616 #[no_mangle]
1617 /// Creates a new CResult_BlindedPathNoneZ in the error state.
1618 pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ {
1619         CResult_BlindedPathNoneZ {
1620                 contents: CResult_BlindedPathNoneZPtr {
1621                         err: core::ptr::null_mut(),
1622                 },
1623                 result_ok: false,
1624         }
1625 }
1626 /// Checks if the given object is currently in the success state
1627 #[no_mangle]
1628 pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool {
1629         o.result_ok
1630 }
1631 #[no_mangle]
1632 /// Frees any resources used by the CResult_BlindedPathNoneZ.
1633 pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { }
1634 impl Drop for CResult_BlindedPathNoneZ {
1635         fn drop(&mut self) {
1636                 if self.result_ok {
1637                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1638                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1639                         }
1640                 } else {
1641                 }
1642         }
1643 }
1644 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>> for CResult_BlindedPathNoneZ {
1645         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, ()>) -> Self {
1646                 let contents = if o.result_ok {
1647                         let result = unsafe { o.contents.result };
1648                         unsafe { o.contents.result = core::ptr::null_mut() };
1649                         CResult_BlindedPathNoneZPtr { result }
1650                 } else {
1651                         let _ = unsafe { Box::from_raw(o.contents.err) };
1652                         o.contents.err = core::ptr::null_mut();
1653                         CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() }
1654                 };
1655                 Self {
1656                         contents,
1657                         result_ok: o.result_ok,
1658                 }
1659         }
1660 }
1661 impl Clone for CResult_BlindedPathNoneZ {
1662         fn clone(&self) -> Self {
1663                 if self.result_ok {
1664                         Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr {
1665                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1666                         } }
1667                 } else {
1668                         Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr {
1669                                 err: core::ptr::null_mut()
1670                         } }
1671                 }
1672         }
1673 }
1674 #[no_mangle]
1675 /// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
1676 /// but with all dynamically-allocated buffers duplicated in new buffers.
1677 pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) }
1678 #[repr(C)]
1679 /// The contents of CResult_BlindedPathDecodeErrorZ
1680 pub union CResult_BlindedPathDecodeErrorZPtr {
1681         /// A pointer to the contents in the success state.
1682         /// Reading from this pointer when `result_ok` is not set is undefined.
1683         pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath,
1684         /// A pointer to the contents in the error state.
1685         /// Reading from this pointer when `result_ok` is set is undefined.
1686         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1687 }
1688 #[repr(C)]
1689 /// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
1690 /// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure.
1691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1692 pub struct CResult_BlindedPathDecodeErrorZ {
1693         /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
1694         /// `err` or `result` depending on the state of `result_ok`.
1695         pub contents: CResult_BlindedPathDecodeErrorZPtr,
1696         /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
1697         pub result_ok: bool,
1698 }
1699 #[no_mangle]
1700 /// Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
1701 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ {
1702         CResult_BlindedPathDecodeErrorZ {
1703                 contents: CResult_BlindedPathDecodeErrorZPtr {
1704                         result: Box::into_raw(Box::new(o)),
1705                 },
1706                 result_ok: true,
1707         }
1708 }
1709 #[no_mangle]
1710 /// Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
1711 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ {
1712         CResult_BlindedPathDecodeErrorZ {
1713                 contents: CResult_BlindedPathDecodeErrorZPtr {
1714                         err: Box::into_raw(Box::new(e)),
1715                 },
1716                 result_ok: false,
1717         }
1718 }
1719 /// Checks if the given object is currently in the success state
1720 #[no_mangle]
1721 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool {
1722         o.result_ok
1723 }
1724 #[no_mangle]
1725 /// Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
1726 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { }
1727 impl Drop for CResult_BlindedPathDecodeErrorZ {
1728         fn drop(&mut self) {
1729                 if self.result_ok {
1730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1732                         }
1733                 } else {
1734                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1735                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1736                         }
1737                 }
1738         }
1739 }
1740 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedPathDecodeErrorZ {
1741         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedPath, crate::lightning::ln::msgs::DecodeError>) -> Self {
1742                 let contents = if o.result_ok {
1743                         let result = unsafe { o.contents.result };
1744                         unsafe { o.contents.result = core::ptr::null_mut() };
1745                         CResult_BlindedPathDecodeErrorZPtr { result }
1746                 } else {
1747                         let err = unsafe { o.contents.err };
1748                         unsafe { o.contents.err = core::ptr::null_mut(); }
1749                         CResult_BlindedPathDecodeErrorZPtr { err }
1750                 };
1751                 Self {
1752                         contents,
1753                         result_ok: o.result_ok,
1754                 }
1755         }
1756 }
1757 impl Clone for CResult_BlindedPathDecodeErrorZ {
1758         fn clone(&self) -> Self {
1759                 if self.result_ok {
1760                         Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr {
1761                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedPath>::clone(unsafe { &*self.contents.result })))
1762                         } }
1763                 } else {
1764                         Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr {
1765                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1766                         } }
1767                 }
1768         }
1769 }
1770 #[no_mangle]
1771 /// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
1772 /// but with all dynamically-allocated buffers duplicated in new buffers.
1773 pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) }
1774 #[repr(C)]
1775 /// The contents of CResult_BlindedHopDecodeErrorZ
1776 pub union CResult_BlindedHopDecodeErrorZPtr {
1777         /// A pointer to the contents in the success state.
1778         /// Reading from this pointer when `result_ok` is not set is undefined.
1779         pub result: *mut crate::lightning::onion_message::blinded_path::BlindedHop,
1780         /// A pointer to the contents in the error state.
1781         /// Reading from this pointer when `result_ok` is set is undefined.
1782         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1783 }
1784 #[repr(C)]
1785 /// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
1786 /// containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1788 pub struct CResult_BlindedHopDecodeErrorZ {
1789         /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
1790         /// `err` or `result` depending on the state of `result_ok`.
1791         pub contents: CResult_BlindedHopDecodeErrorZPtr,
1792         /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
1793         pub result_ok: bool,
1794 }
1795 #[no_mangle]
1796 /// Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
1797 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ {
1798         CResult_BlindedHopDecodeErrorZ {
1799                 contents: CResult_BlindedHopDecodeErrorZPtr {
1800                         result: Box::into_raw(Box::new(o)),
1801                 },
1802                 result_ok: true,
1803         }
1804 }
1805 #[no_mangle]
1806 /// Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
1807 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ {
1808         CResult_BlindedHopDecodeErrorZ {
1809                 contents: CResult_BlindedHopDecodeErrorZPtr {
1810                         err: Box::into_raw(Box::new(e)),
1811                 },
1812                 result_ok: false,
1813         }
1814 }
1815 /// Checks if the given object is currently in the success state
1816 #[no_mangle]
1817 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool {
1818         o.result_ok
1819 }
1820 #[no_mangle]
1821 /// Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
1822 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { }
1823 impl Drop for CResult_BlindedHopDecodeErrorZ {
1824         fn drop(&mut self) {
1825                 if self.result_ok {
1826                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1827                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1828                         }
1829                 } else {
1830                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1831                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1832                         }
1833                 }
1834         }
1835 }
1836 impl From<crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>> for CResult_BlindedHopDecodeErrorZ {
1837         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::onion_message::blinded_path::BlindedHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1838                 let contents = if o.result_ok {
1839                         let result = unsafe { o.contents.result };
1840                         unsafe { o.contents.result = core::ptr::null_mut() };
1841                         CResult_BlindedHopDecodeErrorZPtr { result }
1842                 } else {
1843                         let err = unsafe { o.contents.err };
1844                         unsafe { o.contents.err = core::ptr::null_mut(); }
1845                         CResult_BlindedHopDecodeErrorZPtr { err }
1846                 };
1847                 Self {
1848                         contents,
1849                         result_ok: o.result_ok,
1850                 }
1851         }
1852 }
1853 impl Clone for CResult_BlindedHopDecodeErrorZ {
1854         fn clone(&self) -> Self {
1855                 if self.result_ok {
1856                         Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr {
1857                                 result: Box::into_raw(Box::new(<crate::lightning::onion_message::blinded_path::BlindedHop>::clone(unsafe { &*self.contents.result })))
1858                         } }
1859                 } else {
1860                         Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr {
1861                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1862                         } }
1863                 }
1864         }
1865 }
1866 #[no_mangle]
1867 /// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
1868 /// but with all dynamically-allocated buffers duplicated in new buffers.
1869 pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) }
1870 #[repr(C)]
1871 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1872 pub enum COption_WriteableScoreZ {
1873         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1874         Some(crate::lightning::routing::scoring::WriteableScore),
1875         /// When we're in this state, this COption_WriteableScoreZ contains nothing
1876         None
1877 }
1878 impl COption_WriteableScoreZ {
1879         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1880                 if let Self::None = self { false } else { true }
1881         }
1882         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1883                 !self.is_some()
1884         }
1885         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
1886                 if let Self::Some(v) = self { v } else { unreachable!() }
1887         }
1888 }
1889 #[no_mangle]
1890 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
1891 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
1892         COption_WriteableScoreZ::Some(o)
1893 }
1894 #[no_mangle]
1895 /// Constructs a new COption_WriteableScoreZ containing nothing
1896 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
1897         COption_WriteableScoreZ::None
1898 }
1899 #[no_mangle]
1900 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
1901 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
1902 #[repr(C)]
1903 /// The contents of CResult_NoneErrorZ
1904 pub union CResult_NoneErrorZPtr {
1905         /// Note that this value is always NULL, as there are no contents in the OK variant
1906         pub result: *mut core::ffi::c_void,
1907         /// A pointer to the contents in the error state.
1908         /// Reading from this pointer when `result_ok` is set is undefined.
1909         pub err: *mut crate::c_types::IOError,
1910 }
1911 #[repr(C)]
1912 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1913 /// containing a () on success and a crate::c_types::IOError on failure.
1914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1915 pub struct CResult_NoneErrorZ {
1916         /// The contents of this CResult_NoneErrorZ, accessible via either
1917         /// `err` or `result` depending on the state of `result_ok`.
1918         pub contents: CResult_NoneErrorZPtr,
1919         /// Whether this CResult_NoneErrorZ represents a success state.
1920         pub result_ok: bool,
1921 }
1922 #[no_mangle]
1923 /// Creates a new CResult_NoneErrorZ in the success state.
1924 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1925         CResult_NoneErrorZ {
1926                 contents: CResult_NoneErrorZPtr {
1927                         result: core::ptr::null_mut(),
1928                 },
1929                 result_ok: true,
1930         }
1931 }
1932 #[no_mangle]
1933 /// Creates a new CResult_NoneErrorZ in the error state.
1934 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1935         CResult_NoneErrorZ {
1936                 contents: CResult_NoneErrorZPtr {
1937                         err: Box::into_raw(Box::new(e)),
1938                 },
1939                 result_ok: false,
1940         }
1941 }
1942 /// Checks if the given object is currently in the success state
1943 #[no_mangle]
1944 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1945         o.result_ok
1946 }
1947 #[no_mangle]
1948 /// Frees any resources used by the CResult_NoneErrorZ.
1949 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1950 impl Drop for CResult_NoneErrorZ {
1951         fn drop(&mut self) {
1952                 if self.result_ok {
1953                 } else {
1954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1956                         }
1957                 }
1958         }
1959 }
1960 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1961         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1962                 let contents = if o.result_ok {
1963                         let _ = unsafe { Box::from_raw(o.contents.result) };
1964                         o.contents.result = core::ptr::null_mut();
1965                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1966                 } else {
1967                         let err = unsafe { o.contents.err };
1968                         unsafe { o.contents.err = core::ptr::null_mut(); }
1969                         CResult_NoneErrorZPtr { err }
1970                 };
1971                 Self {
1972                         contents,
1973                         result_ok: o.result_ok,
1974                 }
1975         }
1976 }
1977 impl Clone for CResult_NoneErrorZ {
1978         fn clone(&self) -> Self {
1979                 if self.result_ok {
1980                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1981                                 result: core::ptr::null_mut()
1982                         } }
1983                 } else {
1984                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1985                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1986                         } }
1987                 }
1988         }
1989 }
1990 #[no_mangle]
1991 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1992 /// but with all dynamically-allocated buffers duplicated in new buffers.
1993 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1994 #[repr(C)]
1995 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1996 /// This corresponds to std::vector in C++
1997 pub struct CVec_ChannelDetailsZ {
1998         /// The elements in the array.
1999         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2000         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2001         /// The number of elements pointed to by `data`.
2002         pub datalen: usize
2003 }
2004 impl CVec_ChannelDetailsZ {
2005         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2006                 if self.datalen == 0 { return Vec::new(); }
2007                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2008                 self.data = core::ptr::null_mut();
2009                 self.datalen = 0;
2010                 ret
2011         }
2012         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2013                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2014         }
2015 }
2016 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2017         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2018                 let datalen = v.len();
2019                 let data = Box::into_raw(v.into_boxed_slice());
2020                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2021         }
2022 }
2023 #[no_mangle]
2024 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2025 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2026 impl Drop for CVec_ChannelDetailsZ {
2027         fn drop(&mut self) {
2028                 if self.datalen == 0 { return; }
2029                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2030         }
2031 }
2032 impl Clone for CVec_ChannelDetailsZ {
2033         fn clone(&self) -> Self {
2034                 let mut res = Vec::new();
2035                 if self.datalen == 0 { return Self::from(res); }
2036                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2037                 Self::from(res)
2038         }
2039 }
2040 #[repr(C)]
2041 /// The contents of CResult_RouteLightningErrorZ
2042 pub union CResult_RouteLightningErrorZPtr {
2043         /// A pointer to the contents in the success state.
2044         /// Reading from this pointer when `result_ok` is not set is undefined.
2045         pub result: *mut crate::lightning::routing::router::Route,
2046         /// A pointer to the contents in the error state.
2047         /// Reading from this pointer when `result_ok` is set is undefined.
2048         pub err: *mut crate::lightning::ln::msgs::LightningError,
2049 }
2050 #[repr(C)]
2051 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2052 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2054 pub struct CResult_RouteLightningErrorZ {
2055         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2056         /// `err` or `result` depending on the state of `result_ok`.
2057         pub contents: CResult_RouteLightningErrorZPtr,
2058         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2059         pub result_ok: bool,
2060 }
2061 #[no_mangle]
2062 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2063 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2064         CResult_RouteLightningErrorZ {
2065                 contents: CResult_RouteLightningErrorZPtr {
2066                         result: Box::into_raw(Box::new(o)),
2067                 },
2068                 result_ok: true,
2069         }
2070 }
2071 #[no_mangle]
2072 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2073 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2074         CResult_RouteLightningErrorZ {
2075                 contents: CResult_RouteLightningErrorZPtr {
2076                         err: Box::into_raw(Box::new(e)),
2077                 },
2078                 result_ok: false,
2079         }
2080 }
2081 /// Checks if the given object is currently in the success state
2082 #[no_mangle]
2083 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2084         o.result_ok
2085 }
2086 #[no_mangle]
2087 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2088 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2089 impl Drop for CResult_RouteLightningErrorZ {
2090         fn drop(&mut self) {
2091                 if self.result_ok {
2092                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2093                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2094                         }
2095                 } else {
2096                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2097                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2098                         }
2099                 }
2100         }
2101 }
2102 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2103         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2104                 let contents = if o.result_ok {
2105                         let result = unsafe { o.contents.result };
2106                         unsafe { o.contents.result = core::ptr::null_mut() };
2107                         CResult_RouteLightningErrorZPtr { result }
2108                 } else {
2109                         let err = unsafe { o.contents.err };
2110                         unsafe { o.contents.err = core::ptr::null_mut(); }
2111                         CResult_RouteLightningErrorZPtr { err }
2112                 };
2113                 Self {
2114                         contents,
2115                         result_ok: o.result_ok,
2116                 }
2117         }
2118 }
2119 impl Clone for CResult_RouteLightningErrorZ {
2120         fn clone(&self) -> Self {
2121                 if self.result_ok {
2122                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2123                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2124                         } }
2125                 } else {
2126                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2127                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2128                         } }
2129                 }
2130         }
2131 }
2132 #[no_mangle]
2133 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2134 /// but with all dynamically-allocated buffers duplicated in new buffers.
2135 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2136 #[repr(C)]
2137 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2138 /// This corresponds to std::vector in C++
2139 pub struct CVec_RouteHopZ {
2140         /// The elements in the array.
2141         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2142         pub data: *mut crate::lightning::routing::router::RouteHop,
2143         /// The number of elements pointed to by `data`.
2144         pub datalen: usize
2145 }
2146 impl CVec_RouteHopZ {
2147         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2148                 if self.datalen == 0 { return Vec::new(); }
2149                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2150                 self.data = core::ptr::null_mut();
2151                 self.datalen = 0;
2152                 ret
2153         }
2154         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2155                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2156         }
2157 }
2158 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2159         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2160                 let datalen = v.len();
2161                 let data = Box::into_raw(v.into_boxed_slice());
2162                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2163         }
2164 }
2165 #[no_mangle]
2166 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2167 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2168 impl Drop for CVec_RouteHopZ {
2169         fn drop(&mut self) {
2170                 if self.datalen == 0 { return; }
2171                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2172         }
2173 }
2174 impl Clone for CVec_RouteHopZ {
2175         fn clone(&self) -> Self {
2176                 let mut res = Vec::new();
2177                 if self.datalen == 0 { return Self::from(res); }
2178                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2179                 Self::from(res)
2180         }
2181 }
2182 #[repr(C)]
2183 #[derive(Clone)]
2184 /// An enum which can either contain a u64 or not
2185 pub enum COption_u64Z {
2186         /// When we're in this state, this COption_u64Z contains a u64
2187         Some(u64),
2188         /// When we're in this state, this COption_u64Z contains nothing
2189         None
2190 }
2191 impl COption_u64Z {
2192         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2193                 if let Self::None = self { false } else { true }
2194         }
2195         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2196                 !self.is_some()
2197         }
2198         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2199                 if let Self::Some(v) = self { v } else { unreachable!() }
2200         }
2201 }
2202 #[no_mangle]
2203 /// Constructs a new COption_u64Z containing a u64
2204 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2205         COption_u64Z::Some(o)
2206 }
2207 #[no_mangle]
2208 /// Constructs a new COption_u64Z containing nothing
2209 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2210         COption_u64Z::None
2211 }
2212 #[no_mangle]
2213 /// Frees any resources associated with the u64, if we are in the Some state
2214 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2215 #[no_mangle]
2216 /// Creates a new COption_u64Z which has the same data as `orig`
2217 /// but with all dynamically-allocated buffers duplicated in new buffers.
2218 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2219 #[repr(C)]
2220 /// The contents of CResult_InFlightHtlcsDecodeErrorZ
2221 pub union CResult_InFlightHtlcsDecodeErrorZPtr {
2222         /// A pointer to the contents in the success state.
2223         /// Reading from this pointer when `result_ok` is not set is undefined.
2224         pub result: *mut crate::lightning::routing::router::InFlightHtlcs,
2225         /// A pointer to the contents in the error state.
2226         /// Reading from this pointer when `result_ok` is set is undefined.
2227         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2228 }
2229 #[repr(C)]
2230 /// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation,
2231 /// containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure.
2232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2233 pub struct CResult_InFlightHtlcsDecodeErrorZ {
2234         /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either
2235         /// `err` or `result` depending on the state of `result_ok`.
2236         pub contents: CResult_InFlightHtlcsDecodeErrorZPtr,
2237         /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state.
2238         pub result_ok: bool,
2239 }
2240 #[no_mangle]
2241 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state.
2242 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ {
2243         CResult_InFlightHtlcsDecodeErrorZ {
2244                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2245                         result: Box::into_raw(Box::new(o)),
2246                 },
2247                 result_ok: true,
2248         }
2249 }
2250 #[no_mangle]
2251 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state.
2252 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ {
2253         CResult_InFlightHtlcsDecodeErrorZ {
2254                 contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2255                         err: Box::into_raw(Box::new(e)),
2256                 },
2257                 result_ok: false,
2258         }
2259 }
2260 /// Checks if the given object is currently in the success state
2261 #[no_mangle]
2262 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool {
2263         o.result_ok
2264 }
2265 #[no_mangle]
2266 /// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ.
2267 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { }
2268 impl Drop for CResult_InFlightHtlcsDecodeErrorZ {
2269         fn drop(&mut self) {
2270                 if self.result_ok {
2271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2273                         }
2274                 } else {
2275                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2276                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2277                         }
2278                 }
2279         }
2280 }
2281 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>> for CResult_InFlightHtlcsDecodeErrorZ {
2282         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::InFlightHtlcs, crate::lightning::ln::msgs::DecodeError>) -> Self {
2283                 let contents = if o.result_ok {
2284                         let result = unsafe { o.contents.result };
2285                         unsafe { o.contents.result = core::ptr::null_mut() };
2286                         CResult_InFlightHtlcsDecodeErrorZPtr { result }
2287                 } else {
2288                         let err = unsafe { o.contents.err };
2289                         unsafe { o.contents.err = core::ptr::null_mut(); }
2290                         CResult_InFlightHtlcsDecodeErrorZPtr { err }
2291                 };
2292                 Self {
2293                         contents,
2294                         result_ok: o.result_ok,
2295                 }
2296         }
2297 }
2298 impl Clone for CResult_InFlightHtlcsDecodeErrorZ {
2299         fn clone(&self) -> Self {
2300                 if self.result_ok {
2301                         Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2302                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::InFlightHtlcs>::clone(unsafe { &*self.contents.result })))
2303                         } }
2304                 } else {
2305                         Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr {
2306                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2307                         } }
2308                 }
2309         }
2310 }
2311 #[no_mangle]
2312 /// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig`
2313 /// but with all dynamically-allocated buffers duplicated in new buffers.
2314 pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) }
2315 #[repr(C)]
2316 /// The contents of CResult_RouteHopDecodeErrorZ
2317 pub union CResult_RouteHopDecodeErrorZPtr {
2318         /// A pointer to the contents in the success state.
2319         /// Reading from this pointer when `result_ok` is not set is undefined.
2320         pub result: *mut crate::lightning::routing::router::RouteHop,
2321         /// A pointer to the contents in the error state.
2322         /// Reading from this pointer when `result_ok` is set is undefined.
2323         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2324 }
2325 #[repr(C)]
2326 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
2327 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2328 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2329 pub struct CResult_RouteHopDecodeErrorZ {
2330         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
2331         /// `err` or `result` depending on the state of `result_ok`.
2332         pub contents: CResult_RouteHopDecodeErrorZPtr,
2333         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
2334         pub result_ok: bool,
2335 }
2336 #[no_mangle]
2337 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
2338 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
2339         CResult_RouteHopDecodeErrorZ {
2340                 contents: CResult_RouteHopDecodeErrorZPtr {
2341                         result: Box::into_raw(Box::new(o)),
2342                 },
2343                 result_ok: true,
2344         }
2345 }
2346 #[no_mangle]
2347 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
2348 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
2349         CResult_RouteHopDecodeErrorZ {
2350                 contents: CResult_RouteHopDecodeErrorZPtr {
2351                         err: Box::into_raw(Box::new(e)),
2352                 },
2353                 result_ok: false,
2354         }
2355 }
2356 /// Checks if the given object is currently in the success state
2357 #[no_mangle]
2358 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
2359         o.result_ok
2360 }
2361 #[no_mangle]
2362 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
2363 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
2364 impl Drop for CResult_RouteHopDecodeErrorZ {
2365         fn drop(&mut self) {
2366                 if self.result_ok {
2367                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2368                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2369                         }
2370                 } else {
2371                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2372                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2373                         }
2374                 }
2375         }
2376 }
2377 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
2378         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2379                 let contents = if o.result_ok {
2380                         let result = unsafe { o.contents.result };
2381                         unsafe { o.contents.result = core::ptr::null_mut() };
2382                         CResult_RouteHopDecodeErrorZPtr { result }
2383                 } else {
2384                         let err = unsafe { o.contents.err };
2385                         unsafe { o.contents.err = core::ptr::null_mut(); }
2386                         CResult_RouteHopDecodeErrorZPtr { err }
2387                 };
2388                 Self {
2389                         contents,
2390                         result_ok: o.result_ok,
2391                 }
2392         }
2393 }
2394 impl Clone for CResult_RouteHopDecodeErrorZ {
2395         fn clone(&self) -> Self {
2396                 if self.result_ok {
2397                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2398                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2399                         } }
2400                 } else {
2401                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2402                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2403                         } }
2404                 }
2405         }
2406 }
2407 #[no_mangle]
2408 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2409 /// but with all dynamically-allocated buffers duplicated in new buffers.
2410 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2411 #[repr(C)]
2412 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2413 /// This corresponds to std::vector in C++
2414 pub struct CVec_CVec_RouteHopZZ {
2415         /// The elements in the array.
2416         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2417         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2418         /// The number of elements pointed to by `data`.
2419         pub datalen: usize
2420 }
2421 impl CVec_CVec_RouteHopZZ {
2422         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2423                 if self.datalen == 0 { return Vec::new(); }
2424                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2425                 self.data = core::ptr::null_mut();
2426                 self.datalen = 0;
2427                 ret
2428         }
2429         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2430                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2431         }
2432 }
2433 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2434         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2435                 let datalen = v.len();
2436                 let data = Box::into_raw(v.into_boxed_slice());
2437                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2438         }
2439 }
2440 #[no_mangle]
2441 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2442 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2443 impl Drop for CVec_CVec_RouteHopZZ {
2444         fn drop(&mut self) {
2445                 if self.datalen == 0 { return; }
2446                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2447         }
2448 }
2449 impl Clone for CVec_CVec_RouteHopZZ {
2450         fn clone(&self) -> Self {
2451                 let mut res = Vec::new();
2452                 if self.datalen == 0 { return Self::from(res); }
2453                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2454                 Self::from(res)
2455         }
2456 }
2457 #[repr(C)]
2458 /// The contents of CResult_RouteDecodeErrorZ
2459 pub union CResult_RouteDecodeErrorZPtr {
2460         /// A pointer to the contents in the success state.
2461         /// Reading from this pointer when `result_ok` is not set is undefined.
2462         pub result: *mut crate::lightning::routing::router::Route,
2463         /// A pointer to the contents in the error state.
2464         /// Reading from this pointer when `result_ok` is set is undefined.
2465         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2466 }
2467 #[repr(C)]
2468 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2469 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2471 pub struct CResult_RouteDecodeErrorZ {
2472         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2473         /// `err` or `result` depending on the state of `result_ok`.
2474         pub contents: CResult_RouteDecodeErrorZPtr,
2475         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2476         pub result_ok: bool,
2477 }
2478 #[no_mangle]
2479 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2480 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2481         CResult_RouteDecodeErrorZ {
2482                 contents: CResult_RouteDecodeErrorZPtr {
2483                         result: Box::into_raw(Box::new(o)),
2484                 },
2485                 result_ok: true,
2486         }
2487 }
2488 #[no_mangle]
2489 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2490 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2491         CResult_RouteDecodeErrorZ {
2492                 contents: CResult_RouteDecodeErrorZPtr {
2493                         err: Box::into_raw(Box::new(e)),
2494                 },
2495                 result_ok: false,
2496         }
2497 }
2498 /// Checks if the given object is currently in the success state
2499 #[no_mangle]
2500 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2501         o.result_ok
2502 }
2503 #[no_mangle]
2504 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2505 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2506 impl Drop for CResult_RouteDecodeErrorZ {
2507         fn drop(&mut self) {
2508                 if self.result_ok {
2509                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2510                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2511                         }
2512                 } else {
2513                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2514                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2515                         }
2516                 }
2517         }
2518 }
2519 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2520         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2521                 let contents = if o.result_ok {
2522                         let result = unsafe { o.contents.result };
2523                         unsafe { o.contents.result = core::ptr::null_mut() };
2524                         CResult_RouteDecodeErrorZPtr { result }
2525                 } else {
2526                         let err = unsafe { o.contents.err };
2527                         unsafe { o.contents.err = core::ptr::null_mut(); }
2528                         CResult_RouteDecodeErrorZPtr { err }
2529                 };
2530                 Self {
2531                         contents,
2532                         result_ok: o.result_ok,
2533                 }
2534         }
2535 }
2536 impl Clone for CResult_RouteDecodeErrorZ {
2537         fn clone(&self) -> Self {
2538                 if self.result_ok {
2539                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2540                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2541                         } }
2542                 } else {
2543                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2544                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2545                         } }
2546                 }
2547         }
2548 }
2549 #[no_mangle]
2550 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2551 /// but with all dynamically-allocated buffers duplicated in new buffers.
2552 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2553 #[repr(C)]
2554 /// The contents of CResult_RouteParametersDecodeErrorZ
2555 pub union CResult_RouteParametersDecodeErrorZPtr {
2556         /// A pointer to the contents in the success state.
2557         /// Reading from this pointer when `result_ok` is not set is undefined.
2558         pub result: *mut crate::lightning::routing::router::RouteParameters,
2559         /// A pointer to the contents in the error state.
2560         /// Reading from this pointer when `result_ok` is set is undefined.
2561         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2562 }
2563 #[repr(C)]
2564 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2565 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2567 pub struct CResult_RouteParametersDecodeErrorZ {
2568         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2569         /// `err` or `result` depending on the state of `result_ok`.
2570         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2571         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2572         pub result_ok: bool,
2573 }
2574 #[no_mangle]
2575 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2576 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2577         CResult_RouteParametersDecodeErrorZ {
2578                 contents: CResult_RouteParametersDecodeErrorZPtr {
2579                         result: Box::into_raw(Box::new(o)),
2580                 },
2581                 result_ok: true,
2582         }
2583 }
2584 #[no_mangle]
2585 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2586 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2587         CResult_RouteParametersDecodeErrorZ {
2588                 contents: CResult_RouteParametersDecodeErrorZPtr {
2589                         err: Box::into_raw(Box::new(e)),
2590                 },
2591                 result_ok: false,
2592         }
2593 }
2594 /// Checks if the given object is currently in the success state
2595 #[no_mangle]
2596 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2597         o.result_ok
2598 }
2599 #[no_mangle]
2600 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2601 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2602 impl Drop for CResult_RouteParametersDecodeErrorZ {
2603         fn drop(&mut self) {
2604                 if self.result_ok {
2605                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2606                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2607                         }
2608                 } else {
2609                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2610                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2611                         }
2612                 }
2613         }
2614 }
2615 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2616         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2617                 let contents = if o.result_ok {
2618                         let result = unsafe { o.contents.result };
2619                         unsafe { o.contents.result = core::ptr::null_mut() };
2620                         CResult_RouteParametersDecodeErrorZPtr { result }
2621                 } else {
2622                         let err = unsafe { o.contents.err };
2623                         unsafe { o.contents.err = core::ptr::null_mut(); }
2624                         CResult_RouteParametersDecodeErrorZPtr { err }
2625                 };
2626                 Self {
2627                         contents,
2628                         result_ok: o.result_ok,
2629                 }
2630         }
2631 }
2632 impl Clone for CResult_RouteParametersDecodeErrorZ {
2633         fn clone(&self) -> Self {
2634                 if self.result_ok {
2635                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2636                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2637                         } }
2638                 } else {
2639                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2640                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2641                         } }
2642                 }
2643         }
2644 }
2645 #[no_mangle]
2646 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2647 /// but with all dynamically-allocated buffers duplicated in new buffers.
2648 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2649 #[repr(C)]
2650 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2651 /// This corresponds to std::vector in C++
2652 pub struct CVec_RouteHintZ {
2653         /// The elements in the array.
2654         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2655         pub data: *mut crate::lightning::routing::router::RouteHint,
2656         /// The number of elements pointed to by `data`.
2657         pub datalen: usize
2658 }
2659 impl CVec_RouteHintZ {
2660         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2661                 if self.datalen == 0 { return Vec::new(); }
2662                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2663                 self.data = core::ptr::null_mut();
2664                 self.datalen = 0;
2665                 ret
2666         }
2667         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2668                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2669         }
2670 }
2671 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2672         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2673                 let datalen = v.len();
2674                 let data = Box::into_raw(v.into_boxed_slice());
2675                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2676         }
2677 }
2678 #[no_mangle]
2679 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2680 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2681 impl Drop for CVec_RouteHintZ {
2682         fn drop(&mut self) {
2683                 if self.datalen == 0 { return; }
2684                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2685         }
2686 }
2687 impl Clone for CVec_RouteHintZ {
2688         fn clone(&self) -> Self {
2689                 let mut res = Vec::new();
2690                 if self.datalen == 0 { return Self::from(res); }
2691                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2692                 Self::from(res)
2693         }
2694 }
2695 #[repr(C)]
2696 /// A dynamically-allocated array of u64s of arbitrary size.
2697 /// This corresponds to std::vector in C++
2698 pub struct CVec_u64Z {
2699         /// The elements in the array.
2700         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2701         pub data: *mut u64,
2702         /// The number of elements pointed to by `data`.
2703         pub datalen: usize
2704 }
2705 impl CVec_u64Z {
2706         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2707                 if self.datalen == 0 { return Vec::new(); }
2708                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2709                 self.data = core::ptr::null_mut();
2710                 self.datalen = 0;
2711                 ret
2712         }
2713         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2714                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2715         }
2716 }
2717 impl From<Vec<u64>> for CVec_u64Z {
2718         fn from(v: Vec<u64>) -> Self {
2719                 let datalen = v.len();
2720                 let data = Box::into_raw(v.into_boxed_slice());
2721                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2722         }
2723 }
2724 #[no_mangle]
2725 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2726 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2727 impl Drop for CVec_u64Z {
2728         fn drop(&mut self) {
2729                 if self.datalen == 0 { return; }
2730                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2731         }
2732 }
2733 impl Clone for CVec_u64Z {
2734         fn clone(&self) -> Self {
2735                 let mut res = Vec::new();
2736                 if self.datalen == 0 { return Self::from(res); }
2737                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2738                 Self::from(res)
2739         }
2740 }
2741 #[repr(C)]
2742 /// The contents of CResult_PaymentParametersDecodeErrorZ
2743 pub union CResult_PaymentParametersDecodeErrorZPtr {
2744         /// A pointer to the contents in the success state.
2745         /// Reading from this pointer when `result_ok` is not set is undefined.
2746         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2747         /// A pointer to the contents in the error state.
2748         /// Reading from this pointer when `result_ok` is set is undefined.
2749         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2750 }
2751 #[repr(C)]
2752 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2753 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2755 pub struct CResult_PaymentParametersDecodeErrorZ {
2756         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2757         /// `err` or `result` depending on the state of `result_ok`.
2758         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2759         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2760         pub result_ok: bool,
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2764 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2765         CResult_PaymentParametersDecodeErrorZ {
2766                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2767                         result: Box::into_raw(Box::new(o)),
2768                 },
2769                 result_ok: true,
2770         }
2771 }
2772 #[no_mangle]
2773 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2774 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2775         CResult_PaymentParametersDecodeErrorZ {
2776                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2777                         err: Box::into_raw(Box::new(e)),
2778                 },
2779                 result_ok: false,
2780         }
2781 }
2782 /// Checks if the given object is currently in the success state
2783 #[no_mangle]
2784 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2785         o.result_ok
2786 }
2787 #[no_mangle]
2788 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2789 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2790 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2791         fn drop(&mut self) {
2792                 if self.result_ok {
2793                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2794                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2795                         }
2796                 } else {
2797                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2798                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2799                         }
2800                 }
2801         }
2802 }
2803 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2804         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2805                 let contents = if o.result_ok {
2806                         let result = unsafe { o.contents.result };
2807                         unsafe { o.contents.result = core::ptr::null_mut() };
2808                         CResult_PaymentParametersDecodeErrorZPtr { result }
2809                 } else {
2810                         let err = unsafe { o.contents.err };
2811                         unsafe { o.contents.err = core::ptr::null_mut(); }
2812                         CResult_PaymentParametersDecodeErrorZPtr { err }
2813                 };
2814                 Self {
2815                         contents,
2816                         result_ok: o.result_ok,
2817                 }
2818         }
2819 }
2820 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2821         fn clone(&self) -> Self {
2822                 if self.result_ok {
2823                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2824                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2825                         } }
2826                 } else {
2827                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2828                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2829                         } }
2830                 }
2831         }
2832 }
2833 #[no_mangle]
2834 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2835 /// but with all dynamically-allocated buffers duplicated in new buffers.
2836 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2837 #[repr(C)]
2838 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2839 /// This corresponds to std::vector in C++
2840 pub struct CVec_RouteHintHopZ {
2841         /// The elements in the array.
2842         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2843         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2844         /// The number of elements pointed to by `data`.
2845         pub datalen: usize
2846 }
2847 impl CVec_RouteHintHopZ {
2848         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2849                 if self.datalen == 0 { return Vec::new(); }
2850                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2851                 self.data = core::ptr::null_mut();
2852                 self.datalen = 0;
2853                 ret
2854         }
2855         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2856                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2857         }
2858 }
2859 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2860         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2861                 let datalen = v.len();
2862                 let data = Box::into_raw(v.into_boxed_slice());
2863                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2864         }
2865 }
2866 #[no_mangle]
2867 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2868 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2869 impl Drop for CVec_RouteHintHopZ {
2870         fn drop(&mut self) {
2871                 if self.datalen == 0 { return; }
2872                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2873         }
2874 }
2875 impl Clone for CVec_RouteHintHopZ {
2876         fn clone(&self) -> Self {
2877                 let mut res = Vec::new();
2878                 if self.datalen == 0 { return Self::from(res); }
2879                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2880                 Self::from(res)
2881         }
2882 }
2883 #[repr(C)]
2884 /// The contents of CResult_RouteHintDecodeErrorZ
2885 pub union CResult_RouteHintDecodeErrorZPtr {
2886         /// A pointer to the contents in the success state.
2887         /// Reading from this pointer when `result_ok` is not set is undefined.
2888         pub result: *mut crate::lightning::routing::router::RouteHint,
2889         /// A pointer to the contents in the error state.
2890         /// Reading from this pointer when `result_ok` is set is undefined.
2891         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2892 }
2893 #[repr(C)]
2894 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2895 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2897 pub struct CResult_RouteHintDecodeErrorZ {
2898         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2899         /// `err` or `result` depending on the state of `result_ok`.
2900         pub contents: CResult_RouteHintDecodeErrorZPtr,
2901         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2902         pub result_ok: bool,
2903 }
2904 #[no_mangle]
2905 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2906 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2907         CResult_RouteHintDecodeErrorZ {
2908                 contents: CResult_RouteHintDecodeErrorZPtr {
2909                         result: Box::into_raw(Box::new(o)),
2910                 },
2911                 result_ok: true,
2912         }
2913 }
2914 #[no_mangle]
2915 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2916 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2917         CResult_RouteHintDecodeErrorZ {
2918                 contents: CResult_RouteHintDecodeErrorZPtr {
2919                         err: Box::into_raw(Box::new(e)),
2920                 },
2921                 result_ok: false,
2922         }
2923 }
2924 /// Checks if the given object is currently in the success state
2925 #[no_mangle]
2926 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2927         o.result_ok
2928 }
2929 #[no_mangle]
2930 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2931 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2932 impl Drop for CResult_RouteHintDecodeErrorZ {
2933         fn drop(&mut self) {
2934                 if self.result_ok {
2935                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2936                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2937                         }
2938                 } else {
2939                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2940                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2941                         }
2942                 }
2943         }
2944 }
2945 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2946         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2947                 let contents = if o.result_ok {
2948                         let result = unsafe { o.contents.result };
2949                         unsafe { o.contents.result = core::ptr::null_mut() };
2950                         CResult_RouteHintDecodeErrorZPtr { result }
2951                 } else {
2952                         let err = unsafe { o.contents.err };
2953                         unsafe { o.contents.err = core::ptr::null_mut(); }
2954                         CResult_RouteHintDecodeErrorZPtr { err }
2955                 };
2956                 Self {
2957                         contents,
2958                         result_ok: o.result_ok,
2959                 }
2960         }
2961 }
2962 impl Clone for CResult_RouteHintDecodeErrorZ {
2963         fn clone(&self) -> Self {
2964                 if self.result_ok {
2965                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2966                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2967                         } }
2968                 } else {
2969                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2970                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2971                         } }
2972                 }
2973         }
2974 }
2975 #[no_mangle]
2976 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2977 /// but with all dynamically-allocated buffers duplicated in new buffers.
2978 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2979 #[repr(C)]
2980 /// The contents of CResult_RouteHintHopDecodeErrorZ
2981 pub union CResult_RouteHintHopDecodeErrorZPtr {
2982         /// A pointer to the contents in the success state.
2983         /// Reading from this pointer when `result_ok` is not set is undefined.
2984         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2985         /// A pointer to the contents in the error state.
2986         /// Reading from this pointer when `result_ok` is set is undefined.
2987         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2988 }
2989 #[repr(C)]
2990 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2991 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2993 pub struct CResult_RouteHintHopDecodeErrorZ {
2994         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2995         /// `err` or `result` depending on the state of `result_ok`.
2996         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2997         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2998         pub result_ok: bool,
2999 }
3000 #[no_mangle]
3001 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
3002 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
3003         CResult_RouteHintHopDecodeErrorZ {
3004                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3005                         result: Box::into_raw(Box::new(o)),
3006                 },
3007                 result_ok: true,
3008         }
3009 }
3010 #[no_mangle]
3011 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
3012 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
3013         CResult_RouteHintHopDecodeErrorZ {
3014                 contents: CResult_RouteHintHopDecodeErrorZPtr {
3015                         err: Box::into_raw(Box::new(e)),
3016                 },
3017                 result_ok: false,
3018         }
3019 }
3020 /// Checks if the given object is currently in the success state
3021 #[no_mangle]
3022 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
3023         o.result_ok
3024 }
3025 #[no_mangle]
3026 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
3027 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
3028 impl Drop for CResult_RouteHintHopDecodeErrorZ {
3029         fn drop(&mut self) {
3030                 if self.result_ok {
3031                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3032                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3033                         }
3034                 } else {
3035                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3036                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3037                         }
3038                 }
3039         }
3040 }
3041 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
3042         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
3043                 let contents = if o.result_ok {
3044                         let result = unsafe { o.contents.result };
3045                         unsafe { o.contents.result = core::ptr::null_mut() };
3046                         CResult_RouteHintHopDecodeErrorZPtr { result }
3047                 } else {
3048                         let err = unsafe { o.contents.err };
3049                         unsafe { o.contents.err = core::ptr::null_mut(); }
3050                         CResult_RouteHintHopDecodeErrorZPtr { err }
3051                 };
3052                 Self {
3053                         contents,
3054                         result_ok: o.result_ok,
3055                 }
3056         }
3057 }
3058 impl Clone for CResult_RouteHintHopDecodeErrorZ {
3059         fn clone(&self) -> Self {
3060                 if self.result_ok {
3061                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
3062                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
3063                         } }
3064                 } else {
3065                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
3066                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3067                         } }
3068                 }
3069         }
3070 }
3071 #[no_mangle]
3072 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
3073 /// but with all dynamically-allocated buffers duplicated in new buffers.
3074 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
3075 #[repr(C)]
3076 /// The contents of CResult_PaymentPurposeDecodeErrorZ
3077 pub union CResult_PaymentPurposeDecodeErrorZPtr {
3078         /// A pointer to the contents in the success state.
3079         /// Reading from this pointer when `result_ok` is not set is undefined.
3080         pub result: *mut crate::lightning::util::events::PaymentPurpose,
3081         /// A pointer to the contents in the error state.
3082         /// Reading from this pointer when `result_ok` is set is undefined.
3083         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3084 }
3085 #[repr(C)]
3086 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
3087 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
3088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3089 pub struct CResult_PaymentPurposeDecodeErrorZ {
3090         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
3091         /// `err` or `result` depending on the state of `result_ok`.
3092         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
3093         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
3094         pub result_ok: bool,
3095 }
3096 #[no_mangle]
3097 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
3098 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
3099         CResult_PaymentPurposeDecodeErrorZ {
3100                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3101                         result: Box::into_raw(Box::new(o)),
3102                 },
3103                 result_ok: true,
3104         }
3105 }
3106 #[no_mangle]
3107 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
3108 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
3109         CResult_PaymentPurposeDecodeErrorZ {
3110                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
3111                         err: Box::into_raw(Box::new(e)),
3112                 },
3113                 result_ok: false,
3114         }
3115 }
3116 /// Checks if the given object is currently in the success state
3117 #[no_mangle]
3118 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
3119         o.result_ok
3120 }
3121 #[no_mangle]
3122 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
3123 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
3124 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
3125         fn drop(&mut self) {
3126                 if self.result_ok {
3127                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3128                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3129                         }
3130                 } else {
3131                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3132                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3133                         }
3134                 }
3135         }
3136 }
3137 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
3138         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
3139                 let contents = if o.result_ok {
3140                         let result = unsafe { o.contents.result };
3141                         unsafe { o.contents.result = core::ptr::null_mut() };
3142                         CResult_PaymentPurposeDecodeErrorZPtr { result }
3143                 } else {
3144                         let err = unsafe { o.contents.err };
3145                         unsafe { o.contents.err = core::ptr::null_mut(); }
3146                         CResult_PaymentPurposeDecodeErrorZPtr { err }
3147                 };
3148                 Self {
3149                         contents,
3150                         result_ok: o.result_ok,
3151                 }
3152         }
3153 }
3154 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
3155         fn clone(&self) -> Self {
3156                 if self.result_ok {
3157                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3158                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3159                         } }
3160                 } else {
3161                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3162                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3163                         } }
3164                 }
3165         }
3166 }
3167 #[no_mangle]
3168 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3169 /// but with all dynamically-allocated buffers duplicated in new buffers.
3170 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3171 #[repr(C)]
3172 #[derive(Clone)]
3173 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3174 pub enum COption_ClosureReasonZ {
3175         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3176         Some(crate::lightning::util::events::ClosureReason),
3177         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3178         None
3179 }
3180 impl COption_ClosureReasonZ {
3181         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3182                 if let Self::None = self { false } else { true }
3183         }
3184         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3185                 !self.is_some()
3186         }
3187         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3188                 if let Self::Some(v) = self { v } else { unreachable!() }
3189         }
3190 }
3191 #[no_mangle]
3192 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3193 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3194         COption_ClosureReasonZ::Some(o)
3195 }
3196 #[no_mangle]
3197 /// Constructs a new COption_ClosureReasonZ containing nothing
3198 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3199         COption_ClosureReasonZ::None
3200 }
3201 #[no_mangle]
3202 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3203 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3204 #[no_mangle]
3205 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3206 /// but with all dynamically-allocated buffers duplicated in new buffers.
3207 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3208 #[repr(C)]
3209 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3210 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3211         /// A pointer to the contents in the success state.
3212         /// Reading from this pointer when `result_ok` is not set is undefined.
3213         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3214         /// A pointer to the contents in the error state.
3215         /// Reading from this pointer when `result_ok` is set is undefined.
3216         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3217 }
3218 #[repr(C)]
3219 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3220 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3222 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3223         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3224         /// `err` or `result` depending on the state of `result_ok`.
3225         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3226         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3227         pub result_ok: bool,
3228 }
3229 #[no_mangle]
3230 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3231 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3232         CResult_COption_ClosureReasonZDecodeErrorZ {
3233                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3234                         result: Box::into_raw(Box::new(o)),
3235                 },
3236                 result_ok: true,
3237         }
3238 }
3239 #[no_mangle]
3240 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3241 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3242         CResult_COption_ClosureReasonZDecodeErrorZ {
3243                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3244                         err: Box::into_raw(Box::new(e)),
3245                 },
3246                 result_ok: false,
3247         }
3248 }
3249 /// Checks if the given object is currently in the success state
3250 #[no_mangle]
3251 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3252         o.result_ok
3253 }
3254 #[no_mangle]
3255 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3256 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3257 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3258         fn drop(&mut self) {
3259                 if self.result_ok {
3260                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3261                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3262                         }
3263                 } else {
3264                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3265                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3266                         }
3267                 }
3268         }
3269 }
3270 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3271         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3272                 let contents = if o.result_ok {
3273                         let result = unsafe { o.contents.result };
3274                         unsafe { o.contents.result = core::ptr::null_mut() };
3275                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3276                 } else {
3277                         let err = unsafe { o.contents.err };
3278                         unsafe { o.contents.err = core::ptr::null_mut(); }
3279                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3280                 };
3281                 Self {
3282                         contents,
3283                         result_ok: o.result_ok,
3284                 }
3285         }
3286 }
3287 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3288         fn clone(&self) -> Self {
3289                 if self.result_ok {
3290                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3291                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3292                         } }
3293                 } else {
3294                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3296                         } }
3297                 }
3298         }
3299 }
3300 #[no_mangle]
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3302 /// but with all dynamically-allocated buffers duplicated in new buffers.
3303 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3304 #[repr(C)]
3305 #[derive(Clone)]
3306 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3307 pub enum COption_HTLCDestinationZ {
3308         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3309         Some(crate::lightning::util::events::HTLCDestination),
3310         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3311         None
3312 }
3313 impl COption_HTLCDestinationZ {
3314         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3315                 if let Self::None = self { false } else { true }
3316         }
3317         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3318                 !self.is_some()
3319         }
3320         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3321                 if let Self::Some(v) = self { v } else { unreachable!() }
3322         }
3323 }
3324 #[no_mangle]
3325 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3326 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3327         COption_HTLCDestinationZ::Some(o)
3328 }
3329 #[no_mangle]
3330 /// Constructs a new COption_HTLCDestinationZ containing nothing
3331 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3332         COption_HTLCDestinationZ::None
3333 }
3334 #[no_mangle]
3335 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3336 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3337 #[no_mangle]
3338 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3339 /// but with all dynamically-allocated buffers duplicated in new buffers.
3340 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3341 #[repr(C)]
3342 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3343 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3344         /// A pointer to the contents in the success state.
3345         /// Reading from this pointer when `result_ok` is not set is undefined.
3346         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3347         /// A pointer to the contents in the error state.
3348         /// Reading from this pointer when `result_ok` is set is undefined.
3349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3350 }
3351 #[repr(C)]
3352 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3353 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3355 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3356         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3357         /// `err` or `result` depending on the state of `result_ok`.
3358         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3359         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3360         pub result_ok: bool,
3361 }
3362 #[no_mangle]
3363 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3364 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3365         CResult_COption_HTLCDestinationZDecodeErrorZ {
3366                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3367                         result: Box::into_raw(Box::new(o)),
3368                 },
3369                 result_ok: true,
3370         }
3371 }
3372 #[no_mangle]
3373 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3374 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3375         CResult_COption_HTLCDestinationZDecodeErrorZ {
3376                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3377                         err: Box::into_raw(Box::new(e)),
3378                 },
3379                 result_ok: false,
3380         }
3381 }
3382 /// Checks if the given object is currently in the success state
3383 #[no_mangle]
3384 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3385         o.result_ok
3386 }
3387 #[no_mangle]
3388 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3389 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3390 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3391         fn drop(&mut self) {
3392                 if self.result_ok {
3393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3395                         }
3396                 } else {
3397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3399                         }
3400                 }
3401         }
3402 }
3403 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3404         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3405                 let contents = if o.result_ok {
3406                         let result = unsafe { o.contents.result };
3407                         unsafe { o.contents.result = core::ptr::null_mut() };
3408                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3409                 } else {
3410                         let err = unsafe { o.contents.err };
3411                         unsafe { o.contents.err = core::ptr::null_mut(); }
3412                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3413                 };
3414                 Self {
3415                         contents,
3416                         result_ok: o.result_ok,
3417                 }
3418         }
3419 }
3420 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3421         fn clone(&self) -> Self {
3422                 if self.result_ok {
3423                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3424                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3425                         } }
3426                 } else {
3427                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3429                         } }
3430                 }
3431         }
3432 }
3433 #[no_mangle]
3434 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3435 /// but with all dynamically-allocated buffers duplicated in new buffers.
3436 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3437 #[repr(C)]
3438 #[derive(Clone)]
3439 /// An enum which can either contain a crate::c_types::U128 or not
3440 pub enum COption_u128Z {
3441         /// When we're in this state, this COption_u128Z contains a crate::c_types::U128
3442         Some(crate::c_types::U128),
3443         /// When we're in this state, this COption_u128Z contains nothing
3444         None
3445 }
3446 impl COption_u128Z {
3447         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3448                 if let Self::None = self { false } else { true }
3449         }
3450         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3451                 !self.is_some()
3452         }
3453         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 {
3454                 if let Self::Some(v) = self { v } else { unreachable!() }
3455         }
3456 }
3457 #[no_mangle]
3458 /// Constructs a new COption_u128Z containing a crate::c_types::U128
3459 pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z {
3460         COption_u128Z::Some(o)
3461 }
3462 #[no_mangle]
3463 /// Constructs a new COption_u128Z containing nothing
3464 pub extern "C" fn COption_u128Z_none() -> COption_u128Z {
3465         COption_u128Z::None
3466 }
3467 #[no_mangle]
3468 /// Frees any resources associated with the crate::c_types::U128, if we are in the Some state
3469 pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { }
3470 #[no_mangle]
3471 /// Creates a new COption_u128Z which has the same data as `orig`
3472 /// but with all dynamically-allocated buffers duplicated in new buffers.
3473 pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) }
3474 #[repr(C)]
3475 #[derive(Clone)]
3476 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3477 pub enum COption_NetworkUpdateZ {
3478         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3479         Some(crate::lightning::routing::gossip::NetworkUpdate),
3480         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3481         None
3482 }
3483 impl COption_NetworkUpdateZ {
3484         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3485                 if let Self::None = self { false } else { true }
3486         }
3487         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3488                 !self.is_some()
3489         }
3490         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3491                 if let Self::Some(v) = self { v } else { unreachable!() }
3492         }
3493 }
3494 #[no_mangle]
3495 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3496 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3497         COption_NetworkUpdateZ::Some(o)
3498 }
3499 #[no_mangle]
3500 /// Constructs a new COption_NetworkUpdateZ containing nothing
3501 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3502         COption_NetworkUpdateZ::None
3503 }
3504 #[no_mangle]
3505 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3506 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3507 #[no_mangle]
3508 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3509 /// but with all dynamically-allocated buffers duplicated in new buffers.
3510 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3511 #[repr(C)]
3512 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3513 /// This corresponds to std::vector in C++
3514 pub struct CVec_SpendableOutputDescriptorZ {
3515         /// The elements in the array.
3516         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3517         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3518         /// The number of elements pointed to by `data`.
3519         pub datalen: usize
3520 }
3521 impl CVec_SpendableOutputDescriptorZ {
3522         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3523                 if self.datalen == 0 { return Vec::new(); }
3524                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3525                 self.data = core::ptr::null_mut();
3526                 self.datalen = 0;
3527                 ret
3528         }
3529         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3530                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3531         }
3532 }
3533 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3534         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3535                 let datalen = v.len();
3536                 let data = Box::into_raw(v.into_boxed_slice());
3537                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3538         }
3539 }
3540 #[no_mangle]
3541 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3542 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3543 impl Drop for CVec_SpendableOutputDescriptorZ {
3544         fn drop(&mut self) {
3545                 if self.datalen == 0 { return; }
3546                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3547         }
3548 }
3549 impl Clone for CVec_SpendableOutputDescriptorZ {
3550         fn clone(&self) -> Self {
3551                 let mut res = Vec::new();
3552                 if self.datalen == 0 { return Self::from(res); }
3553                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3554                 Self::from(res)
3555         }
3556 }
3557 #[repr(C)]
3558 #[derive(Clone)]
3559 /// An enum which can either contain a crate::lightning::util::events::Event or not
3560 pub enum COption_EventZ {
3561         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3562         Some(crate::lightning::util::events::Event),
3563         /// When we're in this state, this COption_EventZ contains nothing
3564         None
3565 }
3566 impl COption_EventZ {
3567         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3568                 if let Self::None = self { false } else { true }
3569         }
3570         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3571                 !self.is_some()
3572         }
3573         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3574                 if let Self::Some(v) = self { v } else { unreachable!() }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3579 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3580         COption_EventZ::Some(o)
3581 }
3582 #[no_mangle]
3583 /// Constructs a new COption_EventZ containing nothing
3584 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3585         COption_EventZ::None
3586 }
3587 #[no_mangle]
3588 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3589 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3590 #[no_mangle]
3591 /// Creates a new COption_EventZ which has the same data as `orig`
3592 /// but with all dynamically-allocated buffers duplicated in new buffers.
3593 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3594 #[repr(C)]
3595 /// The contents of CResult_COption_EventZDecodeErrorZ
3596 pub union CResult_COption_EventZDecodeErrorZPtr {
3597         /// A pointer to the contents in the success state.
3598         /// Reading from this pointer when `result_ok` is not set is undefined.
3599         pub result: *mut crate::c_types::derived::COption_EventZ,
3600         /// A pointer to the contents in the error state.
3601         /// Reading from this pointer when `result_ok` is set is undefined.
3602         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3603 }
3604 #[repr(C)]
3605 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3606 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3608 pub struct CResult_COption_EventZDecodeErrorZ {
3609         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3610         /// `err` or `result` depending on the state of `result_ok`.
3611         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3612         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3613         pub result_ok: bool,
3614 }
3615 #[no_mangle]
3616 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3617 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3618         CResult_COption_EventZDecodeErrorZ {
3619                 contents: CResult_COption_EventZDecodeErrorZPtr {
3620                         result: Box::into_raw(Box::new(o)),
3621                 },
3622                 result_ok: true,
3623         }
3624 }
3625 #[no_mangle]
3626 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3627 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3628         CResult_COption_EventZDecodeErrorZ {
3629                 contents: CResult_COption_EventZDecodeErrorZPtr {
3630                         err: Box::into_raw(Box::new(e)),
3631                 },
3632                 result_ok: false,
3633         }
3634 }
3635 /// Checks if the given object is currently in the success state
3636 #[no_mangle]
3637 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3638         o.result_ok
3639 }
3640 #[no_mangle]
3641 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3642 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3643 impl Drop for CResult_COption_EventZDecodeErrorZ {
3644         fn drop(&mut self) {
3645                 if self.result_ok {
3646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3648                         }
3649                 } else {
3650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3652                         }
3653                 }
3654         }
3655 }
3656 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3657         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3658                 let contents = if o.result_ok {
3659                         let result = unsafe { o.contents.result };
3660                         unsafe { o.contents.result = core::ptr::null_mut() };
3661                         CResult_COption_EventZDecodeErrorZPtr { result }
3662                 } else {
3663                         let err = unsafe { o.contents.err };
3664                         unsafe { o.contents.err = core::ptr::null_mut(); }
3665                         CResult_COption_EventZDecodeErrorZPtr { err }
3666                 };
3667                 Self {
3668                         contents,
3669                         result_ok: o.result_ok,
3670                 }
3671         }
3672 }
3673 impl Clone for CResult_COption_EventZDecodeErrorZ {
3674         fn clone(&self) -> Self {
3675                 if self.result_ok {
3676                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3677                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3678                         } }
3679                 } else {
3680                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3681                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3682                         } }
3683                 }
3684         }
3685 }
3686 #[no_mangle]
3687 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3688 /// but with all dynamically-allocated buffers duplicated in new buffers.
3689 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3690 #[repr(C)]
3691 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3692 /// This corresponds to std::vector in C++
3693 pub struct CVec_MessageSendEventZ {
3694         /// The elements in the array.
3695         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3696         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3697         /// The number of elements pointed to by `data`.
3698         pub datalen: usize
3699 }
3700 impl CVec_MessageSendEventZ {
3701         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3702                 if self.datalen == 0 { return Vec::new(); }
3703                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3704                 self.data = core::ptr::null_mut();
3705                 self.datalen = 0;
3706                 ret
3707         }
3708         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3709                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3710         }
3711 }
3712 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3713         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3714                 let datalen = v.len();
3715                 let data = Box::into_raw(v.into_boxed_slice());
3716                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3717         }
3718 }
3719 #[no_mangle]
3720 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3721 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3722 impl Drop for CVec_MessageSendEventZ {
3723         fn drop(&mut self) {
3724                 if self.datalen == 0 { return; }
3725                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3726         }
3727 }
3728 impl Clone for CVec_MessageSendEventZ {
3729         fn clone(&self) -> Self {
3730                 let mut res = Vec::new();
3731                 if self.datalen == 0 { return Self::from(res); }
3732                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3733                 Self::from(res)
3734         }
3735 }
3736 #[repr(C)]
3737 /// The contents of CResult_TxOutAccessErrorZ
3738 pub union CResult_TxOutAccessErrorZPtr {
3739         /// A pointer to the contents in the success state.
3740         /// Reading from this pointer when `result_ok` is not set is undefined.
3741         pub result: *mut crate::c_types::TxOut,
3742         /// A pointer to the contents in the error state.
3743         /// Reading from this pointer when `result_ok` is set is undefined.
3744         pub err: *mut crate::lightning::chain::AccessError,
3745 }
3746 #[repr(C)]
3747 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3748 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3750 pub struct CResult_TxOutAccessErrorZ {
3751         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3752         /// `err` or `result` depending on the state of `result_ok`.
3753         pub contents: CResult_TxOutAccessErrorZPtr,
3754         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3755         pub result_ok: bool,
3756 }
3757 #[no_mangle]
3758 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3759 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3760         CResult_TxOutAccessErrorZ {
3761                 contents: CResult_TxOutAccessErrorZPtr {
3762                         result: Box::into_raw(Box::new(o)),
3763                 },
3764                 result_ok: true,
3765         }
3766 }
3767 #[no_mangle]
3768 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3769 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3770         CResult_TxOutAccessErrorZ {
3771                 contents: CResult_TxOutAccessErrorZPtr {
3772                         err: Box::into_raw(Box::new(e)),
3773                 },
3774                 result_ok: false,
3775         }
3776 }
3777 /// Checks if the given object is currently in the success state
3778 #[no_mangle]
3779 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3780         o.result_ok
3781 }
3782 #[no_mangle]
3783 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3784 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3785 impl Drop for CResult_TxOutAccessErrorZ {
3786         fn drop(&mut self) {
3787                 if self.result_ok {
3788                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3789                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3790                         }
3791                 } else {
3792                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3793                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3794                         }
3795                 }
3796         }
3797 }
3798 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3799         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3800                 let contents = if o.result_ok {
3801                         let result = unsafe { o.contents.result };
3802                         unsafe { o.contents.result = core::ptr::null_mut() };
3803                         CResult_TxOutAccessErrorZPtr { result }
3804                 } else {
3805                         let err = unsafe { o.contents.err };
3806                         unsafe { o.contents.err = core::ptr::null_mut(); }
3807                         CResult_TxOutAccessErrorZPtr { err }
3808                 };
3809                 Self {
3810                         contents,
3811                         result_ok: o.result_ok,
3812                 }
3813         }
3814 }
3815 impl Clone for CResult_TxOutAccessErrorZ {
3816         fn clone(&self) -> Self {
3817                 if self.result_ok {
3818                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3819                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3820                         } }
3821                 } else {
3822                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3823                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3824                         } }
3825                 }
3826         }
3827 }
3828 #[no_mangle]
3829 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3830 /// but with all dynamically-allocated buffers duplicated in new buffers.
3831 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3832 #[repr(C)]
3833 /// A tuple of 2 elements. See the individual fields for the types contained.
3834 pub struct C2Tuple_usizeTransactionZ {
3835         /// The element at position 0
3836         pub a: usize,
3837         /// The element at position 1
3838         pub b: crate::c_types::Transaction,
3839 }
3840 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3841         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3842                 Self {
3843                         a: tup.0,
3844                         b: tup.1,
3845                 }
3846         }
3847 }
3848 impl C2Tuple_usizeTransactionZ {
3849         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3850                 (self.a, self.b)
3851         }
3852 }
3853 impl Clone for C2Tuple_usizeTransactionZ {
3854         fn clone(&self) -> Self {
3855                 Self {
3856                         a: Clone::clone(&self.a),
3857                         b: Clone::clone(&self.b),
3858                 }
3859         }
3860 }
3861 #[no_mangle]
3862 /// Creates a new tuple which has the same data as `orig`
3863 /// but with all dynamically-allocated buffers duplicated in new buffers.
3864 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3865 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3866 #[no_mangle]
3867 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3868         C2Tuple_usizeTransactionZ { a, b, }
3869 }
3870
3871 #[no_mangle]
3872 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3873 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3874 #[repr(C)]
3875 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3876 /// This corresponds to std::vector in C++
3877 pub struct CVec_C2Tuple_usizeTransactionZZ {
3878         /// The elements in the array.
3879         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3880         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3881         /// The number of elements pointed to by `data`.
3882         pub datalen: usize
3883 }
3884 impl CVec_C2Tuple_usizeTransactionZZ {
3885         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3886                 if self.datalen == 0 { return Vec::new(); }
3887                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3888                 self.data = core::ptr::null_mut();
3889                 self.datalen = 0;
3890                 ret
3891         }
3892         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3893                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3894         }
3895 }
3896 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3897         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3898                 let datalen = v.len();
3899                 let data = Box::into_raw(v.into_boxed_slice());
3900                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3901         }
3902 }
3903 #[no_mangle]
3904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3905 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3906 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3907         fn drop(&mut self) {
3908                 if self.datalen == 0 { return; }
3909                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3910         }
3911 }
3912 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3913         fn clone(&self) -> Self {
3914                 let mut res = Vec::new();
3915                 if self.datalen == 0 { return Self::from(res); }
3916                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3917                 Self::from(res)
3918         }
3919 }
3920 #[repr(C)]
3921 /// A tuple of 2 elements. See the individual fields for the types contained.
3922 pub struct C2Tuple_TxidBlockHashZ {
3923         /// The element at position 0
3924         pub a: crate::c_types::ThirtyTwoBytes,
3925         /// The element at position 1
3926         pub b: crate::c_types::ThirtyTwoBytes,
3927 }
3928 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ {
3929         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
3930                 Self {
3931                         a: tup.0,
3932                         b: tup.1,
3933                 }
3934         }
3935 }
3936 impl C2Tuple_TxidBlockHashZ {
3937         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
3938                 (self.a, self.b)
3939         }
3940 }
3941 impl Clone for C2Tuple_TxidBlockHashZ {
3942         fn clone(&self) -> Self {
3943                 Self {
3944                         a: Clone::clone(&self.a),
3945                         b: Clone::clone(&self.b),
3946                 }
3947         }
3948 }
3949 #[no_mangle]
3950 /// Creates a new tuple which has the same data as `orig`
3951 /// but with all dynamically-allocated buffers duplicated in new buffers.
3952 pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) }
3953 /// Creates a new C2Tuple_TxidBlockHashZ from the contained elements.
3954 #[no_mangle]
3955 pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ {
3956         C2Tuple_TxidBlockHashZ { a, b, }
3957 }
3958
3959 #[no_mangle]
3960 /// Frees any resources used by the C2Tuple_TxidBlockHashZ.
3961 pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { }
3962 #[repr(C)]
3963 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
3964 /// This corresponds to std::vector in C++
3965 pub struct CVec_C2Tuple_TxidBlockHashZZ {
3966         /// The elements in the array.
3967         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3968         pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ,
3969         /// The number of elements pointed to by `data`.
3970         pub datalen: usize
3971 }
3972 impl CVec_C2Tuple_TxidBlockHashZZ {
3973         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ> {
3974                 if self.datalen == 0 { return Vec::new(); }
3975                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3976                 self.data = core::ptr::null_mut();
3977                 self.datalen = 0;
3978                 ret
3979         }
3980         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] {
3981                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3982         }
3983 }
3984 impl From<Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>> for CVec_C2Tuple_TxidBlockHashZZ {
3985         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidBlockHashZ>) -> Self {
3986                 let datalen = v.len();
3987                 let data = Box::into_raw(v.into_boxed_slice());
3988                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3989         }
3990 }
3991 #[no_mangle]
3992 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3993 pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { }
3994 impl Drop for CVec_C2Tuple_TxidBlockHashZZ {
3995         fn drop(&mut self) {
3996                 if self.datalen == 0 { return; }
3997                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3998         }
3999 }
4000 impl Clone for CVec_C2Tuple_TxidBlockHashZZ {
4001         fn clone(&self) -> Self {
4002                 let mut res = Vec::new();
4003                 if self.datalen == 0 { return Self::from(res); }
4004                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4005                 Self::from(res)
4006         }
4007 }
4008 #[repr(C)]
4009 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4010 /// This corresponds to std::vector in C++
4011 pub struct CVec_MonitorEventZ {
4012         /// The elements in the array.
4013         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4014         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
4015         /// The number of elements pointed to by `data`.
4016         pub datalen: usize
4017 }
4018 impl CVec_MonitorEventZ {
4019         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
4020                 if self.datalen == 0 { return Vec::new(); }
4021                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4022                 self.data = core::ptr::null_mut();
4023                 self.datalen = 0;
4024                 ret
4025         }
4026         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
4027                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4028         }
4029 }
4030 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
4031         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
4032                 let datalen = v.len();
4033                 let data = Box::into_raw(v.into_boxed_slice());
4034                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4035         }
4036 }
4037 #[no_mangle]
4038 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4039 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
4040 impl Drop for CVec_MonitorEventZ {
4041         fn drop(&mut self) {
4042                 if self.datalen == 0 { return; }
4043                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4044         }
4045 }
4046 impl Clone for CVec_MonitorEventZ {
4047         fn clone(&self) -> Self {
4048                 let mut res = Vec::new();
4049                 if self.datalen == 0 { return Self::from(res); }
4050                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4051                 Self::from(res)
4052         }
4053 }
4054 #[repr(C)]
4055 /// A tuple of 3 elements. See the individual fields for the types contained.
4056 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4057         /// The element at position 0
4058         pub a: crate::lightning::chain::transaction::OutPoint,
4059         /// The element at position 1
4060         pub b: crate::c_types::derived::CVec_MonitorEventZ,
4061         /// The element at position 2
4062         pub c: crate::c_types::PublicKey,
4063 }
4064 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4065         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
4066                 Self {
4067                         a: tup.0,
4068                         b: tup.1,
4069                         c: tup.2,
4070                 }
4071         }
4072 }
4073 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4074         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
4075                 (self.a, self.b, self.c)
4076         }
4077 }
4078 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4079         fn clone(&self) -> Self {
4080                 Self {
4081                         a: Clone::clone(&self.a),
4082                         b: Clone::clone(&self.b),
4083                         c: Clone::clone(&self.c),
4084                 }
4085         }
4086 }
4087 #[no_mangle]
4088 /// Creates a new tuple which has the same data as `orig`
4089 /// but with all dynamically-allocated buffers duplicated in new buffers.
4090 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
4091 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
4092 #[no_mangle]
4093 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4094         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
4095 }
4096
4097 #[no_mangle]
4098 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
4099 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
4100 #[repr(C)]
4101 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4102 /// This corresponds to std::vector in C++
4103 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4104         /// The elements in the array.
4105         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4106         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
4107         /// The number of elements pointed to by `data`.
4108         pub datalen: usize
4109 }
4110 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4111         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
4112                 if self.datalen == 0 { return Vec::new(); }
4113                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4114                 self.data = core::ptr::null_mut();
4115                 self.datalen = 0;
4116                 ret
4117         }
4118         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
4119                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4120         }
4121 }
4122 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4123         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
4124                 let datalen = v.len();
4125                 let data = Box::into_raw(v.into_boxed_slice());
4126                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4127         }
4128 }
4129 #[no_mangle]
4130 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4131 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
4132 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4133         fn drop(&mut self) {
4134                 if self.datalen == 0 { return; }
4135                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4136         }
4137 }
4138 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4139         fn clone(&self) -> Self {
4140                 let mut res = Vec::new();
4141                 if self.datalen == 0 { return Self::from(res); }
4142                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4143                 Self::from(res)
4144         }
4145 }
4146 #[repr(C)]
4147 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4148 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4149         /// A pointer to the contents in the success state.
4150         /// Reading from this pointer when `result_ok` is not set is undefined.
4151         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4152         /// A pointer to the contents in the error state.
4153         /// Reading from this pointer when `result_ok` is set is undefined.
4154         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4155 }
4156 #[repr(C)]
4157 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4158 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4161         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4162         /// `err` or `result` depending on the state of `result_ok`.
4163         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4164         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4165         pub result_ok: bool,
4166 }
4167 #[no_mangle]
4168 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4169 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4170         CResult_FixedPenaltyScorerDecodeErrorZ {
4171                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4172                         result: Box::into_raw(Box::new(o)),
4173                 },
4174                 result_ok: true,
4175         }
4176 }
4177 #[no_mangle]
4178 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4179 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4180         CResult_FixedPenaltyScorerDecodeErrorZ {
4181                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4182                         err: Box::into_raw(Box::new(e)),
4183                 },
4184                 result_ok: false,
4185         }
4186 }
4187 /// Checks if the given object is currently in the success state
4188 #[no_mangle]
4189 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4190         o.result_ok
4191 }
4192 #[no_mangle]
4193 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4194 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4195 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4196         fn drop(&mut self) {
4197                 if self.result_ok {
4198                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4199                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4200                         }
4201                 } else {
4202                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4203                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4204                         }
4205                 }
4206         }
4207 }
4208 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4209         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4210                 let contents = if o.result_ok {
4211                         let result = unsafe { o.contents.result };
4212                         unsafe { o.contents.result = core::ptr::null_mut() };
4213                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4214                 } else {
4215                         let err = unsafe { o.contents.err };
4216                         unsafe { o.contents.err = core::ptr::null_mut(); }
4217                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4218                 };
4219                 Self {
4220                         contents,
4221                         result_ok: o.result_ok,
4222                 }
4223         }
4224 }
4225 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4226         fn clone(&self) -> Self {
4227                 if self.result_ok {
4228                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4229                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4230                         } }
4231                 } else {
4232                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4233                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4234                         } }
4235                 }
4236         }
4237 }
4238 #[no_mangle]
4239 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4240 /// but with all dynamically-allocated buffers duplicated in new buffers.
4241 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4242 #[repr(C)]
4243 /// A tuple of 2 elements. See the individual fields for the types contained.
4244 pub struct C2Tuple_u64u64Z {
4245         /// The element at position 0
4246         pub a: u64,
4247         /// The element at position 1
4248         pub b: u64,
4249 }
4250 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4251         fn from (tup: (u64, u64)) -> Self {
4252                 Self {
4253                         a: tup.0,
4254                         b: tup.1,
4255                 }
4256         }
4257 }
4258 impl C2Tuple_u64u64Z {
4259         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4260                 (self.a, self.b)
4261         }
4262 }
4263 impl Clone for C2Tuple_u64u64Z {
4264         fn clone(&self) -> Self {
4265                 Self {
4266                         a: Clone::clone(&self.a),
4267                         b: Clone::clone(&self.b),
4268                 }
4269         }
4270 }
4271 #[no_mangle]
4272 /// Creates a new tuple which has the same data as `orig`
4273 /// but with all dynamically-allocated buffers duplicated in new buffers.
4274 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4275 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4276 #[no_mangle]
4277 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4278         C2Tuple_u64u64Z { a, b, }
4279 }
4280
4281 #[no_mangle]
4282 /// Frees any resources used by the C2Tuple_u64u64Z.
4283 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4284 #[repr(C)]
4285 #[derive(Clone)]
4286 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4287 pub enum COption_C2Tuple_u64u64ZZ {
4288         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4289         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4290         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4291         None
4292 }
4293 impl COption_C2Tuple_u64u64ZZ {
4294         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4295                 if let Self::None = self { false } else { true }
4296         }
4297         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4298                 !self.is_some()
4299         }
4300         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4301                 if let Self::Some(v) = self { v } else { unreachable!() }
4302         }
4303 }
4304 #[no_mangle]
4305 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4306 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4307         COption_C2Tuple_u64u64ZZ::Some(o)
4308 }
4309 #[no_mangle]
4310 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4311 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4312         COption_C2Tuple_u64u64ZZ::None
4313 }
4314 #[no_mangle]
4315 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4316 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4317 #[no_mangle]
4318 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4319 /// but with all dynamically-allocated buffers duplicated in new buffers.
4320 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4321 #[repr(C)]
4322 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4323 /// This corresponds to std::vector in C++
4324 pub struct CVec_NodeIdZ {
4325         /// The elements in the array.
4326         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4327         pub data: *mut crate::lightning::routing::gossip::NodeId,
4328         /// The number of elements pointed to by `data`.
4329         pub datalen: usize
4330 }
4331 impl CVec_NodeIdZ {
4332         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4333                 if self.datalen == 0 { return Vec::new(); }
4334                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4335                 self.data = core::ptr::null_mut();
4336                 self.datalen = 0;
4337                 ret
4338         }
4339         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4340                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4341         }
4342 }
4343 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4344         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4345                 let datalen = v.len();
4346                 let data = Box::into_raw(v.into_boxed_slice());
4347                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4348         }
4349 }
4350 #[no_mangle]
4351 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4352 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4353 impl Drop for CVec_NodeIdZ {
4354         fn drop(&mut self) {
4355                 if self.datalen == 0 { return; }
4356                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4357         }
4358 }
4359 impl Clone for CVec_NodeIdZ {
4360         fn clone(&self) -> Self {
4361                 let mut res = Vec::new();
4362                 if self.datalen == 0 { return Self::from(res); }
4363                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4364                 Self::from(res)
4365         }
4366 }
4367 #[repr(C)]
4368 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4369 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4370         /// A pointer to the contents in the success state.
4371         /// Reading from this pointer when `result_ok` is not set is undefined.
4372         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
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_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4379 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer 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_ProbabilisticScorerDecodeErrorZ {
4382         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4383         /// `err` or `result` depending on the state of `result_ok`.
4384         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4385         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4386         pub result_ok: bool,
4387 }
4388 #[no_mangle]
4389 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4390 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4391         CResult_ProbabilisticScorerDecodeErrorZ {
4392                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4393                         result: Box::into_raw(Box::new(o)),
4394                 },
4395                 result_ok: true,
4396         }
4397 }
4398 #[no_mangle]
4399 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4400 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4401         CResult_ProbabilisticScorerDecodeErrorZ {
4402                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
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_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4411         o.result_ok
4412 }
4413 #[no_mangle]
4414 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4415 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4416 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4417         fn drop(&mut self) {
4418                 if self.result_ok {
4419                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4420                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4421                         }
4422                 } else {
4423                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4424                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4425                         }
4426                 }
4427         }
4428 }
4429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4430         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, 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_ProbabilisticScorerDecodeErrorZPtr { result }
4435                 } else {
4436                         let err = unsafe { o.contents.err };
4437                         unsafe { o.contents.err = core::ptr::null_mut(); }
4438                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4439                 };
4440                 Self {
4441                         contents,
4442                         result_ok: o.result_ok,
4443                 }
4444         }
4445 }
4446 #[repr(C)]
4447 /// The contents of CResult_InitFeaturesDecodeErrorZ
4448 pub union CResult_InitFeaturesDecodeErrorZPtr {
4449         /// A pointer to the contents in the success state.
4450         /// Reading from this pointer when `result_ok` is not set is undefined.
4451         pub result: *mut crate::lightning::ln::features::InitFeatures,
4452         /// A pointer to the contents in the error state.
4453         /// Reading from this pointer when `result_ok` is set is undefined.
4454         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4455 }
4456 #[repr(C)]
4457 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4458 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4460 pub struct CResult_InitFeaturesDecodeErrorZ {
4461         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4462         /// `err` or `result` depending on the state of `result_ok`.
4463         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4464         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4465         pub result_ok: bool,
4466 }
4467 #[no_mangle]
4468 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4469 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4470         CResult_InitFeaturesDecodeErrorZ {
4471                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4472                         result: Box::into_raw(Box::new(o)),
4473                 },
4474                 result_ok: true,
4475         }
4476 }
4477 #[no_mangle]
4478 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4479 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4480         CResult_InitFeaturesDecodeErrorZ {
4481                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4482                         err: Box::into_raw(Box::new(e)),
4483                 },
4484                 result_ok: false,
4485         }
4486 }
4487 /// Checks if the given object is currently in the success state
4488 #[no_mangle]
4489 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4490         o.result_ok
4491 }
4492 #[no_mangle]
4493 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4494 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4495 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4496         fn drop(&mut self) {
4497                 if self.result_ok {
4498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4500                         }
4501                 } else {
4502                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4503                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4504                         }
4505                 }
4506         }
4507 }
4508 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4509         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4510                 let contents = if o.result_ok {
4511                         let result = unsafe { o.contents.result };
4512                         unsafe { o.contents.result = core::ptr::null_mut() };
4513                         CResult_InitFeaturesDecodeErrorZPtr { result }
4514                 } else {
4515                         let err = unsafe { o.contents.err };
4516                         unsafe { o.contents.err = core::ptr::null_mut(); }
4517                         CResult_InitFeaturesDecodeErrorZPtr { err }
4518                 };
4519                 Self {
4520                         contents,
4521                         result_ok: o.result_ok,
4522                 }
4523         }
4524 }
4525 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4526         fn clone(&self) -> Self {
4527                 if self.result_ok {
4528                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4529                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4530                         } }
4531                 } else {
4532                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4533                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4534                         } }
4535                 }
4536         }
4537 }
4538 #[no_mangle]
4539 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4540 /// but with all dynamically-allocated buffers duplicated in new buffers.
4541 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4542 #[repr(C)]
4543 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4544 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4545         /// A pointer to the contents in the success state.
4546         /// Reading from this pointer when `result_ok` is not set is undefined.
4547         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4548         /// A pointer to the contents in the error state.
4549         /// Reading from this pointer when `result_ok` is set is undefined.
4550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4551 }
4552 #[repr(C)]
4553 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4554 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4556 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4557         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4558         /// `err` or `result` depending on the state of `result_ok`.
4559         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4560         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4561         pub result_ok: bool,
4562 }
4563 #[no_mangle]
4564 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4565 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4566         CResult_ChannelFeaturesDecodeErrorZ {
4567                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4568                         result: Box::into_raw(Box::new(o)),
4569                 },
4570                 result_ok: true,
4571         }
4572 }
4573 #[no_mangle]
4574 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4575 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4576         CResult_ChannelFeaturesDecodeErrorZ {
4577                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4578                         err: Box::into_raw(Box::new(e)),
4579                 },
4580                 result_ok: false,
4581         }
4582 }
4583 /// Checks if the given object is currently in the success state
4584 #[no_mangle]
4585 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4586         o.result_ok
4587 }
4588 #[no_mangle]
4589 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4590 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4591 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4592         fn drop(&mut self) {
4593                 if self.result_ok {
4594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4596                         }
4597                 } else {
4598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4600                         }
4601                 }
4602         }
4603 }
4604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4606                 let contents = if o.result_ok {
4607                         let result = unsafe { o.contents.result };
4608                         unsafe { o.contents.result = core::ptr::null_mut() };
4609                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4610                 } else {
4611                         let err = unsafe { o.contents.err };
4612                         unsafe { o.contents.err = core::ptr::null_mut(); }
4613                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4614                 };
4615                 Self {
4616                         contents,
4617                         result_ok: o.result_ok,
4618                 }
4619         }
4620 }
4621 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4622         fn clone(&self) -> Self {
4623                 if self.result_ok {
4624                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4625                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4626                         } }
4627                 } else {
4628                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4630                         } }
4631                 }
4632         }
4633 }
4634 #[no_mangle]
4635 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4636 /// but with all dynamically-allocated buffers duplicated in new buffers.
4637 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4638 #[repr(C)]
4639 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4640 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4641         /// A pointer to the contents in the success state.
4642         /// Reading from this pointer when `result_ok` is not set is undefined.
4643         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4644         /// A pointer to the contents in the error state.
4645         /// Reading from this pointer when `result_ok` is set is undefined.
4646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4647 }
4648 #[repr(C)]
4649 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4650 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4652 pub struct CResult_NodeFeaturesDecodeErrorZ {
4653         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4654         /// `err` or `result` depending on the state of `result_ok`.
4655         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4656         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4657         pub result_ok: bool,
4658 }
4659 #[no_mangle]
4660 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4661 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4662         CResult_NodeFeaturesDecodeErrorZ {
4663                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4664                         result: Box::into_raw(Box::new(o)),
4665                 },
4666                 result_ok: true,
4667         }
4668 }
4669 #[no_mangle]
4670 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4671 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4672         CResult_NodeFeaturesDecodeErrorZ {
4673                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4674                         err: Box::into_raw(Box::new(e)),
4675                 },
4676                 result_ok: false,
4677         }
4678 }
4679 /// Checks if the given object is currently in the success state
4680 #[no_mangle]
4681 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4682         o.result_ok
4683 }
4684 #[no_mangle]
4685 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4686 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4687 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4688         fn drop(&mut self) {
4689                 if self.result_ok {
4690                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4691                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4692                         }
4693                 } else {
4694                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4695                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4696                         }
4697                 }
4698         }
4699 }
4700 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4701         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4702                 let contents = if o.result_ok {
4703                         let result = unsafe { o.contents.result };
4704                         unsafe { o.contents.result = core::ptr::null_mut() };
4705                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4706                 } else {
4707                         let err = unsafe { o.contents.err };
4708                         unsafe { o.contents.err = core::ptr::null_mut(); }
4709                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4710                 };
4711                 Self {
4712                         contents,
4713                         result_ok: o.result_ok,
4714                 }
4715         }
4716 }
4717 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4718         fn clone(&self) -> Self {
4719                 if self.result_ok {
4720                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4721                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4722                         } }
4723                 } else {
4724                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4725                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4726                         } }
4727                 }
4728         }
4729 }
4730 #[no_mangle]
4731 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4732 /// but with all dynamically-allocated buffers duplicated in new buffers.
4733 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4734 #[repr(C)]
4735 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4736 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4737         /// A pointer to the contents in the success state.
4738         /// Reading from this pointer when `result_ok` is not set is undefined.
4739         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4740         /// A pointer to the contents in the error state.
4741         /// Reading from this pointer when `result_ok` is set is undefined.
4742         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4743 }
4744 #[repr(C)]
4745 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4746 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4747 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4748 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4749         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4750         /// `err` or `result` depending on the state of `result_ok`.
4751         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4752         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4753         pub result_ok: bool,
4754 }
4755 #[no_mangle]
4756 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4757 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4758         CResult_InvoiceFeaturesDecodeErrorZ {
4759                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4760                         result: Box::into_raw(Box::new(o)),
4761                 },
4762                 result_ok: true,
4763         }
4764 }
4765 #[no_mangle]
4766 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4767 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4768         CResult_InvoiceFeaturesDecodeErrorZ {
4769                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4770                         err: Box::into_raw(Box::new(e)),
4771                 },
4772                 result_ok: false,
4773         }
4774 }
4775 /// Checks if the given object is currently in the success state
4776 #[no_mangle]
4777 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4778         o.result_ok
4779 }
4780 #[no_mangle]
4781 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4782 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4783 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4784         fn drop(&mut self) {
4785                 if self.result_ok {
4786                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4787                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4788                         }
4789                 } else {
4790                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4791                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4792                         }
4793                 }
4794         }
4795 }
4796 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4797         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4798                 let contents = if o.result_ok {
4799                         let result = unsafe { o.contents.result };
4800                         unsafe { o.contents.result = core::ptr::null_mut() };
4801                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4802                 } else {
4803                         let err = unsafe { o.contents.err };
4804                         unsafe { o.contents.err = core::ptr::null_mut(); }
4805                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4806                 };
4807                 Self {
4808                         contents,
4809                         result_ok: o.result_ok,
4810                 }
4811         }
4812 }
4813 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4814         fn clone(&self) -> Self {
4815                 if self.result_ok {
4816                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4817                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4818                         } }
4819                 } else {
4820                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4821                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4822                         } }
4823                 }
4824         }
4825 }
4826 #[no_mangle]
4827 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4828 /// but with all dynamically-allocated buffers duplicated in new buffers.
4829 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4830 #[repr(C)]
4831 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4832 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4833         /// A pointer to the contents in the success state.
4834         /// Reading from this pointer when `result_ok` is not set is undefined.
4835         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4836         /// A pointer to the contents in the error state.
4837         /// Reading from this pointer when `result_ok` is set is undefined.
4838         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4839 }
4840 #[repr(C)]
4841 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4842 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4843 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4844 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4845         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4846         /// `err` or `result` depending on the state of `result_ok`.
4847         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4848         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4849         pub result_ok: bool,
4850 }
4851 #[no_mangle]
4852 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4853 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4854         CResult_ChannelTypeFeaturesDecodeErrorZ {
4855                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4856                         result: Box::into_raw(Box::new(o)),
4857                 },
4858                 result_ok: true,
4859         }
4860 }
4861 #[no_mangle]
4862 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4863 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4864         CResult_ChannelTypeFeaturesDecodeErrorZ {
4865                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4866                         err: Box::into_raw(Box::new(e)),
4867                 },
4868                 result_ok: false,
4869         }
4870 }
4871 /// Checks if the given object is currently in the success state
4872 #[no_mangle]
4873 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4874         o.result_ok
4875 }
4876 #[no_mangle]
4877 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4878 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4879 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4880         fn drop(&mut self) {
4881                 if self.result_ok {
4882                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4883                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4884                         }
4885                 } else {
4886                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4887                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4888                         }
4889                 }
4890         }
4891 }
4892 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4893         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4894                 let contents = if o.result_ok {
4895                         let result = unsafe { o.contents.result };
4896                         unsafe { o.contents.result = core::ptr::null_mut() };
4897                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4898                 } else {
4899                         let err = unsafe { o.contents.err };
4900                         unsafe { o.contents.err = core::ptr::null_mut(); }
4901                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4902                 };
4903                 Self {
4904                         contents,
4905                         result_ok: o.result_ok,
4906                 }
4907         }
4908 }
4909 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4910         fn clone(&self) -> Self {
4911                 if self.result_ok {
4912                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4913                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4914                         } }
4915                 } else {
4916                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4917                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4918                         } }
4919                 }
4920         }
4921 }
4922 #[no_mangle]
4923 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4924 /// but with all dynamically-allocated buffers duplicated in new buffers.
4925 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4926 #[repr(C)]
4927 /// The contents of CResult_OfferFeaturesDecodeErrorZ
4928 pub union CResult_OfferFeaturesDecodeErrorZPtr {
4929         /// A pointer to the contents in the success state.
4930         /// Reading from this pointer when `result_ok` is not set is undefined.
4931         pub result: *mut crate::lightning::ln::features::OfferFeatures,
4932         /// A pointer to the contents in the error state.
4933         /// Reading from this pointer when `result_ok` is set is undefined.
4934         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4935 }
4936 #[repr(C)]
4937 /// A CResult_OfferFeaturesDecodeErrorZ represents the result of a fallible operation,
4938 /// containing a crate::lightning::ln::features::OfferFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4940 pub struct CResult_OfferFeaturesDecodeErrorZ {
4941         /// The contents of this CResult_OfferFeaturesDecodeErrorZ, accessible via either
4942         /// `err` or `result` depending on the state of `result_ok`.
4943         pub contents: CResult_OfferFeaturesDecodeErrorZPtr,
4944         /// Whether this CResult_OfferFeaturesDecodeErrorZ represents a success state.
4945         pub result_ok: bool,
4946 }
4947 #[no_mangle]
4948 /// Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state.
4949 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::OfferFeatures) -> CResult_OfferFeaturesDecodeErrorZ {
4950         CResult_OfferFeaturesDecodeErrorZ {
4951                 contents: CResult_OfferFeaturesDecodeErrorZPtr {
4952                         result: Box::into_raw(Box::new(o)),
4953                 },
4954                 result_ok: true,
4955         }
4956 }
4957 #[no_mangle]
4958 /// Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state.
4959 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferFeaturesDecodeErrorZ {
4960         CResult_OfferFeaturesDecodeErrorZ {
4961                 contents: CResult_OfferFeaturesDecodeErrorZPtr {
4962                         err: Box::into_raw(Box::new(e)),
4963                 },
4964                 result_ok: false,
4965         }
4966 }
4967 /// Checks if the given object is currently in the success state
4968 #[no_mangle]
4969 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_is_ok(o: &CResult_OfferFeaturesDecodeErrorZ) -> bool {
4970         o.result_ok
4971 }
4972 #[no_mangle]
4973 /// Frees any resources used by the CResult_OfferFeaturesDecodeErrorZ.
4974 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_free(_res: CResult_OfferFeaturesDecodeErrorZ) { }
4975 impl Drop for CResult_OfferFeaturesDecodeErrorZ {
4976         fn drop(&mut self) {
4977                 if self.result_ok {
4978                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4979                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4980                         }
4981                 } else {
4982                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4983                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4984                         }
4985                 }
4986         }
4987 }
4988 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::OfferFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_OfferFeaturesDecodeErrorZ {
4989         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::OfferFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4990                 let contents = if o.result_ok {
4991                         let result = unsafe { o.contents.result };
4992                         unsafe { o.contents.result = core::ptr::null_mut() };
4993                         CResult_OfferFeaturesDecodeErrorZPtr { result }
4994                 } else {
4995                         let err = unsafe { o.contents.err };
4996                         unsafe { o.contents.err = core::ptr::null_mut(); }
4997                         CResult_OfferFeaturesDecodeErrorZPtr { err }
4998                 };
4999                 Self {
5000                         contents,
5001                         result_ok: o.result_ok,
5002                 }
5003         }
5004 }
5005 impl Clone for CResult_OfferFeaturesDecodeErrorZ {
5006         fn clone(&self) -> Self {
5007                 if self.result_ok {
5008                         Self { result_ok: true, contents: CResult_OfferFeaturesDecodeErrorZPtr {
5009                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::OfferFeatures>::clone(unsafe { &*self.contents.result })))
5010                         } }
5011                 } else {
5012                         Self { result_ok: false, contents: CResult_OfferFeaturesDecodeErrorZPtr {
5013                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5014                         } }
5015                 }
5016         }
5017 }
5018 #[no_mangle]
5019 /// Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig`
5020 /// but with all dynamically-allocated buffers duplicated in new buffers.
5021 pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_clone(orig: &CResult_OfferFeaturesDecodeErrorZ) -> CResult_OfferFeaturesDecodeErrorZ { Clone::clone(&orig) }
5022 #[repr(C)]
5023 /// The contents of CResult_InvoiceRequestFeaturesDecodeErrorZ
5024 pub union CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5025         /// A pointer to the contents in the success state.
5026         /// Reading from this pointer when `result_ok` is not set is undefined.
5027         pub result: *mut crate::lightning::ln::features::InvoiceRequestFeatures,
5028         /// A pointer to the contents in the error state.
5029         /// Reading from this pointer when `result_ok` is set is undefined.
5030         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5031 }
5032 #[repr(C)]
5033 /// A CResult_InvoiceRequestFeaturesDecodeErrorZ represents the result of a fallible operation,
5034 /// containing a crate::lightning::ln::features::InvoiceRequestFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5036 pub struct CResult_InvoiceRequestFeaturesDecodeErrorZ {
5037         /// The contents of this CResult_InvoiceRequestFeaturesDecodeErrorZ, accessible via either
5038         /// `err` or `result` depending on the state of `result_ok`.
5039         pub contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr,
5040         /// Whether this CResult_InvoiceRequestFeaturesDecodeErrorZ represents a success state.
5041         pub result_ok: bool,
5042 }
5043 #[no_mangle]
5044 /// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state.
5045 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceRequestFeatures) -> CResult_InvoiceRequestFeaturesDecodeErrorZ {
5046         CResult_InvoiceRequestFeaturesDecodeErrorZ {
5047                 contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5048                         result: Box::into_raw(Box::new(o)),
5049                 },
5050                 result_ok: true,
5051         }
5052 }
5053 #[no_mangle]
5054 /// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state.
5055 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFeaturesDecodeErrorZ {
5056         CResult_InvoiceRequestFeaturesDecodeErrorZ {
5057                 contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5058                         err: Box::into_raw(Box::new(e)),
5059                 },
5060                 result_ok: false,
5061         }
5062 }
5063 /// Checks if the given object is currently in the success state
5064 #[no_mangle]
5065 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFeaturesDecodeErrorZ) -> bool {
5066         o.result_ok
5067 }
5068 #[no_mangle]
5069 /// Frees any resources used by the CResult_InvoiceRequestFeaturesDecodeErrorZ.
5070 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res: CResult_InvoiceRequestFeaturesDecodeErrorZ) { }
5071 impl Drop for CResult_InvoiceRequestFeaturesDecodeErrorZ {
5072         fn drop(&mut self) {
5073                 if self.result_ok {
5074                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5075                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5076                         }
5077                 } else {
5078                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5079                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5080                         }
5081                 }
5082         }
5083 }
5084 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceRequestFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceRequestFeaturesDecodeErrorZ {
5085         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceRequestFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5086                 let contents = if o.result_ok {
5087                         let result = unsafe { o.contents.result };
5088                         unsafe { o.contents.result = core::ptr::null_mut() };
5089                         CResult_InvoiceRequestFeaturesDecodeErrorZPtr { result }
5090                 } else {
5091                         let err = unsafe { o.contents.err };
5092                         unsafe { o.contents.err = core::ptr::null_mut(); }
5093                         CResult_InvoiceRequestFeaturesDecodeErrorZPtr { err }
5094                 };
5095                 Self {
5096                         contents,
5097                         result_ok: o.result_ok,
5098                 }
5099         }
5100 }
5101 impl Clone for CResult_InvoiceRequestFeaturesDecodeErrorZ {
5102         fn clone(&self) -> Self {
5103                 if self.result_ok {
5104                         Self { result_ok: true, contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5105                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceRequestFeatures>::clone(unsafe { &*self.contents.result })))
5106                         } }
5107                 } else {
5108                         Self { result_ok: false, contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr {
5109                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5110                         } }
5111                 }
5112         }
5113 }
5114 #[no_mangle]
5115 /// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig`
5116 /// but with all dynamically-allocated buffers duplicated in new buffers.
5117 pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFeaturesDecodeErrorZ) -> CResult_InvoiceRequestFeaturesDecodeErrorZ { Clone::clone(&orig) }
5118 #[repr(C)]
5119 /// The contents of CResult_NodeIdDecodeErrorZ
5120 pub union CResult_NodeIdDecodeErrorZPtr {
5121         /// A pointer to the contents in the success state.
5122         /// Reading from this pointer when `result_ok` is not set is undefined.
5123         pub result: *mut crate::lightning::routing::gossip::NodeId,
5124         /// A pointer to the contents in the error state.
5125         /// Reading from this pointer when `result_ok` is set is undefined.
5126         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5127 }
5128 #[repr(C)]
5129 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5130 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5132 pub struct CResult_NodeIdDecodeErrorZ {
5133         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5134         /// `err` or `result` depending on the state of `result_ok`.
5135         pub contents: CResult_NodeIdDecodeErrorZPtr,
5136         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5137         pub result_ok: bool,
5138 }
5139 #[no_mangle]
5140 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
5141 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
5142         CResult_NodeIdDecodeErrorZ {
5143                 contents: CResult_NodeIdDecodeErrorZPtr {
5144                         result: Box::into_raw(Box::new(o)),
5145                 },
5146                 result_ok: true,
5147         }
5148 }
5149 #[no_mangle]
5150 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
5151 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
5152         CResult_NodeIdDecodeErrorZ {
5153                 contents: CResult_NodeIdDecodeErrorZPtr {
5154                         err: Box::into_raw(Box::new(e)),
5155                 },
5156                 result_ok: false,
5157         }
5158 }
5159 /// Checks if the given object is currently in the success state
5160 #[no_mangle]
5161 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
5162         o.result_ok
5163 }
5164 #[no_mangle]
5165 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
5166 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
5167 impl Drop for CResult_NodeIdDecodeErrorZ {
5168         fn drop(&mut self) {
5169                 if self.result_ok {
5170                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5171                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5172                         }
5173                 } else {
5174                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5175                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5176                         }
5177                 }
5178         }
5179 }
5180 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
5181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
5182                 let contents = if o.result_ok {
5183                         let result = unsafe { o.contents.result };
5184                         unsafe { o.contents.result = core::ptr::null_mut() };
5185                         CResult_NodeIdDecodeErrorZPtr { result }
5186                 } else {
5187                         let err = unsafe { o.contents.err };
5188                         unsafe { o.contents.err = core::ptr::null_mut(); }
5189                         CResult_NodeIdDecodeErrorZPtr { err }
5190                 };
5191                 Self {
5192                         contents,
5193                         result_ok: o.result_ok,
5194                 }
5195         }
5196 }
5197 impl Clone for CResult_NodeIdDecodeErrorZ {
5198         fn clone(&self) -> Self {
5199                 if self.result_ok {
5200                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
5201                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
5202                         } }
5203                 } else {
5204                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
5205                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5206                         } }
5207                 }
5208         }
5209 }
5210 #[no_mangle]
5211 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
5212 /// but with all dynamically-allocated buffers duplicated in new buffers.
5213 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
5214 #[repr(C)]
5215 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5216 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5217         /// A pointer to the contents in the success state.
5218         /// Reading from this pointer when `result_ok` is not set is undefined.
5219         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
5220         /// A pointer to the contents in the error state.
5221         /// Reading from this pointer when `result_ok` is set is undefined.
5222         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5223 }
5224 #[repr(C)]
5225 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5226 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5228 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
5229         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5230         /// `err` or `result` depending on the state of `result_ok`.
5231         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
5232         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5233         pub result_ok: bool,
5234 }
5235 #[no_mangle]
5236 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
5237 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5238         CResult_COption_NetworkUpdateZDecodeErrorZ {
5239                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5240                         result: Box::into_raw(Box::new(o)),
5241                 },
5242                 result_ok: true,
5243         }
5244 }
5245 #[no_mangle]
5246 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
5247 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
5248         CResult_COption_NetworkUpdateZDecodeErrorZ {
5249                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5250                         err: Box::into_raw(Box::new(e)),
5251                 },
5252                 result_ok: false,
5253         }
5254 }
5255 /// Checks if the given object is currently in the success state
5256 #[no_mangle]
5257 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
5258         o.result_ok
5259 }
5260 #[no_mangle]
5261 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
5262 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
5263 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
5264         fn drop(&mut self) {
5265                 if self.result_ok {
5266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5268                         }
5269                 } else {
5270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5272                         }
5273                 }
5274         }
5275 }
5276 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
5277         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
5278                 let contents = if o.result_ok {
5279                         let result = unsafe { o.contents.result };
5280                         unsafe { o.contents.result = core::ptr::null_mut() };
5281                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
5282                 } else {
5283                         let err = unsafe { o.contents.err };
5284                         unsafe { o.contents.err = core::ptr::null_mut(); }
5285                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
5286                 };
5287                 Self {
5288                         contents,
5289                         result_ok: o.result_ok,
5290                 }
5291         }
5292 }
5293 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
5294         fn clone(&self) -> Self {
5295                 if self.result_ok {
5296                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5297                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5298                         } }
5299                 } else {
5300                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5301                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5302                         } }
5303                 }
5304         }
5305 }
5306 #[no_mangle]
5307 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5308 /// but with all dynamically-allocated buffers duplicated in new buffers.
5309 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5310 #[repr(C)]
5311 /// An enum which can either contain a crate::lightning::chain::Access or not
5312 pub enum COption_AccessZ {
5313         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5314         Some(crate::lightning::chain::Access),
5315         /// When we're in this state, this COption_AccessZ contains nothing
5316         None
5317 }
5318 impl COption_AccessZ {
5319         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5320                 if let Self::None = self { false } else { true }
5321         }
5322         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5323                 !self.is_some()
5324         }
5325         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5326                 if let Self::Some(v) = self { v } else { unreachable!() }
5327         }
5328 }
5329 #[no_mangle]
5330 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5331 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5332         COption_AccessZ::Some(o)
5333 }
5334 #[no_mangle]
5335 /// Constructs a new COption_AccessZ containing nothing
5336 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5337         COption_AccessZ::None
5338 }
5339 #[no_mangle]
5340 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5341 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5342 #[repr(C)]
5343 /// The contents of CResult_boolLightningErrorZ
5344 pub union CResult_boolLightningErrorZPtr {
5345         /// A pointer to the contents in the success state.
5346         /// Reading from this pointer when `result_ok` is not set is undefined.
5347         pub result: *mut bool,
5348         /// A pointer to the contents in the error state.
5349         /// Reading from this pointer when `result_ok` is set is undefined.
5350         pub err: *mut crate::lightning::ln::msgs::LightningError,
5351 }
5352 #[repr(C)]
5353 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5354 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5355 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5356 pub struct CResult_boolLightningErrorZ {
5357         /// The contents of this CResult_boolLightningErrorZ, accessible via either
5358         /// `err` or `result` depending on the state of `result_ok`.
5359         pub contents: CResult_boolLightningErrorZPtr,
5360         /// Whether this CResult_boolLightningErrorZ represents a success state.
5361         pub result_ok: bool,
5362 }
5363 #[no_mangle]
5364 /// Creates a new CResult_boolLightningErrorZ in the success state.
5365 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5366         CResult_boolLightningErrorZ {
5367                 contents: CResult_boolLightningErrorZPtr {
5368                         result: Box::into_raw(Box::new(o)),
5369                 },
5370                 result_ok: true,
5371         }
5372 }
5373 #[no_mangle]
5374 /// Creates a new CResult_boolLightningErrorZ in the error state.
5375 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5376         CResult_boolLightningErrorZ {
5377                 contents: CResult_boolLightningErrorZPtr {
5378                         err: Box::into_raw(Box::new(e)),
5379                 },
5380                 result_ok: false,
5381         }
5382 }
5383 /// Checks if the given object is currently in the success state
5384 #[no_mangle]
5385 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5386         o.result_ok
5387 }
5388 #[no_mangle]
5389 /// Frees any resources used by the CResult_boolLightningErrorZ.
5390 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5391 impl Drop for CResult_boolLightningErrorZ {
5392         fn drop(&mut self) {
5393                 if self.result_ok {
5394                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5395                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5396                         }
5397                 } else {
5398                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5399                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5400                         }
5401                 }
5402         }
5403 }
5404 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5405         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5406                 let contents = if o.result_ok {
5407                         let result = unsafe { o.contents.result };
5408                         unsafe { o.contents.result = core::ptr::null_mut() };
5409                         CResult_boolLightningErrorZPtr { result }
5410                 } else {
5411                         let err = unsafe { o.contents.err };
5412                         unsafe { o.contents.err = core::ptr::null_mut(); }
5413                         CResult_boolLightningErrorZPtr { err }
5414                 };
5415                 Self {
5416                         contents,
5417                         result_ok: o.result_ok,
5418                 }
5419         }
5420 }
5421 impl Clone for CResult_boolLightningErrorZ {
5422         fn clone(&self) -> Self {
5423                 if self.result_ok {
5424                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5425                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5426                         } }
5427                 } else {
5428                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5429                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5430                         } }
5431                 }
5432         }
5433 }
5434 #[no_mangle]
5435 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5436 /// but with all dynamically-allocated buffers duplicated in new buffers.
5437 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5438 #[repr(C)]
5439 /// A tuple of 3 elements. See the individual fields for the types contained.
5440 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5441         /// The element at position 0
5442         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5443         /// The element at position 1
5444         pub b: crate::lightning::ln::msgs::ChannelUpdate,
5445         /// The element at position 2
5446         pub c: crate::lightning::ln::msgs::ChannelUpdate,
5447 }
5448 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5449         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5450                 Self {
5451                         a: tup.0,
5452                         b: tup.1,
5453                         c: tup.2,
5454                 }
5455         }
5456 }
5457 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5458         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5459                 (self.a, self.b, self.c)
5460         }
5461 }
5462 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5463         fn clone(&self) -> Self {
5464                 Self {
5465                         a: Clone::clone(&self.a),
5466                         b: Clone::clone(&self.b),
5467                         c: Clone::clone(&self.c),
5468                 }
5469         }
5470 }
5471 #[no_mangle]
5472 /// Creates a new tuple which has the same data as `orig`
5473 /// but with all dynamically-allocated buffers duplicated in new buffers.
5474 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5475 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5476 #[no_mangle]
5477 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 {
5478         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5479 }
5480
5481 #[no_mangle]
5482 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5483 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5484 #[repr(C)]
5485 #[derive(Clone)]
5486 /// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not
5487 pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5488         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5489         Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ),
5490         /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing
5491         None
5492 }
5493 impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5494         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5495                 if let Self::None = self { false } else { true }
5496         }
5497         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5498                 !self.is_some()
5499         }
5500         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5501                 if let Self::Some(v) = self { v } else { unreachable!() }
5502         }
5503 }
5504 #[no_mangle]
5505 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ
5506 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5507         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o)
5508 }
5509 #[no_mangle]
5510 /// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing
5511 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5512         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None
5513 }
5514 #[no_mangle]
5515 /// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state
5516 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5517 #[no_mangle]
5518 /// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig`
5519 /// but with all dynamically-allocated buffers duplicated in new buffers.
5520 pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) }
5521 #[repr(C)]
5522 /// The contents of CResult_NoneLightningErrorZ
5523 pub union CResult_NoneLightningErrorZPtr {
5524         /// Note that this value is always NULL, as there are no contents in the OK variant
5525         pub result: *mut core::ffi::c_void,
5526         /// A pointer to the contents in the error state.
5527         /// Reading from this pointer when `result_ok` is set is undefined.
5528         pub err: *mut crate::lightning::ln::msgs::LightningError,
5529 }
5530 #[repr(C)]
5531 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5532 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5533 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5534 pub struct CResult_NoneLightningErrorZ {
5535         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5536         /// `err` or `result` depending on the state of `result_ok`.
5537         pub contents: CResult_NoneLightningErrorZPtr,
5538         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5539         pub result_ok: bool,
5540 }
5541 #[no_mangle]
5542 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5543 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5544         CResult_NoneLightningErrorZ {
5545                 contents: CResult_NoneLightningErrorZPtr {
5546                         result: core::ptr::null_mut(),
5547                 },
5548                 result_ok: true,
5549         }
5550 }
5551 #[no_mangle]
5552 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5553 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5554         CResult_NoneLightningErrorZ {
5555                 contents: CResult_NoneLightningErrorZPtr {
5556                         err: Box::into_raw(Box::new(e)),
5557                 },
5558                 result_ok: false,
5559         }
5560 }
5561 /// Checks if the given object is currently in the success state
5562 #[no_mangle]
5563 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5564         o.result_ok
5565 }
5566 #[no_mangle]
5567 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5568 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5569 impl Drop for CResult_NoneLightningErrorZ {
5570         fn drop(&mut self) {
5571                 if self.result_ok {
5572                 } else {
5573                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5574                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5575                         }
5576                 }
5577         }
5578 }
5579 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5580         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5581                 let contents = if o.result_ok {
5582                         let _ = unsafe { Box::from_raw(o.contents.result) };
5583                         o.contents.result = core::ptr::null_mut();
5584                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5585                 } else {
5586                         let err = unsafe { o.contents.err };
5587                         unsafe { o.contents.err = core::ptr::null_mut(); }
5588                         CResult_NoneLightningErrorZPtr { err }
5589                 };
5590                 Self {
5591                         contents,
5592                         result_ok: o.result_ok,
5593                 }
5594         }
5595 }
5596 impl Clone for CResult_NoneLightningErrorZ {
5597         fn clone(&self) -> Self {
5598                 if self.result_ok {
5599                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5600                                 result: core::ptr::null_mut()
5601                         } }
5602                 } else {
5603                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5604                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5605                         } }
5606                 }
5607         }
5608 }
5609 #[no_mangle]
5610 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5611 /// but with all dynamically-allocated buffers duplicated in new buffers.
5612 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5613 #[repr(C)]
5614 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5615 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5616         /// A pointer to the contents in the success state.
5617         /// Reading from this pointer when `result_ok` is not set is undefined.
5618         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5619         /// A pointer to the contents in the error state.
5620         /// Reading from this pointer when `result_ok` is set is undefined.
5621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5622 }
5623 #[repr(C)]
5624 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5625 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5627 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5628         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5629         /// `err` or `result` depending on the state of `result_ok`.
5630         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5631         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5632         pub result_ok: bool,
5633 }
5634 #[no_mangle]
5635 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5636 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5637         CResult_ChannelUpdateInfoDecodeErrorZ {
5638                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5639                         result: Box::into_raw(Box::new(o)),
5640                 },
5641                 result_ok: true,
5642         }
5643 }
5644 #[no_mangle]
5645 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5646 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5647         CResult_ChannelUpdateInfoDecodeErrorZ {
5648                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5649                         err: Box::into_raw(Box::new(e)),
5650                 },
5651                 result_ok: false,
5652         }
5653 }
5654 /// Checks if the given object is currently in the success state
5655 #[no_mangle]
5656 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5657         o.result_ok
5658 }
5659 #[no_mangle]
5660 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5661 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5662 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5663         fn drop(&mut self) {
5664                 if self.result_ok {
5665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5667                         }
5668                 } else {
5669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5671                         }
5672                 }
5673         }
5674 }
5675 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5677                 let contents = if o.result_ok {
5678                         let result = unsafe { o.contents.result };
5679                         unsafe { o.contents.result = core::ptr::null_mut() };
5680                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5681                 } else {
5682                         let err = unsafe { o.contents.err };
5683                         unsafe { o.contents.err = core::ptr::null_mut(); }
5684                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5685                 };
5686                 Self {
5687                         contents,
5688                         result_ok: o.result_ok,
5689                 }
5690         }
5691 }
5692 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5693         fn clone(&self) -> Self {
5694                 if self.result_ok {
5695                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5696                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5697                         } }
5698                 } else {
5699                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5701                         } }
5702                 }
5703         }
5704 }
5705 #[no_mangle]
5706 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5707 /// but with all dynamically-allocated buffers duplicated in new buffers.
5708 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5709 #[repr(C)]
5710 /// The contents of CResult_ChannelInfoDecodeErrorZ
5711 pub union CResult_ChannelInfoDecodeErrorZPtr {
5712         /// A pointer to the contents in the success state.
5713         /// Reading from this pointer when `result_ok` is not set is undefined.
5714         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5715         /// A pointer to the contents in the error state.
5716         /// Reading from this pointer when `result_ok` is set is undefined.
5717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5718 }
5719 #[repr(C)]
5720 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5721 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5723 pub struct CResult_ChannelInfoDecodeErrorZ {
5724         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5725         /// `err` or `result` depending on the state of `result_ok`.
5726         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5727         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5728         pub result_ok: bool,
5729 }
5730 #[no_mangle]
5731 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5732 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5733         CResult_ChannelInfoDecodeErrorZ {
5734                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5735                         result: Box::into_raw(Box::new(o)),
5736                 },
5737                 result_ok: true,
5738         }
5739 }
5740 #[no_mangle]
5741 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5742 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5743         CResult_ChannelInfoDecodeErrorZ {
5744                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5745                         err: Box::into_raw(Box::new(e)),
5746                 },
5747                 result_ok: false,
5748         }
5749 }
5750 /// Checks if the given object is currently in the success state
5751 #[no_mangle]
5752 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5753         o.result_ok
5754 }
5755 #[no_mangle]
5756 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5757 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5758 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5759         fn drop(&mut self) {
5760                 if self.result_ok {
5761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5763                         }
5764                 } else {
5765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5767                         }
5768                 }
5769         }
5770 }
5771 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5773                 let contents = if o.result_ok {
5774                         let result = unsafe { o.contents.result };
5775                         unsafe { o.contents.result = core::ptr::null_mut() };
5776                         CResult_ChannelInfoDecodeErrorZPtr { result }
5777                 } else {
5778                         let err = unsafe { o.contents.err };
5779                         unsafe { o.contents.err = core::ptr::null_mut(); }
5780                         CResult_ChannelInfoDecodeErrorZPtr { err }
5781                 };
5782                 Self {
5783                         contents,
5784                         result_ok: o.result_ok,
5785                 }
5786         }
5787 }
5788 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5789         fn clone(&self) -> Self {
5790                 if self.result_ok {
5791                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5792                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5793                         } }
5794                 } else {
5795                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5796                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5797                         } }
5798                 }
5799         }
5800 }
5801 #[no_mangle]
5802 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5803 /// but with all dynamically-allocated buffers duplicated in new buffers.
5804 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5805 #[repr(C)]
5806 /// The contents of CResult_RoutingFeesDecodeErrorZ
5807 pub union CResult_RoutingFeesDecodeErrorZPtr {
5808         /// A pointer to the contents in the success state.
5809         /// Reading from this pointer when `result_ok` is not set is undefined.
5810         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5811         /// A pointer to the contents in the error state.
5812         /// Reading from this pointer when `result_ok` is set is undefined.
5813         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5814 }
5815 #[repr(C)]
5816 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5817 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5819 pub struct CResult_RoutingFeesDecodeErrorZ {
5820         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5821         /// `err` or `result` depending on the state of `result_ok`.
5822         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5823         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5824         pub result_ok: bool,
5825 }
5826 #[no_mangle]
5827 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5828 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5829         CResult_RoutingFeesDecodeErrorZ {
5830                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5831                         result: Box::into_raw(Box::new(o)),
5832                 },
5833                 result_ok: true,
5834         }
5835 }
5836 #[no_mangle]
5837 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5838 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5839         CResult_RoutingFeesDecodeErrorZ {
5840                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5841                         err: Box::into_raw(Box::new(e)),
5842                 },
5843                 result_ok: false,
5844         }
5845 }
5846 /// Checks if the given object is currently in the success state
5847 #[no_mangle]
5848 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5849         o.result_ok
5850 }
5851 #[no_mangle]
5852 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5853 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5854 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5855         fn drop(&mut self) {
5856                 if self.result_ok {
5857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5859                         }
5860                 } else {
5861                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5862                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5863                         }
5864                 }
5865         }
5866 }
5867 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5868         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5869                 let contents = if o.result_ok {
5870                         let result = unsafe { o.contents.result };
5871                         unsafe { o.contents.result = core::ptr::null_mut() };
5872                         CResult_RoutingFeesDecodeErrorZPtr { result }
5873                 } else {
5874                         let err = unsafe { o.contents.err };
5875                         unsafe { o.contents.err = core::ptr::null_mut(); }
5876                         CResult_RoutingFeesDecodeErrorZPtr { err }
5877                 };
5878                 Self {
5879                         contents,
5880                         result_ok: o.result_ok,
5881                 }
5882         }
5883 }
5884 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5885         fn clone(&self) -> Self {
5886                 if self.result_ok {
5887                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5888                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5889                         } }
5890                 } else {
5891                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5892                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5893                         } }
5894                 }
5895         }
5896 }
5897 #[no_mangle]
5898 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5899 /// but with all dynamically-allocated buffers duplicated in new buffers.
5900 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5901 #[repr(C)]
5902 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5903 /// This corresponds to std::vector in C++
5904 pub struct CVec_NetAddressZ {
5905         /// The elements in the array.
5906         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5907         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5908         /// The number of elements pointed to by `data`.
5909         pub datalen: usize
5910 }
5911 impl CVec_NetAddressZ {
5912         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5913                 if self.datalen == 0 { return Vec::new(); }
5914                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5915                 self.data = core::ptr::null_mut();
5916                 self.datalen = 0;
5917                 ret
5918         }
5919         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5920                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5921         }
5922 }
5923 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5924         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5925                 let datalen = v.len();
5926                 let data = Box::into_raw(v.into_boxed_slice());
5927                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5928         }
5929 }
5930 #[no_mangle]
5931 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5932 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5933 impl Drop for CVec_NetAddressZ {
5934         fn drop(&mut self) {
5935                 if self.datalen == 0 { return; }
5936                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5937         }
5938 }
5939 impl Clone for CVec_NetAddressZ {
5940         fn clone(&self) -> Self {
5941                 let mut res = Vec::new();
5942                 if self.datalen == 0 { return Self::from(res); }
5943                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5944                 Self::from(res)
5945         }
5946 }
5947 #[repr(C)]
5948 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5949 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5950         /// A pointer to the contents in the success state.
5951         /// Reading from this pointer when `result_ok` is not set is undefined.
5952         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5953         /// A pointer to the contents in the error state.
5954         /// Reading from this pointer when `result_ok` is set is undefined.
5955         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5956 }
5957 #[repr(C)]
5958 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5959 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5960 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5961 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5962         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5963         /// `err` or `result` depending on the state of `result_ok`.
5964         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5965         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5966         pub result_ok: bool,
5967 }
5968 #[no_mangle]
5969 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5970 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5971         CResult_NodeAnnouncementInfoDecodeErrorZ {
5972                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5973                         result: Box::into_raw(Box::new(o)),
5974                 },
5975                 result_ok: true,
5976         }
5977 }
5978 #[no_mangle]
5979 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5980 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5981         CResult_NodeAnnouncementInfoDecodeErrorZ {
5982                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5983                         err: Box::into_raw(Box::new(e)),
5984                 },
5985                 result_ok: false,
5986         }
5987 }
5988 /// Checks if the given object is currently in the success state
5989 #[no_mangle]
5990 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5991         o.result_ok
5992 }
5993 #[no_mangle]
5994 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5995 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5996 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5997         fn drop(&mut self) {
5998                 if self.result_ok {
5999                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6000                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6001                         }
6002                 } else {
6003                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6004                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6005                         }
6006                 }
6007         }
6008 }
6009 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
6010         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6011                 let contents = if o.result_ok {
6012                         let result = unsafe { o.contents.result };
6013                         unsafe { o.contents.result = core::ptr::null_mut() };
6014                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
6015                 } else {
6016                         let err = unsafe { o.contents.err };
6017                         unsafe { o.contents.err = core::ptr::null_mut(); }
6018                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
6019                 };
6020                 Self {
6021                         contents,
6022                         result_ok: o.result_ok,
6023                 }
6024         }
6025 }
6026 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
6027         fn clone(&self) -> Self {
6028                 if self.result_ok {
6029                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6030                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
6031                         } }
6032                 } else {
6033                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
6034                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6035                         } }
6036                 }
6037         }
6038 }
6039 #[no_mangle]
6040 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
6041 /// but with all dynamically-allocated buffers duplicated in new buffers.
6042 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
6043 #[repr(C)]
6044 /// The contents of CResult_NodeAliasDecodeErrorZ
6045 pub union CResult_NodeAliasDecodeErrorZPtr {
6046         /// A pointer to the contents in the success state.
6047         /// Reading from this pointer when `result_ok` is not set is undefined.
6048         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
6049         /// A pointer to the contents in the error state.
6050         /// Reading from this pointer when `result_ok` is set is undefined.
6051         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6052 }
6053 #[repr(C)]
6054 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
6055 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
6056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6057 pub struct CResult_NodeAliasDecodeErrorZ {
6058         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
6059         /// `err` or `result` depending on the state of `result_ok`.
6060         pub contents: CResult_NodeAliasDecodeErrorZPtr,
6061         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
6062         pub result_ok: bool,
6063 }
6064 #[no_mangle]
6065 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
6066 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
6067         CResult_NodeAliasDecodeErrorZ {
6068                 contents: CResult_NodeAliasDecodeErrorZPtr {
6069                         result: Box::into_raw(Box::new(o)),
6070                 },
6071                 result_ok: true,
6072         }
6073 }
6074 #[no_mangle]
6075 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
6076 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
6077         CResult_NodeAliasDecodeErrorZ {
6078                 contents: CResult_NodeAliasDecodeErrorZPtr {
6079                         err: Box::into_raw(Box::new(e)),
6080                 },
6081                 result_ok: false,
6082         }
6083 }
6084 /// Checks if the given object is currently in the success state
6085 #[no_mangle]
6086 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
6087         o.result_ok
6088 }
6089 #[no_mangle]
6090 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
6091 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
6092 impl Drop for CResult_NodeAliasDecodeErrorZ {
6093         fn drop(&mut self) {
6094                 if self.result_ok {
6095                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6096                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6097                         }
6098                 } else {
6099                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6100                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6101                         }
6102                 }
6103         }
6104 }
6105 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
6106         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
6107                 let contents = if o.result_ok {
6108                         let result = unsafe { o.contents.result };
6109                         unsafe { o.contents.result = core::ptr::null_mut() };
6110                         CResult_NodeAliasDecodeErrorZPtr { result }
6111                 } else {
6112                         let err = unsafe { o.contents.err };
6113                         unsafe { o.contents.err = core::ptr::null_mut(); }
6114                         CResult_NodeAliasDecodeErrorZPtr { err }
6115                 };
6116                 Self {
6117                         contents,
6118                         result_ok: o.result_ok,
6119                 }
6120         }
6121 }
6122 impl Clone for CResult_NodeAliasDecodeErrorZ {
6123         fn clone(&self) -> Self {
6124                 if self.result_ok {
6125                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
6126                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
6127                         } }
6128                 } else {
6129                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
6130                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6131                         } }
6132                 }
6133         }
6134 }
6135 #[no_mangle]
6136 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
6137 /// but with all dynamically-allocated buffers duplicated in new buffers.
6138 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
6139 #[repr(C)]
6140 /// The contents of CResult_NodeInfoDecodeErrorZ
6141 pub union CResult_NodeInfoDecodeErrorZPtr {
6142         /// A pointer to the contents in the success state.
6143         /// Reading from this pointer when `result_ok` is not set is undefined.
6144         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
6145         /// A pointer to the contents in the error state.
6146         /// Reading from this pointer when `result_ok` is set is undefined.
6147         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6148 }
6149 #[repr(C)]
6150 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6151 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6152 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6153 pub struct CResult_NodeInfoDecodeErrorZ {
6154         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6155         /// `err` or `result` depending on the state of `result_ok`.
6156         pub contents: CResult_NodeInfoDecodeErrorZPtr,
6157         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6158         pub result_ok: bool,
6159 }
6160 #[no_mangle]
6161 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
6162 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
6163         CResult_NodeInfoDecodeErrorZ {
6164                 contents: CResult_NodeInfoDecodeErrorZPtr {
6165                         result: Box::into_raw(Box::new(o)),
6166                 },
6167                 result_ok: true,
6168         }
6169 }
6170 #[no_mangle]
6171 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
6172 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
6173         CResult_NodeInfoDecodeErrorZ {
6174                 contents: CResult_NodeInfoDecodeErrorZPtr {
6175                         err: Box::into_raw(Box::new(e)),
6176                 },
6177                 result_ok: false,
6178         }
6179 }
6180 /// Checks if the given object is currently in the success state
6181 #[no_mangle]
6182 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
6183         o.result_ok
6184 }
6185 #[no_mangle]
6186 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
6187 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
6188 impl Drop for CResult_NodeInfoDecodeErrorZ {
6189         fn drop(&mut self) {
6190                 if self.result_ok {
6191                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6192                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6193                         }
6194                 } else {
6195                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6196                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6197                         }
6198                 }
6199         }
6200 }
6201 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
6202         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
6203                 let contents = if o.result_ok {
6204                         let result = unsafe { o.contents.result };
6205                         unsafe { o.contents.result = core::ptr::null_mut() };
6206                         CResult_NodeInfoDecodeErrorZPtr { result }
6207                 } else {
6208                         let err = unsafe { o.contents.err };
6209                         unsafe { o.contents.err = core::ptr::null_mut(); }
6210                         CResult_NodeInfoDecodeErrorZPtr { err }
6211                 };
6212                 Self {
6213                         contents,
6214                         result_ok: o.result_ok,
6215                 }
6216         }
6217 }
6218 impl Clone for CResult_NodeInfoDecodeErrorZ {
6219         fn clone(&self) -> Self {
6220                 if self.result_ok {
6221                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
6222                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
6223                         } }
6224                 } else {
6225                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
6226                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6227                         } }
6228                 }
6229         }
6230 }
6231 #[no_mangle]
6232 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
6233 /// but with all dynamically-allocated buffers duplicated in new buffers.
6234 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
6235 #[repr(C)]
6236 /// The contents of CResult_NetworkGraphDecodeErrorZ
6237 pub union CResult_NetworkGraphDecodeErrorZPtr {
6238         /// A pointer to the contents in the success state.
6239         /// Reading from this pointer when `result_ok` is not set is undefined.
6240         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
6241         /// A pointer to the contents in the error state.
6242         /// Reading from this pointer when `result_ok` is set is undefined.
6243         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6244 }
6245 #[repr(C)]
6246 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6247 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6249 pub struct CResult_NetworkGraphDecodeErrorZ {
6250         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6251         /// `err` or `result` depending on the state of `result_ok`.
6252         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6253         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6254         pub result_ok: bool,
6255 }
6256 #[no_mangle]
6257 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6258 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6259         CResult_NetworkGraphDecodeErrorZ {
6260                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6261                         result: Box::into_raw(Box::new(o)),
6262                 },
6263                 result_ok: true,
6264         }
6265 }
6266 #[no_mangle]
6267 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6268 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6269         CResult_NetworkGraphDecodeErrorZ {
6270                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6271                         err: Box::into_raw(Box::new(e)),
6272                 },
6273                 result_ok: false,
6274         }
6275 }
6276 /// Checks if the given object is currently in the success state
6277 #[no_mangle]
6278 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6279         o.result_ok
6280 }
6281 #[no_mangle]
6282 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6283 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6284 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6285         fn drop(&mut self) {
6286                 if self.result_ok {
6287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6289                         }
6290                 } else {
6291                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6292                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6293                         }
6294                 }
6295         }
6296 }
6297 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6298         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6299                 let contents = if o.result_ok {
6300                         let result = unsafe { o.contents.result };
6301                         unsafe { o.contents.result = core::ptr::null_mut() };
6302                         CResult_NetworkGraphDecodeErrorZPtr { result }
6303                 } else {
6304                         let err = unsafe { o.contents.err };
6305                         unsafe { o.contents.err = core::ptr::null_mut(); }
6306                         CResult_NetworkGraphDecodeErrorZPtr { err }
6307                 };
6308                 Self {
6309                         contents,
6310                         result_ok: o.result_ok,
6311                 }
6312         }
6313 }
6314 #[repr(C)]
6315 #[derive(Clone)]
6316 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6317 pub enum COption_CVec_NetAddressZZ {
6318         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6319         Some(crate::c_types::derived::CVec_NetAddressZ),
6320         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6321         None
6322 }
6323 impl COption_CVec_NetAddressZZ {
6324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6325                 if let Self::None = self { false } else { true }
6326         }
6327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6328                 !self.is_some()
6329         }
6330         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6331                 if let Self::Some(v) = self { v } else { unreachable!() }
6332         }
6333 }
6334 #[no_mangle]
6335 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6336 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6337         COption_CVec_NetAddressZZ::Some(o)
6338 }
6339 #[no_mangle]
6340 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6341 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6342         COption_CVec_NetAddressZZ::None
6343 }
6344 #[no_mangle]
6345 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6346 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6347 #[no_mangle]
6348 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6349 /// but with all dynamically-allocated buffers duplicated in new buffers.
6350 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6351 #[repr(C)]
6352 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6353 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6354         /// A pointer to the contents in the success state.
6355         /// Reading from this pointer when `result_ok` is not set is undefined.
6356         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6357         /// A pointer to the contents in the error state.
6358         /// Reading from this pointer when `result_ok` is set is undefined.
6359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6360 }
6361 #[repr(C)]
6362 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6363 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6365 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6366         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6367         /// `err` or `result` depending on the state of `result_ok`.
6368         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6369         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6370         pub result_ok: bool,
6371 }
6372 #[no_mangle]
6373 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6374 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6375         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6376                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6377                         result: Box::into_raw(Box::new(o)),
6378                 },
6379                 result_ok: true,
6380         }
6381 }
6382 #[no_mangle]
6383 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6384 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6385         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6386                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6387                         err: Box::into_raw(Box::new(e)),
6388                 },
6389                 result_ok: false,
6390         }
6391 }
6392 /// Checks if the given object is currently in the success state
6393 #[no_mangle]
6394 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6395         o.result_ok
6396 }
6397 #[no_mangle]
6398 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6399 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6400 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6401         fn drop(&mut self) {
6402                 if self.result_ok {
6403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6405                         }
6406                 } else {
6407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6409                         }
6410                 }
6411         }
6412 }
6413 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6415                 let contents = if o.result_ok {
6416                         let result = unsafe { o.contents.result };
6417                         unsafe { o.contents.result = core::ptr::null_mut() };
6418                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6419                 } else {
6420                         let err = unsafe { o.contents.err };
6421                         unsafe { o.contents.err = core::ptr::null_mut(); }
6422                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6423                 };
6424                 Self {
6425                         contents,
6426                         result_ok: o.result_ok,
6427                 }
6428         }
6429 }
6430 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6431         fn clone(&self) -> Self {
6432                 if self.result_ok {
6433                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6434                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6435                         } }
6436                 } else {
6437                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6439                         } }
6440                 }
6441         }
6442 }
6443 #[no_mangle]
6444 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6445 /// but with all dynamically-allocated buffers duplicated in new buffers.
6446 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6447 #[repr(C)]
6448 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6449 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6450         /// A pointer to the contents in the success state.
6451         /// Reading from this pointer when `result_ok` is not set is undefined.
6452         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6453         /// A pointer to the contents in the error state.
6454         /// Reading from this pointer when `result_ok` is set is undefined.
6455         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6456 }
6457 #[repr(C)]
6458 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6459 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6460 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6461 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6462         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6463         /// `err` or `result` depending on the state of `result_ok`.
6464         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6465         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6466         pub result_ok: bool,
6467 }
6468 #[no_mangle]
6469 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6470 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6471         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6472                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6473                         result: Box::into_raw(Box::new(o)),
6474                 },
6475                 result_ok: true,
6476         }
6477 }
6478 #[no_mangle]
6479 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6480 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6481         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6482                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6483                         err: Box::into_raw(Box::new(e)),
6484                 },
6485                 result_ok: false,
6486         }
6487 }
6488 /// Checks if the given object is currently in the success state
6489 #[no_mangle]
6490 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6491         o.result_ok
6492 }
6493 #[no_mangle]
6494 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6495 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6496 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6497         fn drop(&mut self) {
6498                 if self.result_ok {
6499                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6500                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6501                         }
6502                 } else {
6503                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6504                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6505                         }
6506                 }
6507         }
6508 }
6509 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6510         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6511                 let contents = if o.result_ok {
6512                         let result = unsafe { o.contents.result };
6513                         unsafe { o.contents.result = core::ptr::null_mut() };
6514                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6515                 } else {
6516                         let err = unsafe { o.contents.err };
6517                         unsafe { o.contents.err = core::ptr::null_mut(); }
6518                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6519                 };
6520                 Self {
6521                         contents,
6522                         result_ok: o.result_ok,
6523                 }
6524         }
6525 }
6526 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6527         fn clone(&self) -> Self {
6528                 if self.result_ok {
6529                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6530                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6531                         } }
6532                 } else {
6533                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6534                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6535                         } }
6536                 }
6537         }
6538 }
6539 #[no_mangle]
6540 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6541 /// but with all dynamically-allocated buffers duplicated in new buffers.
6542 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6543 #[repr(C)]
6544 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6545 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6546         /// A pointer to the contents in the success state.
6547         /// Reading from this pointer when `result_ok` is not set is undefined.
6548         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6549         /// A pointer to the contents in the error state.
6550         /// Reading from this pointer when `result_ok` is set is undefined.
6551         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6552 }
6553 #[repr(C)]
6554 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6555 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6557 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6558         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6559         /// `err` or `result` depending on the state of `result_ok`.
6560         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6561         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6562         pub result_ok: bool,
6563 }
6564 #[no_mangle]
6565 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6566 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6567         CResult_SpendableOutputDescriptorDecodeErrorZ {
6568                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6569                         result: Box::into_raw(Box::new(o)),
6570                 },
6571                 result_ok: true,
6572         }
6573 }
6574 #[no_mangle]
6575 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6576 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6577         CResult_SpendableOutputDescriptorDecodeErrorZ {
6578                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6579                         err: Box::into_raw(Box::new(e)),
6580                 },
6581                 result_ok: false,
6582         }
6583 }
6584 /// Checks if the given object is currently in the success state
6585 #[no_mangle]
6586 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6587         o.result_ok
6588 }
6589 #[no_mangle]
6590 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6591 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6592 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6593         fn drop(&mut self) {
6594                 if self.result_ok {
6595                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6596                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6597                         }
6598                 } else {
6599                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6600                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6601                         }
6602                 }
6603         }
6604 }
6605 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6606         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6607                 let contents = if o.result_ok {
6608                         let result = unsafe { o.contents.result };
6609                         unsafe { o.contents.result = core::ptr::null_mut() };
6610                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6611                 } else {
6612                         let err = unsafe { o.contents.err };
6613                         unsafe { o.contents.err = core::ptr::null_mut(); }
6614                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6615                 };
6616                 Self {
6617                         contents,
6618                         result_ok: o.result_ok,
6619                 }
6620         }
6621 }
6622 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6623         fn clone(&self) -> Self {
6624                 if self.result_ok {
6625                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6626                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6627                         } }
6628                 } else {
6629                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6630                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6631                         } }
6632                 }
6633         }
6634 }
6635 #[no_mangle]
6636 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6637 /// but with all dynamically-allocated buffers duplicated in new buffers.
6638 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6639 #[repr(C)]
6640 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6641 /// This corresponds to std::vector in C++
6642 pub struct CVec_PaymentPreimageZ {
6643         /// The elements in the array.
6644         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6645         pub data: *mut crate::c_types::ThirtyTwoBytes,
6646         /// The number of elements pointed to by `data`.
6647         pub datalen: usize
6648 }
6649 impl CVec_PaymentPreimageZ {
6650         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6651                 if self.datalen == 0 { return Vec::new(); }
6652                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6653                 self.data = core::ptr::null_mut();
6654                 self.datalen = 0;
6655                 ret
6656         }
6657         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6658                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6659         }
6660 }
6661 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6662         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6663                 let datalen = v.len();
6664                 let data = Box::into_raw(v.into_boxed_slice());
6665                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6666         }
6667 }
6668 #[no_mangle]
6669 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6670 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6671 impl Drop for CVec_PaymentPreimageZ {
6672         fn drop(&mut self) {
6673                 if self.datalen == 0 { return; }
6674                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6675         }
6676 }
6677 impl Clone for CVec_PaymentPreimageZ {
6678         fn clone(&self) -> Self {
6679                 let mut res = Vec::new();
6680                 if self.datalen == 0 { return Self::from(res); }
6681                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6682                 Self::from(res)
6683         }
6684 }
6685 #[repr(C)]
6686 /// A tuple of 2 elements. See the individual fields for the types contained.
6687 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6688         /// The element at position 0
6689         pub a: crate::c_types::Signature,
6690         /// The element at position 1
6691         pub b: crate::c_types::derived::CVec_SignatureZ,
6692 }
6693 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6694         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6695                 Self {
6696                         a: tup.0,
6697                         b: tup.1,
6698                 }
6699         }
6700 }
6701 impl C2Tuple_SignatureCVec_SignatureZZ {
6702         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6703                 (self.a, self.b)
6704         }
6705 }
6706 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6707         fn clone(&self) -> Self {
6708                 Self {
6709                         a: Clone::clone(&self.a),
6710                         b: Clone::clone(&self.b),
6711                 }
6712         }
6713 }
6714 #[no_mangle]
6715 /// Creates a new tuple which has the same data as `orig`
6716 /// but with all dynamically-allocated buffers duplicated in new buffers.
6717 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6718 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6719 #[no_mangle]
6720 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6721         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6722 }
6723
6724 #[no_mangle]
6725 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6726 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6727 #[repr(C)]
6728 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6729 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6730         /// A pointer to the contents in the success state.
6731         /// Reading from this pointer when `result_ok` is not set is undefined.
6732         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6733         /// Note that this value is always NULL, as there are no contents in the Err variant
6734         pub err: *mut core::ffi::c_void,
6735 }
6736 #[repr(C)]
6737 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6738 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6739 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6740 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6741         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6742         /// `err` or `result` depending on the state of `result_ok`.
6743         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6744         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6745         pub result_ok: bool,
6746 }
6747 #[no_mangle]
6748 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6749 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6750         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6751                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6752                         result: Box::into_raw(Box::new(o)),
6753                 },
6754                 result_ok: true,
6755         }
6756 }
6757 #[no_mangle]
6758 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6759 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6760         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6761                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6762                         err: core::ptr::null_mut(),
6763                 },
6764                 result_ok: false,
6765         }
6766 }
6767 /// Checks if the given object is currently in the success state
6768 #[no_mangle]
6769 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6770         o.result_ok
6771 }
6772 #[no_mangle]
6773 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6774 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6775 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6776         fn drop(&mut self) {
6777                 if self.result_ok {
6778                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6779                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6780                         }
6781                 } else {
6782                 }
6783         }
6784 }
6785 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6786         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6787                 let contents = if o.result_ok {
6788                         let result = unsafe { o.contents.result };
6789                         unsafe { o.contents.result = core::ptr::null_mut() };
6790                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6791                 } else {
6792                         let _ = unsafe { Box::from_raw(o.contents.err) };
6793                         o.contents.err = core::ptr::null_mut();
6794                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6795                 };
6796                 Self {
6797                         contents,
6798                         result_ok: o.result_ok,
6799                 }
6800         }
6801 }
6802 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6803         fn clone(&self) -> Self {
6804                 if self.result_ok {
6805                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6806                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6807                         } }
6808                 } else {
6809                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6810                                 err: core::ptr::null_mut()
6811                         } }
6812                 }
6813         }
6814 }
6815 #[no_mangle]
6816 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6817 /// but with all dynamically-allocated buffers duplicated in new buffers.
6818 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6819 #[repr(C)]
6820 /// The contents of CResult_SignatureNoneZ
6821 pub union CResult_SignatureNoneZPtr {
6822         /// A pointer to the contents in the success state.
6823         /// Reading from this pointer when `result_ok` is not set is undefined.
6824         pub result: *mut crate::c_types::Signature,
6825         /// Note that this value is always NULL, as there are no contents in the Err variant
6826         pub err: *mut core::ffi::c_void,
6827 }
6828 #[repr(C)]
6829 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6830 /// containing a crate::c_types::Signature on success and a () on failure.
6831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6832 pub struct CResult_SignatureNoneZ {
6833         /// The contents of this CResult_SignatureNoneZ, accessible via either
6834         /// `err` or `result` depending on the state of `result_ok`.
6835         pub contents: CResult_SignatureNoneZPtr,
6836         /// Whether this CResult_SignatureNoneZ represents a success state.
6837         pub result_ok: bool,
6838 }
6839 #[no_mangle]
6840 /// Creates a new CResult_SignatureNoneZ in the success state.
6841 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6842         CResult_SignatureNoneZ {
6843                 contents: CResult_SignatureNoneZPtr {
6844                         result: Box::into_raw(Box::new(o)),
6845                 },
6846                 result_ok: true,
6847         }
6848 }
6849 #[no_mangle]
6850 /// Creates a new CResult_SignatureNoneZ in the error state.
6851 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6852         CResult_SignatureNoneZ {
6853                 contents: CResult_SignatureNoneZPtr {
6854                         err: core::ptr::null_mut(),
6855                 },
6856                 result_ok: false,
6857         }
6858 }
6859 /// Checks if the given object is currently in the success state
6860 #[no_mangle]
6861 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6862         o.result_ok
6863 }
6864 #[no_mangle]
6865 /// Frees any resources used by the CResult_SignatureNoneZ.
6866 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6867 impl Drop for CResult_SignatureNoneZ {
6868         fn drop(&mut self) {
6869                 if self.result_ok {
6870                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6871                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6872                         }
6873                 } else {
6874                 }
6875         }
6876 }
6877 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6878         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6879                 let contents = if o.result_ok {
6880                         let result = unsafe { o.contents.result };
6881                         unsafe { o.contents.result = core::ptr::null_mut() };
6882                         CResult_SignatureNoneZPtr { result }
6883                 } else {
6884                         let _ = unsafe { Box::from_raw(o.contents.err) };
6885                         o.contents.err = core::ptr::null_mut();
6886                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6887                 };
6888                 Self {
6889                         contents,
6890                         result_ok: o.result_ok,
6891                 }
6892         }
6893 }
6894 impl Clone for CResult_SignatureNoneZ {
6895         fn clone(&self) -> Self {
6896                 if self.result_ok {
6897                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6898                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6899                         } }
6900                 } else {
6901                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6902                                 err: core::ptr::null_mut()
6903                         } }
6904                 }
6905         }
6906 }
6907 #[no_mangle]
6908 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6909 /// but with all dynamically-allocated buffers duplicated in new buffers.
6910 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6911 #[repr(C)]
6912 /// A tuple of 2 elements. See the individual fields for the types contained.
6913 pub struct C2Tuple_SignatureSignatureZ {
6914         /// The element at position 0
6915         pub a: crate::c_types::Signature,
6916         /// The element at position 1
6917         pub b: crate::c_types::Signature,
6918 }
6919 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6920         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6921                 Self {
6922                         a: tup.0,
6923                         b: tup.1,
6924                 }
6925         }
6926 }
6927 impl C2Tuple_SignatureSignatureZ {
6928         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6929                 (self.a, self.b)
6930         }
6931 }
6932 impl Clone for C2Tuple_SignatureSignatureZ {
6933         fn clone(&self) -> Self {
6934                 Self {
6935                         a: Clone::clone(&self.a),
6936                         b: Clone::clone(&self.b),
6937                 }
6938         }
6939 }
6940 #[no_mangle]
6941 /// Creates a new tuple which has the same data as `orig`
6942 /// but with all dynamically-allocated buffers duplicated in new buffers.
6943 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6944 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6945 #[no_mangle]
6946 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6947         C2Tuple_SignatureSignatureZ { a, b, }
6948 }
6949
6950 #[no_mangle]
6951 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6952 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6953 #[repr(C)]
6954 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6955 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6956         /// A pointer to the contents in the success state.
6957         /// Reading from this pointer when `result_ok` is not set is undefined.
6958         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6959         /// Note that this value is always NULL, as there are no contents in the Err variant
6960         pub err: *mut core::ffi::c_void,
6961 }
6962 #[repr(C)]
6963 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6964 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6965 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6966 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6967         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6968         /// `err` or `result` depending on the state of `result_ok`.
6969         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6970         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6971         pub result_ok: bool,
6972 }
6973 #[no_mangle]
6974 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6975 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6976         CResult_C2Tuple_SignatureSignatureZNoneZ {
6977                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6978                         result: Box::into_raw(Box::new(o)),
6979                 },
6980                 result_ok: true,
6981         }
6982 }
6983 #[no_mangle]
6984 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6985 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6986         CResult_C2Tuple_SignatureSignatureZNoneZ {
6987                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6988                         err: core::ptr::null_mut(),
6989                 },
6990                 result_ok: false,
6991         }
6992 }
6993 /// Checks if the given object is currently in the success state
6994 #[no_mangle]
6995 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6996         o.result_ok
6997 }
6998 #[no_mangle]
6999 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
7000 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
7001 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
7002         fn drop(&mut self) {
7003                 if self.result_ok {
7004                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7005                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7006                         }
7007                 } else {
7008                 }
7009         }
7010 }
7011 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
7012         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
7013                 let contents = if o.result_ok {
7014                         let result = unsafe { o.contents.result };
7015                         unsafe { o.contents.result = core::ptr::null_mut() };
7016                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
7017                 } else {
7018                         let _ = unsafe { Box::from_raw(o.contents.err) };
7019                         o.contents.err = core::ptr::null_mut();
7020                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
7021                 };
7022                 Self {
7023                         contents,
7024                         result_ok: o.result_ok,
7025                 }
7026         }
7027 }
7028 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
7029         fn clone(&self) -> Self {
7030                 if self.result_ok {
7031                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
7032                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
7033                         } }
7034                 } else {
7035                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
7036                                 err: core::ptr::null_mut()
7037                         } }
7038                 }
7039         }
7040 }
7041 #[no_mangle]
7042 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
7043 /// but with all dynamically-allocated buffers duplicated in new buffers.
7044 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
7045 #[repr(C)]
7046 /// The contents of CResult_SecretKeyNoneZ
7047 pub union CResult_SecretKeyNoneZPtr {
7048         /// A pointer to the contents in the success state.
7049         /// Reading from this pointer when `result_ok` is not set is undefined.
7050         pub result: *mut crate::c_types::SecretKey,
7051         /// Note that this value is always NULL, as there are no contents in the Err variant
7052         pub err: *mut core::ffi::c_void,
7053 }
7054 #[repr(C)]
7055 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
7056 /// containing a crate::c_types::SecretKey on success and a () on failure.
7057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7058 pub struct CResult_SecretKeyNoneZ {
7059         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
7060         /// `err` or `result` depending on the state of `result_ok`.
7061         pub contents: CResult_SecretKeyNoneZPtr,
7062         /// Whether this CResult_SecretKeyNoneZ represents a success state.
7063         pub result_ok: bool,
7064 }
7065 #[no_mangle]
7066 /// Creates a new CResult_SecretKeyNoneZ in the success state.
7067 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
7068         CResult_SecretKeyNoneZ {
7069                 contents: CResult_SecretKeyNoneZPtr {
7070                         result: Box::into_raw(Box::new(o)),
7071                 },
7072                 result_ok: true,
7073         }
7074 }
7075 #[no_mangle]
7076 /// Creates a new CResult_SecretKeyNoneZ in the error state.
7077 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
7078         CResult_SecretKeyNoneZ {
7079                 contents: CResult_SecretKeyNoneZPtr {
7080                         err: core::ptr::null_mut(),
7081                 },
7082                 result_ok: false,
7083         }
7084 }
7085 /// Checks if the given object is currently in the success state
7086 #[no_mangle]
7087 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
7088         o.result_ok
7089 }
7090 #[no_mangle]
7091 /// Frees any resources used by the CResult_SecretKeyNoneZ.
7092 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
7093 impl Drop for CResult_SecretKeyNoneZ {
7094         fn drop(&mut self) {
7095                 if self.result_ok {
7096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7098                         }
7099                 } else {
7100                 }
7101         }
7102 }
7103 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
7104         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
7105                 let contents = if o.result_ok {
7106                         let result = unsafe { o.contents.result };
7107                         unsafe { o.contents.result = core::ptr::null_mut() };
7108                         CResult_SecretKeyNoneZPtr { result }
7109                 } else {
7110                         let _ = unsafe { Box::from_raw(o.contents.err) };
7111                         o.contents.err = core::ptr::null_mut();
7112                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
7113                 };
7114                 Self {
7115                         contents,
7116                         result_ok: o.result_ok,
7117                 }
7118         }
7119 }
7120 impl Clone for CResult_SecretKeyNoneZ {
7121         fn clone(&self) -> Self {
7122                 if self.result_ok {
7123                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
7124                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
7125                         } }
7126                 } else {
7127                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
7128                                 err: core::ptr::null_mut()
7129                         } }
7130                 }
7131         }
7132 }
7133 #[no_mangle]
7134 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
7135 /// but with all dynamically-allocated buffers duplicated in new buffers.
7136 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
7137 #[repr(C)]
7138 /// The contents of CResult_PublicKeyNoneZ
7139 pub union CResult_PublicKeyNoneZPtr {
7140         /// A pointer to the contents in the success state.
7141         /// Reading from this pointer when `result_ok` is not set is undefined.
7142         pub result: *mut crate::c_types::PublicKey,
7143         /// Note that this value is always NULL, as there are no contents in the Err variant
7144         pub err: *mut core::ffi::c_void,
7145 }
7146 #[repr(C)]
7147 /// A CResult_PublicKeyNoneZ represents the result of a fallible operation,
7148 /// containing a crate::c_types::PublicKey on success and a () on failure.
7149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7150 pub struct CResult_PublicKeyNoneZ {
7151         /// The contents of this CResult_PublicKeyNoneZ, accessible via either
7152         /// `err` or `result` depending on the state of `result_ok`.
7153         pub contents: CResult_PublicKeyNoneZPtr,
7154         /// Whether this CResult_PublicKeyNoneZ represents a success state.
7155         pub result_ok: bool,
7156 }
7157 #[no_mangle]
7158 /// Creates a new CResult_PublicKeyNoneZ in the success state.
7159 pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ {
7160         CResult_PublicKeyNoneZ {
7161                 contents: CResult_PublicKeyNoneZPtr {
7162                         result: Box::into_raw(Box::new(o)),
7163                 },
7164                 result_ok: true,
7165         }
7166 }
7167 #[no_mangle]
7168 /// Creates a new CResult_PublicKeyNoneZ in the error state.
7169 pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ {
7170         CResult_PublicKeyNoneZ {
7171                 contents: CResult_PublicKeyNoneZPtr {
7172                         err: core::ptr::null_mut(),
7173                 },
7174                 result_ok: false,
7175         }
7176 }
7177 /// Checks if the given object is currently in the success state
7178 #[no_mangle]
7179 pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool {
7180         o.result_ok
7181 }
7182 #[no_mangle]
7183 /// Frees any resources used by the CResult_PublicKeyNoneZ.
7184 pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { }
7185 impl Drop for CResult_PublicKeyNoneZ {
7186         fn drop(&mut self) {
7187                 if self.result_ok {
7188                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7189                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7190                         }
7191                 } else {
7192                 }
7193         }
7194 }
7195 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>> for CResult_PublicKeyNoneZ {
7196         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, ()>) -> Self {
7197                 let contents = if o.result_ok {
7198                         let result = unsafe { o.contents.result };
7199                         unsafe { o.contents.result = core::ptr::null_mut() };
7200                         CResult_PublicKeyNoneZPtr { result }
7201                 } else {
7202                         let _ = unsafe { Box::from_raw(o.contents.err) };
7203                         o.contents.err = core::ptr::null_mut();
7204                         CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() }
7205                 };
7206                 Self {
7207                         contents,
7208                         result_ok: o.result_ok,
7209                 }
7210         }
7211 }
7212 impl Clone for CResult_PublicKeyNoneZ {
7213         fn clone(&self) -> Self {
7214                 if self.result_ok {
7215                         Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr {
7216                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
7217                         } }
7218                 } else {
7219                         Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr {
7220                                 err: core::ptr::null_mut()
7221                         } }
7222                 }
7223         }
7224 }
7225 #[no_mangle]
7226 /// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig`
7227 /// but with all dynamically-allocated buffers duplicated in new buffers.
7228 pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) }
7229 #[repr(C)]
7230 /// An enum which can either contain a crate::c_types::BigEndianScalar or not
7231 pub enum COption_ScalarZ {
7232         /// When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar
7233         Some(crate::c_types::BigEndianScalar),
7234         /// When we're in this state, this COption_ScalarZ contains nothing
7235         None
7236 }
7237 impl COption_ScalarZ {
7238         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7239                 if let Self::None = self { false } else { true }
7240         }
7241         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7242                 !self.is_some()
7243         }
7244         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar {
7245                 if let Self::Some(v) = self { v } else { unreachable!() }
7246         }
7247 }
7248 #[no_mangle]
7249 /// Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar
7250 pub extern "C" fn COption_ScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_ScalarZ {
7251         COption_ScalarZ::Some(o)
7252 }
7253 #[no_mangle]
7254 /// Constructs a new COption_ScalarZ containing nothing
7255 pub extern "C" fn COption_ScalarZ_none() -> COption_ScalarZ {
7256         COption_ScalarZ::None
7257 }
7258 #[no_mangle]
7259 /// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state
7260 pub extern "C" fn COption_ScalarZ_free(_res: COption_ScalarZ) { }
7261 #[repr(C)]
7262 /// The contents of CResult_SharedSecretNoneZ
7263 pub union CResult_SharedSecretNoneZPtr {
7264         /// A pointer to the contents in the success state.
7265         /// Reading from this pointer when `result_ok` is not set is undefined.
7266         pub result: *mut crate::c_types::ThirtyTwoBytes,
7267         /// Note that this value is always NULL, as there are no contents in the Err variant
7268         pub err: *mut core::ffi::c_void,
7269 }
7270 #[repr(C)]
7271 /// A CResult_SharedSecretNoneZ represents the result of a fallible operation,
7272 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7274 pub struct CResult_SharedSecretNoneZ {
7275         /// The contents of this CResult_SharedSecretNoneZ, accessible via either
7276         /// `err` or `result` depending on the state of `result_ok`.
7277         pub contents: CResult_SharedSecretNoneZPtr,
7278         /// Whether this CResult_SharedSecretNoneZ represents a success state.
7279         pub result_ok: bool,
7280 }
7281 #[no_mangle]
7282 /// Creates a new CResult_SharedSecretNoneZ in the success state.
7283 pub extern "C" fn CResult_SharedSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_SharedSecretNoneZ {
7284         CResult_SharedSecretNoneZ {
7285                 contents: CResult_SharedSecretNoneZPtr {
7286                         result: Box::into_raw(Box::new(o)),
7287                 },
7288                 result_ok: true,
7289         }
7290 }
7291 #[no_mangle]
7292 /// Creates a new CResult_SharedSecretNoneZ in the error state.
7293 pub extern "C" fn CResult_SharedSecretNoneZ_err() -> CResult_SharedSecretNoneZ {
7294         CResult_SharedSecretNoneZ {
7295                 contents: CResult_SharedSecretNoneZPtr {
7296                         err: core::ptr::null_mut(),
7297                 },
7298                 result_ok: false,
7299         }
7300 }
7301 /// Checks if the given object is currently in the success state
7302 #[no_mangle]
7303 pub extern "C" fn CResult_SharedSecretNoneZ_is_ok(o: &CResult_SharedSecretNoneZ) -> bool {
7304         o.result_ok
7305 }
7306 #[no_mangle]
7307 /// Frees any resources used by the CResult_SharedSecretNoneZ.
7308 pub extern "C" fn CResult_SharedSecretNoneZ_free(_res: CResult_SharedSecretNoneZ) { }
7309 impl Drop for CResult_SharedSecretNoneZ {
7310         fn drop(&mut self) {
7311                 if self.result_ok {
7312                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7313                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7314                         }
7315                 } else {
7316                 }
7317         }
7318 }
7319 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_SharedSecretNoneZ {
7320         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7321                 let contents = if o.result_ok {
7322                         let result = unsafe { o.contents.result };
7323                         unsafe { o.contents.result = core::ptr::null_mut() };
7324                         CResult_SharedSecretNoneZPtr { result }
7325                 } else {
7326                         let _ = unsafe { Box::from_raw(o.contents.err) };
7327                         o.contents.err = core::ptr::null_mut();
7328                         CResult_SharedSecretNoneZPtr { err: core::ptr::null_mut() }
7329                 };
7330                 Self {
7331                         contents,
7332                         result_ok: o.result_ok,
7333                 }
7334         }
7335 }
7336 impl Clone for CResult_SharedSecretNoneZ {
7337         fn clone(&self) -> Self {
7338                 if self.result_ok {
7339                         Self { result_ok: true, contents: CResult_SharedSecretNoneZPtr {
7340                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7341                         } }
7342                 } else {
7343                         Self { result_ok: false, contents: CResult_SharedSecretNoneZPtr {
7344                                 err: core::ptr::null_mut()
7345                         } }
7346                 }
7347         }
7348 }
7349 #[no_mangle]
7350 /// Creates a new CResult_SharedSecretNoneZ which has the same data as `orig`
7351 /// but with all dynamically-allocated buffers duplicated in new buffers.
7352 pub extern "C" fn CResult_SharedSecretNoneZ_clone(orig: &CResult_SharedSecretNoneZ) -> CResult_SharedSecretNoneZ { Clone::clone(&orig) }
7353 #[repr(C)]
7354 /// The contents of CResult_SignDecodeErrorZ
7355 pub union CResult_SignDecodeErrorZPtr {
7356         /// A pointer to the contents in the success state.
7357         /// Reading from this pointer when `result_ok` is not set is undefined.
7358         pub result: *mut crate::lightning::chain::keysinterface::Sign,
7359         /// A pointer to the contents in the error state.
7360         /// Reading from this pointer when `result_ok` is set is undefined.
7361         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7362 }
7363 #[repr(C)]
7364 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
7365 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
7366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7367 pub struct CResult_SignDecodeErrorZ {
7368         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
7369         /// `err` or `result` depending on the state of `result_ok`.
7370         pub contents: CResult_SignDecodeErrorZPtr,
7371         /// Whether this CResult_SignDecodeErrorZ represents a success state.
7372         pub result_ok: bool,
7373 }
7374 #[no_mangle]
7375 /// Creates a new CResult_SignDecodeErrorZ in the success state.
7376 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
7377         CResult_SignDecodeErrorZ {
7378                 contents: CResult_SignDecodeErrorZPtr {
7379                         result: Box::into_raw(Box::new(o)),
7380                 },
7381                 result_ok: true,
7382         }
7383 }
7384 #[no_mangle]
7385 /// Creates a new CResult_SignDecodeErrorZ in the error state.
7386 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
7387         CResult_SignDecodeErrorZ {
7388                 contents: CResult_SignDecodeErrorZPtr {
7389                         err: Box::into_raw(Box::new(e)),
7390                 },
7391                 result_ok: false,
7392         }
7393 }
7394 /// Checks if the given object is currently in the success state
7395 #[no_mangle]
7396 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
7397         o.result_ok
7398 }
7399 #[no_mangle]
7400 /// Frees any resources used by the CResult_SignDecodeErrorZ.
7401 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
7402 impl Drop for CResult_SignDecodeErrorZ {
7403         fn drop(&mut self) {
7404                 if self.result_ok {
7405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7407                         }
7408                 } else {
7409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7411                         }
7412                 }
7413         }
7414 }
7415 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
7416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
7417                 let contents = if o.result_ok {
7418                         let result = unsafe { o.contents.result };
7419                         unsafe { o.contents.result = core::ptr::null_mut() };
7420                         CResult_SignDecodeErrorZPtr { result }
7421                 } else {
7422                         let err = unsafe { o.contents.err };
7423                         unsafe { o.contents.err = core::ptr::null_mut(); }
7424                         CResult_SignDecodeErrorZPtr { err }
7425                 };
7426                 Self {
7427                         contents,
7428                         result_ok: o.result_ok,
7429                 }
7430         }
7431 }
7432 #[repr(C)]
7433 /// A dynamically-allocated array of crate::c_types::U5s of arbitrary size.
7434 /// This corresponds to std::vector in C++
7435 pub struct CVec_U5Z {
7436         /// The elements in the array.
7437         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7438         pub data: *mut crate::c_types::U5,
7439         /// The number of elements pointed to by `data`.
7440         pub datalen: usize
7441 }
7442 impl CVec_U5Z {
7443         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::U5> {
7444                 if self.datalen == 0 { return Vec::new(); }
7445                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7446                 self.data = core::ptr::null_mut();
7447                 self.datalen = 0;
7448                 ret
7449         }
7450         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] {
7451                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7452         }
7453 }
7454 impl From<Vec<crate::c_types::U5>> for CVec_U5Z {
7455         fn from(v: Vec<crate::c_types::U5>) -> Self {
7456                 let datalen = v.len();
7457                 let data = Box::into_raw(v.into_boxed_slice());
7458                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7459         }
7460 }
7461 #[no_mangle]
7462 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7463 pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { }
7464 impl Drop for CVec_U5Z {
7465         fn drop(&mut self) {
7466                 if self.datalen == 0 { return; }
7467                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7468         }
7469 }
7470 impl Clone for CVec_U5Z {
7471         fn clone(&self) -> Self {
7472                 let mut res = Vec::new();
7473                 if self.datalen == 0 { return Self::from(res); }
7474                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7475                 Self::from(res)
7476         }
7477 }
7478 #[repr(C)]
7479 /// The contents of CResult_RecoverableSignatureNoneZ
7480 pub union CResult_RecoverableSignatureNoneZPtr {
7481         /// A pointer to the contents in the success state.
7482         /// Reading from this pointer when `result_ok` is not set is undefined.
7483         pub result: *mut crate::c_types::RecoverableSignature,
7484         /// Note that this value is always NULL, as there are no contents in the Err variant
7485         pub err: *mut core::ffi::c_void,
7486 }
7487 #[repr(C)]
7488 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7489 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7491 pub struct CResult_RecoverableSignatureNoneZ {
7492         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7493         /// `err` or `result` depending on the state of `result_ok`.
7494         pub contents: CResult_RecoverableSignatureNoneZPtr,
7495         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7496         pub result_ok: bool,
7497 }
7498 #[no_mangle]
7499 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7500 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7501         CResult_RecoverableSignatureNoneZ {
7502                 contents: CResult_RecoverableSignatureNoneZPtr {
7503                         result: Box::into_raw(Box::new(o)),
7504                 },
7505                 result_ok: true,
7506         }
7507 }
7508 #[no_mangle]
7509 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7510 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7511         CResult_RecoverableSignatureNoneZ {
7512                 contents: CResult_RecoverableSignatureNoneZPtr {
7513                         err: core::ptr::null_mut(),
7514                 },
7515                 result_ok: false,
7516         }
7517 }
7518 /// Checks if the given object is currently in the success state
7519 #[no_mangle]
7520 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7521         o.result_ok
7522 }
7523 #[no_mangle]
7524 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7525 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7526 impl Drop for CResult_RecoverableSignatureNoneZ {
7527         fn drop(&mut self) {
7528                 if self.result_ok {
7529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7531                         }
7532                 } else {
7533                 }
7534         }
7535 }
7536 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7537         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7538                 let contents = if o.result_ok {
7539                         let result = unsafe { o.contents.result };
7540                         unsafe { o.contents.result = core::ptr::null_mut() };
7541                         CResult_RecoverableSignatureNoneZPtr { result }
7542                 } else {
7543                         let _ = unsafe { Box::from_raw(o.contents.err) };
7544                         o.contents.err = core::ptr::null_mut();
7545                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7546                 };
7547                 Self {
7548                         contents,
7549                         result_ok: o.result_ok,
7550                 }
7551         }
7552 }
7553 impl Clone for CResult_RecoverableSignatureNoneZ {
7554         fn clone(&self) -> Self {
7555                 if self.result_ok {
7556                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7557                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7558                         } }
7559                 } else {
7560                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7561                                 err: core::ptr::null_mut()
7562                         } }
7563                 }
7564         }
7565 }
7566 #[no_mangle]
7567 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7568 /// but with all dynamically-allocated buffers duplicated in new buffers.
7569 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7570 #[repr(C)]
7571 /// A dynamically-allocated array of u8s of arbitrary size.
7572 /// This corresponds to std::vector in C++
7573 pub struct CVec_u8Z {
7574         /// The elements in the array.
7575         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7576         pub data: *mut u8,
7577         /// The number of elements pointed to by `data`.
7578         pub datalen: usize
7579 }
7580 impl CVec_u8Z {
7581         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7582                 if self.datalen == 0 { return Vec::new(); }
7583                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7584                 self.data = core::ptr::null_mut();
7585                 self.datalen = 0;
7586                 ret
7587         }
7588         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7589                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7590         }
7591 }
7592 impl From<Vec<u8>> for CVec_u8Z {
7593         fn from(v: Vec<u8>) -> Self {
7594                 let datalen = v.len();
7595                 let data = Box::into_raw(v.into_boxed_slice());
7596                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7597         }
7598 }
7599 #[no_mangle]
7600 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7601 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7602 impl Drop for CVec_u8Z {
7603         fn drop(&mut self) {
7604                 if self.datalen == 0 { return; }
7605                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7606         }
7607 }
7608 impl Clone for CVec_u8Z {
7609         fn clone(&self) -> Self {
7610                 let mut res = Vec::new();
7611                 if self.datalen == 0 { return Self::from(res); }
7612                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7613                 Self::from(res)
7614         }
7615 }
7616 #[repr(C)]
7617 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7618 /// This corresponds to std::vector in C++
7619 pub struct CVec_CVec_u8ZZ {
7620         /// The elements in the array.
7621         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7622         pub data: *mut crate::c_types::derived::CVec_u8Z,
7623         /// The number of elements pointed to by `data`.
7624         pub datalen: usize
7625 }
7626 impl CVec_CVec_u8ZZ {
7627         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7628                 if self.datalen == 0 { return Vec::new(); }
7629                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7630                 self.data = core::ptr::null_mut();
7631                 self.datalen = 0;
7632                 ret
7633         }
7634         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7635                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7636         }
7637 }
7638 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7639         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7640                 let datalen = v.len();
7641                 let data = Box::into_raw(v.into_boxed_slice());
7642                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7643         }
7644 }
7645 #[no_mangle]
7646 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7647 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7648 impl Drop for CVec_CVec_u8ZZ {
7649         fn drop(&mut self) {
7650                 if self.datalen == 0 { return; }
7651                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7652         }
7653 }
7654 impl Clone for CVec_CVec_u8ZZ {
7655         fn clone(&self) -> Self {
7656                 let mut res = Vec::new();
7657                 if self.datalen == 0 { return Self::from(res); }
7658                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7659                 Self::from(res)
7660         }
7661 }
7662 #[repr(C)]
7663 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7664 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7665         /// A pointer to the contents in the success state.
7666         /// Reading from this pointer when `result_ok` is not set is undefined.
7667         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7668         /// Note that this value is always NULL, as there are no contents in the Err variant
7669         pub err: *mut core::ffi::c_void,
7670 }
7671 #[repr(C)]
7672 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7673 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7674 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7675 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7676         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7677         /// `err` or `result` depending on the state of `result_ok`.
7678         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7679         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7680         pub result_ok: bool,
7681 }
7682 #[no_mangle]
7683 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7684 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7685         CResult_CVec_CVec_u8ZZNoneZ {
7686                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7687                         result: Box::into_raw(Box::new(o)),
7688                 },
7689                 result_ok: true,
7690         }
7691 }
7692 #[no_mangle]
7693 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7694 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7695         CResult_CVec_CVec_u8ZZNoneZ {
7696                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7697                         err: core::ptr::null_mut(),
7698                 },
7699                 result_ok: false,
7700         }
7701 }
7702 /// Checks if the given object is currently in the success state
7703 #[no_mangle]
7704 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7705         o.result_ok
7706 }
7707 #[no_mangle]
7708 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7709 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7710 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7711         fn drop(&mut self) {
7712                 if self.result_ok {
7713                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7714                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7715                         }
7716                 } else {
7717                 }
7718         }
7719 }
7720 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7721         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7722                 let contents = if o.result_ok {
7723                         let result = unsafe { o.contents.result };
7724                         unsafe { o.contents.result = core::ptr::null_mut() };
7725                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
7726                 } else {
7727                         let _ = unsafe { Box::from_raw(o.contents.err) };
7728                         o.contents.err = core::ptr::null_mut();
7729                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7730                 };
7731                 Self {
7732                         contents,
7733                         result_ok: o.result_ok,
7734                 }
7735         }
7736 }
7737 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7738         fn clone(&self) -> Self {
7739                 if self.result_ok {
7740                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7741                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7742                         } }
7743                 } else {
7744                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7745                                 err: core::ptr::null_mut()
7746                         } }
7747                 }
7748         }
7749 }
7750 #[no_mangle]
7751 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7752 /// but with all dynamically-allocated buffers duplicated in new buffers.
7753 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7754 #[repr(C)]
7755 /// The contents of CResult_InMemorySignerDecodeErrorZ
7756 pub union CResult_InMemorySignerDecodeErrorZPtr {
7757         /// A pointer to the contents in the success state.
7758         /// Reading from this pointer when `result_ok` is not set is undefined.
7759         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7760         /// A pointer to the contents in the error state.
7761         /// Reading from this pointer when `result_ok` is set is undefined.
7762         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7763 }
7764 #[repr(C)]
7765 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7766 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7767 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7768 pub struct CResult_InMemorySignerDecodeErrorZ {
7769         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7770         /// `err` or `result` depending on the state of `result_ok`.
7771         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7772         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7773         pub result_ok: bool,
7774 }
7775 #[no_mangle]
7776 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7777 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7778         CResult_InMemorySignerDecodeErrorZ {
7779                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7780                         result: Box::into_raw(Box::new(o)),
7781                 },
7782                 result_ok: true,
7783         }
7784 }
7785 #[no_mangle]
7786 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7787 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7788         CResult_InMemorySignerDecodeErrorZ {
7789                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7790                         err: Box::into_raw(Box::new(e)),
7791                 },
7792                 result_ok: false,
7793         }
7794 }
7795 /// Checks if the given object is currently in the success state
7796 #[no_mangle]
7797 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7798         o.result_ok
7799 }
7800 #[no_mangle]
7801 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7802 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7803 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7804         fn drop(&mut self) {
7805                 if self.result_ok {
7806                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7807                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7808                         }
7809                 } else {
7810                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7811                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7812                         }
7813                 }
7814         }
7815 }
7816 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7817         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7818                 let contents = if o.result_ok {
7819                         let result = unsafe { o.contents.result };
7820                         unsafe { o.contents.result = core::ptr::null_mut() };
7821                         CResult_InMemorySignerDecodeErrorZPtr { result }
7822                 } else {
7823                         let err = unsafe { o.contents.err };
7824                         unsafe { o.contents.err = core::ptr::null_mut(); }
7825                         CResult_InMemorySignerDecodeErrorZPtr { err }
7826                 };
7827                 Self {
7828                         contents,
7829                         result_ok: o.result_ok,
7830                 }
7831         }
7832 }
7833 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7834         fn clone(&self) -> Self {
7835                 if self.result_ok {
7836                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7837                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7838                         } }
7839                 } else {
7840                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7841                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7842                         } }
7843                 }
7844         }
7845 }
7846 #[no_mangle]
7847 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7848 /// but with all dynamically-allocated buffers duplicated in new buffers.
7849 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7850 #[repr(C)]
7851 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7852 /// This corresponds to std::vector in C++
7853 pub struct CVec_TxOutZ {
7854         /// The elements in the array.
7855         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7856         pub data: *mut crate::c_types::TxOut,
7857         /// The number of elements pointed to by `data`.
7858         pub datalen: usize
7859 }
7860 impl CVec_TxOutZ {
7861         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7862                 if self.datalen == 0 { return Vec::new(); }
7863                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7864                 self.data = core::ptr::null_mut();
7865                 self.datalen = 0;
7866                 ret
7867         }
7868         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7869                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7870         }
7871 }
7872 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7873         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7874                 let datalen = v.len();
7875                 let data = Box::into_raw(v.into_boxed_slice());
7876                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7877         }
7878 }
7879 #[no_mangle]
7880 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7881 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7882 impl Drop for CVec_TxOutZ {
7883         fn drop(&mut self) {
7884                 if self.datalen == 0 { return; }
7885                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7886         }
7887 }
7888 impl Clone for CVec_TxOutZ {
7889         fn clone(&self) -> Self {
7890                 let mut res = Vec::new();
7891                 if self.datalen == 0 { return Self::from(res); }
7892                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7893                 Self::from(res)
7894         }
7895 }
7896 #[repr(C)]
7897 /// The contents of CResult_TransactionNoneZ
7898 pub union CResult_TransactionNoneZPtr {
7899         /// A pointer to the contents in the success state.
7900         /// Reading from this pointer when `result_ok` is not set is undefined.
7901         pub result: *mut crate::c_types::Transaction,
7902         /// Note that this value is always NULL, as there are no contents in the Err variant
7903         pub err: *mut core::ffi::c_void,
7904 }
7905 #[repr(C)]
7906 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7907 /// containing a crate::c_types::Transaction on success and a () on failure.
7908 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7909 pub struct CResult_TransactionNoneZ {
7910         /// The contents of this CResult_TransactionNoneZ, accessible via either
7911         /// `err` or `result` depending on the state of `result_ok`.
7912         pub contents: CResult_TransactionNoneZPtr,
7913         /// Whether this CResult_TransactionNoneZ represents a success state.
7914         pub result_ok: bool,
7915 }
7916 #[no_mangle]
7917 /// Creates a new CResult_TransactionNoneZ in the success state.
7918 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7919         CResult_TransactionNoneZ {
7920                 contents: CResult_TransactionNoneZPtr {
7921                         result: Box::into_raw(Box::new(o)),
7922                 },
7923                 result_ok: true,
7924         }
7925 }
7926 #[no_mangle]
7927 /// Creates a new CResult_TransactionNoneZ in the error state.
7928 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7929         CResult_TransactionNoneZ {
7930                 contents: CResult_TransactionNoneZPtr {
7931                         err: core::ptr::null_mut(),
7932                 },
7933                 result_ok: false,
7934         }
7935 }
7936 /// Checks if the given object is currently in the success state
7937 #[no_mangle]
7938 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7939         o.result_ok
7940 }
7941 #[no_mangle]
7942 /// Frees any resources used by the CResult_TransactionNoneZ.
7943 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7944 impl Drop for CResult_TransactionNoneZ {
7945         fn drop(&mut self) {
7946                 if self.result_ok {
7947                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7948                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7949                         }
7950                 } else {
7951                 }
7952         }
7953 }
7954 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7955         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7956                 let contents = if o.result_ok {
7957                         let result = unsafe { o.contents.result };
7958                         unsafe { o.contents.result = core::ptr::null_mut() };
7959                         CResult_TransactionNoneZPtr { result }
7960                 } else {
7961                         let _ = unsafe { Box::from_raw(o.contents.err) };
7962                         o.contents.err = core::ptr::null_mut();
7963                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7964                 };
7965                 Self {
7966                         contents,
7967                         result_ok: o.result_ok,
7968                 }
7969         }
7970 }
7971 impl Clone for CResult_TransactionNoneZ {
7972         fn clone(&self) -> Self {
7973                 if self.result_ok {
7974                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7975                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7976                         } }
7977                 } else {
7978                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7979                                 err: core::ptr::null_mut()
7980                         } }
7981                 }
7982         }
7983 }
7984 #[no_mangle]
7985 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7986 /// but with all dynamically-allocated buffers duplicated in new buffers.
7987 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7988 #[repr(C)]
7989 /// A tuple of 2 elements. See the individual fields for the types contained.
7990 pub struct C2Tuple_BlockHashChannelMonitorZ {
7991         /// The element at position 0
7992         pub a: crate::c_types::ThirtyTwoBytes,
7993         /// The element at position 1
7994         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7995 }
7996 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7997         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7998                 Self {
7999                         a: tup.0,
8000                         b: tup.1,
8001                 }
8002         }
8003 }
8004 impl C2Tuple_BlockHashChannelMonitorZ {
8005         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
8006                 (self.a, self.b)
8007         }
8008 }
8009 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8010 #[no_mangle]
8011 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
8012         C2Tuple_BlockHashChannelMonitorZ { a, b, }
8013 }
8014
8015 #[no_mangle]
8016 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8017 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
8018 #[repr(C)]
8019 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8020 /// This corresponds to std::vector in C++
8021 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8022         /// The elements in the array.
8023         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8024         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8025         /// The number of elements pointed to by `data`.
8026         pub datalen: usize
8027 }
8028 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8029         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8030                 if self.datalen == 0 { return Vec::new(); }
8031                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8032                 self.data = core::ptr::null_mut();
8033                 self.datalen = 0;
8034                 ret
8035         }
8036         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8037                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8038         }
8039 }
8040 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8041         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8042                 let datalen = v.len();
8043                 let data = Box::into_raw(v.into_boxed_slice());
8044                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8045         }
8046 }
8047 #[no_mangle]
8048 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8049 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8050 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8051         fn drop(&mut self) {
8052                 if self.datalen == 0 { return; }
8053                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8054         }
8055 }
8056 #[repr(C)]
8057 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8058 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8059         /// A pointer to the contents in the success state.
8060         /// Reading from this pointer when `result_ok` is not set is undefined.
8061         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8062         /// A pointer to the contents in the error state.
8063         /// Reading from this pointer when `result_ok` is set is undefined.
8064         pub err: *mut crate::c_types::IOError,
8065 }
8066 #[repr(C)]
8067 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8068 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8070 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8071         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8072         /// `err` or `result` depending on the state of `result_ok`.
8073         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8074         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8075         pub result_ok: bool,
8076 }
8077 #[no_mangle]
8078 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8079 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8080         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8081                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8082                         result: Box::into_raw(Box::new(o)),
8083                 },
8084                 result_ok: true,
8085         }
8086 }
8087 #[no_mangle]
8088 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8089 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8090         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8091                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8092                         err: Box::into_raw(Box::new(e)),
8093                 },
8094                 result_ok: false,
8095         }
8096 }
8097 /// Checks if the given object is currently in the success state
8098 #[no_mangle]
8099 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
8100         o.result_ok
8101 }
8102 #[no_mangle]
8103 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8104 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8105 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8106         fn drop(&mut self) {
8107                 if self.result_ok {
8108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8110                         }
8111                 } else {
8112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8114                         }
8115                 }
8116         }
8117 }
8118 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8119         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8120                 let contents = if o.result_ok {
8121                         let result = unsafe { o.contents.result };
8122                         unsafe { o.contents.result = core::ptr::null_mut() };
8123                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8124                 } else {
8125                         let err = unsafe { o.contents.err };
8126                         unsafe { o.contents.err = core::ptr::null_mut(); }
8127                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8128                 };
8129                 Self {
8130                         contents,
8131                         result_ok: o.result_ok,
8132                 }
8133         }
8134 }
8135 #[repr(C)]
8136 #[derive(Clone)]
8137 /// An enum which can either contain a u16 or not
8138 pub enum COption_u16Z {
8139         /// When we're in this state, this COption_u16Z contains a u16
8140         Some(u16),
8141         /// When we're in this state, this COption_u16Z contains nothing
8142         None
8143 }
8144 impl COption_u16Z {
8145         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8146                 if let Self::None = self { false } else { true }
8147         }
8148         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8149                 !self.is_some()
8150         }
8151         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
8152                 if let Self::Some(v) = self { v } else { unreachable!() }
8153         }
8154 }
8155 #[no_mangle]
8156 /// Constructs a new COption_u16Z containing a u16
8157 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
8158         COption_u16Z::Some(o)
8159 }
8160 #[no_mangle]
8161 /// Constructs a new COption_u16Z containing nothing
8162 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
8163         COption_u16Z::None
8164 }
8165 #[no_mangle]
8166 /// Frees any resources associated with the u16, if we are in the Some state
8167 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
8168 #[no_mangle]
8169 /// Creates a new COption_u16Z which has the same data as `orig`
8170 /// but with all dynamically-allocated buffers duplicated in new buffers.
8171 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
8172 #[repr(C)]
8173 /// The contents of CResult_NoneAPIErrorZ
8174 pub union CResult_NoneAPIErrorZPtr {
8175         /// Note that this value is always NULL, as there are no contents in the OK variant
8176         pub result: *mut core::ffi::c_void,
8177         /// A pointer to the contents in the error state.
8178         /// Reading from this pointer when `result_ok` is set is undefined.
8179         pub err: *mut crate::lightning::util::errors::APIError,
8180 }
8181 #[repr(C)]
8182 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8183 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8185 pub struct CResult_NoneAPIErrorZ {
8186         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8187         /// `err` or `result` depending on the state of `result_ok`.
8188         pub contents: CResult_NoneAPIErrorZPtr,
8189         /// Whether this CResult_NoneAPIErrorZ represents a success state.
8190         pub result_ok: bool,
8191 }
8192 #[no_mangle]
8193 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8194 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8195         CResult_NoneAPIErrorZ {
8196                 contents: CResult_NoneAPIErrorZPtr {
8197                         result: core::ptr::null_mut(),
8198                 },
8199                 result_ok: true,
8200         }
8201 }
8202 #[no_mangle]
8203 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8204 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8205         CResult_NoneAPIErrorZ {
8206                 contents: CResult_NoneAPIErrorZPtr {
8207                         err: Box::into_raw(Box::new(e)),
8208                 },
8209                 result_ok: false,
8210         }
8211 }
8212 /// Checks if the given object is currently in the success state
8213 #[no_mangle]
8214 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
8215         o.result_ok
8216 }
8217 #[no_mangle]
8218 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8219 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8220 impl Drop for CResult_NoneAPIErrorZ {
8221         fn drop(&mut self) {
8222                 if self.result_ok {
8223                 } else {
8224                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8225                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8226                         }
8227                 }
8228         }
8229 }
8230 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8231         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
8232                 let contents = if o.result_ok {
8233                         let _ = unsafe { Box::from_raw(o.contents.result) };
8234                         o.contents.result = core::ptr::null_mut();
8235                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
8236                 } else {
8237                         let err = unsafe { o.contents.err };
8238                         unsafe { o.contents.err = core::ptr::null_mut(); }
8239                         CResult_NoneAPIErrorZPtr { err }
8240                 };
8241                 Self {
8242                         contents,
8243                         result_ok: o.result_ok,
8244                 }
8245         }
8246 }
8247 impl Clone for CResult_NoneAPIErrorZ {
8248         fn clone(&self) -> Self {
8249                 if self.result_ok {
8250                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8251                                 result: core::ptr::null_mut()
8252                         } }
8253                 } else {
8254                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8255                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8256                         } }
8257                 }
8258         }
8259 }
8260 #[no_mangle]
8261 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8262 /// but with all dynamically-allocated buffers duplicated in new buffers.
8263 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
8264 #[repr(C)]
8265 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8266 /// This corresponds to std::vector in C++
8267 pub struct CVec_CResult_NoneAPIErrorZZ {
8268         /// The elements in the array.
8269         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8270         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8271         /// The number of elements pointed to by `data`.
8272         pub datalen: usize
8273 }
8274 impl CVec_CResult_NoneAPIErrorZZ {
8275         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8276                 if self.datalen == 0 { return Vec::new(); }
8277                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8278                 self.data = core::ptr::null_mut();
8279                 self.datalen = 0;
8280                 ret
8281         }
8282         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8283                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8284         }
8285 }
8286 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8287         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8288                 let datalen = v.len();
8289                 let data = Box::into_raw(v.into_boxed_slice());
8290                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8291         }
8292 }
8293 #[no_mangle]
8294 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8295 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8296 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8297         fn drop(&mut self) {
8298                 if self.datalen == 0 { return; }
8299                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8300         }
8301 }
8302 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8303         fn clone(&self) -> Self {
8304                 let mut res = Vec::new();
8305                 if self.datalen == 0 { return Self::from(res); }
8306                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8307                 Self::from(res)
8308         }
8309 }
8310 #[repr(C)]
8311 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8312 /// This corresponds to std::vector in C++
8313 pub struct CVec_APIErrorZ {
8314         /// The elements in the array.
8315         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8316         pub data: *mut crate::lightning::util::errors::APIError,
8317         /// The number of elements pointed to by `data`.
8318         pub datalen: usize
8319 }
8320 impl CVec_APIErrorZ {
8321         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8322                 if self.datalen == 0 { return Vec::new(); }
8323                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8324                 self.data = core::ptr::null_mut();
8325                 self.datalen = 0;
8326                 ret
8327         }
8328         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8329                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8330         }
8331 }
8332 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8333         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8334                 let datalen = v.len();
8335                 let data = Box::into_raw(v.into_boxed_slice());
8336                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8337         }
8338 }
8339 #[no_mangle]
8340 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8341 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8342 impl Drop for CVec_APIErrorZ {
8343         fn drop(&mut self) {
8344                 if self.datalen == 0 { return; }
8345                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8346         }
8347 }
8348 impl Clone for CVec_APIErrorZ {
8349         fn clone(&self) -> Self {
8350                 let mut res = Vec::new();
8351                 if self.datalen == 0 { return Self::from(res); }
8352                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8353                 Self::from(res)
8354         }
8355 }
8356 #[repr(C)]
8357 /// The contents of CResult__u832APIErrorZ
8358 pub union CResult__u832APIErrorZPtr {
8359         /// A pointer to the contents in the success state.
8360         /// Reading from this pointer when `result_ok` is not set is undefined.
8361         pub result: *mut crate::c_types::ThirtyTwoBytes,
8362         /// A pointer to the contents in the error state.
8363         /// Reading from this pointer when `result_ok` is set is undefined.
8364         pub err: *mut crate::lightning::util::errors::APIError,
8365 }
8366 #[repr(C)]
8367 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
8368 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8370 pub struct CResult__u832APIErrorZ {
8371         /// The contents of this CResult__u832APIErrorZ, accessible via either
8372         /// `err` or `result` depending on the state of `result_ok`.
8373         pub contents: CResult__u832APIErrorZPtr,
8374         /// Whether this CResult__u832APIErrorZ represents a success state.
8375         pub result_ok: bool,
8376 }
8377 #[no_mangle]
8378 /// Creates a new CResult__u832APIErrorZ in the success state.
8379 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
8380         CResult__u832APIErrorZ {
8381                 contents: CResult__u832APIErrorZPtr {
8382                         result: Box::into_raw(Box::new(o)),
8383                 },
8384                 result_ok: true,
8385         }
8386 }
8387 #[no_mangle]
8388 /// Creates a new CResult__u832APIErrorZ in the error state.
8389 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
8390         CResult__u832APIErrorZ {
8391                 contents: CResult__u832APIErrorZPtr {
8392                         err: Box::into_raw(Box::new(e)),
8393                 },
8394                 result_ok: false,
8395         }
8396 }
8397 /// Checks if the given object is currently in the success state
8398 #[no_mangle]
8399 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
8400         o.result_ok
8401 }
8402 #[no_mangle]
8403 /// Frees any resources used by the CResult__u832APIErrorZ.
8404 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
8405 impl Drop for CResult__u832APIErrorZ {
8406         fn drop(&mut self) {
8407                 if self.result_ok {
8408                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8409                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8410                         }
8411                 } else {
8412                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8413                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8414                         }
8415                 }
8416         }
8417 }
8418 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
8419         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8420                 let contents = if o.result_ok {
8421                         let result = unsafe { o.contents.result };
8422                         unsafe { o.contents.result = core::ptr::null_mut() };
8423                         CResult__u832APIErrorZPtr { result }
8424                 } else {
8425                         let err = unsafe { o.contents.err };
8426                         unsafe { o.contents.err = core::ptr::null_mut(); }
8427                         CResult__u832APIErrorZPtr { err }
8428                 };
8429                 Self {
8430                         contents,
8431                         result_ok: o.result_ok,
8432                 }
8433         }
8434 }
8435 impl Clone for CResult__u832APIErrorZ {
8436         fn clone(&self) -> Self {
8437                 if self.result_ok {
8438                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
8439                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8440                         } }
8441                 } else {
8442                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8443                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8444                         } }
8445                 }
8446         }
8447 }
8448 #[no_mangle]
8449 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8450 /// but with all dynamically-allocated buffers duplicated in new buffers.
8451 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8452 #[repr(C)]
8453 /// The contents of CResult_NonePaymentSendFailureZ
8454 pub union CResult_NonePaymentSendFailureZPtr {
8455         /// Note that this value is always NULL, as there are no contents in the OK variant
8456         pub result: *mut core::ffi::c_void,
8457         /// A pointer to the contents in the error state.
8458         /// Reading from this pointer when `result_ok` is set is undefined.
8459         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8460 }
8461 #[repr(C)]
8462 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8463 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8465 pub struct CResult_NonePaymentSendFailureZ {
8466         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8467         /// `err` or `result` depending on the state of `result_ok`.
8468         pub contents: CResult_NonePaymentSendFailureZPtr,
8469         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8470         pub result_ok: bool,
8471 }
8472 #[no_mangle]
8473 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8474 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8475         CResult_NonePaymentSendFailureZ {
8476                 contents: CResult_NonePaymentSendFailureZPtr {
8477                         result: core::ptr::null_mut(),
8478                 },
8479                 result_ok: true,
8480         }
8481 }
8482 #[no_mangle]
8483 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8484 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8485         CResult_NonePaymentSendFailureZ {
8486                 contents: CResult_NonePaymentSendFailureZPtr {
8487                         err: Box::into_raw(Box::new(e)),
8488                 },
8489                 result_ok: false,
8490         }
8491 }
8492 /// Checks if the given object is currently in the success state
8493 #[no_mangle]
8494 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8495         o.result_ok
8496 }
8497 #[no_mangle]
8498 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8499 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8500 impl Drop for CResult_NonePaymentSendFailureZ {
8501         fn drop(&mut self) {
8502                 if self.result_ok {
8503                 } else {
8504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8506                         }
8507                 }
8508         }
8509 }
8510 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8511         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8512                 let contents = if o.result_ok {
8513                         let _ = unsafe { Box::from_raw(o.contents.result) };
8514                         o.contents.result = core::ptr::null_mut();
8515                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8516                 } else {
8517                         let err = unsafe { o.contents.err };
8518                         unsafe { o.contents.err = core::ptr::null_mut(); }
8519                         CResult_NonePaymentSendFailureZPtr { err }
8520                 };
8521                 Self {
8522                         contents,
8523                         result_ok: o.result_ok,
8524                 }
8525         }
8526 }
8527 impl Clone for CResult_NonePaymentSendFailureZ {
8528         fn clone(&self) -> Self {
8529                 if self.result_ok {
8530                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8531                                 result: core::ptr::null_mut()
8532                         } }
8533                 } else {
8534                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8536                         } }
8537                 }
8538         }
8539 }
8540 #[no_mangle]
8541 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8542 /// but with all dynamically-allocated buffers duplicated in new buffers.
8543 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8544 #[repr(C)]
8545 /// The contents of CResult_PaymentHashPaymentSendFailureZ
8546 pub union CResult_PaymentHashPaymentSendFailureZPtr {
8547         /// A pointer to the contents in the success state.
8548         /// Reading from this pointer when `result_ok` is not set is undefined.
8549         pub result: *mut crate::c_types::ThirtyTwoBytes,
8550         /// A pointer to the contents in the error state.
8551         /// Reading from this pointer when `result_ok` is set is undefined.
8552         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8553 }
8554 #[repr(C)]
8555 /// A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
8556 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8558 pub struct CResult_PaymentHashPaymentSendFailureZ {
8559         /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
8560         /// `err` or `result` depending on the state of `result_ok`.
8561         pub contents: CResult_PaymentHashPaymentSendFailureZPtr,
8562         /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
8563         pub result_ok: bool,
8564 }
8565 #[no_mangle]
8566 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
8567 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ {
8568         CResult_PaymentHashPaymentSendFailureZ {
8569                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8570                         result: Box::into_raw(Box::new(o)),
8571                 },
8572                 result_ok: true,
8573         }
8574 }
8575 #[no_mangle]
8576 /// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
8577 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ {
8578         CResult_PaymentHashPaymentSendFailureZ {
8579                 contents: CResult_PaymentHashPaymentSendFailureZPtr {
8580                         err: Box::into_raw(Box::new(e)),
8581                 },
8582                 result_ok: false,
8583         }
8584 }
8585 /// Checks if the given object is currently in the success state
8586 #[no_mangle]
8587 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool {
8588         o.result_ok
8589 }
8590 #[no_mangle]
8591 /// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
8592 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { }
8593 impl Drop for CResult_PaymentHashPaymentSendFailureZ {
8594         fn drop(&mut self) {
8595                 if self.result_ok {
8596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8598                         }
8599                 } else {
8600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8602                         }
8603                 }
8604         }
8605 }
8606 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentHashPaymentSendFailureZ {
8607         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8608                 let contents = if o.result_ok {
8609                         let result = unsafe { o.contents.result };
8610                         unsafe { o.contents.result = core::ptr::null_mut() };
8611                         CResult_PaymentHashPaymentSendFailureZPtr { result }
8612                 } else {
8613                         let err = unsafe { o.contents.err };
8614                         unsafe { o.contents.err = core::ptr::null_mut(); }
8615                         CResult_PaymentHashPaymentSendFailureZPtr { err }
8616                 };
8617                 Self {
8618                         contents,
8619                         result_ok: o.result_ok,
8620                 }
8621         }
8622 }
8623 impl Clone for CResult_PaymentHashPaymentSendFailureZ {
8624         fn clone(&self) -> Self {
8625                 if self.result_ok {
8626                         Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8627                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8628                         } }
8629                 } else {
8630                         Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr {
8631                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8632                         } }
8633                 }
8634         }
8635 }
8636 #[no_mangle]
8637 /// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
8638 /// but with all dynamically-allocated buffers duplicated in new buffers.
8639 pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) }
8640 #[repr(C)]
8641 /// A tuple of 2 elements. See the individual fields for the types contained.
8642 pub struct C2Tuple_PaymentHashPaymentIdZ {
8643         /// The element at position 0
8644         pub a: crate::c_types::ThirtyTwoBytes,
8645         /// The element at position 1
8646         pub b: crate::c_types::ThirtyTwoBytes,
8647 }
8648 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8649         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8650                 Self {
8651                         a: tup.0,
8652                         b: tup.1,
8653                 }
8654         }
8655 }
8656 impl C2Tuple_PaymentHashPaymentIdZ {
8657         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8658                 (self.a, self.b)
8659         }
8660 }
8661 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8662         fn clone(&self) -> Self {
8663                 Self {
8664                         a: Clone::clone(&self.a),
8665                         b: Clone::clone(&self.b),
8666                 }
8667         }
8668 }
8669 #[no_mangle]
8670 /// Creates a new tuple which has the same data as `orig`
8671 /// but with all dynamically-allocated buffers duplicated in new buffers.
8672 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8673 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8674 #[no_mangle]
8675 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8676         C2Tuple_PaymentHashPaymentIdZ { a, b, }
8677 }
8678
8679 #[no_mangle]
8680 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8681 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8682 #[repr(C)]
8683 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8684 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8685         /// A pointer to the contents in the success state.
8686         /// Reading from this pointer when `result_ok` is not set is undefined.
8687         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8688         /// A pointer to the contents in the error state.
8689         /// Reading from this pointer when `result_ok` is set is undefined.
8690         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8691 }
8692 #[repr(C)]
8693 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8694 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8696 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8697         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8698         /// `err` or `result` depending on the state of `result_ok`.
8699         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8700         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8701         pub result_ok: bool,
8702 }
8703 #[no_mangle]
8704 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8705 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8706         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8707                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8708                         result: Box::into_raw(Box::new(o)),
8709                 },
8710                 result_ok: true,
8711         }
8712 }
8713 #[no_mangle]
8714 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8715 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8716         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8717                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8718                         err: Box::into_raw(Box::new(e)),
8719                 },
8720                 result_ok: false,
8721         }
8722 }
8723 /// Checks if the given object is currently in the success state
8724 #[no_mangle]
8725 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8726         o.result_ok
8727 }
8728 #[no_mangle]
8729 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8730 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8731 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8732         fn drop(&mut self) {
8733                 if self.result_ok {
8734                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8735                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8736                         }
8737                 } else {
8738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8740                         }
8741                 }
8742         }
8743 }
8744 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8745         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8746                 let contents = if o.result_ok {
8747                         let result = unsafe { o.contents.result };
8748                         unsafe { o.contents.result = core::ptr::null_mut() };
8749                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8750                 } else {
8751                         let err = unsafe { o.contents.err };
8752                         unsafe { o.contents.err = core::ptr::null_mut(); }
8753                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8754                 };
8755                 Self {
8756                         contents,
8757                         result_ok: o.result_ok,
8758                 }
8759         }
8760 }
8761 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8762         fn clone(&self) -> Self {
8763                 if self.result_ok {
8764                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8765                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8766                         } }
8767                 } else {
8768                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8769                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8770                         } }
8771                 }
8772         }
8773 }
8774 #[no_mangle]
8775 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8776 /// but with all dynamically-allocated buffers duplicated in new buffers.
8777 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8778 #[repr(C)]
8779 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8780 /// This corresponds to std::vector in C++
8781 pub struct CVec_ThirtyTwoBytesZ {
8782         /// The elements in the array.
8783         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8784         pub data: *mut crate::c_types::ThirtyTwoBytes,
8785         /// The number of elements pointed to by `data`.
8786         pub datalen: usize
8787 }
8788 impl CVec_ThirtyTwoBytesZ {
8789         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8790                 if self.datalen == 0 { return Vec::new(); }
8791                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8792                 self.data = core::ptr::null_mut();
8793                 self.datalen = 0;
8794                 ret
8795         }
8796         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8797                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8798         }
8799 }
8800 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8801         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8802                 let datalen = v.len();
8803                 let data = Box::into_raw(v.into_boxed_slice());
8804                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8805         }
8806 }
8807 #[no_mangle]
8808 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8809 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8810 impl Drop for CVec_ThirtyTwoBytesZ {
8811         fn drop(&mut self) {
8812                 if self.datalen == 0 { return; }
8813                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8814         }
8815 }
8816 impl Clone for CVec_ThirtyTwoBytesZ {
8817         fn clone(&self) -> Self {
8818                 let mut res = Vec::new();
8819                 if self.datalen == 0 { return Self::from(res); }
8820                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8821                 Self::from(res)
8822         }
8823 }
8824 #[repr(C)]
8825 /// A tuple of 2 elements. See the individual fields for the types contained.
8826 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8827         /// The element at position 0
8828         pub a: crate::c_types::ThirtyTwoBytes,
8829         /// The element at position 1
8830         pub b: crate::c_types::ThirtyTwoBytes,
8831 }
8832 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8833         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8834                 Self {
8835                         a: tup.0,
8836                         b: tup.1,
8837                 }
8838         }
8839 }
8840 impl C2Tuple_PaymentHashPaymentSecretZ {
8841         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8842                 (self.a, self.b)
8843         }
8844 }
8845 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8846         fn clone(&self) -> Self {
8847                 Self {
8848                         a: Clone::clone(&self.a),
8849                         b: Clone::clone(&self.b),
8850                 }
8851         }
8852 }
8853 #[no_mangle]
8854 /// Creates a new tuple which has the same data as `orig`
8855 /// but with all dynamically-allocated buffers duplicated in new buffers.
8856 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8857 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8858 #[no_mangle]
8859 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8860         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8861 }
8862
8863 #[no_mangle]
8864 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8865 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8866 #[repr(C)]
8867 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8868 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8869         /// A pointer to the contents in the success state.
8870         /// Reading from this pointer when `result_ok` is not set is undefined.
8871         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8872         /// Note that this value is always NULL, as there are no contents in the Err variant
8873         pub err: *mut core::ffi::c_void,
8874 }
8875 #[repr(C)]
8876 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8877 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8878 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8879 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8880         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8881         /// `err` or `result` depending on the state of `result_ok`.
8882         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8883         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8884         pub result_ok: bool,
8885 }
8886 #[no_mangle]
8887 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8888 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8889         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8890                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8891                         result: Box::into_raw(Box::new(o)),
8892                 },
8893                 result_ok: true,
8894         }
8895 }
8896 #[no_mangle]
8897 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8898 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8899         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8900                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8901                         err: core::ptr::null_mut(),
8902                 },
8903                 result_ok: false,
8904         }
8905 }
8906 /// Checks if the given object is currently in the success state
8907 #[no_mangle]
8908 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8909         o.result_ok
8910 }
8911 #[no_mangle]
8912 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8913 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8914 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8915         fn drop(&mut self) {
8916                 if self.result_ok {
8917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8919                         }
8920                 } else {
8921                 }
8922         }
8923 }
8924 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8925         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8926                 let contents = if o.result_ok {
8927                         let result = unsafe { o.contents.result };
8928                         unsafe { o.contents.result = core::ptr::null_mut() };
8929                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8930                 } else {
8931                         let _ = unsafe { Box::from_raw(o.contents.err) };
8932                         o.contents.err = core::ptr::null_mut();
8933                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8934                 };
8935                 Self {
8936                         contents,
8937                         result_ok: o.result_ok,
8938                 }
8939         }
8940 }
8941 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8942         fn clone(&self) -> Self {
8943                 if self.result_ok {
8944                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8945                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8946                         } }
8947                 } else {
8948                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8949                                 err: core::ptr::null_mut()
8950                         } }
8951                 }
8952         }
8953 }
8954 #[no_mangle]
8955 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8956 /// but with all dynamically-allocated buffers duplicated in new buffers.
8957 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8958 #[repr(C)]
8959 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8960 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8961         /// A pointer to the contents in the success state.
8962         /// Reading from this pointer when `result_ok` is not set is undefined.
8963         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8964         /// A pointer to the contents in the error state.
8965         /// Reading from this pointer when `result_ok` is set is undefined.
8966         pub err: *mut crate::lightning::util::errors::APIError,
8967 }
8968 #[repr(C)]
8969 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8970 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8972 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8973         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8974         /// `err` or `result` depending on the state of `result_ok`.
8975         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8976         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8977         pub result_ok: bool,
8978 }
8979 #[no_mangle]
8980 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8981 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8982         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8983                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8984                         result: Box::into_raw(Box::new(o)),
8985                 },
8986                 result_ok: true,
8987         }
8988 }
8989 #[no_mangle]
8990 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8991 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8992         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8993                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8994                         err: Box::into_raw(Box::new(e)),
8995                 },
8996                 result_ok: false,
8997         }
8998 }
8999 /// Checks if the given object is currently in the success state
9000 #[no_mangle]
9001 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
9002         o.result_ok
9003 }
9004 #[no_mangle]
9005 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
9006 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
9007 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9008         fn drop(&mut self) {
9009                 if self.result_ok {
9010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9012                         }
9013                 } else {
9014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9016                         }
9017                 }
9018         }
9019 }
9020 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9021         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
9022                 let contents = if o.result_ok {
9023                         let result = unsafe { o.contents.result };
9024                         unsafe { o.contents.result = core::ptr::null_mut() };
9025                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
9026                 } else {
9027                         let err = unsafe { o.contents.err };
9028                         unsafe { o.contents.err = core::ptr::null_mut(); }
9029                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
9030                 };
9031                 Self {
9032                         contents,
9033                         result_ok: o.result_ok,
9034                 }
9035         }
9036 }
9037 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
9038         fn clone(&self) -> Self {
9039                 if self.result_ok {
9040                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9041                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
9042                         } }
9043                 } else {
9044                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
9045                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9046                         } }
9047                 }
9048         }
9049 }
9050 #[no_mangle]
9051 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
9052 /// but with all dynamically-allocated buffers duplicated in new buffers.
9053 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
9054 #[repr(C)]
9055 /// The contents of CResult_PaymentSecretNoneZ
9056 pub union CResult_PaymentSecretNoneZPtr {
9057         /// A pointer to the contents in the success state.
9058         /// Reading from this pointer when `result_ok` is not set is undefined.
9059         pub result: *mut crate::c_types::ThirtyTwoBytes,
9060         /// Note that this value is always NULL, as there are no contents in the Err variant
9061         pub err: *mut core::ffi::c_void,
9062 }
9063 #[repr(C)]
9064 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
9065 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
9066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9067 pub struct CResult_PaymentSecretNoneZ {
9068         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
9069         /// `err` or `result` depending on the state of `result_ok`.
9070         pub contents: CResult_PaymentSecretNoneZPtr,
9071         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
9072         pub result_ok: bool,
9073 }
9074 #[no_mangle]
9075 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
9076 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
9077         CResult_PaymentSecretNoneZ {
9078                 contents: CResult_PaymentSecretNoneZPtr {
9079                         result: Box::into_raw(Box::new(o)),
9080                 },
9081                 result_ok: true,
9082         }
9083 }
9084 #[no_mangle]
9085 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
9086 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
9087         CResult_PaymentSecretNoneZ {
9088                 contents: CResult_PaymentSecretNoneZPtr {
9089                         err: core::ptr::null_mut(),
9090                 },
9091                 result_ok: false,
9092         }
9093 }
9094 /// Checks if the given object is currently in the success state
9095 #[no_mangle]
9096 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
9097         o.result_ok
9098 }
9099 #[no_mangle]
9100 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
9101 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
9102 impl Drop for CResult_PaymentSecretNoneZ {
9103         fn drop(&mut self) {
9104                 if self.result_ok {
9105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9107                         }
9108                 } else {
9109                 }
9110         }
9111 }
9112 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
9113         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
9114                 let contents = if o.result_ok {
9115                         let result = unsafe { o.contents.result };
9116                         unsafe { o.contents.result = core::ptr::null_mut() };
9117                         CResult_PaymentSecretNoneZPtr { result }
9118                 } else {
9119                         let _ = unsafe { Box::from_raw(o.contents.err) };
9120                         o.contents.err = core::ptr::null_mut();
9121                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
9122                 };
9123                 Self {
9124                         contents,
9125                         result_ok: o.result_ok,
9126                 }
9127         }
9128 }
9129 impl Clone for CResult_PaymentSecretNoneZ {
9130         fn clone(&self) -> Self {
9131                 if self.result_ok {
9132                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
9133                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9134                         } }
9135                 } else {
9136                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
9137                                 err: core::ptr::null_mut()
9138                         } }
9139                 }
9140         }
9141 }
9142 #[no_mangle]
9143 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
9144 /// but with all dynamically-allocated buffers duplicated in new buffers.
9145 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
9146 #[repr(C)]
9147 /// The contents of CResult_PaymentSecretAPIErrorZ
9148 pub union CResult_PaymentSecretAPIErrorZPtr {
9149         /// A pointer to the contents in the success state.
9150         /// Reading from this pointer when `result_ok` is not set is undefined.
9151         pub result: *mut crate::c_types::ThirtyTwoBytes,
9152         /// A pointer to the contents in the error state.
9153         /// Reading from this pointer when `result_ok` is set is undefined.
9154         pub err: *mut crate::lightning::util::errors::APIError,
9155 }
9156 #[repr(C)]
9157 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
9158 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9160 pub struct CResult_PaymentSecretAPIErrorZ {
9161         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
9162         /// `err` or `result` depending on the state of `result_ok`.
9163         pub contents: CResult_PaymentSecretAPIErrorZPtr,
9164         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
9165         pub result_ok: bool,
9166 }
9167 #[no_mangle]
9168 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9169 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
9170         CResult_PaymentSecretAPIErrorZ {
9171                 contents: CResult_PaymentSecretAPIErrorZPtr {
9172                         result: Box::into_raw(Box::new(o)),
9173                 },
9174                 result_ok: true,
9175         }
9176 }
9177 #[no_mangle]
9178 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9179 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
9180         CResult_PaymentSecretAPIErrorZ {
9181                 contents: CResult_PaymentSecretAPIErrorZPtr {
9182                         err: Box::into_raw(Box::new(e)),
9183                 },
9184                 result_ok: false,
9185         }
9186 }
9187 /// Checks if the given object is currently in the success state
9188 #[no_mangle]
9189 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
9190         o.result_ok
9191 }
9192 #[no_mangle]
9193 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9194 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
9195 impl Drop for CResult_PaymentSecretAPIErrorZ {
9196         fn drop(&mut self) {
9197                 if self.result_ok {
9198                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9199                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9200                         }
9201                 } else {
9202                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9203                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9204                         }
9205                 }
9206         }
9207 }
9208 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
9209         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9210                 let contents = if o.result_ok {
9211                         let result = unsafe { o.contents.result };
9212                         unsafe { o.contents.result = core::ptr::null_mut() };
9213                         CResult_PaymentSecretAPIErrorZPtr { result }
9214                 } else {
9215                         let err = unsafe { o.contents.err };
9216                         unsafe { o.contents.err = core::ptr::null_mut(); }
9217                         CResult_PaymentSecretAPIErrorZPtr { err }
9218                 };
9219                 Self {
9220                         contents,
9221                         result_ok: o.result_ok,
9222                 }
9223         }
9224 }
9225 impl Clone for CResult_PaymentSecretAPIErrorZ {
9226         fn clone(&self) -> Self {
9227                 if self.result_ok {
9228                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
9229                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9230                         } }
9231                 } else {
9232                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
9233                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9234                         } }
9235                 }
9236         }
9237 }
9238 #[no_mangle]
9239 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9240 /// but with all dynamically-allocated buffers duplicated in new buffers.
9241 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
9242 #[repr(C)]
9243 /// The contents of CResult_PaymentPreimageAPIErrorZ
9244 pub union CResult_PaymentPreimageAPIErrorZPtr {
9245         /// A pointer to the contents in the success state.
9246         /// Reading from this pointer when `result_ok` is not set is undefined.
9247         pub result: *mut crate::c_types::ThirtyTwoBytes,
9248         /// A pointer to the contents in the error state.
9249         /// Reading from this pointer when `result_ok` is set is undefined.
9250         pub err: *mut crate::lightning::util::errors::APIError,
9251 }
9252 #[repr(C)]
9253 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
9254 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
9255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9256 pub struct CResult_PaymentPreimageAPIErrorZ {
9257         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
9258         /// `err` or `result` depending on the state of `result_ok`.
9259         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
9260         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
9261         pub result_ok: bool,
9262 }
9263 #[no_mangle]
9264 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
9265 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
9266         CResult_PaymentPreimageAPIErrorZ {
9267                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9268                         result: Box::into_raw(Box::new(o)),
9269                 },
9270                 result_ok: true,
9271         }
9272 }
9273 #[no_mangle]
9274 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
9275 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
9276         CResult_PaymentPreimageAPIErrorZ {
9277                 contents: CResult_PaymentPreimageAPIErrorZPtr {
9278                         err: Box::into_raw(Box::new(e)),
9279                 },
9280                 result_ok: false,
9281         }
9282 }
9283 /// Checks if the given object is currently in the success state
9284 #[no_mangle]
9285 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
9286         o.result_ok
9287 }
9288 #[no_mangle]
9289 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
9290 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
9291 impl Drop for CResult_PaymentPreimageAPIErrorZ {
9292         fn drop(&mut self) {
9293                 if self.result_ok {
9294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9296                         }
9297                 } else {
9298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9300                         }
9301                 }
9302         }
9303 }
9304 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
9305         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
9306                 let contents = if o.result_ok {
9307                         let result = unsafe { o.contents.result };
9308                         unsafe { o.contents.result = core::ptr::null_mut() };
9309                         CResult_PaymentPreimageAPIErrorZPtr { result }
9310                 } else {
9311                         let err = unsafe { o.contents.err };
9312                         unsafe { o.contents.err = core::ptr::null_mut(); }
9313                         CResult_PaymentPreimageAPIErrorZPtr { err }
9314                 };
9315                 Self {
9316                         contents,
9317                         result_ok: o.result_ok,
9318                 }
9319         }
9320 }
9321 impl Clone for CResult_PaymentPreimageAPIErrorZ {
9322         fn clone(&self) -> Self {
9323                 if self.result_ok {
9324                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
9325                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9326                         } }
9327                 } else {
9328                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
9329                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
9330                         } }
9331                 }
9332         }
9333 }
9334 #[no_mangle]
9335 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
9336 /// but with all dynamically-allocated buffers duplicated in new buffers.
9337 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
9338 #[repr(C)]
9339 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
9340 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9341         /// A pointer to the contents in the success state.
9342         /// Reading from this pointer when `result_ok` is not set is undefined.
9343         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
9344         /// A pointer to the contents in the error state.
9345         /// Reading from this pointer when `result_ok` is set is undefined.
9346         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9347 }
9348 #[repr(C)]
9349 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
9350 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
9351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9352 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
9353         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
9354         /// `err` or `result` depending on the state of `result_ok`.
9355         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
9356         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
9357         pub result_ok: bool,
9358 }
9359 #[no_mangle]
9360 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
9361 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9362         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9363                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9364                         result: Box::into_raw(Box::new(o)),
9365                 },
9366                 result_ok: true,
9367         }
9368 }
9369 #[no_mangle]
9370 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
9371 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
9372         CResult_CounterpartyForwardingInfoDecodeErrorZ {
9373                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9374                         err: Box::into_raw(Box::new(e)),
9375                 },
9376                 result_ok: false,
9377         }
9378 }
9379 /// Checks if the given object is currently in the success state
9380 #[no_mangle]
9381 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
9382         o.result_ok
9383 }
9384 #[no_mangle]
9385 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
9386 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
9387 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9388         fn drop(&mut self) {
9389                 if self.result_ok {
9390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9392                         }
9393                 } else {
9394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9396                         }
9397                 }
9398         }
9399 }
9400 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9401         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
9402                 let contents = if o.result_ok {
9403                         let result = unsafe { o.contents.result };
9404                         unsafe { o.contents.result = core::ptr::null_mut() };
9405                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
9406                 } else {
9407                         let err = unsafe { o.contents.err };
9408                         unsafe { o.contents.err = core::ptr::null_mut(); }
9409                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
9410                 };
9411                 Self {
9412                         contents,
9413                         result_ok: o.result_ok,
9414                 }
9415         }
9416 }
9417 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
9418         fn clone(&self) -> Self {
9419                 if self.result_ok {
9420                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9421                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
9422                         } }
9423                 } else {
9424                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
9425                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9426                         } }
9427                 }
9428         }
9429 }
9430 #[no_mangle]
9431 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
9432 /// but with all dynamically-allocated buffers duplicated in new buffers.
9433 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
9434 #[repr(C)]
9435 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
9436 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
9437         /// A pointer to the contents in the success state.
9438         /// Reading from this pointer when `result_ok` is not set is undefined.
9439         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
9440         /// A pointer to the contents in the error state.
9441         /// Reading from this pointer when `result_ok` is set is undefined.
9442         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9443 }
9444 #[repr(C)]
9445 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9446 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9448 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9449         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9450         /// `err` or `result` depending on the state of `result_ok`.
9451         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9452         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9453         pub result_ok: bool,
9454 }
9455 #[no_mangle]
9456 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9457 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9458         CResult_ChannelCounterpartyDecodeErrorZ {
9459                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9460                         result: Box::into_raw(Box::new(o)),
9461                 },
9462                 result_ok: true,
9463         }
9464 }
9465 #[no_mangle]
9466 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9467 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9468         CResult_ChannelCounterpartyDecodeErrorZ {
9469                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9470                         err: Box::into_raw(Box::new(e)),
9471                 },
9472                 result_ok: false,
9473         }
9474 }
9475 /// Checks if the given object is currently in the success state
9476 #[no_mangle]
9477 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9478         o.result_ok
9479 }
9480 #[no_mangle]
9481 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9482 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9483 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9484         fn drop(&mut self) {
9485                 if self.result_ok {
9486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9488                         }
9489                 } else {
9490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9492                         }
9493                 }
9494         }
9495 }
9496 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9497         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9498                 let contents = if o.result_ok {
9499                         let result = unsafe { o.contents.result };
9500                         unsafe { o.contents.result = core::ptr::null_mut() };
9501                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9502                 } else {
9503                         let err = unsafe { o.contents.err };
9504                         unsafe { o.contents.err = core::ptr::null_mut(); }
9505                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9506                 };
9507                 Self {
9508                         contents,
9509                         result_ok: o.result_ok,
9510                 }
9511         }
9512 }
9513 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9514         fn clone(&self) -> Self {
9515                 if self.result_ok {
9516                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9517                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9518                         } }
9519                 } else {
9520                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9521                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9522                         } }
9523                 }
9524         }
9525 }
9526 #[no_mangle]
9527 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9528 /// but with all dynamically-allocated buffers duplicated in new buffers.
9529 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9530 #[repr(C)]
9531 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9532 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9533         /// A pointer to the contents in the success state.
9534         /// Reading from this pointer when `result_ok` is not set is undefined.
9535         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9536         /// A pointer to the contents in the error state.
9537         /// Reading from this pointer when `result_ok` is set is undefined.
9538         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9539 }
9540 #[repr(C)]
9541 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9542 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9544 pub struct CResult_ChannelDetailsDecodeErrorZ {
9545         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9546         /// `err` or `result` depending on the state of `result_ok`.
9547         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9548         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9549         pub result_ok: bool,
9550 }
9551 #[no_mangle]
9552 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9553 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9554         CResult_ChannelDetailsDecodeErrorZ {
9555                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9556                         result: Box::into_raw(Box::new(o)),
9557                 },
9558                 result_ok: true,
9559         }
9560 }
9561 #[no_mangle]
9562 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9563 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9564         CResult_ChannelDetailsDecodeErrorZ {
9565                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9566                         err: Box::into_raw(Box::new(e)),
9567                 },
9568                 result_ok: false,
9569         }
9570 }
9571 /// Checks if the given object is currently in the success state
9572 #[no_mangle]
9573 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9574         o.result_ok
9575 }
9576 #[no_mangle]
9577 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9578 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9579 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9580         fn drop(&mut self) {
9581                 if self.result_ok {
9582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9584                         }
9585                 } else {
9586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9588                         }
9589                 }
9590         }
9591 }
9592 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9594                 let contents = if o.result_ok {
9595                         let result = unsafe { o.contents.result };
9596                         unsafe { o.contents.result = core::ptr::null_mut() };
9597                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9598                 } else {
9599                         let err = unsafe { o.contents.err };
9600                         unsafe { o.contents.err = core::ptr::null_mut(); }
9601                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9602                 };
9603                 Self {
9604                         contents,
9605                         result_ok: o.result_ok,
9606                 }
9607         }
9608 }
9609 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9610         fn clone(&self) -> Self {
9611                 if self.result_ok {
9612                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9613                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9614                         } }
9615                 } else {
9616                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9618                         } }
9619                 }
9620         }
9621 }
9622 #[no_mangle]
9623 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9624 /// but with all dynamically-allocated buffers duplicated in new buffers.
9625 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9626 #[repr(C)]
9627 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9628 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9629         /// A pointer to the contents in the success state.
9630         /// Reading from this pointer when `result_ok` is not set is undefined.
9631         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9632         /// A pointer to the contents in the error state.
9633         /// Reading from this pointer when `result_ok` is set is undefined.
9634         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9635 }
9636 #[repr(C)]
9637 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9638 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9640 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9641         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9642         /// `err` or `result` depending on the state of `result_ok`.
9643         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9644         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9645         pub result_ok: bool,
9646 }
9647 #[no_mangle]
9648 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9649 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9650         CResult_PhantomRouteHintsDecodeErrorZ {
9651                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9652                         result: Box::into_raw(Box::new(o)),
9653                 },
9654                 result_ok: true,
9655         }
9656 }
9657 #[no_mangle]
9658 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9659 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9660         CResult_PhantomRouteHintsDecodeErrorZ {
9661                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9662                         err: Box::into_raw(Box::new(e)),
9663                 },
9664                 result_ok: false,
9665         }
9666 }
9667 /// Checks if the given object is currently in the success state
9668 #[no_mangle]
9669 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9670         o.result_ok
9671 }
9672 #[no_mangle]
9673 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9674 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9675 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9676         fn drop(&mut self) {
9677                 if self.result_ok {
9678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9680                         }
9681                 } else {
9682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9684                         }
9685                 }
9686         }
9687 }
9688 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9689         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9690                 let contents = if o.result_ok {
9691                         let result = unsafe { o.contents.result };
9692                         unsafe { o.contents.result = core::ptr::null_mut() };
9693                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9694                 } else {
9695                         let err = unsafe { o.contents.err };
9696                         unsafe { o.contents.err = core::ptr::null_mut(); }
9697                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9698                 };
9699                 Self {
9700                         contents,
9701                         result_ok: o.result_ok,
9702                 }
9703         }
9704 }
9705 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9706         fn clone(&self) -> Self {
9707                 if self.result_ok {
9708                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9709                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9710                         } }
9711                 } else {
9712                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9714                         } }
9715                 }
9716         }
9717 }
9718 #[no_mangle]
9719 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9720 /// but with all dynamically-allocated buffers duplicated in new buffers.
9721 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9722 #[repr(C)]
9723 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9724 /// This corresponds to std::vector in C++
9725 pub struct CVec_ChannelMonitorZ {
9726         /// The elements in the array.
9727         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9728         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9729         /// The number of elements pointed to by `data`.
9730         pub datalen: usize
9731 }
9732 impl CVec_ChannelMonitorZ {
9733         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9734                 if self.datalen == 0 { return Vec::new(); }
9735                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9736                 self.data = core::ptr::null_mut();
9737                 self.datalen = 0;
9738                 ret
9739         }
9740         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9741                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9742         }
9743 }
9744 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9745         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9746                 let datalen = v.len();
9747                 let data = Box::into_raw(v.into_boxed_slice());
9748                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9749         }
9750 }
9751 #[no_mangle]
9752 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9753 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9754 impl Drop for CVec_ChannelMonitorZ {
9755         fn drop(&mut self) {
9756                 if self.datalen == 0 { return; }
9757                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9758         }
9759 }
9760 #[repr(C)]
9761 /// A tuple of 2 elements. See the individual fields for the types contained.
9762 pub struct C2Tuple_BlockHashChannelManagerZ {
9763         /// The element at position 0
9764         pub a: crate::c_types::ThirtyTwoBytes,
9765         /// The element at position 1
9766         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9767 }
9768 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9769         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9770                 Self {
9771                         a: tup.0,
9772                         b: tup.1,
9773                 }
9774         }
9775 }
9776 impl C2Tuple_BlockHashChannelManagerZ {
9777         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9778                 (self.a, self.b)
9779         }
9780 }
9781 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9782 #[no_mangle]
9783 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9784         C2Tuple_BlockHashChannelManagerZ { a, b, }
9785 }
9786
9787 #[no_mangle]
9788 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9789 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9790 #[repr(C)]
9791 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9792 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9793         /// A pointer to the contents in the success state.
9794         /// Reading from this pointer when `result_ok` is not set is undefined.
9795         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9796         /// A pointer to the contents in the error state.
9797         /// Reading from this pointer when `result_ok` is set is undefined.
9798         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9799 }
9800 #[repr(C)]
9801 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9802 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9804 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9805         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9806         /// `err` or `result` depending on the state of `result_ok`.
9807         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9808         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9809         pub result_ok: bool,
9810 }
9811 #[no_mangle]
9812 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9813 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9814         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9815                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9816                         result: Box::into_raw(Box::new(o)),
9817                 },
9818                 result_ok: true,
9819         }
9820 }
9821 #[no_mangle]
9822 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9823 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9824         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9825                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9826                         err: Box::into_raw(Box::new(e)),
9827                 },
9828                 result_ok: false,
9829         }
9830 }
9831 /// Checks if the given object is currently in the success state
9832 #[no_mangle]
9833 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9834         o.result_ok
9835 }
9836 #[no_mangle]
9837 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9838 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9839 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9840         fn drop(&mut self) {
9841                 if self.result_ok {
9842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9844                         }
9845                 } else {
9846                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9847                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9848                         }
9849                 }
9850         }
9851 }
9852 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9853         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9854                 let contents = if o.result_ok {
9855                         let result = unsafe { o.contents.result };
9856                         unsafe { o.contents.result = core::ptr::null_mut() };
9857                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9858                 } else {
9859                         let err = unsafe { o.contents.err };
9860                         unsafe { o.contents.err = core::ptr::null_mut(); }
9861                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9862                 };
9863                 Self {
9864                         contents,
9865                         result_ok: o.result_ok,
9866                 }
9867         }
9868 }
9869 #[repr(C)]
9870 /// The contents of CResult_ChannelConfigDecodeErrorZ
9871 pub union CResult_ChannelConfigDecodeErrorZPtr {
9872         /// A pointer to the contents in the success state.
9873         /// Reading from this pointer when `result_ok` is not set is undefined.
9874         pub result: *mut crate::lightning::util::config::ChannelConfig,
9875         /// A pointer to the contents in the error state.
9876         /// Reading from this pointer when `result_ok` is set is undefined.
9877         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9878 }
9879 #[repr(C)]
9880 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9881 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9882 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9883 pub struct CResult_ChannelConfigDecodeErrorZ {
9884         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9885         /// `err` or `result` depending on the state of `result_ok`.
9886         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9887         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9888         pub result_ok: bool,
9889 }
9890 #[no_mangle]
9891 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9892 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9893         CResult_ChannelConfigDecodeErrorZ {
9894                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9895                         result: Box::into_raw(Box::new(o)),
9896                 },
9897                 result_ok: true,
9898         }
9899 }
9900 #[no_mangle]
9901 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9902 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9903         CResult_ChannelConfigDecodeErrorZ {
9904                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9905                         err: Box::into_raw(Box::new(e)),
9906                 },
9907                 result_ok: false,
9908         }
9909 }
9910 /// Checks if the given object is currently in the success state
9911 #[no_mangle]
9912 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9913         o.result_ok
9914 }
9915 #[no_mangle]
9916 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9917 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9918 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9919         fn drop(&mut self) {
9920                 if self.result_ok {
9921                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9922                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9923                         }
9924                 } else {
9925                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9926                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9927                         }
9928                 }
9929         }
9930 }
9931 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9932         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9933                 let contents = if o.result_ok {
9934                         let result = unsafe { o.contents.result };
9935                         unsafe { o.contents.result = core::ptr::null_mut() };
9936                         CResult_ChannelConfigDecodeErrorZPtr { result }
9937                 } else {
9938                         let err = unsafe { o.contents.err };
9939                         unsafe { o.contents.err = core::ptr::null_mut(); }
9940                         CResult_ChannelConfigDecodeErrorZPtr { err }
9941                 };
9942                 Self {
9943                         contents,
9944                         result_ok: o.result_ok,
9945                 }
9946         }
9947 }
9948 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9949         fn clone(&self) -> Self {
9950                 if self.result_ok {
9951                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9952                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9953                         } }
9954                 } else {
9955                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9956                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9957                         } }
9958                 }
9959         }
9960 }
9961 #[no_mangle]
9962 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9963 /// but with all dynamically-allocated buffers duplicated in new buffers.
9964 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9965 #[repr(C)]
9966 /// The contents of CResult_OutPointDecodeErrorZ
9967 pub union CResult_OutPointDecodeErrorZPtr {
9968         /// A pointer to the contents in the success state.
9969         /// Reading from this pointer when `result_ok` is not set is undefined.
9970         pub result: *mut crate::lightning::chain::transaction::OutPoint,
9971         /// A pointer to the contents in the error state.
9972         /// Reading from this pointer when `result_ok` is set is undefined.
9973         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9974 }
9975 #[repr(C)]
9976 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9977 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9978 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9979 pub struct CResult_OutPointDecodeErrorZ {
9980         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9981         /// `err` or `result` depending on the state of `result_ok`.
9982         pub contents: CResult_OutPointDecodeErrorZPtr,
9983         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9984         pub result_ok: bool,
9985 }
9986 #[no_mangle]
9987 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9988 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9989         CResult_OutPointDecodeErrorZ {
9990                 contents: CResult_OutPointDecodeErrorZPtr {
9991                         result: Box::into_raw(Box::new(o)),
9992                 },
9993                 result_ok: true,
9994         }
9995 }
9996 #[no_mangle]
9997 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9998 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9999         CResult_OutPointDecodeErrorZ {
10000                 contents: CResult_OutPointDecodeErrorZPtr {
10001                         err: Box::into_raw(Box::new(e)),
10002                 },
10003                 result_ok: false,
10004         }
10005 }
10006 /// Checks if the given object is currently in the success state
10007 #[no_mangle]
10008 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
10009         o.result_ok
10010 }
10011 #[no_mangle]
10012 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
10013 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
10014 impl Drop for CResult_OutPointDecodeErrorZ {
10015         fn drop(&mut self) {
10016                 if self.result_ok {
10017                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10018                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10019                         }
10020                 } else {
10021                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10022                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10023                         }
10024                 }
10025         }
10026 }
10027 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
10028         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
10029                 let contents = if o.result_ok {
10030                         let result = unsafe { o.contents.result };
10031                         unsafe { o.contents.result = core::ptr::null_mut() };
10032                         CResult_OutPointDecodeErrorZPtr { result }
10033                 } else {
10034                         let err = unsafe { o.contents.err };
10035                         unsafe { o.contents.err = core::ptr::null_mut(); }
10036                         CResult_OutPointDecodeErrorZPtr { err }
10037                 };
10038                 Self {
10039                         contents,
10040                         result_ok: o.result_ok,
10041                 }
10042         }
10043 }
10044 impl Clone for CResult_OutPointDecodeErrorZ {
10045         fn clone(&self) -> Self {
10046                 if self.result_ok {
10047                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
10048                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
10049                         } }
10050                 } else {
10051                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
10052                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10053                         } }
10054                 }
10055         }
10056 }
10057 #[no_mangle]
10058 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10059 /// but with all dynamically-allocated buffers duplicated in new buffers.
10060 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
10061 #[repr(C)]
10062 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
10063 pub enum COption_TypeZ {
10064         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
10065         Some(crate::lightning::ln::wire::Type),
10066         /// When we're in this state, this COption_TypeZ contains nothing
10067         None
10068 }
10069 impl COption_TypeZ {
10070         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10071                 if let Self::None = self { false } else { true }
10072         }
10073         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10074                 !self.is_some()
10075         }
10076         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
10077                 if let Self::Some(v) = self { v } else { unreachable!() }
10078         }
10079 }
10080 #[no_mangle]
10081 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
10082 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
10083         COption_TypeZ::Some(o)
10084 }
10085 #[no_mangle]
10086 /// Constructs a new COption_TypeZ containing nothing
10087 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
10088         COption_TypeZ::None
10089 }
10090 #[no_mangle]
10091 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
10092 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
10093 #[repr(C)]
10094 /// The contents of CResult_COption_TypeZDecodeErrorZ
10095 pub union CResult_COption_TypeZDecodeErrorZPtr {
10096         /// A pointer to the contents in the success state.
10097         /// Reading from this pointer when `result_ok` is not set is undefined.
10098         pub result: *mut crate::c_types::derived::COption_TypeZ,
10099         /// A pointer to the contents in the error state.
10100         /// Reading from this pointer when `result_ok` is set is undefined.
10101         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10102 }
10103 #[repr(C)]
10104 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
10105 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10107 pub struct CResult_COption_TypeZDecodeErrorZ {
10108         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
10109         /// `err` or `result` depending on the state of `result_ok`.
10110         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
10111         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
10112         pub result_ok: bool,
10113 }
10114 #[no_mangle]
10115 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
10116 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
10117         CResult_COption_TypeZDecodeErrorZ {
10118                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10119                         result: Box::into_raw(Box::new(o)),
10120                 },
10121                 result_ok: true,
10122         }
10123 }
10124 #[no_mangle]
10125 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
10126 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
10127         CResult_COption_TypeZDecodeErrorZ {
10128                 contents: CResult_COption_TypeZDecodeErrorZPtr {
10129                         err: Box::into_raw(Box::new(e)),
10130                 },
10131                 result_ok: false,
10132         }
10133 }
10134 /// Checks if the given object is currently in the success state
10135 #[no_mangle]
10136 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
10137         o.result_ok
10138 }
10139 #[no_mangle]
10140 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
10141 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
10142 impl Drop for CResult_COption_TypeZDecodeErrorZ {
10143         fn drop(&mut self) {
10144                 if self.result_ok {
10145                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10146                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10147                         }
10148                 } else {
10149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10151                         }
10152                 }
10153         }
10154 }
10155 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
10156         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10157                 let contents = if o.result_ok {
10158                         let result = unsafe { o.contents.result };
10159                         unsafe { o.contents.result = core::ptr::null_mut() };
10160                         CResult_COption_TypeZDecodeErrorZPtr { result }
10161                 } else {
10162                         let err = unsafe { o.contents.err };
10163                         unsafe { o.contents.err = core::ptr::null_mut(); }
10164                         CResult_COption_TypeZDecodeErrorZPtr { err }
10165                 };
10166                 Self {
10167                         contents,
10168                         result_ok: o.result_ok,
10169                 }
10170         }
10171 }
10172 #[repr(C)]
10173 /// The contents of CResult_PaymentIdPaymentErrorZ
10174 pub union CResult_PaymentIdPaymentErrorZPtr {
10175         /// A pointer to the contents in the success state.
10176         /// Reading from this pointer when `result_ok` is not set is undefined.
10177         pub result: *mut crate::c_types::ThirtyTwoBytes,
10178         /// A pointer to the contents in the error state.
10179         /// Reading from this pointer when `result_ok` is set is undefined.
10180         pub err: *mut crate::lightning_invoice::payment::PaymentError,
10181 }
10182 #[repr(C)]
10183 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
10184 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
10185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10186 pub struct CResult_PaymentIdPaymentErrorZ {
10187         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
10188         /// `err` or `result` depending on the state of `result_ok`.
10189         pub contents: CResult_PaymentIdPaymentErrorZPtr,
10190         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
10191         pub result_ok: bool,
10192 }
10193 #[no_mangle]
10194 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
10195 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
10196         CResult_PaymentIdPaymentErrorZ {
10197                 contents: CResult_PaymentIdPaymentErrorZPtr {
10198                         result: Box::into_raw(Box::new(o)),
10199                 },
10200                 result_ok: true,
10201         }
10202 }
10203 #[no_mangle]
10204 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
10205 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
10206         CResult_PaymentIdPaymentErrorZ {
10207                 contents: CResult_PaymentIdPaymentErrorZPtr {
10208                         err: Box::into_raw(Box::new(e)),
10209                 },
10210                 result_ok: false,
10211         }
10212 }
10213 /// Checks if the given object is currently in the success state
10214 #[no_mangle]
10215 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
10216         o.result_ok
10217 }
10218 #[no_mangle]
10219 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
10220 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
10221 impl Drop for CResult_PaymentIdPaymentErrorZ {
10222         fn drop(&mut self) {
10223                 if self.result_ok {
10224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10226                         }
10227                 } else {
10228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10230                         }
10231                 }
10232         }
10233 }
10234 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
10235         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
10236                 let contents = if o.result_ok {
10237                         let result = unsafe { o.contents.result };
10238                         unsafe { o.contents.result = core::ptr::null_mut() };
10239                         CResult_PaymentIdPaymentErrorZPtr { result }
10240                 } else {
10241                         let err = unsafe { o.contents.err };
10242                         unsafe { o.contents.err = core::ptr::null_mut(); }
10243                         CResult_PaymentIdPaymentErrorZPtr { err }
10244                 };
10245                 Self {
10246                         contents,
10247                         result_ok: o.result_ok,
10248                 }
10249         }
10250 }
10251 impl Clone for CResult_PaymentIdPaymentErrorZ {
10252         fn clone(&self) -> Self {
10253                 if self.result_ok {
10254                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
10255                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
10256                         } }
10257                 } else {
10258                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
10259                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10260                         } }
10261                 }
10262         }
10263 }
10264 #[no_mangle]
10265 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
10266 /// but with all dynamically-allocated buffers duplicated in new buffers.
10267 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
10268 #[repr(C)]
10269 /// The contents of CResult_NonePaymentErrorZ
10270 pub union CResult_NonePaymentErrorZPtr {
10271         /// Note that this value is always NULL, as there are no contents in the OK variant
10272         pub result: *mut core::ffi::c_void,
10273         /// A pointer to the contents in the error state.
10274         /// Reading from this pointer when `result_ok` is set is undefined.
10275         pub err: *mut crate::lightning_invoice::payment::PaymentError,
10276 }
10277 #[repr(C)]
10278 /// A CResult_NonePaymentErrorZ represents the result of a fallible operation,
10279 /// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure.
10280 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10281 pub struct CResult_NonePaymentErrorZ {
10282         /// The contents of this CResult_NonePaymentErrorZ, accessible via either
10283         /// `err` or `result` depending on the state of `result_ok`.
10284         pub contents: CResult_NonePaymentErrorZPtr,
10285         /// Whether this CResult_NonePaymentErrorZ represents a success state.
10286         pub result_ok: bool,
10287 }
10288 #[no_mangle]
10289 /// Creates a new CResult_NonePaymentErrorZ in the success state.
10290 pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ {
10291         CResult_NonePaymentErrorZ {
10292                 contents: CResult_NonePaymentErrorZPtr {
10293                         result: core::ptr::null_mut(),
10294                 },
10295                 result_ok: true,
10296         }
10297 }
10298 #[no_mangle]
10299 /// Creates a new CResult_NonePaymentErrorZ in the error state.
10300 pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ {
10301         CResult_NonePaymentErrorZ {
10302                 contents: CResult_NonePaymentErrorZPtr {
10303                         err: Box::into_raw(Box::new(e)),
10304                 },
10305                 result_ok: false,
10306         }
10307 }
10308 /// Checks if the given object is currently in the success state
10309 #[no_mangle]
10310 pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool {
10311         o.result_ok
10312 }
10313 #[no_mangle]
10314 /// Frees any resources used by the CResult_NonePaymentErrorZ.
10315 pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { }
10316 impl Drop for CResult_NonePaymentErrorZ {
10317         fn drop(&mut self) {
10318                 if self.result_ok {
10319                 } else {
10320                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10321                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10322                         }
10323                 }
10324         }
10325 }
10326 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>> for CResult_NonePaymentErrorZ {
10327         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self {
10328                 let contents = if o.result_ok {
10329                         let _ = unsafe { Box::from_raw(o.contents.result) };
10330                         o.contents.result = core::ptr::null_mut();
10331                         CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() }
10332                 } else {
10333                         let err = unsafe { o.contents.err };
10334                         unsafe { o.contents.err = core::ptr::null_mut(); }
10335                         CResult_NonePaymentErrorZPtr { err }
10336                 };
10337                 Self {
10338                         contents,
10339                         result_ok: o.result_ok,
10340                 }
10341         }
10342 }
10343 impl Clone for CResult_NonePaymentErrorZ {
10344         fn clone(&self) -> Self {
10345                 if self.result_ok {
10346                         Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr {
10347                                 result: core::ptr::null_mut()
10348                         } }
10349                 } else {
10350                         Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr {
10351                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
10352                         } }
10353                 }
10354         }
10355 }
10356 #[no_mangle]
10357 /// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig`
10358 /// but with all dynamically-allocated buffers duplicated in new buffers.
10359 pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) }
10360 #[repr(C)]
10361 /// The contents of CResult_StringErrorZ
10362 pub union CResult_StringErrorZPtr {
10363         /// A pointer to the contents in the success state.
10364         /// Reading from this pointer when `result_ok` is not set is undefined.
10365         pub result: *mut crate::c_types::Str,
10366         /// A pointer to the contents in the error state.
10367         /// Reading from this pointer when `result_ok` is set is undefined.
10368         pub err: *mut crate::c_types::Secp256k1Error,
10369 }
10370 #[repr(C)]
10371 /// A CResult_StringErrorZ represents the result of a fallible operation,
10372 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10374 pub struct CResult_StringErrorZ {
10375         /// The contents of this CResult_StringErrorZ, accessible via either
10376         /// `err` or `result` depending on the state of `result_ok`.
10377         pub contents: CResult_StringErrorZPtr,
10378         /// Whether this CResult_StringErrorZ represents a success state.
10379         pub result_ok: bool,
10380 }
10381 #[no_mangle]
10382 /// Creates a new CResult_StringErrorZ in the success state.
10383 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10384         CResult_StringErrorZ {
10385                 contents: CResult_StringErrorZPtr {
10386                         result: Box::into_raw(Box::new(o)),
10387                 },
10388                 result_ok: true,
10389         }
10390 }
10391 #[no_mangle]
10392 /// Creates a new CResult_StringErrorZ in the error state.
10393 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10394         CResult_StringErrorZ {
10395                 contents: CResult_StringErrorZPtr {
10396                         err: Box::into_raw(Box::new(e)),
10397                 },
10398                 result_ok: false,
10399         }
10400 }
10401 /// Checks if the given object is currently in the success state
10402 #[no_mangle]
10403 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10404         o.result_ok
10405 }
10406 #[no_mangle]
10407 /// Frees any resources used by the CResult_StringErrorZ.
10408 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10409 impl Drop for CResult_StringErrorZ {
10410         fn drop(&mut self) {
10411                 if self.result_ok {
10412                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10413                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10414                         }
10415                 } else {
10416                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10417                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10418                         }
10419                 }
10420         }
10421 }
10422 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10423         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10424                 let contents = if o.result_ok {
10425                         let result = unsafe { o.contents.result };
10426                         unsafe { o.contents.result = core::ptr::null_mut() };
10427                         CResult_StringErrorZPtr { result }
10428                 } else {
10429                         let err = unsafe { o.contents.err };
10430                         unsafe { o.contents.err = core::ptr::null_mut(); }
10431                         CResult_StringErrorZPtr { err }
10432                 };
10433                 Self {
10434                         contents,
10435                         result_ok: o.result_ok,
10436                 }
10437         }
10438 }
10439 impl Clone for CResult_StringErrorZ {
10440         fn clone(&self) -> Self {
10441                 if self.result_ok {
10442                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
10443                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10444                         } }
10445                 } else {
10446                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
10447                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10448                         } }
10449                 }
10450         }
10451 }
10452 #[no_mangle]
10453 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10454 /// but with all dynamically-allocated buffers duplicated in new buffers.
10455 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10456 #[repr(C)]
10457 /// The contents of CResult_PublicKeyErrorZ
10458 pub union CResult_PublicKeyErrorZPtr {
10459         /// A pointer to the contents in the success state.
10460         /// Reading from this pointer when `result_ok` is not set is undefined.
10461         pub result: *mut crate::c_types::PublicKey,
10462         /// A pointer to the contents in the error state.
10463         /// Reading from this pointer when `result_ok` is set is undefined.
10464         pub err: *mut crate::c_types::Secp256k1Error,
10465 }
10466 #[repr(C)]
10467 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
10468 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
10469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10470 pub struct CResult_PublicKeyErrorZ {
10471         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
10472         /// `err` or `result` depending on the state of `result_ok`.
10473         pub contents: CResult_PublicKeyErrorZPtr,
10474         /// Whether this CResult_PublicKeyErrorZ represents a success state.
10475         pub result_ok: bool,
10476 }
10477 #[no_mangle]
10478 /// Creates a new CResult_PublicKeyErrorZ in the success state.
10479 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
10480         CResult_PublicKeyErrorZ {
10481                 contents: CResult_PublicKeyErrorZPtr {
10482                         result: Box::into_raw(Box::new(o)),
10483                 },
10484                 result_ok: true,
10485         }
10486 }
10487 #[no_mangle]
10488 /// Creates a new CResult_PublicKeyErrorZ in the error state.
10489 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
10490         CResult_PublicKeyErrorZ {
10491                 contents: CResult_PublicKeyErrorZPtr {
10492                         err: Box::into_raw(Box::new(e)),
10493                 },
10494                 result_ok: false,
10495         }
10496 }
10497 /// Checks if the given object is currently in the success state
10498 #[no_mangle]
10499 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
10500         o.result_ok
10501 }
10502 #[no_mangle]
10503 /// Frees any resources used by the CResult_PublicKeyErrorZ.
10504 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
10505 impl Drop for CResult_PublicKeyErrorZ {
10506         fn drop(&mut self) {
10507                 if self.result_ok {
10508                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10509                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10510                         }
10511                 } else {
10512                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10513                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10514                         }
10515                 }
10516         }
10517 }
10518 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
10519         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
10520                 let contents = if o.result_ok {
10521                         let result = unsafe { o.contents.result };
10522                         unsafe { o.contents.result = core::ptr::null_mut() };
10523                         CResult_PublicKeyErrorZPtr { result }
10524                 } else {
10525                         let err = unsafe { o.contents.err };
10526                         unsafe { o.contents.err = core::ptr::null_mut(); }
10527                         CResult_PublicKeyErrorZPtr { err }
10528                 };
10529                 Self {
10530                         contents,
10531                         result_ok: o.result_ok,
10532                 }
10533         }
10534 }
10535 impl Clone for CResult_PublicKeyErrorZ {
10536         fn clone(&self) -> Self {
10537                 if self.result_ok {
10538                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
10539                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
10540                         } }
10541                 } else {
10542                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
10543                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10544                         } }
10545                 }
10546         }
10547 }
10548 #[no_mangle]
10549 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
10550 /// but with all dynamically-allocated buffers duplicated in new buffers.
10551 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
10552 #[repr(C)]
10553 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10554 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10555         /// A pointer to the contents in the success state.
10556         /// Reading from this pointer when `result_ok` is not set is undefined.
10557         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10558         /// A pointer to the contents in the error state.
10559         /// Reading from this pointer when `result_ok` is set is undefined.
10560         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10561 }
10562 #[repr(C)]
10563 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10564 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10566 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10567         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10568         /// `err` or `result` depending on the state of `result_ok`.
10569         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10570         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10571         pub result_ok: bool,
10572 }
10573 #[no_mangle]
10574 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10575 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10576         CResult_ChannelMonitorUpdateDecodeErrorZ {
10577                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10578                         result: Box::into_raw(Box::new(o)),
10579                 },
10580                 result_ok: true,
10581         }
10582 }
10583 #[no_mangle]
10584 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10585 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10586         CResult_ChannelMonitorUpdateDecodeErrorZ {
10587                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10588                         err: Box::into_raw(Box::new(e)),
10589                 },
10590                 result_ok: false,
10591         }
10592 }
10593 /// Checks if the given object is currently in the success state
10594 #[no_mangle]
10595 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10596         o.result_ok
10597 }
10598 #[no_mangle]
10599 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10600 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10601 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10602         fn drop(&mut self) {
10603                 if self.result_ok {
10604                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10605                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10606                         }
10607                 } else {
10608                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10609                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10610                         }
10611                 }
10612         }
10613 }
10614 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10615         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10616                 let contents = if o.result_ok {
10617                         let result = unsafe { o.contents.result };
10618                         unsafe { o.contents.result = core::ptr::null_mut() };
10619                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10620                 } else {
10621                         let err = unsafe { o.contents.err };
10622                         unsafe { o.contents.err = core::ptr::null_mut(); }
10623                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10624                 };
10625                 Self {
10626                         contents,
10627                         result_ok: o.result_ok,
10628                 }
10629         }
10630 }
10631 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10632         fn clone(&self) -> Self {
10633                 if self.result_ok {
10634                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10635                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10636                         } }
10637                 } else {
10638                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10639                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10640                         } }
10641                 }
10642         }
10643 }
10644 #[no_mangle]
10645 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10646 /// but with all dynamically-allocated buffers duplicated in new buffers.
10647 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10648 #[repr(C)]
10649 #[derive(Clone)]
10650 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10651 pub enum COption_MonitorEventZ {
10652         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10653         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10654         /// When we're in this state, this COption_MonitorEventZ contains nothing
10655         None
10656 }
10657 impl COption_MonitorEventZ {
10658         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10659                 if let Self::None = self { false } else { true }
10660         }
10661         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10662                 !self.is_some()
10663         }
10664         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10665                 if let Self::Some(v) = self { v } else { unreachable!() }
10666         }
10667 }
10668 #[no_mangle]
10669 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10670 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10671         COption_MonitorEventZ::Some(o)
10672 }
10673 #[no_mangle]
10674 /// Constructs a new COption_MonitorEventZ containing nothing
10675 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10676         COption_MonitorEventZ::None
10677 }
10678 #[no_mangle]
10679 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10680 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10681 #[no_mangle]
10682 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10683 /// but with all dynamically-allocated buffers duplicated in new buffers.
10684 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10685 #[repr(C)]
10686 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10687 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10688         /// A pointer to the contents in the success state.
10689         /// Reading from this pointer when `result_ok` is not set is undefined.
10690         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10691         /// A pointer to the contents in the error state.
10692         /// Reading from this pointer when `result_ok` is set is undefined.
10693         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10694 }
10695 #[repr(C)]
10696 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10697 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10699 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10700         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10701         /// `err` or `result` depending on the state of `result_ok`.
10702         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10703         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10704         pub result_ok: bool,
10705 }
10706 #[no_mangle]
10707 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10708 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10709         CResult_COption_MonitorEventZDecodeErrorZ {
10710                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10711                         result: Box::into_raw(Box::new(o)),
10712                 },
10713                 result_ok: true,
10714         }
10715 }
10716 #[no_mangle]
10717 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10718 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10719         CResult_COption_MonitorEventZDecodeErrorZ {
10720                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10721                         err: Box::into_raw(Box::new(e)),
10722                 },
10723                 result_ok: false,
10724         }
10725 }
10726 /// Checks if the given object is currently in the success state
10727 #[no_mangle]
10728 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10729         o.result_ok
10730 }
10731 #[no_mangle]
10732 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10733 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10734 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10735         fn drop(&mut self) {
10736                 if self.result_ok {
10737                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10738                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10739                         }
10740                 } else {
10741                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10742                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10743                         }
10744                 }
10745         }
10746 }
10747 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10748         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10749                 let contents = if o.result_ok {
10750                         let result = unsafe { o.contents.result };
10751                         unsafe { o.contents.result = core::ptr::null_mut() };
10752                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10753                 } else {
10754                         let err = unsafe { o.contents.err };
10755                         unsafe { o.contents.err = core::ptr::null_mut(); }
10756                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10757                 };
10758                 Self {
10759                         contents,
10760                         result_ok: o.result_ok,
10761                 }
10762         }
10763 }
10764 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10765         fn clone(&self) -> Self {
10766                 if self.result_ok {
10767                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10768                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10769                         } }
10770                 } else {
10771                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10772                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10773                         } }
10774                 }
10775         }
10776 }
10777 #[no_mangle]
10778 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10779 /// but with all dynamically-allocated buffers duplicated in new buffers.
10780 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10781 #[repr(C)]
10782 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10783 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10784         /// A pointer to the contents in the success state.
10785         /// Reading from this pointer when `result_ok` is not set is undefined.
10786         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10787         /// A pointer to the contents in the error state.
10788         /// Reading from this pointer when `result_ok` is set is undefined.
10789         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10790 }
10791 #[repr(C)]
10792 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10793 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10795 pub struct CResult_HTLCUpdateDecodeErrorZ {
10796         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10797         /// `err` or `result` depending on the state of `result_ok`.
10798         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10799         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10800         pub result_ok: bool,
10801 }
10802 #[no_mangle]
10803 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10804 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10805         CResult_HTLCUpdateDecodeErrorZ {
10806                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10807                         result: Box::into_raw(Box::new(o)),
10808                 },
10809                 result_ok: true,
10810         }
10811 }
10812 #[no_mangle]
10813 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10814 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10815         CResult_HTLCUpdateDecodeErrorZ {
10816                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10817                         err: Box::into_raw(Box::new(e)),
10818                 },
10819                 result_ok: false,
10820         }
10821 }
10822 /// Checks if the given object is currently in the success state
10823 #[no_mangle]
10824 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10825         o.result_ok
10826 }
10827 #[no_mangle]
10828 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10829 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10830 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10831         fn drop(&mut self) {
10832                 if self.result_ok {
10833                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10834                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10835                         }
10836                 } else {
10837                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10838                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10839                         }
10840                 }
10841         }
10842 }
10843 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10844         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10845                 let contents = if o.result_ok {
10846                         let result = unsafe { o.contents.result };
10847                         unsafe { o.contents.result = core::ptr::null_mut() };
10848                         CResult_HTLCUpdateDecodeErrorZPtr { result }
10849                 } else {
10850                         let err = unsafe { o.contents.err };
10851                         unsafe { o.contents.err = core::ptr::null_mut(); }
10852                         CResult_HTLCUpdateDecodeErrorZPtr { err }
10853                 };
10854                 Self {
10855                         contents,
10856                         result_ok: o.result_ok,
10857                 }
10858         }
10859 }
10860 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10861         fn clone(&self) -> Self {
10862                 if self.result_ok {
10863                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10864                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10865                         } }
10866                 } else {
10867                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10868                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10869                         } }
10870                 }
10871         }
10872 }
10873 #[no_mangle]
10874 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10875 /// but with all dynamically-allocated buffers duplicated in new buffers.
10876 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10877 #[repr(C)]
10878 /// A tuple of 2 elements. See the individual fields for the types contained.
10879 pub struct C2Tuple_OutPointScriptZ {
10880         /// The element at position 0
10881         pub a: crate::lightning::chain::transaction::OutPoint,
10882         /// The element at position 1
10883         pub b: crate::c_types::derived::CVec_u8Z,
10884 }
10885 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10886         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10887                 Self {
10888                         a: tup.0,
10889                         b: tup.1,
10890                 }
10891         }
10892 }
10893 impl C2Tuple_OutPointScriptZ {
10894         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10895                 (self.a, self.b)
10896         }
10897 }
10898 impl Clone for C2Tuple_OutPointScriptZ {
10899         fn clone(&self) -> Self {
10900                 Self {
10901                         a: Clone::clone(&self.a),
10902                         b: Clone::clone(&self.b),
10903                 }
10904         }
10905 }
10906 #[no_mangle]
10907 /// Creates a new tuple which has the same data as `orig`
10908 /// but with all dynamically-allocated buffers duplicated in new buffers.
10909 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10910 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10911 #[no_mangle]
10912 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10913         C2Tuple_OutPointScriptZ { a, b, }
10914 }
10915
10916 #[no_mangle]
10917 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10918 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10919 #[repr(C)]
10920 /// A tuple of 2 elements. See the individual fields for the types contained.
10921 pub struct C2Tuple_u32ScriptZ {
10922         /// The element at position 0
10923         pub a: u32,
10924         /// The element at position 1
10925         pub b: crate::c_types::derived::CVec_u8Z,
10926 }
10927 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10928         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10929                 Self {
10930                         a: tup.0,
10931                         b: tup.1,
10932                 }
10933         }
10934 }
10935 impl C2Tuple_u32ScriptZ {
10936         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10937                 (self.a, self.b)
10938         }
10939 }
10940 impl Clone for C2Tuple_u32ScriptZ {
10941         fn clone(&self) -> Self {
10942                 Self {
10943                         a: Clone::clone(&self.a),
10944                         b: Clone::clone(&self.b),
10945                 }
10946         }
10947 }
10948 #[no_mangle]
10949 /// Creates a new tuple which has the same data as `orig`
10950 /// but with all dynamically-allocated buffers duplicated in new buffers.
10951 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10952 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10953 #[no_mangle]
10954 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10955         C2Tuple_u32ScriptZ { a, b, }
10956 }
10957
10958 #[no_mangle]
10959 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10960 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10961 #[repr(C)]
10962 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10963 /// This corresponds to std::vector in C++
10964 pub struct CVec_C2Tuple_u32ScriptZZ {
10965         /// The elements in the array.
10966         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10967         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10968         /// The number of elements pointed to by `data`.
10969         pub datalen: usize
10970 }
10971 impl CVec_C2Tuple_u32ScriptZZ {
10972         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10973                 if self.datalen == 0 { return Vec::new(); }
10974                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10975                 self.data = core::ptr::null_mut();
10976                 self.datalen = 0;
10977                 ret
10978         }
10979         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10980                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10981         }
10982 }
10983 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10984         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10985                 let datalen = v.len();
10986                 let data = Box::into_raw(v.into_boxed_slice());
10987                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10988         }
10989 }
10990 #[no_mangle]
10991 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10992 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10993 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10994         fn drop(&mut self) {
10995                 if self.datalen == 0 { return; }
10996                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10997         }
10998 }
10999 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11000         fn clone(&self) -> Self {
11001                 let mut res = Vec::new();
11002                 if self.datalen == 0 { return Self::from(res); }
11003                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11004                 Self::from(res)
11005         }
11006 }
11007 #[repr(C)]
11008 /// A tuple of 2 elements. See the individual fields for the types contained.
11009 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11010         /// The element at position 0
11011         pub a: crate::c_types::ThirtyTwoBytes,
11012         /// The element at position 1
11013         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11014 }
11015 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11016         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11017                 Self {
11018                         a: tup.0,
11019                         b: tup.1,
11020                 }
11021         }
11022 }
11023 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11024         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11025                 (self.a, self.b)
11026         }
11027 }
11028 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11029         fn clone(&self) -> Self {
11030                 Self {
11031                         a: Clone::clone(&self.a),
11032                         b: Clone::clone(&self.b),
11033                 }
11034         }
11035 }
11036 #[no_mangle]
11037 /// Creates a new tuple which has the same data as `orig`
11038 /// but with all dynamically-allocated buffers duplicated in new buffers.
11039 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11040 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11041 #[no_mangle]
11042 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11043         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11044 }
11045
11046 #[no_mangle]
11047 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11048 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11049 #[repr(C)]
11050 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11051 /// This corresponds to std::vector in C++
11052 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11053         /// The elements in the array.
11054         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11055         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11056         /// The number of elements pointed to by `data`.
11057         pub datalen: usize
11058 }
11059 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11060         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11061                 if self.datalen == 0 { return Vec::new(); }
11062                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11063                 self.data = core::ptr::null_mut();
11064                 self.datalen = 0;
11065                 ret
11066         }
11067         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11068                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11069         }
11070 }
11071 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11072         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11073                 let datalen = v.len();
11074                 let data = Box::into_raw(v.into_boxed_slice());
11075                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11076         }
11077 }
11078 #[no_mangle]
11079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11080 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11081 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11082         fn drop(&mut self) {
11083                 if self.datalen == 0 { return; }
11084                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11085         }
11086 }
11087 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11088         fn clone(&self) -> Self {
11089                 let mut res = Vec::new();
11090                 if self.datalen == 0 { return Self::from(res); }
11091                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11092                 Self::from(res)
11093         }
11094 }
11095 #[repr(C)]
11096 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11097 /// This corresponds to std::vector in C++
11098 pub struct CVec_EventZ {
11099         /// The elements in the array.
11100         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11101         pub data: *mut crate::lightning::util::events::Event,
11102         /// The number of elements pointed to by `data`.
11103         pub datalen: usize
11104 }
11105 impl CVec_EventZ {
11106         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11107                 if self.datalen == 0 { return Vec::new(); }
11108                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11109                 self.data = core::ptr::null_mut();
11110                 self.datalen = 0;
11111                 ret
11112         }
11113         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11114                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11115         }
11116 }
11117 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11118         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11119                 let datalen = v.len();
11120                 let data = Box::into_raw(v.into_boxed_slice());
11121                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11122         }
11123 }
11124 #[no_mangle]
11125 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11126 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11127 impl Drop for CVec_EventZ {
11128         fn drop(&mut self) {
11129                 if self.datalen == 0 { return; }
11130                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11131         }
11132 }
11133 impl Clone for CVec_EventZ {
11134         fn clone(&self) -> Self {
11135                 let mut res = Vec::new();
11136                 if self.datalen == 0 { return Self::from(res); }
11137                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11138                 Self::from(res)
11139         }
11140 }
11141 #[repr(C)]
11142 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11143 /// This corresponds to std::vector in C++
11144 pub struct CVec_TransactionZ {
11145         /// The elements in the array.
11146         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11147         pub data: *mut crate::c_types::Transaction,
11148         /// The number of elements pointed to by `data`.
11149         pub datalen: usize
11150 }
11151 impl CVec_TransactionZ {
11152         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11153                 if self.datalen == 0 { return Vec::new(); }
11154                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11155                 self.data = core::ptr::null_mut();
11156                 self.datalen = 0;
11157                 ret
11158         }
11159         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11160                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11161         }
11162 }
11163 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11164         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11165                 let datalen = v.len();
11166                 let data = Box::into_raw(v.into_boxed_slice());
11167                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11168         }
11169 }
11170 #[no_mangle]
11171 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11172 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11173 impl Drop for CVec_TransactionZ {
11174         fn drop(&mut self) {
11175                 if self.datalen == 0 { return; }
11176                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11177         }
11178 }
11179 impl Clone for CVec_TransactionZ {
11180         fn clone(&self) -> Self {
11181                 let mut res = Vec::new();
11182                 if self.datalen == 0 { return Self::from(res); }
11183                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11184                 Self::from(res)
11185         }
11186 }
11187 #[repr(C)]
11188 /// A tuple of 2 elements. See the individual fields for the types contained.
11189 pub struct C2Tuple_u32TxOutZ {
11190         /// The element at position 0
11191         pub a: u32,
11192         /// The element at position 1
11193         pub b: crate::c_types::TxOut,
11194 }
11195 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11196         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11197                 Self {
11198                         a: tup.0,
11199                         b: tup.1,
11200                 }
11201         }
11202 }
11203 impl C2Tuple_u32TxOutZ {
11204         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11205                 (self.a, self.b)
11206         }
11207 }
11208 impl Clone for C2Tuple_u32TxOutZ {
11209         fn clone(&self) -> Self {
11210                 Self {
11211                         a: Clone::clone(&self.a),
11212                         b: Clone::clone(&self.b),
11213                 }
11214         }
11215 }
11216 #[no_mangle]
11217 /// Creates a new tuple which has the same data as `orig`
11218 /// but with all dynamically-allocated buffers duplicated in new buffers.
11219 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11220 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11221 #[no_mangle]
11222 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11223         C2Tuple_u32TxOutZ { a, b, }
11224 }
11225
11226 #[no_mangle]
11227 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11228 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11229 #[repr(C)]
11230 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11231 /// This corresponds to std::vector in C++
11232 pub struct CVec_C2Tuple_u32TxOutZZ {
11233         /// The elements in the array.
11234         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11235         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11236         /// The number of elements pointed to by `data`.
11237         pub datalen: usize
11238 }
11239 impl CVec_C2Tuple_u32TxOutZZ {
11240         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11241                 if self.datalen == 0 { return Vec::new(); }
11242                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11243                 self.data = core::ptr::null_mut();
11244                 self.datalen = 0;
11245                 ret
11246         }
11247         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11248                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11249         }
11250 }
11251 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11252         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11253                 let datalen = v.len();
11254                 let data = Box::into_raw(v.into_boxed_slice());
11255                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11256         }
11257 }
11258 #[no_mangle]
11259 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11260 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11261 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11262         fn drop(&mut self) {
11263                 if self.datalen == 0 { return; }
11264                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11265         }
11266 }
11267 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11268         fn clone(&self) -> Self {
11269                 let mut res = Vec::new();
11270                 if self.datalen == 0 { return Self::from(res); }
11271                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11272                 Self::from(res)
11273         }
11274 }
11275 #[repr(C)]
11276 /// A tuple of 2 elements. See the individual fields for the types contained.
11277 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11278         /// The element at position 0
11279         pub a: crate::c_types::ThirtyTwoBytes,
11280         /// The element at position 1
11281         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11282 }
11283 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11284         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11285                 Self {
11286                         a: tup.0,
11287                         b: tup.1,
11288                 }
11289         }
11290 }
11291 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11292         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11293                 (self.a, self.b)
11294         }
11295 }
11296 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11297         fn clone(&self) -> Self {
11298                 Self {
11299                         a: Clone::clone(&self.a),
11300                         b: Clone::clone(&self.b),
11301                 }
11302         }
11303 }
11304 #[no_mangle]
11305 /// Creates a new tuple which has the same data as `orig`
11306 /// but with all dynamically-allocated buffers duplicated in new buffers.
11307 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11308 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11309 #[no_mangle]
11310 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11311         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11312 }
11313
11314 #[no_mangle]
11315 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11316 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11317 #[repr(C)]
11318 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11319 /// This corresponds to std::vector in C++
11320 pub struct CVec_TransactionOutputsZ {
11321         /// The elements in the array.
11322         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11323         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11324         /// The number of elements pointed to by `data`.
11325         pub datalen: usize
11326 }
11327 impl CVec_TransactionOutputsZ {
11328         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11329                 if self.datalen == 0 { return Vec::new(); }
11330                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11331                 self.data = core::ptr::null_mut();
11332                 self.datalen = 0;
11333                 ret
11334         }
11335         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11336                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11337         }
11338 }
11339 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11340         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11341                 let datalen = v.len();
11342                 let data = Box::into_raw(v.into_boxed_slice());
11343                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11344         }
11345 }
11346 #[no_mangle]
11347 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11348 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11349 impl Drop for CVec_TransactionOutputsZ {
11350         fn drop(&mut self) {
11351                 if self.datalen == 0 { return; }
11352                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11353         }
11354 }
11355 impl Clone for CVec_TransactionOutputsZ {
11356         fn clone(&self) -> Self {
11357                 let mut res = Vec::new();
11358                 if self.datalen == 0 { return Self::from(res); }
11359                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11360                 Self::from(res)
11361         }
11362 }
11363 #[repr(C)]
11364 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11365 /// This corresponds to std::vector in C++
11366 pub struct CVec_BalanceZ {
11367         /// The elements in the array.
11368         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11369         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11370         /// The number of elements pointed to by `data`.
11371         pub datalen: usize
11372 }
11373 impl CVec_BalanceZ {
11374         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11375                 if self.datalen == 0 { return Vec::new(); }
11376                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11377                 self.data = core::ptr::null_mut();
11378                 self.datalen = 0;
11379                 ret
11380         }
11381         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11382                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11383         }
11384 }
11385 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11386         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11387                 let datalen = v.len();
11388                 let data = Box::into_raw(v.into_boxed_slice());
11389                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11390         }
11391 }
11392 #[no_mangle]
11393 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11394 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11395 impl Drop for CVec_BalanceZ {
11396         fn drop(&mut self) {
11397                 if self.datalen == 0 { return; }
11398                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11399         }
11400 }
11401 impl Clone for CVec_BalanceZ {
11402         fn clone(&self) -> Self {
11403                 let mut res = Vec::new();
11404                 if self.datalen == 0 { return Self::from(res); }
11405                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11406                 Self::from(res)
11407         }
11408 }
11409 #[repr(C)]
11410 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11411 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11412         /// A pointer to the contents in the success state.
11413         /// Reading from this pointer when `result_ok` is not set is undefined.
11414         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11415         /// A pointer to the contents in the error state.
11416         /// Reading from this pointer when `result_ok` is set is undefined.
11417         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11418 }
11419 #[repr(C)]
11420 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11421 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11423 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11424         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11425         /// `err` or `result` depending on the state of `result_ok`.
11426         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11427         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11428         pub result_ok: bool,
11429 }
11430 #[no_mangle]
11431 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11432 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11433         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11434                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11435                         result: Box::into_raw(Box::new(o)),
11436                 },
11437                 result_ok: true,
11438         }
11439 }
11440 #[no_mangle]
11441 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11442 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11443         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11444                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11445                         err: Box::into_raw(Box::new(e)),
11446                 },
11447                 result_ok: false,
11448         }
11449 }
11450 /// Checks if the given object is currently in the success state
11451 #[no_mangle]
11452 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11453         o.result_ok
11454 }
11455 #[no_mangle]
11456 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11457 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11458 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11459         fn drop(&mut self) {
11460                 if self.result_ok {
11461                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11462                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11463                         }
11464                 } else {
11465                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11466                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11467                         }
11468                 }
11469         }
11470 }
11471 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11472         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11473                 let contents = if o.result_ok {
11474                         let result = unsafe { o.contents.result };
11475                         unsafe { o.contents.result = core::ptr::null_mut() };
11476                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11477                 } else {
11478                         let err = unsafe { o.contents.err };
11479                         unsafe { o.contents.err = core::ptr::null_mut(); }
11480                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11481                 };
11482                 Self {
11483                         contents,
11484                         result_ok: o.result_ok,
11485                 }
11486         }
11487 }
11488 #[repr(C)]
11489 /// A tuple of 2 elements. See the individual fields for the types contained.
11490 pub struct C2Tuple_PublicKeyTypeZ {
11491         /// The element at position 0
11492         pub a: crate::c_types::PublicKey,
11493         /// The element at position 1
11494         pub b: crate::lightning::ln::wire::Type,
11495 }
11496 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11497         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11498                 Self {
11499                         a: tup.0,
11500                         b: tup.1,
11501                 }
11502         }
11503 }
11504 impl C2Tuple_PublicKeyTypeZ {
11505         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11506                 (self.a, self.b)
11507         }
11508 }
11509 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11510 #[no_mangle]
11511 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11512         C2Tuple_PublicKeyTypeZ { a, b, }
11513 }
11514
11515 #[no_mangle]
11516 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11517 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11518 #[repr(C)]
11519 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11520 /// This corresponds to std::vector in C++
11521 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11522         /// The elements in the array.
11523         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11524         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11525         /// The number of elements pointed to by `data`.
11526         pub datalen: usize
11527 }
11528 impl CVec_C2Tuple_PublicKeyTypeZZ {
11529         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11530                 if self.datalen == 0 { return Vec::new(); }
11531                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11532                 self.data = core::ptr::null_mut();
11533                 self.datalen = 0;
11534                 ret
11535         }
11536         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11537                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11538         }
11539 }
11540 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11541         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11542                 let datalen = v.len();
11543                 let data = Box::into_raw(v.into_boxed_slice());
11544                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11545         }
11546 }
11547 #[no_mangle]
11548 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11549 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11550 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11551         fn drop(&mut self) {
11552                 if self.datalen == 0 { return; }
11553                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11554         }
11555 }
11556 #[repr(C)]
11557 /// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not
11558 pub enum COption_CustomOnionMessageContentsZ {
11559         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents
11560         Some(crate::lightning::onion_message::packet::CustomOnionMessageContents),
11561         /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing
11562         None
11563 }
11564 impl COption_CustomOnionMessageContentsZ {
11565         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11566                 if let Self::None = self { false } else { true }
11567         }
11568         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11569                 !self.is_some()
11570         }
11571         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents {
11572                 if let Self::Some(v) = self { v } else { unreachable!() }
11573         }
11574 }
11575 #[no_mangle]
11576 /// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents
11577 pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ {
11578         COption_CustomOnionMessageContentsZ::Some(o)
11579 }
11580 #[no_mangle]
11581 /// Constructs a new COption_CustomOnionMessageContentsZ containing nothing
11582 pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ {
11583         COption_CustomOnionMessageContentsZ::None
11584 }
11585 #[no_mangle]
11586 /// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state
11587 pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { }
11588 #[repr(C)]
11589 /// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ
11590 pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11591         /// A pointer to the contents in the success state.
11592         /// Reading from this pointer when `result_ok` is not set is undefined.
11593         pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ,
11594         /// A pointer to the contents in the error state.
11595         /// Reading from this pointer when `result_ok` is set is undefined.
11596         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11597 }
11598 #[repr(C)]
11599 /// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation,
11600 /// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11602 pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11603         /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either
11604         /// `err` or `result` depending on the state of `result_ok`.
11605         pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr,
11606         /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state.
11607         pub result_ok: bool,
11608 }
11609 #[no_mangle]
11610 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state.
11611 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11612         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11613                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11614                         result: Box::into_raw(Box::new(o)),
11615                 },
11616                 result_ok: true,
11617         }
11618 }
11619 #[no_mangle]
11620 /// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state.
11621 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11622         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11623                 contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr {
11624                         err: Box::into_raw(Box::new(e)),
11625                 },
11626                 result_ok: false,
11627         }
11628 }
11629 /// Checks if the given object is currently in the success state
11630 #[no_mangle]
11631 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool {
11632         o.result_ok
11633 }
11634 #[no_mangle]
11635 /// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ.
11636 pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { }
11637 impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11638         fn drop(&mut self) {
11639                 if self.result_ok {
11640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11642                         }
11643                 } else {
11644                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11645                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11646                         }
11647                 }
11648         }
11649 }
11650 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ {
11651         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_CustomOnionMessageContentsZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11652                 let contents = if o.result_ok {
11653                         let result = unsafe { o.contents.result };
11654                         unsafe { o.contents.result = core::ptr::null_mut() };
11655                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result }
11656                 } else {
11657                         let err = unsafe { o.contents.err };
11658                         unsafe { o.contents.err = core::ptr::null_mut(); }
11659                         CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err }
11660                 };
11661                 Self {
11662                         contents,
11663                         result_ok: o.result_ok,
11664                 }
11665         }
11666 }
11667 #[repr(C)]
11668 #[derive(Clone)]
11669 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11670 pub enum COption_NetAddressZ {
11671         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11672         Some(crate::lightning::ln::msgs::NetAddress),
11673         /// When we're in this state, this COption_NetAddressZ contains nothing
11674         None
11675 }
11676 impl COption_NetAddressZ {
11677         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11678                 if let Self::None = self { false } else { true }
11679         }
11680         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11681                 !self.is_some()
11682         }
11683         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11684                 if let Self::Some(v) = self { v } else { unreachable!() }
11685         }
11686 }
11687 #[no_mangle]
11688 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11689 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11690         COption_NetAddressZ::Some(o)
11691 }
11692 #[no_mangle]
11693 /// Constructs a new COption_NetAddressZ containing nothing
11694 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11695         COption_NetAddressZ::None
11696 }
11697 #[no_mangle]
11698 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11699 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11700 #[no_mangle]
11701 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11702 /// but with all dynamically-allocated buffers duplicated in new buffers.
11703 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11704 #[repr(C)]
11705 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11706 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11707         /// A pointer to the contents in the success state.
11708         /// Reading from this pointer when `result_ok` is not set is undefined.
11709         pub result: *mut crate::c_types::derived::CVec_u8Z,
11710         /// A pointer to the contents in the error state.
11711         /// Reading from this pointer when `result_ok` is set is undefined.
11712         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11713 }
11714 #[repr(C)]
11715 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11716 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11718 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11719         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11720         /// `err` or `result` depending on the state of `result_ok`.
11721         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11722         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11723         pub result_ok: bool,
11724 }
11725 #[no_mangle]
11726 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11727 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11728         CResult_CVec_u8ZPeerHandleErrorZ {
11729                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11730                         result: Box::into_raw(Box::new(o)),
11731                 },
11732                 result_ok: true,
11733         }
11734 }
11735 #[no_mangle]
11736 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11737 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11738         CResult_CVec_u8ZPeerHandleErrorZ {
11739                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11740                         err: Box::into_raw(Box::new(e)),
11741                 },
11742                 result_ok: false,
11743         }
11744 }
11745 /// Checks if the given object is currently in the success state
11746 #[no_mangle]
11747 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11748         o.result_ok
11749 }
11750 #[no_mangle]
11751 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11752 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11753 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11754         fn drop(&mut self) {
11755                 if self.result_ok {
11756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11758                         }
11759                 } else {
11760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11762                         }
11763                 }
11764         }
11765 }
11766 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11767         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11768                 let contents = if o.result_ok {
11769                         let result = unsafe { o.contents.result };
11770                         unsafe { o.contents.result = core::ptr::null_mut() };
11771                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11772                 } else {
11773                         let err = unsafe { o.contents.err };
11774                         unsafe { o.contents.err = core::ptr::null_mut(); }
11775                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11776                 };
11777                 Self {
11778                         contents,
11779                         result_ok: o.result_ok,
11780                 }
11781         }
11782 }
11783 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11784         fn clone(&self) -> Self {
11785                 if self.result_ok {
11786                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11787                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11788                         } }
11789                 } else {
11790                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11791                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11792                         } }
11793                 }
11794         }
11795 }
11796 #[no_mangle]
11797 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11798 /// but with all dynamically-allocated buffers duplicated in new buffers.
11799 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11800 #[repr(C)]
11801 /// The contents of CResult_NonePeerHandleErrorZ
11802 pub union CResult_NonePeerHandleErrorZPtr {
11803         /// Note that this value is always NULL, as there are no contents in the OK variant
11804         pub result: *mut core::ffi::c_void,
11805         /// A pointer to the contents in the error state.
11806         /// Reading from this pointer when `result_ok` is set is undefined.
11807         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11808 }
11809 #[repr(C)]
11810 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11811 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11812 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11813 pub struct CResult_NonePeerHandleErrorZ {
11814         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11815         /// `err` or `result` depending on the state of `result_ok`.
11816         pub contents: CResult_NonePeerHandleErrorZPtr,
11817         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11818         pub result_ok: bool,
11819 }
11820 #[no_mangle]
11821 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11822 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11823         CResult_NonePeerHandleErrorZ {
11824                 contents: CResult_NonePeerHandleErrorZPtr {
11825                         result: core::ptr::null_mut(),
11826                 },
11827                 result_ok: true,
11828         }
11829 }
11830 #[no_mangle]
11831 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11832 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11833         CResult_NonePeerHandleErrorZ {
11834                 contents: CResult_NonePeerHandleErrorZPtr {
11835                         err: Box::into_raw(Box::new(e)),
11836                 },
11837                 result_ok: false,
11838         }
11839 }
11840 /// Checks if the given object is currently in the success state
11841 #[no_mangle]
11842 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11843         o.result_ok
11844 }
11845 #[no_mangle]
11846 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11847 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11848 impl Drop for CResult_NonePeerHandleErrorZ {
11849         fn drop(&mut self) {
11850                 if self.result_ok {
11851                 } else {
11852                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11853                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11854                         }
11855                 }
11856         }
11857 }
11858 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11859         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11860                 let contents = if o.result_ok {
11861                         let _ = unsafe { Box::from_raw(o.contents.result) };
11862                         o.contents.result = core::ptr::null_mut();
11863                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11864                 } else {
11865                         let err = unsafe { o.contents.err };
11866                         unsafe { o.contents.err = core::ptr::null_mut(); }
11867                         CResult_NonePeerHandleErrorZPtr { err }
11868                 };
11869                 Self {
11870                         contents,
11871                         result_ok: o.result_ok,
11872                 }
11873         }
11874 }
11875 impl Clone for CResult_NonePeerHandleErrorZ {
11876         fn clone(&self) -> Self {
11877                 if self.result_ok {
11878                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11879                                 result: core::ptr::null_mut()
11880                         } }
11881                 } else {
11882                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11883                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11884                         } }
11885                 }
11886         }
11887 }
11888 #[no_mangle]
11889 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11890 /// but with all dynamically-allocated buffers duplicated in new buffers.
11891 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11892 #[repr(C)]
11893 /// The contents of CResult_boolPeerHandleErrorZ
11894 pub union CResult_boolPeerHandleErrorZPtr {
11895         /// A pointer to the contents in the success state.
11896         /// Reading from this pointer when `result_ok` is not set is undefined.
11897         pub result: *mut bool,
11898         /// A pointer to the contents in the error state.
11899         /// Reading from this pointer when `result_ok` is set is undefined.
11900         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11901 }
11902 #[repr(C)]
11903 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11904 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11905 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11906 pub struct CResult_boolPeerHandleErrorZ {
11907         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11908         /// `err` or `result` depending on the state of `result_ok`.
11909         pub contents: CResult_boolPeerHandleErrorZPtr,
11910         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11911         pub result_ok: bool,
11912 }
11913 #[no_mangle]
11914 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11915 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11916         CResult_boolPeerHandleErrorZ {
11917                 contents: CResult_boolPeerHandleErrorZPtr {
11918                         result: Box::into_raw(Box::new(o)),
11919                 },
11920                 result_ok: true,
11921         }
11922 }
11923 #[no_mangle]
11924 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11925 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11926         CResult_boolPeerHandleErrorZ {
11927                 contents: CResult_boolPeerHandleErrorZPtr {
11928                         err: Box::into_raw(Box::new(e)),
11929                 },
11930                 result_ok: false,
11931         }
11932 }
11933 /// Checks if the given object is currently in the success state
11934 #[no_mangle]
11935 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11936         o.result_ok
11937 }
11938 #[no_mangle]
11939 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11940 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11941 impl Drop for CResult_boolPeerHandleErrorZ {
11942         fn drop(&mut self) {
11943                 if self.result_ok {
11944                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11945                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11946                         }
11947                 } else {
11948                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11949                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11950                         }
11951                 }
11952         }
11953 }
11954 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11955         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11956                 let contents = if o.result_ok {
11957                         let result = unsafe { o.contents.result };
11958                         unsafe { o.contents.result = core::ptr::null_mut() };
11959                         CResult_boolPeerHandleErrorZPtr { result }
11960                 } else {
11961                         let err = unsafe { o.contents.err };
11962                         unsafe { o.contents.err = core::ptr::null_mut(); }
11963                         CResult_boolPeerHandleErrorZPtr { err }
11964                 };
11965                 Self {
11966                         contents,
11967                         result_ok: o.result_ok,
11968                 }
11969         }
11970 }
11971 impl Clone for CResult_boolPeerHandleErrorZ {
11972         fn clone(&self) -> Self {
11973                 if self.result_ok {
11974                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11975                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11976                         } }
11977                 } else {
11978                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11979                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11980                         } }
11981                 }
11982         }
11983 }
11984 #[no_mangle]
11985 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11986 /// but with all dynamically-allocated buffers duplicated in new buffers.
11987 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11988 #[repr(C)]
11989 /// The contents of CResult_NoneSendErrorZ
11990 pub union CResult_NoneSendErrorZPtr {
11991         /// Note that this value is always NULL, as there are no contents in the OK variant
11992         pub result: *mut core::ffi::c_void,
11993         /// A pointer to the contents in the error state.
11994         /// Reading from this pointer when `result_ok` is set is undefined.
11995         pub err: *mut crate::lightning::onion_message::messenger::SendError,
11996 }
11997 #[repr(C)]
11998 /// A CResult_NoneSendErrorZ represents the result of a fallible operation,
11999 /// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure.
12000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12001 pub struct CResult_NoneSendErrorZ {
12002         /// The contents of this CResult_NoneSendErrorZ, accessible via either
12003         /// `err` or `result` depending on the state of `result_ok`.
12004         pub contents: CResult_NoneSendErrorZPtr,
12005         /// Whether this CResult_NoneSendErrorZ represents a success state.
12006         pub result_ok: bool,
12007 }
12008 #[no_mangle]
12009 /// Creates a new CResult_NoneSendErrorZ in the success state.
12010 pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ {
12011         CResult_NoneSendErrorZ {
12012                 contents: CResult_NoneSendErrorZPtr {
12013                         result: core::ptr::null_mut(),
12014                 },
12015                 result_ok: true,
12016         }
12017 }
12018 #[no_mangle]
12019 /// Creates a new CResult_NoneSendErrorZ in the error state.
12020 pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ {
12021         CResult_NoneSendErrorZ {
12022                 contents: CResult_NoneSendErrorZPtr {
12023                         err: Box::into_raw(Box::new(e)),
12024                 },
12025                 result_ok: false,
12026         }
12027 }
12028 /// Checks if the given object is currently in the success state
12029 #[no_mangle]
12030 pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool {
12031         o.result_ok
12032 }
12033 #[no_mangle]
12034 /// Frees any resources used by the CResult_NoneSendErrorZ.
12035 pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { }
12036 impl Drop for CResult_NoneSendErrorZ {
12037         fn drop(&mut self) {
12038                 if self.result_ok {
12039                 } else {
12040                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12041                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12042                         }
12043                 }
12044         }
12045 }
12046 impl From<crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>> for CResult_NoneSendErrorZ {
12047         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self {
12048                 let contents = if o.result_ok {
12049                         let _ = unsafe { Box::from_raw(o.contents.result) };
12050                         o.contents.result = core::ptr::null_mut();
12051                         CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() }
12052                 } else {
12053                         let err = unsafe { o.contents.err };
12054                         unsafe { o.contents.err = core::ptr::null_mut(); }
12055                         CResult_NoneSendErrorZPtr { err }
12056                 };
12057                 Self {
12058                         contents,
12059                         result_ok: o.result_ok,
12060                 }
12061         }
12062 }
12063 #[repr(C)]
12064 /// The contents of CResult_SiPrefixParseErrorZ
12065 pub union CResult_SiPrefixParseErrorZPtr {
12066         /// A pointer to the contents in the success state.
12067         /// Reading from this pointer when `result_ok` is not set is undefined.
12068         pub result: *mut crate::lightning_invoice::SiPrefix,
12069         /// A pointer to the contents in the error state.
12070         /// Reading from this pointer when `result_ok` is set is undefined.
12071         pub err: *mut crate::lightning_invoice::ParseError,
12072 }
12073 #[repr(C)]
12074 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
12075 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
12076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12077 pub struct CResult_SiPrefixParseErrorZ {
12078         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
12079         /// `err` or `result` depending on the state of `result_ok`.
12080         pub contents: CResult_SiPrefixParseErrorZPtr,
12081         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
12082         pub result_ok: bool,
12083 }
12084 #[no_mangle]
12085 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
12086 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
12087         CResult_SiPrefixParseErrorZ {
12088                 contents: CResult_SiPrefixParseErrorZPtr {
12089                         result: Box::into_raw(Box::new(o)),
12090                 },
12091                 result_ok: true,
12092         }
12093 }
12094 #[no_mangle]
12095 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
12096 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
12097         CResult_SiPrefixParseErrorZ {
12098                 contents: CResult_SiPrefixParseErrorZPtr {
12099                         err: Box::into_raw(Box::new(e)),
12100                 },
12101                 result_ok: false,
12102         }
12103 }
12104 /// Checks if the given object is currently in the success state
12105 #[no_mangle]
12106 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
12107         o.result_ok
12108 }
12109 #[no_mangle]
12110 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
12111 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
12112 impl Drop for CResult_SiPrefixParseErrorZ {
12113         fn drop(&mut self) {
12114                 if self.result_ok {
12115                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12116                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12117                         }
12118                 } else {
12119                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12120                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12121                         }
12122                 }
12123         }
12124 }
12125 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
12126         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
12127                 let contents = if o.result_ok {
12128                         let result = unsafe { o.contents.result };
12129                         unsafe { o.contents.result = core::ptr::null_mut() };
12130                         CResult_SiPrefixParseErrorZPtr { result }
12131                 } else {
12132                         let err = unsafe { o.contents.err };
12133                         unsafe { o.contents.err = core::ptr::null_mut(); }
12134                         CResult_SiPrefixParseErrorZPtr { err }
12135                 };
12136                 Self {
12137                         contents,
12138                         result_ok: o.result_ok,
12139                 }
12140         }
12141 }
12142 impl Clone for CResult_SiPrefixParseErrorZ {
12143         fn clone(&self) -> Self {
12144                 if self.result_ok {
12145                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
12146                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
12147                         } }
12148                 } else {
12149                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
12150                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12151                         } }
12152                 }
12153         }
12154 }
12155 #[no_mangle]
12156 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
12157 /// but with all dynamically-allocated buffers duplicated in new buffers.
12158 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
12159 #[repr(C)]
12160 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
12161 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
12162         /// A pointer to the contents in the success state.
12163         /// Reading from this pointer when `result_ok` is not set is undefined.
12164         pub result: *mut crate::lightning_invoice::Invoice,
12165         /// A pointer to the contents in the error state.
12166         /// Reading from this pointer when `result_ok` is set is undefined.
12167         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
12168 }
12169 #[repr(C)]
12170 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
12171 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
12172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12173 pub struct CResult_InvoiceParseOrSemanticErrorZ {
12174         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
12175         /// `err` or `result` depending on the state of `result_ok`.
12176         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
12177         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
12178         pub result_ok: bool,
12179 }
12180 #[no_mangle]
12181 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
12182 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
12183         CResult_InvoiceParseOrSemanticErrorZ {
12184                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12185                         result: Box::into_raw(Box::new(o)),
12186                 },
12187                 result_ok: true,
12188         }
12189 }
12190 #[no_mangle]
12191 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
12192 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
12193         CResult_InvoiceParseOrSemanticErrorZ {
12194                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12195                         err: Box::into_raw(Box::new(e)),
12196                 },
12197                 result_ok: false,
12198         }
12199 }
12200 /// Checks if the given object is currently in the success state
12201 #[no_mangle]
12202 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
12203         o.result_ok
12204 }
12205 #[no_mangle]
12206 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
12207 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
12208 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
12209         fn drop(&mut self) {
12210                 if self.result_ok {
12211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12213                         }
12214                 } else {
12215                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12216                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12217                         }
12218                 }
12219         }
12220 }
12221 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
12222         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
12223                 let contents = if o.result_ok {
12224                         let result = unsafe { o.contents.result };
12225                         unsafe { o.contents.result = core::ptr::null_mut() };
12226                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
12227                 } else {
12228                         let err = unsafe { o.contents.err };
12229                         unsafe { o.contents.err = core::ptr::null_mut(); }
12230                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
12231                 };
12232                 Self {
12233                         contents,
12234                         result_ok: o.result_ok,
12235                 }
12236         }
12237 }
12238 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
12239         fn clone(&self) -> Self {
12240                 if self.result_ok {
12241                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12242                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12243                         } }
12244                 } else {
12245                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
12246                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
12247                         } }
12248                 }
12249         }
12250 }
12251 #[no_mangle]
12252 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
12253 /// but with all dynamically-allocated buffers duplicated in new buffers.
12254 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
12255 #[repr(C)]
12256 /// The contents of CResult_SignedRawInvoiceParseErrorZ
12257 pub union CResult_SignedRawInvoiceParseErrorZPtr {
12258         /// A pointer to the contents in the success state.
12259         /// Reading from this pointer when `result_ok` is not set is undefined.
12260         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
12261         /// A pointer to the contents in the error state.
12262         /// Reading from this pointer when `result_ok` is set is undefined.
12263         pub err: *mut crate::lightning_invoice::ParseError,
12264 }
12265 #[repr(C)]
12266 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
12267 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
12268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12269 pub struct CResult_SignedRawInvoiceParseErrorZ {
12270         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
12271         /// `err` or `result` depending on the state of `result_ok`.
12272         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
12273         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
12274         pub result_ok: bool,
12275 }
12276 #[no_mangle]
12277 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
12278 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
12279         CResult_SignedRawInvoiceParseErrorZ {
12280                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12281                         result: Box::into_raw(Box::new(o)),
12282                 },
12283                 result_ok: true,
12284         }
12285 }
12286 #[no_mangle]
12287 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
12288 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
12289         CResult_SignedRawInvoiceParseErrorZ {
12290                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
12291                         err: Box::into_raw(Box::new(e)),
12292                 },
12293                 result_ok: false,
12294         }
12295 }
12296 /// Checks if the given object is currently in the success state
12297 #[no_mangle]
12298 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
12299         o.result_ok
12300 }
12301 #[no_mangle]
12302 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
12303 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
12304 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
12305         fn drop(&mut self) {
12306                 if self.result_ok {
12307                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12308                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12309                         }
12310                 } else {
12311                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12312                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12313                         }
12314                 }
12315         }
12316 }
12317 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
12318         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
12319                 let contents = if o.result_ok {
12320                         let result = unsafe { o.contents.result };
12321                         unsafe { o.contents.result = core::ptr::null_mut() };
12322                         CResult_SignedRawInvoiceParseErrorZPtr { result }
12323                 } else {
12324                         let err = unsafe { o.contents.err };
12325                         unsafe { o.contents.err = core::ptr::null_mut(); }
12326                         CResult_SignedRawInvoiceParseErrorZPtr { err }
12327                 };
12328                 Self {
12329                         contents,
12330                         result_ok: o.result_ok,
12331                 }
12332         }
12333 }
12334 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
12335         fn clone(&self) -> Self {
12336                 if self.result_ok {
12337                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12338                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
12339                         } }
12340                 } else {
12341                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
12342                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
12343                         } }
12344                 }
12345         }
12346 }
12347 #[no_mangle]
12348 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
12349 /// but with all dynamically-allocated buffers duplicated in new buffers.
12350 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
12351 #[repr(C)]
12352 /// A tuple of 3 elements. See the individual fields for the types contained.
12353 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12354         /// The element at position 0
12355         pub a: crate::lightning_invoice::RawInvoice,
12356         /// The element at position 1
12357         pub b: crate::c_types::ThirtyTwoBytes,
12358         /// The element at position 2
12359         pub c: crate::lightning_invoice::InvoiceSignature,
12360 }
12361 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12362         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
12363                 Self {
12364                         a: tup.0,
12365                         b: tup.1,
12366                         c: tup.2,
12367                 }
12368         }
12369 }
12370 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12371         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
12372                 (self.a, self.b, self.c)
12373         }
12374 }
12375 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12376         fn clone(&self) -> Self {
12377                 Self {
12378                         a: Clone::clone(&self.a),
12379                         b: Clone::clone(&self.b),
12380                         c: Clone::clone(&self.c),
12381                 }
12382         }
12383 }
12384 #[no_mangle]
12385 /// Creates a new tuple which has the same data as `orig`
12386 /// but with all dynamically-allocated buffers duplicated in new buffers.
12387 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
12388 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
12389 #[no_mangle]
12390 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ {
12391         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
12392 }
12393
12394 #[no_mangle]
12395 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
12396 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
12397 #[repr(C)]
12398 /// The contents of CResult_PayeePubKeyErrorZ
12399 pub union CResult_PayeePubKeyErrorZPtr {
12400         /// A pointer to the contents in the success state.
12401         /// Reading from this pointer when `result_ok` is not set is undefined.
12402         pub result: *mut crate::lightning_invoice::PayeePubKey,
12403         /// A pointer to the contents in the error state.
12404         /// Reading from this pointer when `result_ok` is set is undefined.
12405         pub err: *mut crate::c_types::Secp256k1Error,
12406 }
12407 #[repr(C)]
12408 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
12409 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
12410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12411 pub struct CResult_PayeePubKeyErrorZ {
12412         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
12413         /// `err` or `result` depending on the state of `result_ok`.
12414         pub contents: CResult_PayeePubKeyErrorZPtr,
12415         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
12416         pub result_ok: bool,
12417 }
12418 #[no_mangle]
12419 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
12420 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
12421         CResult_PayeePubKeyErrorZ {
12422                 contents: CResult_PayeePubKeyErrorZPtr {
12423                         result: Box::into_raw(Box::new(o)),
12424                 },
12425                 result_ok: true,
12426         }
12427 }
12428 #[no_mangle]
12429 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
12430 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
12431         CResult_PayeePubKeyErrorZ {
12432                 contents: CResult_PayeePubKeyErrorZPtr {
12433                         err: Box::into_raw(Box::new(e)),
12434                 },
12435                 result_ok: false,
12436         }
12437 }
12438 /// Checks if the given object is currently in the success state
12439 #[no_mangle]
12440 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
12441         o.result_ok
12442 }
12443 #[no_mangle]
12444 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
12445 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
12446 impl Drop for CResult_PayeePubKeyErrorZ {
12447         fn drop(&mut self) {
12448                 if self.result_ok {
12449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12451                         }
12452                 } else {
12453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12455                         }
12456                 }
12457         }
12458 }
12459 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
12460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
12461                 let contents = if o.result_ok {
12462                         let result = unsafe { o.contents.result };
12463                         unsafe { o.contents.result = core::ptr::null_mut() };
12464                         CResult_PayeePubKeyErrorZPtr { result }
12465                 } else {
12466                         let err = unsafe { o.contents.err };
12467                         unsafe { o.contents.err = core::ptr::null_mut(); }
12468                         CResult_PayeePubKeyErrorZPtr { err }
12469                 };
12470                 Self {
12471                         contents,
12472                         result_ok: o.result_ok,
12473                 }
12474         }
12475 }
12476 impl Clone for CResult_PayeePubKeyErrorZ {
12477         fn clone(&self) -> Self {
12478                 if self.result_ok {
12479                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
12480                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
12481                         } }
12482                 } else {
12483                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
12484                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
12485                         } }
12486                 }
12487         }
12488 }
12489 #[no_mangle]
12490 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
12491 /// but with all dynamically-allocated buffers duplicated in new buffers.
12492 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
12493 #[repr(C)]
12494 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
12495 /// This corresponds to std::vector in C++
12496 pub struct CVec_PrivateRouteZ {
12497         /// The elements in the array.
12498         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12499         pub data: *mut crate::lightning_invoice::PrivateRoute,
12500         /// The number of elements pointed to by `data`.
12501         pub datalen: usize
12502 }
12503 impl CVec_PrivateRouteZ {
12504         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
12505                 if self.datalen == 0 { return Vec::new(); }
12506                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12507                 self.data = core::ptr::null_mut();
12508                 self.datalen = 0;
12509                 ret
12510         }
12511         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
12512                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12513         }
12514 }
12515 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
12516         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
12517                 let datalen = v.len();
12518                 let data = Box::into_raw(v.into_boxed_slice());
12519                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12520         }
12521 }
12522 #[no_mangle]
12523 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12524 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
12525 impl Drop for CVec_PrivateRouteZ {
12526         fn drop(&mut self) {
12527                 if self.datalen == 0 { return; }
12528                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12529         }
12530 }
12531 impl Clone for CVec_PrivateRouteZ {
12532         fn clone(&self) -> Self {
12533                 let mut res = Vec::new();
12534                 if self.datalen == 0 { return Self::from(res); }
12535                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12536                 Self::from(res)
12537         }
12538 }
12539 #[repr(C)]
12540 /// The contents of CResult_PositiveTimestampCreationErrorZ
12541 pub union CResult_PositiveTimestampCreationErrorZPtr {
12542         /// A pointer to the contents in the success state.
12543         /// Reading from this pointer when `result_ok` is not set is undefined.
12544         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
12545         /// A pointer to the contents in the error state.
12546         /// Reading from this pointer when `result_ok` is set is undefined.
12547         pub err: *mut crate::lightning_invoice::CreationError,
12548 }
12549 #[repr(C)]
12550 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
12551 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
12552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12553 pub struct CResult_PositiveTimestampCreationErrorZ {
12554         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
12555         /// `err` or `result` depending on the state of `result_ok`.
12556         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
12557         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
12558         pub result_ok: bool,
12559 }
12560 #[no_mangle]
12561 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
12562 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
12563         CResult_PositiveTimestampCreationErrorZ {
12564                 contents: CResult_PositiveTimestampCreationErrorZPtr {
12565                         result: Box::into_raw(Box::new(o)),
12566                 },
12567                 result_ok: true,
12568         }
12569 }
12570 #[no_mangle]
12571 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
12572 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
12573         CResult_PositiveTimestampCreationErrorZ {
12574                 contents: CResult_PositiveTimestampCreationErrorZPtr {
12575                         err: Box::into_raw(Box::new(e)),
12576                 },
12577                 result_ok: false,
12578         }
12579 }
12580 /// Checks if the given object is currently in the success state
12581 #[no_mangle]
12582 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
12583         o.result_ok
12584 }
12585 #[no_mangle]
12586 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
12587 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
12588 impl Drop for CResult_PositiveTimestampCreationErrorZ {
12589         fn drop(&mut self) {
12590                 if self.result_ok {
12591                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12592                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12593                         }
12594                 } else {
12595                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12596                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12597                         }
12598                 }
12599         }
12600 }
12601 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
12602         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
12603                 let contents = if o.result_ok {
12604                         let result = unsafe { o.contents.result };
12605                         unsafe { o.contents.result = core::ptr::null_mut() };
12606                         CResult_PositiveTimestampCreationErrorZPtr { result }
12607                 } else {
12608                         let err = unsafe { o.contents.err };
12609                         unsafe { o.contents.err = core::ptr::null_mut(); }
12610                         CResult_PositiveTimestampCreationErrorZPtr { err }
12611                 };
12612                 Self {
12613                         contents,
12614                         result_ok: o.result_ok,
12615                 }
12616         }
12617 }
12618 impl Clone for CResult_PositiveTimestampCreationErrorZ {
12619         fn clone(&self) -> Self {
12620                 if self.result_ok {
12621                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
12622                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
12623                         } }
12624                 } else {
12625                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
12626                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
12627                         } }
12628                 }
12629         }
12630 }
12631 #[no_mangle]
12632 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
12633 /// but with all dynamically-allocated buffers duplicated in new buffers.
12634 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
12635 #[repr(C)]
12636 /// The contents of CResult_NoneSemanticErrorZ
12637 pub union CResult_NoneSemanticErrorZPtr {
12638         /// Note that this value is always NULL, as there are no contents in the OK variant
12639         pub result: *mut core::ffi::c_void,
12640         /// A pointer to the contents in the error state.
12641         /// Reading from this pointer when `result_ok` is set is undefined.
12642         pub err: *mut crate::lightning_invoice::SemanticError,
12643 }
12644 #[repr(C)]
12645 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
12646 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
12647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12648 pub struct CResult_NoneSemanticErrorZ {
12649         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
12650         /// `err` or `result` depending on the state of `result_ok`.
12651         pub contents: CResult_NoneSemanticErrorZPtr,
12652         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
12653         pub result_ok: bool,
12654 }
12655 #[no_mangle]
12656 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
12657 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
12658         CResult_NoneSemanticErrorZ {
12659                 contents: CResult_NoneSemanticErrorZPtr {
12660                         result: core::ptr::null_mut(),
12661                 },
12662                 result_ok: true,
12663         }
12664 }
12665 #[no_mangle]
12666 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
12667 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
12668         CResult_NoneSemanticErrorZ {
12669                 contents: CResult_NoneSemanticErrorZPtr {
12670                         err: Box::into_raw(Box::new(e)),
12671                 },
12672                 result_ok: false,
12673         }
12674 }
12675 /// Checks if the given object is currently in the success state
12676 #[no_mangle]
12677 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
12678         o.result_ok
12679 }
12680 #[no_mangle]
12681 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
12682 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
12683 impl Drop for CResult_NoneSemanticErrorZ {
12684         fn drop(&mut self) {
12685                 if self.result_ok {
12686                 } else {
12687                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12688                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12689                         }
12690                 }
12691         }
12692 }
12693 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
12694         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
12695                 let contents = if o.result_ok {
12696                         let _ = unsafe { Box::from_raw(o.contents.result) };
12697                         o.contents.result = core::ptr::null_mut();
12698                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
12699                 } else {
12700                         let err = unsafe { o.contents.err };
12701                         unsafe { o.contents.err = core::ptr::null_mut(); }
12702                         CResult_NoneSemanticErrorZPtr { err }
12703                 };
12704                 Self {
12705                         contents,
12706                         result_ok: o.result_ok,
12707                 }
12708         }
12709 }
12710 impl Clone for CResult_NoneSemanticErrorZ {
12711         fn clone(&self) -> Self {
12712                 if self.result_ok {
12713                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
12714                                 result: core::ptr::null_mut()
12715                         } }
12716                 } else {
12717                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
12718                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
12719                         } }
12720                 }
12721         }
12722 }
12723 #[no_mangle]
12724 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
12725 /// but with all dynamically-allocated buffers duplicated in new buffers.
12726 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
12727 #[repr(C)]
12728 /// The contents of CResult_InvoiceSemanticErrorZ
12729 pub union CResult_InvoiceSemanticErrorZPtr {
12730         /// A pointer to the contents in the success state.
12731         /// Reading from this pointer when `result_ok` is not set is undefined.
12732         pub result: *mut crate::lightning_invoice::Invoice,
12733         /// A pointer to the contents in the error state.
12734         /// Reading from this pointer when `result_ok` is set is undefined.
12735         pub err: *mut crate::lightning_invoice::SemanticError,
12736 }
12737 #[repr(C)]
12738 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
12739 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
12740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12741 pub struct CResult_InvoiceSemanticErrorZ {
12742         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
12743         /// `err` or `result` depending on the state of `result_ok`.
12744         pub contents: CResult_InvoiceSemanticErrorZPtr,
12745         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
12746         pub result_ok: bool,
12747 }
12748 #[no_mangle]
12749 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
12750 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
12751         CResult_InvoiceSemanticErrorZ {
12752                 contents: CResult_InvoiceSemanticErrorZPtr {
12753                         result: Box::into_raw(Box::new(o)),
12754                 },
12755                 result_ok: true,
12756         }
12757 }
12758 #[no_mangle]
12759 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
12760 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
12761         CResult_InvoiceSemanticErrorZ {
12762                 contents: CResult_InvoiceSemanticErrorZPtr {
12763                         err: Box::into_raw(Box::new(e)),
12764                 },
12765                 result_ok: false,
12766         }
12767 }
12768 /// Checks if the given object is currently in the success state
12769 #[no_mangle]
12770 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
12771         o.result_ok
12772 }
12773 #[no_mangle]
12774 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
12775 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
12776 impl Drop for CResult_InvoiceSemanticErrorZ {
12777         fn drop(&mut self) {
12778                 if self.result_ok {
12779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12781                         }
12782                 } else {
12783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12785                         }
12786                 }
12787         }
12788 }
12789 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
12790         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
12791                 let contents = if o.result_ok {
12792                         let result = unsafe { o.contents.result };
12793                         unsafe { o.contents.result = core::ptr::null_mut() };
12794                         CResult_InvoiceSemanticErrorZPtr { result }
12795                 } else {
12796                         let err = unsafe { o.contents.err };
12797                         unsafe { o.contents.err = core::ptr::null_mut(); }
12798                         CResult_InvoiceSemanticErrorZPtr { err }
12799                 };
12800                 Self {
12801                         contents,
12802                         result_ok: o.result_ok,
12803                 }
12804         }
12805 }
12806 impl Clone for CResult_InvoiceSemanticErrorZ {
12807         fn clone(&self) -> Self {
12808                 if self.result_ok {
12809                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
12810                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
12811                         } }
12812                 } else {
12813                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
12814                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
12815                         } }
12816                 }
12817         }
12818 }
12819 #[no_mangle]
12820 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
12821 /// but with all dynamically-allocated buffers duplicated in new buffers.
12822 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
12823 #[repr(C)]
12824 /// The contents of CResult_DescriptionCreationErrorZ
12825 pub union CResult_DescriptionCreationErrorZPtr {
12826         /// A pointer to the contents in the success state.
12827         /// Reading from this pointer when `result_ok` is not set is undefined.
12828         pub result: *mut crate::lightning_invoice::Description,
12829         /// A pointer to the contents in the error state.
12830         /// Reading from this pointer when `result_ok` is set is undefined.
12831         pub err: *mut crate::lightning_invoice::CreationError,
12832 }
12833 #[repr(C)]
12834 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
12835 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
12836 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12837 pub struct CResult_DescriptionCreationErrorZ {
12838         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
12839         /// `err` or `result` depending on the state of `result_ok`.
12840         pub contents: CResult_DescriptionCreationErrorZPtr,
12841         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
12842         pub result_ok: bool,
12843 }
12844 #[no_mangle]
12845 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
12846 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
12847         CResult_DescriptionCreationErrorZ {
12848                 contents: CResult_DescriptionCreationErrorZPtr {
12849                         result: Box::into_raw(Box::new(o)),
12850                 },
12851                 result_ok: true,
12852         }
12853 }
12854 #[no_mangle]
12855 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
12856 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
12857         CResult_DescriptionCreationErrorZ {
12858                 contents: CResult_DescriptionCreationErrorZPtr {
12859                         err: Box::into_raw(Box::new(e)),
12860                 },
12861                 result_ok: false,
12862         }
12863 }
12864 /// Checks if the given object is currently in the success state
12865 #[no_mangle]
12866 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
12867         o.result_ok
12868 }
12869 #[no_mangle]
12870 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
12871 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
12872 impl Drop for CResult_DescriptionCreationErrorZ {
12873         fn drop(&mut self) {
12874                 if self.result_ok {
12875                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12876                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12877                         }
12878                 } else {
12879                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12880                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12881                         }
12882                 }
12883         }
12884 }
12885 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
12886         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
12887                 let contents = if o.result_ok {
12888                         let result = unsafe { o.contents.result };
12889                         unsafe { o.contents.result = core::ptr::null_mut() };
12890                         CResult_DescriptionCreationErrorZPtr { result }
12891                 } else {
12892                         let err = unsafe { o.contents.err };
12893                         unsafe { o.contents.err = core::ptr::null_mut(); }
12894                         CResult_DescriptionCreationErrorZPtr { err }
12895                 };
12896                 Self {
12897                         contents,
12898                         result_ok: o.result_ok,
12899                 }
12900         }
12901 }
12902 impl Clone for CResult_DescriptionCreationErrorZ {
12903         fn clone(&self) -> Self {
12904                 if self.result_ok {
12905                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
12906                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
12907                         } }
12908                 } else {
12909                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
12910                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
12911                         } }
12912                 }
12913         }
12914 }
12915 #[no_mangle]
12916 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
12917 /// but with all dynamically-allocated buffers duplicated in new buffers.
12918 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
12919 #[repr(C)]
12920 /// The contents of CResult_PrivateRouteCreationErrorZ
12921 pub union CResult_PrivateRouteCreationErrorZPtr {
12922         /// A pointer to the contents in the success state.
12923         /// Reading from this pointer when `result_ok` is not set is undefined.
12924         pub result: *mut crate::lightning_invoice::PrivateRoute,
12925         /// A pointer to the contents in the error state.
12926         /// Reading from this pointer when `result_ok` is set is undefined.
12927         pub err: *mut crate::lightning_invoice::CreationError,
12928 }
12929 #[repr(C)]
12930 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
12931 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
12932 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12933 pub struct CResult_PrivateRouteCreationErrorZ {
12934         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
12935         /// `err` or `result` depending on the state of `result_ok`.
12936         pub contents: CResult_PrivateRouteCreationErrorZPtr,
12937         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
12938         pub result_ok: bool,
12939 }
12940 #[no_mangle]
12941 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
12942 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
12943         CResult_PrivateRouteCreationErrorZ {
12944                 contents: CResult_PrivateRouteCreationErrorZPtr {
12945                         result: Box::into_raw(Box::new(o)),
12946                 },
12947                 result_ok: true,
12948         }
12949 }
12950 #[no_mangle]
12951 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
12952 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
12953         CResult_PrivateRouteCreationErrorZ {
12954                 contents: CResult_PrivateRouteCreationErrorZPtr {
12955                         err: Box::into_raw(Box::new(e)),
12956                 },
12957                 result_ok: false,
12958         }
12959 }
12960 /// Checks if the given object is currently in the success state
12961 #[no_mangle]
12962 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
12963         o.result_ok
12964 }
12965 #[no_mangle]
12966 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
12967 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
12968 impl Drop for CResult_PrivateRouteCreationErrorZ {
12969         fn drop(&mut self) {
12970                 if self.result_ok {
12971                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12972                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12973                         }
12974                 } else {
12975                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12976                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12977                         }
12978                 }
12979         }
12980 }
12981 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
12982         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
12983                 let contents = if o.result_ok {
12984                         let result = unsafe { o.contents.result };
12985                         unsafe { o.contents.result = core::ptr::null_mut() };
12986                         CResult_PrivateRouteCreationErrorZPtr { result }
12987                 } else {
12988                         let err = unsafe { o.contents.err };
12989                         unsafe { o.contents.err = core::ptr::null_mut(); }
12990                         CResult_PrivateRouteCreationErrorZPtr { err }
12991                 };
12992                 Self {
12993                         contents,
12994                         result_ok: o.result_ok,
12995                 }
12996         }
12997 }
12998 impl Clone for CResult_PrivateRouteCreationErrorZ {
12999         fn clone(&self) -> Self {
13000                 if self.result_ok {
13001                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
13002                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
13003                         } }
13004                 } else {
13005                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
13006                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
13007                         } }
13008                 }
13009         }
13010 }
13011 #[no_mangle]
13012 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
13013 /// but with all dynamically-allocated buffers duplicated in new buffers.
13014 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
13015 #[repr(C)]
13016 /// The contents of CResult_u32GraphSyncErrorZ
13017 pub union CResult_u32GraphSyncErrorZPtr {
13018         /// A pointer to the contents in the success state.
13019         /// Reading from this pointer when `result_ok` is not set is undefined.
13020         pub result: *mut u32,
13021         /// A pointer to the contents in the error state.
13022         /// Reading from this pointer when `result_ok` is set is undefined.
13023         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
13024 }
13025 #[repr(C)]
13026 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
13027 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
13028 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13029 pub struct CResult_u32GraphSyncErrorZ {
13030         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
13031         /// `err` or `result` depending on the state of `result_ok`.
13032         pub contents: CResult_u32GraphSyncErrorZPtr,
13033         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
13034         pub result_ok: bool,
13035 }
13036 #[no_mangle]
13037 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
13038 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
13039         CResult_u32GraphSyncErrorZ {
13040                 contents: CResult_u32GraphSyncErrorZPtr {
13041                         result: Box::into_raw(Box::new(o)),
13042                 },
13043                 result_ok: true,
13044         }
13045 }
13046 #[no_mangle]
13047 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
13048 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
13049         CResult_u32GraphSyncErrorZ {
13050                 contents: CResult_u32GraphSyncErrorZPtr {
13051                         err: Box::into_raw(Box::new(e)),
13052                 },
13053                 result_ok: false,
13054         }
13055 }
13056 /// Checks if the given object is currently in the success state
13057 #[no_mangle]
13058 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
13059         o.result_ok
13060 }
13061 #[no_mangle]
13062 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
13063 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
13064 impl Drop for CResult_u32GraphSyncErrorZ {
13065         fn drop(&mut self) {
13066                 if self.result_ok {
13067                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13068                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13069                         }
13070                 } else {
13071                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13072                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13073                         }
13074                 }
13075         }
13076 }
13077 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
13078         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
13079                 let contents = if o.result_ok {
13080                         let result = unsafe { o.contents.result };
13081                         unsafe { o.contents.result = core::ptr::null_mut() };
13082                         CResult_u32GraphSyncErrorZPtr { result }
13083                 } else {
13084                         let err = unsafe { o.contents.err };
13085                         unsafe { o.contents.err = core::ptr::null_mut(); }
13086                         CResult_u32GraphSyncErrorZPtr { err }
13087                 };
13088                 Self {
13089                         contents,
13090                         result_ok: o.result_ok,
13091                 }
13092         }
13093 }
13094 #[repr(C)]
13095 /// The contents of CResult_NetAddressDecodeErrorZ
13096 pub union CResult_NetAddressDecodeErrorZPtr {
13097         /// A pointer to the contents in the success state.
13098         /// Reading from this pointer when `result_ok` is not set is undefined.
13099         pub result: *mut crate::lightning::ln::msgs::NetAddress,
13100         /// A pointer to the contents in the error state.
13101         /// Reading from this pointer when `result_ok` is set is undefined.
13102         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13103 }
13104 #[repr(C)]
13105 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
13106 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
13107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13108 pub struct CResult_NetAddressDecodeErrorZ {
13109         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
13110         /// `err` or `result` depending on the state of `result_ok`.
13111         pub contents: CResult_NetAddressDecodeErrorZPtr,
13112         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
13113         pub result_ok: bool,
13114 }
13115 #[no_mangle]
13116 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
13117 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
13118         CResult_NetAddressDecodeErrorZ {
13119                 contents: CResult_NetAddressDecodeErrorZPtr {
13120                         result: Box::into_raw(Box::new(o)),
13121                 },
13122                 result_ok: true,
13123         }
13124 }
13125 #[no_mangle]
13126 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
13127 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
13128         CResult_NetAddressDecodeErrorZ {
13129                 contents: CResult_NetAddressDecodeErrorZPtr {
13130                         err: Box::into_raw(Box::new(e)),
13131                 },
13132                 result_ok: false,
13133         }
13134 }
13135 /// Checks if the given object is currently in the success state
13136 #[no_mangle]
13137 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
13138         o.result_ok
13139 }
13140 #[no_mangle]
13141 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
13142 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
13143 impl Drop for CResult_NetAddressDecodeErrorZ {
13144         fn drop(&mut self) {
13145                 if self.result_ok {
13146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13148                         }
13149                 } else {
13150                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13151                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13152                         }
13153                 }
13154         }
13155 }
13156 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
13157         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
13158                 let contents = if o.result_ok {
13159                         let result = unsafe { o.contents.result };
13160                         unsafe { o.contents.result = core::ptr::null_mut() };
13161                         CResult_NetAddressDecodeErrorZPtr { result }
13162                 } else {
13163                         let err = unsafe { o.contents.err };
13164                         unsafe { o.contents.err = core::ptr::null_mut(); }
13165                         CResult_NetAddressDecodeErrorZPtr { err }
13166                 };
13167                 Self {
13168                         contents,
13169                         result_ok: o.result_ok,
13170                 }
13171         }
13172 }
13173 impl Clone for CResult_NetAddressDecodeErrorZ {
13174         fn clone(&self) -> Self {
13175                 if self.result_ok {
13176                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
13177                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
13178                         } }
13179                 } else {
13180                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
13181                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13182                         } }
13183                 }
13184         }
13185 }
13186 #[no_mangle]
13187 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
13188 /// but with all dynamically-allocated buffers duplicated in new buffers.
13189 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
13190 #[repr(C)]
13191 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
13192 /// This corresponds to std::vector in C++
13193 pub struct CVec_UpdateAddHTLCZ {
13194         /// The elements in the array.
13195         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13196         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13197         /// The number of elements pointed to by `data`.
13198         pub datalen: usize
13199 }
13200 impl CVec_UpdateAddHTLCZ {
13201         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
13202                 if self.datalen == 0 { return Vec::new(); }
13203                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13204                 self.data = core::ptr::null_mut();
13205                 self.datalen = 0;
13206                 ret
13207         }
13208         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
13209                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13210         }
13211 }
13212 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
13213         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
13214                 let datalen = v.len();
13215                 let data = Box::into_raw(v.into_boxed_slice());
13216                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13217         }
13218 }
13219 #[no_mangle]
13220 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13221 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
13222 impl Drop for CVec_UpdateAddHTLCZ {
13223         fn drop(&mut self) {
13224                 if self.datalen == 0 { return; }
13225                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13226         }
13227 }
13228 impl Clone for CVec_UpdateAddHTLCZ {
13229         fn clone(&self) -> Self {
13230                 let mut res = Vec::new();
13231                 if self.datalen == 0 { return Self::from(res); }
13232                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13233                 Self::from(res)
13234         }
13235 }
13236 #[repr(C)]
13237 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
13238 /// This corresponds to std::vector in C++
13239 pub struct CVec_UpdateFulfillHTLCZ {
13240         /// The elements in the array.
13241         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13242         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13243         /// The number of elements pointed to by `data`.
13244         pub datalen: usize
13245 }
13246 impl CVec_UpdateFulfillHTLCZ {
13247         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
13248                 if self.datalen == 0 { return Vec::new(); }
13249                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13250                 self.data = core::ptr::null_mut();
13251                 self.datalen = 0;
13252                 ret
13253         }
13254         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
13255                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13256         }
13257 }
13258 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
13259         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
13260                 let datalen = v.len();
13261                 let data = Box::into_raw(v.into_boxed_slice());
13262                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13263         }
13264 }
13265 #[no_mangle]
13266 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13267 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
13268 impl Drop for CVec_UpdateFulfillHTLCZ {
13269         fn drop(&mut self) {
13270                 if self.datalen == 0 { return; }
13271                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13272         }
13273 }
13274 impl Clone for CVec_UpdateFulfillHTLCZ {
13275         fn clone(&self) -> Self {
13276                 let mut res = Vec::new();
13277                 if self.datalen == 0 { return Self::from(res); }
13278                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13279                 Self::from(res)
13280         }
13281 }
13282 #[repr(C)]
13283 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
13284 /// This corresponds to std::vector in C++
13285 pub struct CVec_UpdateFailHTLCZ {
13286         /// The elements in the array.
13287         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13288         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13289         /// The number of elements pointed to by `data`.
13290         pub datalen: usize
13291 }
13292 impl CVec_UpdateFailHTLCZ {
13293         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
13294                 if self.datalen == 0 { return Vec::new(); }
13295                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13296                 self.data = core::ptr::null_mut();
13297                 self.datalen = 0;
13298                 ret
13299         }
13300         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
13301                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13302         }
13303 }
13304 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
13305         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
13306                 let datalen = v.len();
13307                 let data = Box::into_raw(v.into_boxed_slice());
13308                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13309         }
13310 }
13311 #[no_mangle]
13312 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13313 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
13314 impl Drop for CVec_UpdateFailHTLCZ {
13315         fn drop(&mut self) {
13316                 if self.datalen == 0 { return; }
13317                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13318         }
13319 }
13320 impl Clone for CVec_UpdateFailHTLCZ {
13321         fn clone(&self) -> Self {
13322                 let mut res = Vec::new();
13323                 if self.datalen == 0 { return Self::from(res); }
13324                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13325                 Self::from(res)
13326         }
13327 }
13328 #[repr(C)]
13329 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
13330 /// This corresponds to std::vector in C++
13331 pub struct CVec_UpdateFailMalformedHTLCZ {
13332         /// The elements in the array.
13333         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
13334         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13335         /// The number of elements pointed to by `data`.
13336         pub datalen: usize
13337 }
13338 impl CVec_UpdateFailMalformedHTLCZ {
13339         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
13340                 if self.datalen == 0 { return Vec::new(); }
13341                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
13342                 self.data = core::ptr::null_mut();
13343                 self.datalen = 0;
13344                 ret
13345         }
13346         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
13347                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
13348         }
13349 }
13350 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
13351         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
13352                 let datalen = v.len();
13353                 let data = Box::into_raw(v.into_boxed_slice());
13354                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
13355         }
13356 }
13357 #[no_mangle]
13358 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
13359 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
13360 impl Drop for CVec_UpdateFailMalformedHTLCZ {
13361         fn drop(&mut self) {
13362                 if self.datalen == 0 { return; }
13363                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
13364         }
13365 }
13366 impl Clone for CVec_UpdateFailMalformedHTLCZ {
13367         fn clone(&self) -> Self {
13368                 let mut res = Vec::new();
13369                 if self.datalen == 0 { return Self::from(res); }
13370                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
13371                 Self::from(res)
13372         }
13373 }
13374 #[repr(C)]
13375 /// The contents of CResult_AcceptChannelDecodeErrorZ
13376 pub union CResult_AcceptChannelDecodeErrorZPtr {
13377         /// A pointer to the contents in the success state.
13378         /// Reading from this pointer when `result_ok` is not set is undefined.
13379         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
13380         /// A pointer to the contents in the error state.
13381         /// Reading from this pointer when `result_ok` is set is undefined.
13382         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13383 }
13384 #[repr(C)]
13385 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
13386 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13387 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13388 pub struct CResult_AcceptChannelDecodeErrorZ {
13389         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
13390         /// `err` or `result` depending on the state of `result_ok`.
13391         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
13392         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
13393         pub result_ok: bool,
13394 }
13395 #[no_mangle]
13396 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
13397 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
13398         CResult_AcceptChannelDecodeErrorZ {
13399                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13400                         result: Box::into_raw(Box::new(o)),
13401                 },
13402                 result_ok: true,
13403         }
13404 }
13405 #[no_mangle]
13406 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
13407 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
13408         CResult_AcceptChannelDecodeErrorZ {
13409                 contents: CResult_AcceptChannelDecodeErrorZPtr {
13410                         err: Box::into_raw(Box::new(e)),
13411                 },
13412                 result_ok: false,
13413         }
13414 }
13415 /// Checks if the given object is currently in the success state
13416 #[no_mangle]
13417 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
13418         o.result_ok
13419 }
13420 #[no_mangle]
13421 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
13422 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
13423 impl Drop for CResult_AcceptChannelDecodeErrorZ {
13424         fn drop(&mut self) {
13425                 if self.result_ok {
13426                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13427                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13428                         }
13429                 } else {
13430                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13431                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13432                         }
13433                 }
13434         }
13435 }
13436 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
13437         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13438                 let contents = if o.result_ok {
13439                         let result = unsafe { o.contents.result };
13440                         unsafe { o.contents.result = core::ptr::null_mut() };
13441                         CResult_AcceptChannelDecodeErrorZPtr { result }
13442                 } else {
13443                         let err = unsafe { o.contents.err };
13444                         unsafe { o.contents.err = core::ptr::null_mut(); }
13445                         CResult_AcceptChannelDecodeErrorZPtr { err }
13446                 };
13447                 Self {
13448                         contents,
13449                         result_ok: o.result_ok,
13450                 }
13451         }
13452 }
13453 impl Clone for CResult_AcceptChannelDecodeErrorZ {
13454         fn clone(&self) -> Self {
13455                 if self.result_ok {
13456                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
13457                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
13458                         } }
13459                 } else {
13460                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
13461                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13462                         } }
13463                 }
13464         }
13465 }
13466 #[no_mangle]
13467 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
13468 /// but with all dynamically-allocated buffers duplicated in new buffers.
13469 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
13470 #[repr(C)]
13471 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
13472 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
13473         /// A pointer to the contents in the success state.
13474         /// Reading from this pointer when `result_ok` is not set is undefined.
13475         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
13476         /// A pointer to the contents in the error state.
13477         /// Reading from this pointer when `result_ok` is set is undefined.
13478         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13479 }
13480 #[repr(C)]
13481 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
13482 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
13483 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13484 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
13485         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
13486         /// `err` or `result` depending on the state of `result_ok`.
13487         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
13488         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
13489         pub result_ok: bool,
13490 }
13491 #[no_mangle]
13492 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
13493 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13494         CResult_AnnouncementSignaturesDecodeErrorZ {
13495                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13496                         result: Box::into_raw(Box::new(o)),
13497                 },
13498                 result_ok: true,
13499         }
13500 }
13501 #[no_mangle]
13502 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
13503 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
13504         CResult_AnnouncementSignaturesDecodeErrorZ {
13505                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13506                         err: Box::into_raw(Box::new(e)),
13507                 },
13508                 result_ok: false,
13509         }
13510 }
13511 /// Checks if the given object is currently in the success state
13512 #[no_mangle]
13513 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
13514         o.result_ok
13515 }
13516 #[no_mangle]
13517 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
13518 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
13519 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
13520         fn drop(&mut self) {
13521                 if self.result_ok {
13522                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13523                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13524                         }
13525                 } else {
13526                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13527                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13528                         }
13529                 }
13530         }
13531 }
13532 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
13533         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
13534                 let contents = if o.result_ok {
13535                         let result = unsafe { o.contents.result };
13536                         unsafe { o.contents.result = core::ptr::null_mut() };
13537                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
13538                 } else {
13539                         let err = unsafe { o.contents.err };
13540                         unsafe { o.contents.err = core::ptr::null_mut(); }
13541                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
13542                 };
13543                 Self {
13544                         contents,
13545                         result_ok: o.result_ok,
13546                 }
13547         }
13548 }
13549 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
13550         fn clone(&self) -> Self {
13551                 if self.result_ok {
13552                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13553                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
13554                         } }
13555                 } else {
13556                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
13557                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13558                         } }
13559                 }
13560         }
13561 }
13562 #[no_mangle]
13563 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
13564 /// but with all dynamically-allocated buffers duplicated in new buffers.
13565 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
13566 #[repr(C)]
13567 /// The contents of CResult_ChannelReestablishDecodeErrorZ
13568 pub union CResult_ChannelReestablishDecodeErrorZPtr {
13569         /// A pointer to the contents in the success state.
13570         /// Reading from this pointer when `result_ok` is not set is undefined.
13571         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
13572         /// A pointer to the contents in the error state.
13573         /// Reading from this pointer when `result_ok` is set is undefined.
13574         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13575 }
13576 #[repr(C)]
13577 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
13578 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
13579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13580 pub struct CResult_ChannelReestablishDecodeErrorZ {
13581         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
13582         /// `err` or `result` depending on the state of `result_ok`.
13583         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
13584         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
13585         pub result_ok: bool,
13586 }
13587 #[no_mangle]
13588 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
13589 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
13590         CResult_ChannelReestablishDecodeErrorZ {
13591                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13592                         result: Box::into_raw(Box::new(o)),
13593                 },
13594                 result_ok: true,
13595         }
13596 }
13597 #[no_mangle]
13598 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
13599 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
13600         CResult_ChannelReestablishDecodeErrorZ {
13601                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
13602                         err: Box::into_raw(Box::new(e)),
13603                 },
13604                 result_ok: false,
13605         }
13606 }
13607 /// Checks if the given object is currently in the success state
13608 #[no_mangle]
13609 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
13610         o.result_ok
13611 }
13612 #[no_mangle]
13613 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
13614 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
13615 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
13616         fn drop(&mut self) {
13617                 if self.result_ok {
13618                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13619                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13620                         }
13621                 } else {
13622                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13623                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13624                         }
13625                 }
13626         }
13627 }
13628 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
13629         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
13630                 let contents = if o.result_ok {
13631                         let result = unsafe { o.contents.result };
13632                         unsafe { o.contents.result = core::ptr::null_mut() };
13633                         CResult_ChannelReestablishDecodeErrorZPtr { result }
13634                 } else {
13635                         let err = unsafe { o.contents.err };
13636                         unsafe { o.contents.err = core::ptr::null_mut(); }
13637                         CResult_ChannelReestablishDecodeErrorZPtr { err }
13638                 };
13639                 Self {
13640                         contents,
13641                         result_ok: o.result_ok,
13642                 }
13643         }
13644 }
13645 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
13646         fn clone(&self) -> Self {
13647                 if self.result_ok {
13648                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13649                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
13650                         } }
13651                 } else {
13652                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
13653                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13654                         } }
13655                 }
13656         }
13657 }
13658 #[no_mangle]
13659 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
13660 /// but with all dynamically-allocated buffers duplicated in new buffers.
13661 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
13662 #[repr(C)]
13663 /// The contents of CResult_ClosingSignedDecodeErrorZ
13664 pub union CResult_ClosingSignedDecodeErrorZPtr {
13665         /// A pointer to the contents in the success state.
13666         /// Reading from this pointer when `result_ok` is not set is undefined.
13667         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
13668         /// A pointer to the contents in the error state.
13669         /// Reading from this pointer when `result_ok` is set is undefined.
13670         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13671 }
13672 #[repr(C)]
13673 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
13674 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13675 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13676 pub struct CResult_ClosingSignedDecodeErrorZ {
13677         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
13678         /// `err` or `result` depending on the state of `result_ok`.
13679         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
13680         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
13681         pub result_ok: bool,
13682 }
13683 #[no_mangle]
13684 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
13685 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
13686         CResult_ClosingSignedDecodeErrorZ {
13687                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13688                         result: Box::into_raw(Box::new(o)),
13689                 },
13690                 result_ok: true,
13691         }
13692 }
13693 #[no_mangle]
13694 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
13695 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
13696         CResult_ClosingSignedDecodeErrorZ {
13697                 contents: CResult_ClosingSignedDecodeErrorZPtr {
13698                         err: Box::into_raw(Box::new(e)),
13699                 },
13700                 result_ok: false,
13701         }
13702 }
13703 /// Checks if the given object is currently in the success state
13704 #[no_mangle]
13705 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
13706         o.result_ok
13707 }
13708 #[no_mangle]
13709 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
13710 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
13711 impl Drop for CResult_ClosingSignedDecodeErrorZ {
13712         fn drop(&mut self) {
13713                 if self.result_ok {
13714                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13715                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13716                         }
13717                 } else {
13718                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13719                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13720                         }
13721                 }
13722         }
13723 }
13724 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
13725         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13726                 let contents = if o.result_ok {
13727                         let result = unsafe { o.contents.result };
13728                         unsafe { o.contents.result = core::ptr::null_mut() };
13729                         CResult_ClosingSignedDecodeErrorZPtr { result }
13730                 } else {
13731                         let err = unsafe { o.contents.err };
13732                         unsafe { o.contents.err = core::ptr::null_mut(); }
13733                         CResult_ClosingSignedDecodeErrorZPtr { err }
13734                 };
13735                 Self {
13736                         contents,
13737                         result_ok: o.result_ok,
13738                 }
13739         }
13740 }
13741 impl Clone for CResult_ClosingSignedDecodeErrorZ {
13742         fn clone(&self) -> Self {
13743                 if self.result_ok {
13744                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
13745                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
13746                         } }
13747                 } else {
13748                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
13749                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13750                         } }
13751                 }
13752         }
13753 }
13754 #[no_mangle]
13755 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
13756 /// but with all dynamically-allocated buffers duplicated in new buffers.
13757 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
13758 #[repr(C)]
13759 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
13760 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13761         /// A pointer to the contents in the success state.
13762         /// Reading from this pointer when `result_ok` is not set is undefined.
13763         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
13764         /// A pointer to the contents in the error state.
13765         /// Reading from this pointer when `result_ok` is set is undefined.
13766         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13767 }
13768 #[repr(C)]
13769 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
13770 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13771 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13772 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
13773         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
13774         /// `err` or `result` depending on the state of `result_ok`.
13775         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
13776         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
13777         pub result_ok: bool,
13778 }
13779 #[no_mangle]
13780 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
13781 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13782         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13783                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13784                         result: Box::into_raw(Box::new(o)),
13785                 },
13786                 result_ok: true,
13787         }
13788 }
13789 #[no_mangle]
13790 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
13791 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
13792         CResult_ClosingSignedFeeRangeDecodeErrorZ {
13793                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13794                         err: Box::into_raw(Box::new(e)),
13795                 },
13796                 result_ok: false,
13797         }
13798 }
13799 /// Checks if the given object is currently in the success state
13800 #[no_mangle]
13801 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
13802         o.result_ok
13803 }
13804 #[no_mangle]
13805 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
13806 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
13807 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13808         fn drop(&mut self) {
13809                 if self.result_ok {
13810                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13811                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13812                         }
13813                 } else {
13814                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13815                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13816                         }
13817                 }
13818         }
13819 }
13820 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13821         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13822                 let contents = if o.result_ok {
13823                         let result = unsafe { o.contents.result };
13824                         unsafe { o.contents.result = core::ptr::null_mut() };
13825                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13826                 } else {
13827                         let err = unsafe { o.contents.err };
13828                         unsafe { o.contents.err = core::ptr::null_mut(); }
13829                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13830                 };
13831                 Self {
13832                         contents,
13833                         result_ok: o.result_ok,
13834                 }
13835         }
13836 }
13837 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13838         fn clone(&self) -> Self {
13839                 if self.result_ok {
13840                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13841                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13842                         } }
13843                 } else {
13844                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13845                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13846                         } }
13847                 }
13848         }
13849 }
13850 #[no_mangle]
13851 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13852 /// but with all dynamically-allocated buffers duplicated in new buffers.
13853 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13854 #[repr(C)]
13855 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13856 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13857         /// A pointer to the contents in the success state.
13858         /// Reading from this pointer when `result_ok` is not set is undefined.
13859         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13860         /// A pointer to the contents in the error state.
13861         /// Reading from this pointer when `result_ok` is set is undefined.
13862         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13863 }
13864 #[repr(C)]
13865 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13866 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13867 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13868 pub struct CResult_CommitmentSignedDecodeErrorZ {
13869         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13870         /// `err` or `result` depending on the state of `result_ok`.
13871         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13872         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13873         pub result_ok: bool,
13874 }
13875 #[no_mangle]
13876 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13877 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13878         CResult_CommitmentSignedDecodeErrorZ {
13879                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13880                         result: Box::into_raw(Box::new(o)),
13881                 },
13882                 result_ok: true,
13883         }
13884 }
13885 #[no_mangle]
13886 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13887 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13888         CResult_CommitmentSignedDecodeErrorZ {
13889                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13890                         err: Box::into_raw(Box::new(e)),
13891                 },
13892                 result_ok: false,
13893         }
13894 }
13895 /// Checks if the given object is currently in the success state
13896 #[no_mangle]
13897 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13898         o.result_ok
13899 }
13900 #[no_mangle]
13901 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13902 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13903 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13904         fn drop(&mut self) {
13905                 if self.result_ok {
13906                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13907                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13908                         }
13909                 } else {
13910                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13911                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13912                         }
13913                 }
13914         }
13915 }
13916 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13917         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13918                 let contents = if o.result_ok {
13919                         let result = unsafe { o.contents.result };
13920                         unsafe { o.contents.result = core::ptr::null_mut() };
13921                         CResult_CommitmentSignedDecodeErrorZPtr { result }
13922                 } else {
13923                         let err = unsafe { o.contents.err };
13924                         unsafe { o.contents.err = core::ptr::null_mut(); }
13925                         CResult_CommitmentSignedDecodeErrorZPtr { err }
13926                 };
13927                 Self {
13928                         contents,
13929                         result_ok: o.result_ok,
13930                 }
13931         }
13932 }
13933 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13934         fn clone(&self) -> Self {
13935                 if self.result_ok {
13936                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13937                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13938                         } }
13939                 } else {
13940                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13941                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13942                         } }
13943                 }
13944         }
13945 }
13946 #[no_mangle]
13947 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13948 /// but with all dynamically-allocated buffers duplicated in new buffers.
13949 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13950 #[repr(C)]
13951 /// The contents of CResult_FundingCreatedDecodeErrorZ
13952 pub union CResult_FundingCreatedDecodeErrorZPtr {
13953         /// A pointer to the contents in the success state.
13954         /// Reading from this pointer when `result_ok` is not set is undefined.
13955         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13956         /// A pointer to the contents in the error state.
13957         /// Reading from this pointer when `result_ok` is set is undefined.
13958         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13959 }
13960 #[repr(C)]
13961 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13962 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13963 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13964 pub struct CResult_FundingCreatedDecodeErrorZ {
13965         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13966         /// `err` or `result` depending on the state of `result_ok`.
13967         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13968         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13969         pub result_ok: bool,
13970 }
13971 #[no_mangle]
13972 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13973 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13974         CResult_FundingCreatedDecodeErrorZ {
13975                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13976                         result: Box::into_raw(Box::new(o)),
13977                 },
13978                 result_ok: true,
13979         }
13980 }
13981 #[no_mangle]
13982 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13983 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13984         CResult_FundingCreatedDecodeErrorZ {
13985                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13986                         err: Box::into_raw(Box::new(e)),
13987                 },
13988                 result_ok: false,
13989         }
13990 }
13991 /// Checks if the given object is currently in the success state
13992 #[no_mangle]
13993 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13994         o.result_ok
13995 }
13996 #[no_mangle]
13997 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13998 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13999 impl Drop for CResult_FundingCreatedDecodeErrorZ {
14000         fn drop(&mut self) {
14001                 if self.result_ok {
14002                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14003                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14004                         }
14005                 } else {
14006                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14007                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14008                         }
14009                 }
14010         }
14011 }
14012 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
14013         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
14014                 let contents = if o.result_ok {
14015                         let result = unsafe { o.contents.result };
14016                         unsafe { o.contents.result = core::ptr::null_mut() };
14017                         CResult_FundingCreatedDecodeErrorZPtr { result }
14018                 } else {
14019                         let err = unsafe { o.contents.err };
14020                         unsafe { o.contents.err = core::ptr::null_mut(); }
14021                         CResult_FundingCreatedDecodeErrorZPtr { err }
14022                 };
14023                 Self {
14024                         contents,
14025                         result_ok: o.result_ok,
14026                 }
14027         }
14028 }
14029 impl Clone for CResult_FundingCreatedDecodeErrorZ {
14030         fn clone(&self) -> Self {
14031                 if self.result_ok {
14032                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
14033                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
14034                         } }
14035                 } else {
14036                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
14037                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14038                         } }
14039                 }
14040         }
14041 }
14042 #[no_mangle]
14043 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
14044 /// but with all dynamically-allocated buffers duplicated in new buffers.
14045 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
14046 #[repr(C)]
14047 /// The contents of CResult_FundingSignedDecodeErrorZ
14048 pub union CResult_FundingSignedDecodeErrorZPtr {
14049         /// A pointer to the contents in the success state.
14050         /// Reading from this pointer when `result_ok` is not set is undefined.
14051         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
14052         /// A pointer to the contents in the error state.
14053         /// Reading from this pointer when `result_ok` is set is undefined.
14054         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14055 }
14056 #[repr(C)]
14057 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
14058 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
14059 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14060 pub struct CResult_FundingSignedDecodeErrorZ {
14061         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
14062         /// `err` or `result` depending on the state of `result_ok`.
14063         pub contents: CResult_FundingSignedDecodeErrorZPtr,
14064         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
14065         pub result_ok: bool,
14066 }
14067 #[no_mangle]
14068 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
14069 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
14070         CResult_FundingSignedDecodeErrorZ {
14071                 contents: CResult_FundingSignedDecodeErrorZPtr {
14072                         result: Box::into_raw(Box::new(o)),
14073                 },
14074                 result_ok: true,
14075         }
14076 }
14077 #[no_mangle]
14078 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
14079 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
14080         CResult_FundingSignedDecodeErrorZ {
14081                 contents: CResult_FundingSignedDecodeErrorZPtr {
14082                         err: Box::into_raw(Box::new(e)),
14083                 },
14084                 result_ok: false,
14085         }
14086 }
14087 /// Checks if the given object is currently in the success state
14088 #[no_mangle]
14089 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
14090         o.result_ok
14091 }
14092 #[no_mangle]
14093 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
14094 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
14095 impl Drop for CResult_FundingSignedDecodeErrorZ {
14096         fn drop(&mut self) {
14097                 if self.result_ok {
14098                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14099                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14100                         }
14101                 } else {
14102                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14103                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14104                         }
14105                 }
14106         }
14107 }
14108 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
14109         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
14110                 let contents = if o.result_ok {
14111                         let result = unsafe { o.contents.result };
14112                         unsafe { o.contents.result = core::ptr::null_mut() };
14113                         CResult_FundingSignedDecodeErrorZPtr { result }
14114                 } else {
14115                         let err = unsafe { o.contents.err };
14116                         unsafe { o.contents.err = core::ptr::null_mut(); }
14117                         CResult_FundingSignedDecodeErrorZPtr { err }
14118                 };
14119                 Self {
14120                         contents,
14121                         result_ok: o.result_ok,
14122                 }
14123         }
14124 }
14125 impl Clone for CResult_FundingSignedDecodeErrorZ {
14126         fn clone(&self) -> Self {
14127                 if self.result_ok {
14128                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
14129                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
14130                         } }
14131                 } else {
14132                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
14133                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14134                         } }
14135                 }
14136         }
14137 }
14138 #[no_mangle]
14139 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
14140 /// but with all dynamically-allocated buffers duplicated in new buffers.
14141 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
14142 #[repr(C)]
14143 /// The contents of CResult_ChannelReadyDecodeErrorZ
14144 pub union CResult_ChannelReadyDecodeErrorZPtr {
14145         /// A pointer to the contents in the success state.
14146         /// Reading from this pointer when `result_ok` is not set is undefined.
14147         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
14148         /// A pointer to the contents in the error state.
14149         /// Reading from this pointer when `result_ok` is set is undefined.
14150         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14151 }
14152 #[repr(C)]
14153 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
14154 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
14155 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14156 pub struct CResult_ChannelReadyDecodeErrorZ {
14157         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
14158         /// `err` or `result` depending on the state of `result_ok`.
14159         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
14160         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
14161         pub result_ok: bool,
14162 }
14163 #[no_mangle]
14164 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
14165 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
14166         CResult_ChannelReadyDecodeErrorZ {
14167                 contents: CResult_ChannelReadyDecodeErrorZPtr {
14168                         result: Box::into_raw(Box::new(o)),
14169                 },
14170                 result_ok: true,
14171         }
14172 }
14173 #[no_mangle]
14174 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
14175 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
14176         CResult_ChannelReadyDecodeErrorZ {
14177                 contents: CResult_ChannelReadyDecodeErrorZPtr {
14178                         err: Box::into_raw(Box::new(e)),
14179                 },
14180                 result_ok: false,
14181         }
14182 }
14183 /// Checks if the given object is currently in the success state
14184 #[no_mangle]
14185 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
14186         o.result_ok
14187 }
14188 #[no_mangle]
14189 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
14190 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
14191 impl Drop for CResult_ChannelReadyDecodeErrorZ {
14192         fn drop(&mut self) {
14193                 if self.result_ok {
14194                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14195                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14196                         }
14197                 } else {
14198                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14199                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14200                         }
14201                 }
14202         }
14203 }
14204 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
14205         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
14206                 let contents = if o.result_ok {
14207                         let result = unsafe { o.contents.result };
14208                         unsafe { o.contents.result = core::ptr::null_mut() };
14209                         CResult_ChannelReadyDecodeErrorZPtr { result }
14210                 } else {
14211                         let err = unsafe { o.contents.err };
14212                         unsafe { o.contents.err = core::ptr::null_mut(); }
14213                         CResult_ChannelReadyDecodeErrorZPtr { err }
14214                 };
14215                 Self {
14216                         contents,
14217                         result_ok: o.result_ok,
14218                 }
14219         }
14220 }
14221 impl Clone for CResult_ChannelReadyDecodeErrorZ {
14222         fn clone(&self) -> Self {
14223                 if self.result_ok {
14224                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
14225                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
14226                         } }
14227                 } else {
14228                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
14229                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14230                         } }
14231                 }
14232         }
14233 }
14234 #[no_mangle]
14235 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
14236 /// but with all dynamically-allocated buffers duplicated in new buffers.
14237 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
14238 #[repr(C)]
14239 /// The contents of CResult_InitDecodeErrorZ
14240 pub union CResult_InitDecodeErrorZPtr {
14241         /// A pointer to the contents in the success state.
14242         /// Reading from this pointer when `result_ok` is not set is undefined.
14243         pub result: *mut crate::lightning::ln::msgs::Init,
14244         /// A pointer to the contents in the error state.
14245         /// Reading from this pointer when `result_ok` is set is undefined.
14246         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14247 }
14248 #[repr(C)]
14249 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
14250 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
14251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14252 pub struct CResult_InitDecodeErrorZ {
14253         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
14254         /// `err` or `result` depending on the state of `result_ok`.
14255         pub contents: CResult_InitDecodeErrorZPtr,
14256         /// Whether this CResult_InitDecodeErrorZ represents a success state.
14257         pub result_ok: bool,
14258 }
14259 #[no_mangle]
14260 /// Creates a new CResult_InitDecodeErrorZ in the success state.
14261 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
14262         CResult_InitDecodeErrorZ {
14263                 contents: CResult_InitDecodeErrorZPtr {
14264                         result: Box::into_raw(Box::new(o)),
14265                 },
14266                 result_ok: true,
14267         }
14268 }
14269 #[no_mangle]
14270 /// Creates a new CResult_InitDecodeErrorZ in the error state.
14271 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
14272         CResult_InitDecodeErrorZ {
14273                 contents: CResult_InitDecodeErrorZPtr {
14274                         err: Box::into_raw(Box::new(e)),
14275                 },
14276                 result_ok: false,
14277         }
14278 }
14279 /// Checks if the given object is currently in the success state
14280 #[no_mangle]
14281 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
14282         o.result_ok
14283 }
14284 #[no_mangle]
14285 /// Frees any resources used by the CResult_InitDecodeErrorZ.
14286 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
14287 impl Drop for CResult_InitDecodeErrorZ {
14288         fn drop(&mut self) {
14289                 if self.result_ok {
14290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14292                         }
14293                 } else {
14294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14296                         }
14297                 }
14298         }
14299 }
14300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
14301         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
14302                 let contents = if o.result_ok {
14303                         let result = unsafe { o.contents.result };
14304                         unsafe { o.contents.result = core::ptr::null_mut() };
14305                         CResult_InitDecodeErrorZPtr { result }
14306                 } else {
14307                         let err = unsafe { o.contents.err };
14308                         unsafe { o.contents.err = core::ptr::null_mut(); }
14309                         CResult_InitDecodeErrorZPtr { err }
14310                 };
14311                 Self {
14312                         contents,
14313                         result_ok: o.result_ok,
14314                 }
14315         }
14316 }
14317 impl Clone for CResult_InitDecodeErrorZ {
14318         fn clone(&self) -> Self {
14319                 if self.result_ok {
14320                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
14321                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
14322                         } }
14323                 } else {
14324                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
14325                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14326                         } }
14327                 }
14328         }
14329 }
14330 #[no_mangle]
14331 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
14332 /// but with all dynamically-allocated buffers duplicated in new buffers.
14333 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
14334 #[repr(C)]
14335 /// The contents of CResult_OpenChannelDecodeErrorZ
14336 pub union CResult_OpenChannelDecodeErrorZPtr {
14337         /// A pointer to the contents in the success state.
14338         /// Reading from this pointer when `result_ok` is not set is undefined.
14339         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
14340         /// A pointer to the contents in the error state.
14341         /// Reading from this pointer when `result_ok` is set is undefined.
14342         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14343 }
14344 #[repr(C)]
14345 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
14346 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
14347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14348 pub struct CResult_OpenChannelDecodeErrorZ {
14349         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
14350         /// `err` or `result` depending on the state of `result_ok`.
14351         pub contents: CResult_OpenChannelDecodeErrorZPtr,
14352         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
14353         pub result_ok: bool,
14354 }
14355 #[no_mangle]
14356 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
14357 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
14358         CResult_OpenChannelDecodeErrorZ {
14359                 contents: CResult_OpenChannelDecodeErrorZPtr {
14360                         result: Box::into_raw(Box::new(o)),
14361                 },
14362                 result_ok: true,
14363         }
14364 }
14365 #[no_mangle]
14366 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
14367 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
14368         CResult_OpenChannelDecodeErrorZ {
14369                 contents: CResult_OpenChannelDecodeErrorZPtr {
14370                         err: Box::into_raw(Box::new(e)),
14371                 },
14372                 result_ok: false,
14373         }
14374 }
14375 /// Checks if the given object is currently in the success state
14376 #[no_mangle]
14377 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
14378         o.result_ok
14379 }
14380 #[no_mangle]
14381 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
14382 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
14383 impl Drop for CResult_OpenChannelDecodeErrorZ {
14384         fn drop(&mut self) {
14385                 if self.result_ok {
14386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14388                         }
14389                 } else {
14390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14392                         }
14393                 }
14394         }
14395 }
14396 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
14397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
14398                 let contents = if o.result_ok {
14399                         let result = unsafe { o.contents.result };
14400                         unsafe { o.contents.result = core::ptr::null_mut() };
14401                         CResult_OpenChannelDecodeErrorZPtr { result }
14402                 } else {
14403                         let err = unsafe { o.contents.err };
14404                         unsafe { o.contents.err = core::ptr::null_mut(); }
14405                         CResult_OpenChannelDecodeErrorZPtr { err }
14406                 };
14407                 Self {
14408                         contents,
14409                         result_ok: o.result_ok,
14410                 }
14411         }
14412 }
14413 impl Clone for CResult_OpenChannelDecodeErrorZ {
14414         fn clone(&self) -> Self {
14415                 if self.result_ok {
14416                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
14417                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
14418                         } }
14419                 } else {
14420                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
14421                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14422                         } }
14423                 }
14424         }
14425 }
14426 #[no_mangle]
14427 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
14428 /// but with all dynamically-allocated buffers duplicated in new buffers.
14429 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
14430 #[repr(C)]
14431 /// The contents of CResult_RevokeAndACKDecodeErrorZ
14432 pub union CResult_RevokeAndACKDecodeErrorZPtr {
14433         /// A pointer to the contents in the success state.
14434         /// Reading from this pointer when `result_ok` is not set is undefined.
14435         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
14436         /// A pointer to the contents in the error state.
14437         /// Reading from this pointer when `result_ok` is set is undefined.
14438         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14439 }
14440 #[repr(C)]
14441 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
14442 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
14443 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14444 pub struct CResult_RevokeAndACKDecodeErrorZ {
14445         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
14446         /// `err` or `result` depending on the state of `result_ok`.
14447         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
14448         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
14449         pub result_ok: bool,
14450 }
14451 #[no_mangle]
14452 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
14453 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
14454         CResult_RevokeAndACKDecodeErrorZ {
14455                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14456                         result: Box::into_raw(Box::new(o)),
14457                 },
14458                 result_ok: true,
14459         }
14460 }
14461 #[no_mangle]
14462 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
14463 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
14464         CResult_RevokeAndACKDecodeErrorZ {
14465                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
14466                         err: Box::into_raw(Box::new(e)),
14467                 },
14468                 result_ok: false,
14469         }
14470 }
14471 /// Checks if the given object is currently in the success state
14472 #[no_mangle]
14473 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
14474         o.result_ok
14475 }
14476 #[no_mangle]
14477 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
14478 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
14479 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
14480         fn drop(&mut self) {
14481                 if self.result_ok {
14482                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14483                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14484                         }
14485                 } else {
14486                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14487                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14488                         }
14489                 }
14490         }
14491 }
14492 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
14493         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
14494                 let contents = if o.result_ok {
14495                         let result = unsafe { o.contents.result };
14496                         unsafe { o.contents.result = core::ptr::null_mut() };
14497                         CResult_RevokeAndACKDecodeErrorZPtr { result }
14498                 } else {
14499                         let err = unsafe { o.contents.err };
14500                         unsafe { o.contents.err = core::ptr::null_mut(); }
14501                         CResult_RevokeAndACKDecodeErrorZPtr { err }
14502                 };
14503                 Self {
14504                         contents,
14505                         result_ok: o.result_ok,
14506                 }
14507         }
14508 }
14509 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
14510         fn clone(&self) -> Self {
14511                 if self.result_ok {
14512                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14513                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
14514                         } }
14515                 } else {
14516                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
14517                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14518                         } }
14519                 }
14520         }
14521 }
14522 #[no_mangle]
14523 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
14524 /// but with all dynamically-allocated buffers duplicated in new buffers.
14525 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
14526 #[repr(C)]
14527 /// The contents of CResult_ShutdownDecodeErrorZ
14528 pub union CResult_ShutdownDecodeErrorZPtr {
14529         /// A pointer to the contents in the success state.
14530         /// Reading from this pointer when `result_ok` is not set is undefined.
14531         pub result: *mut crate::lightning::ln::msgs::Shutdown,
14532         /// A pointer to the contents in the error state.
14533         /// Reading from this pointer when `result_ok` is set is undefined.
14534         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14535 }
14536 #[repr(C)]
14537 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
14538 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
14539 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14540 pub struct CResult_ShutdownDecodeErrorZ {
14541         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
14542         /// `err` or `result` depending on the state of `result_ok`.
14543         pub contents: CResult_ShutdownDecodeErrorZPtr,
14544         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
14545         pub result_ok: bool,
14546 }
14547 #[no_mangle]
14548 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
14549 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
14550         CResult_ShutdownDecodeErrorZ {
14551                 contents: CResult_ShutdownDecodeErrorZPtr {
14552                         result: Box::into_raw(Box::new(o)),
14553                 },
14554                 result_ok: true,
14555         }
14556 }
14557 #[no_mangle]
14558 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
14559 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
14560         CResult_ShutdownDecodeErrorZ {
14561                 contents: CResult_ShutdownDecodeErrorZPtr {
14562                         err: Box::into_raw(Box::new(e)),
14563                 },
14564                 result_ok: false,
14565         }
14566 }
14567 /// Checks if the given object is currently in the success state
14568 #[no_mangle]
14569 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
14570         o.result_ok
14571 }
14572 #[no_mangle]
14573 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
14574 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
14575 impl Drop for CResult_ShutdownDecodeErrorZ {
14576         fn drop(&mut self) {
14577                 if self.result_ok {
14578                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14579                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14580                         }
14581                 } else {
14582                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14583                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14584                         }
14585                 }
14586         }
14587 }
14588 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
14589         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
14590                 let contents = if o.result_ok {
14591                         let result = unsafe { o.contents.result };
14592                         unsafe { o.contents.result = core::ptr::null_mut() };
14593                         CResult_ShutdownDecodeErrorZPtr { result }
14594                 } else {
14595                         let err = unsafe { o.contents.err };
14596                         unsafe { o.contents.err = core::ptr::null_mut(); }
14597                         CResult_ShutdownDecodeErrorZPtr { err }
14598                 };
14599                 Self {
14600                         contents,
14601                         result_ok: o.result_ok,
14602                 }
14603         }
14604 }
14605 impl Clone for CResult_ShutdownDecodeErrorZ {
14606         fn clone(&self) -> Self {
14607                 if self.result_ok {
14608                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
14609                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
14610                         } }
14611                 } else {
14612                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
14613                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14614                         } }
14615                 }
14616         }
14617 }
14618 #[no_mangle]
14619 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
14620 /// but with all dynamically-allocated buffers duplicated in new buffers.
14621 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
14622 #[repr(C)]
14623 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
14624 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
14625         /// A pointer to the contents in the success state.
14626         /// Reading from this pointer when `result_ok` is not set is undefined.
14627         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
14628         /// A pointer to the contents in the error state.
14629         /// Reading from this pointer when `result_ok` is set is undefined.
14630         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14631 }
14632 #[repr(C)]
14633 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
14634 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14635 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14636 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
14637         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
14638         /// `err` or `result` depending on the state of `result_ok`.
14639         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
14640         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
14641         pub result_ok: bool,
14642 }
14643 #[no_mangle]
14644 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
14645 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
14646         CResult_UpdateFailHTLCDecodeErrorZ {
14647                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14648                         result: Box::into_raw(Box::new(o)),
14649                 },
14650                 result_ok: true,
14651         }
14652 }
14653 #[no_mangle]
14654 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
14655 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
14656         CResult_UpdateFailHTLCDecodeErrorZ {
14657                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14658                         err: Box::into_raw(Box::new(e)),
14659                 },
14660                 result_ok: false,
14661         }
14662 }
14663 /// Checks if the given object is currently in the success state
14664 #[no_mangle]
14665 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
14666         o.result_ok
14667 }
14668 #[no_mangle]
14669 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
14670 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
14671 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
14672         fn drop(&mut self) {
14673                 if self.result_ok {
14674                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14675                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14676                         }
14677                 } else {
14678                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14679                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14680                         }
14681                 }
14682         }
14683 }
14684 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
14685         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14686                 let contents = if o.result_ok {
14687                         let result = unsafe { o.contents.result };
14688                         unsafe { o.contents.result = core::ptr::null_mut() };
14689                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
14690                 } else {
14691                         let err = unsafe { o.contents.err };
14692                         unsafe { o.contents.err = core::ptr::null_mut(); }
14693                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
14694                 };
14695                 Self {
14696                         contents,
14697                         result_ok: o.result_ok,
14698                 }
14699         }
14700 }
14701 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
14702         fn clone(&self) -> Self {
14703                 if self.result_ok {
14704                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14705                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
14706                         } }
14707                 } else {
14708                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
14709                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14710                         } }
14711                 }
14712         }
14713 }
14714 #[no_mangle]
14715 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
14716 /// but with all dynamically-allocated buffers duplicated in new buffers.
14717 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
14718 #[repr(C)]
14719 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
14720 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14721         /// A pointer to the contents in the success state.
14722         /// Reading from this pointer when `result_ok` is not set is undefined.
14723         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
14724         /// A pointer to the contents in the error state.
14725         /// Reading from this pointer when `result_ok` is set is undefined.
14726         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14727 }
14728 #[repr(C)]
14729 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
14730 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14732 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14733         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
14734         /// `err` or `result` depending on the state of `result_ok`.
14735         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
14736         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
14737         pub result_ok: bool,
14738 }
14739 #[no_mangle]
14740 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
14741 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14742         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14743                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14744                         result: Box::into_raw(Box::new(o)),
14745                 },
14746                 result_ok: true,
14747         }
14748 }
14749 #[no_mangle]
14750 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
14751 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14752         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14753                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14754                         err: Box::into_raw(Box::new(e)),
14755                 },
14756                 result_ok: false,
14757         }
14758 }
14759 /// Checks if the given object is currently in the success state
14760 #[no_mangle]
14761 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
14762         o.result_ok
14763 }
14764 #[no_mangle]
14765 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
14766 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
14767 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14768         fn drop(&mut self) {
14769                 if self.result_ok {
14770                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14771                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14772                         }
14773                 } else {
14774                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14775                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14776                         }
14777                 }
14778         }
14779 }
14780 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14781         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14782                 let contents = if o.result_ok {
14783                         let result = unsafe { o.contents.result };
14784                         unsafe { o.contents.result = core::ptr::null_mut() };
14785                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
14786                 } else {
14787                         let err = unsafe { o.contents.err };
14788                         unsafe { o.contents.err = core::ptr::null_mut(); }
14789                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
14790                 };
14791                 Self {
14792                         contents,
14793                         result_ok: o.result_ok,
14794                 }
14795         }
14796 }
14797 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
14798         fn clone(&self) -> Self {
14799                 if self.result_ok {
14800                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14801                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
14802                         } }
14803                 } else {
14804                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
14805                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14806                         } }
14807                 }
14808         }
14809 }
14810 #[no_mangle]
14811 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
14812 /// but with all dynamically-allocated buffers duplicated in new buffers.
14813 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
14814 #[repr(C)]
14815 /// The contents of CResult_UpdateFeeDecodeErrorZ
14816 pub union CResult_UpdateFeeDecodeErrorZPtr {
14817         /// A pointer to the contents in the success state.
14818         /// Reading from this pointer when `result_ok` is not set is undefined.
14819         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14820         /// A pointer to the contents in the error state.
14821         /// Reading from this pointer when `result_ok` is set is undefined.
14822         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14823 }
14824 #[repr(C)]
14825 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14826 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14828 pub struct CResult_UpdateFeeDecodeErrorZ {
14829         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14830         /// `err` or `result` depending on the state of `result_ok`.
14831         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14832         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14833         pub result_ok: bool,
14834 }
14835 #[no_mangle]
14836 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14837 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14838         CResult_UpdateFeeDecodeErrorZ {
14839                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14840                         result: Box::into_raw(Box::new(o)),
14841                 },
14842                 result_ok: true,
14843         }
14844 }
14845 #[no_mangle]
14846 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14847 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14848         CResult_UpdateFeeDecodeErrorZ {
14849                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14850                         err: Box::into_raw(Box::new(e)),
14851                 },
14852                 result_ok: false,
14853         }
14854 }
14855 /// Checks if the given object is currently in the success state
14856 #[no_mangle]
14857 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14858         o.result_ok
14859 }
14860 #[no_mangle]
14861 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14862 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14863 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14864         fn drop(&mut self) {
14865                 if self.result_ok {
14866                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14867                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14868                         }
14869                 } else {
14870                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14871                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14872                         }
14873                 }
14874         }
14875 }
14876 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14877         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14878                 let contents = if o.result_ok {
14879                         let result = unsafe { o.contents.result };
14880                         unsafe { o.contents.result = core::ptr::null_mut() };
14881                         CResult_UpdateFeeDecodeErrorZPtr { result }
14882                 } else {
14883                         let err = unsafe { o.contents.err };
14884                         unsafe { o.contents.err = core::ptr::null_mut(); }
14885                         CResult_UpdateFeeDecodeErrorZPtr { err }
14886                 };
14887                 Self {
14888                         contents,
14889                         result_ok: o.result_ok,
14890                 }
14891         }
14892 }
14893 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14894         fn clone(&self) -> Self {
14895                 if self.result_ok {
14896                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14897                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14898                         } }
14899                 } else {
14900                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14901                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14902                         } }
14903                 }
14904         }
14905 }
14906 #[no_mangle]
14907 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14908 /// but with all dynamically-allocated buffers duplicated in new buffers.
14909 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14910 #[repr(C)]
14911 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14912 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14913         /// A pointer to the contents in the success state.
14914         /// Reading from this pointer when `result_ok` is not set is undefined.
14915         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14916         /// A pointer to the contents in the error state.
14917         /// Reading from this pointer when `result_ok` is set is undefined.
14918         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14919 }
14920 #[repr(C)]
14921 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14922 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14924 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14925         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14926         /// `err` or `result` depending on the state of `result_ok`.
14927         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14928         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14929         pub result_ok: bool,
14930 }
14931 #[no_mangle]
14932 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14933 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14934         CResult_UpdateFulfillHTLCDecodeErrorZ {
14935                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14936                         result: Box::into_raw(Box::new(o)),
14937                 },
14938                 result_ok: true,
14939         }
14940 }
14941 #[no_mangle]
14942 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14943 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14944         CResult_UpdateFulfillHTLCDecodeErrorZ {
14945                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14946                         err: Box::into_raw(Box::new(e)),
14947                 },
14948                 result_ok: false,
14949         }
14950 }
14951 /// Checks if the given object is currently in the success state
14952 #[no_mangle]
14953 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14954         o.result_ok
14955 }
14956 #[no_mangle]
14957 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14958 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14959 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14960         fn drop(&mut self) {
14961                 if self.result_ok {
14962                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14963                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14964                         }
14965                 } else {
14966                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14967                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14968                         }
14969                 }
14970         }
14971 }
14972 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14973         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14974                 let contents = if o.result_ok {
14975                         let result = unsafe { o.contents.result };
14976                         unsafe { o.contents.result = core::ptr::null_mut() };
14977                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14978                 } else {
14979                         let err = unsafe { o.contents.err };
14980                         unsafe { o.contents.err = core::ptr::null_mut(); }
14981                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14982                 };
14983                 Self {
14984                         contents,
14985                         result_ok: o.result_ok,
14986                 }
14987         }
14988 }
14989 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14990         fn clone(&self) -> Self {
14991                 if self.result_ok {
14992                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14993                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14994                         } }
14995                 } else {
14996                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14997                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14998                         } }
14999                 }
15000         }
15001 }
15002 #[no_mangle]
15003 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15004 /// but with all dynamically-allocated buffers duplicated in new buffers.
15005 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
15006 #[repr(C)]
15007 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
15008 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
15009         /// A pointer to the contents in the success state.
15010         /// Reading from this pointer when `result_ok` is not set is undefined.
15011         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
15012         /// A pointer to the contents in the error state.
15013         /// Reading from this pointer when `result_ok` is set is undefined.
15014         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15015 }
15016 #[repr(C)]
15017 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
15018 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
15019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15020 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
15021         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
15022         /// `err` or `result` depending on the state of `result_ok`.
15023         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
15024         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
15025         pub result_ok: bool,
15026 }
15027 #[no_mangle]
15028 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15029 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
15030         CResult_UpdateAddHTLCDecodeErrorZ {
15031                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15032                         result: Box::into_raw(Box::new(o)),
15033                 },
15034                 result_ok: true,
15035         }
15036 }
15037 #[no_mangle]
15038 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15039 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
15040         CResult_UpdateAddHTLCDecodeErrorZ {
15041                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15042                         err: Box::into_raw(Box::new(e)),
15043                 },
15044                 result_ok: false,
15045         }
15046 }
15047 /// Checks if the given object is currently in the success state
15048 #[no_mangle]
15049 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
15050         o.result_ok
15051 }
15052 #[no_mangle]
15053 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15054 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
15055 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
15056         fn drop(&mut self) {
15057                 if self.result_ok {
15058                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15059                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15060                         }
15061                 } else {
15062                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15063                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15064                         }
15065                 }
15066         }
15067 }
15068 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
15069         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
15070                 let contents = if o.result_ok {
15071                         let result = unsafe { o.contents.result };
15072                         unsafe { o.contents.result = core::ptr::null_mut() };
15073                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
15074                 } else {
15075                         let err = unsafe { o.contents.err };
15076                         unsafe { o.contents.err = core::ptr::null_mut(); }
15077                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
15078                 };
15079                 Self {
15080                         contents,
15081                         result_ok: o.result_ok,
15082                 }
15083         }
15084 }
15085 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
15086         fn clone(&self) -> Self {
15087                 if self.result_ok {
15088                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15089                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
15090                         } }
15091                 } else {
15092                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
15093                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15094                         } }
15095                 }
15096         }
15097 }
15098 #[no_mangle]
15099 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15100 /// but with all dynamically-allocated buffers duplicated in new buffers.
15101 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
15102 #[repr(C)]
15103 /// The contents of CResult_OnionMessageDecodeErrorZ
15104 pub union CResult_OnionMessageDecodeErrorZPtr {
15105         /// A pointer to the contents in the success state.
15106         /// Reading from this pointer when `result_ok` is not set is undefined.
15107         pub result: *mut crate::lightning::ln::msgs::OnionMessage,
15108         /// A pointer to the contents in the error state.
15109         /// Reading from this pointer when `result_ok` is set is undefined.
15110         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15111 }
15112 #[repr(C)]
15113 /// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation,
15114 /// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15115 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15116 pub struct CResult_OnionMessageDecodeErrorZ {
15117         /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either
15118         /// `err` or `result` depending on the state of `result_ok`.
15119         pub contents: CResult_OnionMessageDecodeErrorZPtr,
15120         /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state.
15121         pub result_ok: bool,
15122 }
15123 #[no_mangle]
15124 /// Creates a new CResult_OnionMessageDecodeErrorZ in the success state.
15125 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ {
15126         CResult_OnionMessageDecodeErrorZ {
15127                 contents: CResult_OnionMessageDecodeErrorZPtr {
15128                         result: Box::into_raw(Box::new(o)),
15129                 },
15130                 result_ok: true,
15131         }
15132 }
15133 #[no_mangle]
15134 /// Creates a new CResult_OnionMessageDecodeErrorZ in the error state.
15135 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ {
15136         CResult_OnionMessageDecodeErrorZ {
15137                 contents: CResult_OnionMessageDecodeErrorZPtr {
15138                         err: Box::into_raw(Box::new(e)),
15139                 },
15140                 result_ok: false,
15141         }
15142 }
15143 /// Checks if the given object is currently in the success state
15144 #[no_mangle]
15145 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool {
15146         o.result_ok
15147 }
15148 #[no_mangle]
15149 /// Frees any resources used by the CResult_OnionMessageDecodeErrorZ.
15150 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { }
15151 impl Drop for CResult_OnionMessageDecodeErrorZ {
15152         fn drop(&mut self) {
15153                 if self.result_ok {
15154                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15155                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15156                         }
15157                 } else {
15158                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15159                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15160                         }
15161                 }
15162         }
15163 }
15164 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_OnionMessageDecodeErrorZ {
15165         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OnionMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15166                 let contents = if o.result_ok {
15167                         let result = unsafe { o.contents.result };
15168                         unsafe { o.contents.result = core::ptr::null_mut() };
15169                         CResult_OnionMessageDecodeErrorZPtr { result }
15170                 } else {
15171                         let err = unsafe { o.contents.err };
15172                         unsafe { o.contents.err = core::ptr::null_mut(); }
15173                         CResult_OnionMessageDecodeErrorZPtr { err }
15174                 };
15175                 Self {
15176                         contents,
15177                         result_ok: o.result_ok,
15178                 }
15179         }
15180 }
15181 impl Clone for CResult_OnionMessageDecodeErrorZ {
15182         fn clone(&self) -> Self {
15183                 if self.result_ok {
15184                         Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr {
15185                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OnionMessage>::clone(unsafe { &*self.contents.result })))
15186                         } }
15187                 } else {
15188                         Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr {
15189                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15190                         } }
15191                 }
15192         }
15193 }
15194 #[no_mangle]
15195 /// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig`
15196 /// but with all dynamically-allocated buffers duplicated in new buffers.
15197 pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) }
15198 #[repr(C)]
15199 /// The contents of CResult_PingDecodeErrorZ
15200 pub union CResult_PingDecodeErrorZPtr {
15201         /// A pointer to the contents in the success state.
15202         /// Reading from this pointer when `result_ok` is not set is undefined.
15203         pub result: *mut crate::lightning::ln::msgs::Ping,
15204         /// A pointer to the contents in the error state.
15205         /// Reading from this pointer when `result_ok` is set is undefined.
15206         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15207 }
15208 #[repr(C)]
15209 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
15210 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
15211 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15212 pub struct CResult_PingDecodeErrorZ {
15213         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
15214         /// `err` or `result` depending on the state of `result_ok`.
15215         pub contents: CResult_PingDecodeErrorZPtr,
15216         /// Whether this CResult_PingDecodeErrorZ represents a success state.
15217         pub result_ok: bool,
15218 }
15219 #[no_mangle]
15220 /// Creates a new CResult_PingDecodeErrorZ in the success state.
15221 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
15222         CResult_PingDecodeErrorZ {
15223                 contents: CResult_PingDecodeErrorZPtr {
15224                         result: Box::into_raw(Box::new(o)),
15225                 },
15226                 result_ok: true,
15227         }
15228 }
15229 #[no_mangle]
15230 /// Creates a new CResult_PingDecodeErrorZ in the error state.
15231 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
15232         CResult_PingDecodeErrorZ {
15233                 contents: CResult_PingDecodeErrorZPtr {
15234                         err: Box::into_raw(Box::new(e)),
15235                 },
15236                 result_ok: false,
15237         }
15238 }
15239 /// Checks if the given object is currently in the success state
15240 #[no_mangle]
15241 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
15242         o.result_ok
15243 }
15244 #[no_mangle]
15245 /// Frees any resources used by the CResult_PingDecodeErrorZ.
15246 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
15247 impl Drop for CResult_PingDecodeErrorZ {
15248         fn drop(&mut self) {
15249                 if self.result_ok {
15250                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15251                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15252                         }
15253                 } else {
15254                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15255                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15256                         }
15257                 }
15258         }
15259 }
15260 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
15261         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
15262                 let contents = if o.result_ok {
15263                         let result = unsafe { o.contents.result };
15264                         unsafe { o.contents.result = core::ptr::null_mut() };
15265                         CResult_PingDecodeErrorZPtr { result }
15266                 } else {
15267                         let err = unsafe { o.contents.err };
15268                         unsafe { o.contents.err = core::ptr::null_mut(); }
15269                         CResult_PingDecodeErrorZPtr { err }
15270                 };
15271                 Self {
15272                         contents,
15273                         result_ok: o.result_ok,
15274                 }
15275         }
15276 }
15277 impl Clone for CResult_PingDecodeErrorZ {
15278         fn clone(&self) -> Self {
15279                 if self.result_ok {
15280                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
15281                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
15282                         } }
15283                 } else {
15284                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
15285                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15286                         } }
15287                 }
15288         }
15289 }
15290 #[no_mangle]
15291 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15292 /// but with all dynamically-allocated buffers duplicated in new buffers.
15293 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
15294 #[repr(C)]
15295 /// The contents of CResult_PongDecodeErrorZ
15296 pub union CResult_PongDecodeErrorZPtr {
15297         /// A pointer to the contents in the success state.
15298         /// Reading from this pointer when `result_ok` is not set is undefined.
15299         pub result: *mut crate::lightning::ln::msgs::Pong,
15300         /// A pointer to the contents in the error state.
15301         /// Reading from this pointer when `result_ok` is set is undefined.
15302         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15303 }
15304 #[repr(C)]
15305 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
15306 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
15307 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15308 pub struct CResult_PongDecodeErrorZ {
15309         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
15310         /// `err` or `result` depending on the state of `result_ok`.
15311         pub contents: CResult_PongDecodeErrorZPtr,
15312         /// Whether this CResult_PongDecodeErrorZ represents a success state.
15313         pub result_ok: bool,
15314 }
15315 #[no_mangle]
15316 /// Creates a new CResult_PongDecodeErrorZ in the success state.
15317 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
15318         CResult_PongDecodeErrorZ {
15319                 contents: CResult_PongDecodeErrorZPtr {
15320                         result: Box::into_raw(Box::new(o)),
15321                 },
15322                 result_ok: true,
15323         }
15324 }
15325 #[no_mangle]
15326 /// Creates a new CResult_PongDecodeErrorZ in the error state.
15327 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
15328         CResult_PongDecodeErrorZ {
15329                 contents: CResult_PongDecodeErrorZPtr {
15330                         err: Box::into_raw(Box::new(e)),
15331                 },
15332                 result_ok: false,
15333         }
15334 }
15335 /// Checks if the given object is currently in the success state
15336 #[no_mangle]
15337 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
15338         o.result_ok
15339 }
15340 #[no_mangle]
15341 /// Frees any resources used by the CResult_PongDecodeErrorZ.
15342 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
15343 impl Drop for CResult_PongDecodeErrorZ {
15344         fn drop(&mut self) {
15345                 if self.result_ok {
15346                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15347                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15348                         }
15349                 } else {
15350                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15351                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15352                         }
15353                 }
15354         }
15355 }
15356 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
15357         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
15358                 let contents = if o.result_ok {
15359                         let result = unsafe { o.contents.result };
15360                         unsafe { o.contents.result = core::ptr::null_mut() };
15361                         CResult_PongDecodeErrorZPtr { result }
15362                 } else {
15363                         let err = unsafe { o.contents.err };
15364                         unsafe { o.contents.err = core::ptr::null_mut(); }
15365                         CResult_PongDecodeErrorZPtr { err }
15366                 };
15367                 Self {
15368                         contents,
15369                         result_ok: o.result_ok,
15370                 }
15371         }
15372 }
15373 impl Clone for CResult_PongDecodeErrorZ {
15374         fn clone(&self) -> Self {
15375                 if self.result_ok {
15376                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
15377                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
15378                         } }
15379                 } else {
15380                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
15381                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15382                         } }
15383                 }
15384         }
15385 }
15386 #[no_mangle]
15387 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15388 /// but with all dynamically-allocated buffers duplicated in new buffers.
15389 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
15390 #[repr(C)]
15391 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
15392 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15393         /// A pointer to the contents in the success state.
15394         /// Reading from this pointer when `result_ok` is not set is undefined.
15395         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
15396         /// A pointer to the contents in the error state.
15397         /// Reading from this pointer when `result_ok` is set is undefined.
15398         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15399 }
15400 #[repr(C)]
15401 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15402 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15403 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15404 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15405         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
15406         /// `err` or `result` depending on the state of `result_ok`.
15407         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
15408         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
15409         pub result_ok: bool,
15410 }
15411 #[no_mangle]
15412 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15413 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15414         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15415                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15416                         result: Box::into_raw(Box::new(o)),
15417                 },
15418                 result_ok: true,
15419         }
15420 }
15421 #[no_mangle]
15422 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15423 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15424         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15425                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15426                         err: Box::into_raw(Box::new(e)),
15427                 },
15428                 result_ok: false,
15429         }
15430 }
15431 /// Checks if the given object is currently in the success state
15432 #[no_mangle]
15433 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
15434         o.result_ok
15435 }
15436 #[no_mangle]
15437 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15438 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
15439 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15440         fn drop(&mut self) {
15441                 if self.result_ok {
15442                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15443                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15444                         }
15445                 } else {
15446                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15447                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15448                         }
15449                 }
15450         }
15451 }
15452 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15453         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15454                 let contents = if o.result_ok {
15455                         let result = unsafe { o.contents.result };
15456                         unsafe { o.contents.result = core::ptr::null_mut() };
15457                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
15458                 } else {
15459                         let err = unsafe { o.contents.err };
15460                         unsafe { o.contents.err = core::ptr::null_mut(); }
15461                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
15462                 };
15463                 Self {
15464                         contents,
15465                         result_ok: o.result_ok,
15466                 }
15467         }
15468 }
15469 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
15470         fn clone(&self) -> Self {
15471                 if self.result_ok {
15472                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15473                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15474                         } }
15475                 } else {
15476                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
15477                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15478                         } }
15479                 }
15480         }
15481 }
15482 #[no_mangle]
15483 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15484 /// but with all dynamically-allocated buffers duplicated in new buffers.
15485 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15486 #[repr(C)]
15487 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
15488 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
15489         /// A pointer to the contents in the success state.
15490         /// Reading from this pointer when `result_ok` is not set is undefined.
15491         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
15492         /// A pointer to the contents in the error state.
15493         /// Reading from this pointer when `result_ok` is set is undefined.
15494         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15495 }
15496 #[repr(C)]
15497 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
15498 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15500 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
15501         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
15502         /// `err` or `result` depending on the state of `result_ok`.
15503         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
15504         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
15505         pub result_ok: bool,
15506 }
15507 #[no_mangle]
15508 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15509 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
15510         CResult_ChannelAnnouncementDecodeErrorZ {
15511                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15512                         result: Box::into_raw(Box::new(o)),
15513                 },
15514                 result_ok: true,
15515         }
15516 }
15517 #[no_mangle]
15518 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15519 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
15520         CResult_ChannelAnnouncementDecodeErrorZ {
15521                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15522                         err: Box::into_raw(Box::new(e)),
15523                 },
15524                 result_ok: false,
15525         }
15526 }
15527 /// Checks if the given object is currently in the success state
15528 #[no_mangle]
15529 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
15530         o.result_ok
15531 }
15532 #[no_mangle]
15533 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15534 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
15535 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
15536         fn drop(&mut self) {
15537                 if self.result_ok {
15538                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15539                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15540                         }
15541                 } else {
15542                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15543                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15544                         }
15545                 }
15546         }
15547 }
15548 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
15549         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15550                 let contents = if o.result_ok {
15551                         let result = unsafe { o.contents.result };
15552                         unsafe { o.contents.result = core::ptr::null_mut() };
15553                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
15554                 } else {
15555                         let err = unsafe { o.contents.err };
15556                         unsafe { o.contents.err = core::ptr::null_mut(); }
15557                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
15558                 };
15559                 Self {
15560                         contents,
15561                         result_ok: o.result_ok,
15562                 }
15563         }
15564 }
15565 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
15566         fn clone(&self) -> Self {
15567                 if self.result_ok {
15568                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15569                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
15570                         } }
15571                 } else {
15572                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
15573                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15574                         } }
15575                 }
15576         }
15577 }
15578 #[no_mangle]
15579 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15580 /// but with all dynamically-allocated buffers duplicated in new buffers.
15581 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15582 #[repr(C)]
15583 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
15584 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15585         /// A pointer to the contents in the success state.
15586         /// Reading from this pointer when `result_ok` is not set is undefined.
15587         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
15588         /// A pointer to the contents in the error state.
15589         /// Reading from this pointer when `result_ok` is set is undefined.
15590         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15591 }
15592 #[repr(C)]
15593 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15594 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15595 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15596 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
15597         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
15598         /// `err` or `result` depending on the state of `result_ok`.
15599         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
15600         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
15601         pub result_ok: bool,
15602 }
15603 #[no_mangle]
15604 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15605 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15606         CResult_UnsignedChannelUpdateDecodeErrorZ {
15607                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15608                         result: Box::into_raw(Box::new(o)),
15609                 },
15610                 result_ok: true,
15611         }
15612 }
15613 #[no_mangle]
15614 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15615 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
15616         CResult_UnsignedChannelUpdateDecodeErrorZ {
15617                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15618                         err: Box::into_raw(Box::new(e)),
15619                 },
15620                 result_ok: false,
15621         }
15622 }
15623 /// Checks if the given object is currently in the success state
15624 #[no_mangle]
15625 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
15626         o.result_ok
15627 }
15628 #[no_mangle]
15629 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15630 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
15631 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
15632         fn drop(&mut self) {
15633                 if self.result_ok {
15634                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15635                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15636                         }
15637                 } else {
15638                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15639                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15640                         }
15641                 }
15642         }
15643 }
15644 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
15645         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15646                 let contents = if o.result_ok {
15647                         let result = unsafe { o.contents.result };
15648                         unsafe { o.contents.result = core::ptr::null_mut() };
15649                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
15650                 } else {
15651                         let err = unsafe { o.contents.err };
15652                         unsafe { o.contents.err = core::ptr::null_mut(); }
15653                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
15654                 };
15655                 Self {
15656                         contents,
15657                         result_ok: o.result_ok,
15658                 }
15659         }
15660 }
15661 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
15662         fn clone(&self) -> Self {
15663                 if self.result_ok {
15664                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15665                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
15666                         } }
15667                 } else {
15668                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
15669                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15670                         } }
15671                 }
15672         }
15673 }
15674 #[no_mangle]
15675 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15676 /// but with all dynamically-allocated buffers duplicated in new buffers.
15677 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15678 #[repr(C)]
15679 /// The contents of CResult_ChannelUpdateDecodeErrorZ
15680 pub union CResult_ChannelUpdateDecodeErrorZPtr {
15681         /// A pointer to the contents in the success state.
15682         /// Reading from this pointer when `result_ok` is not set is undefined.
15683         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
15684         /// A pointer to the contents in the error state.
15685         /// Reading from this pointer when `result_ok` is set is undefined.
15686         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15687 }
15688 #[repr(C)]
15689 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
15690 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
15691 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15692 pub struct CResult_ChannelUpdateDecodeErrorZ {
15693         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
15694         /// `err` or `result` depending on the state of `result_ok`.
15695         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
15696         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
15697         pub result_ok: bool,
15698 }
15699 #[no_mangle]
15700 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15701 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
15702         CResult_ChannelUpdateDecodeErrorZ {
15703                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15704                         result: Box::into_raw(Box::new(o)),
15705                 },
15706                 result_ok: true,
15707         }
15708 }
15709 #[no_mangle]
15710 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15711 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
15712         CResult_ChannelUpdateDecodeErrorZ {
15713                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
15714                         err: Box::into_raw(Box::new(e)),
15715                 },
15716                 result_ok: false,
15717         }
15718 }
15719 /// Checks if the given object is currently in the success state
15720 #[no_mangle]
15721 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
15722         o.result_ok
15723 }
15724 #[no_mangle]
15725 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15726 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
15727 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
15728         fn drop(&mut self) {
15729                 if self.result_ok {
15730                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15731                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15732                         }
15733                 } else {
15734                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15735                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15736                         }
15737                 }
15738         }
15739 }
15740 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
15741         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
15742                 let contents = if o.result_ok {
15743                         let result = unsafe { o.contents.result };
15744                         unsafe { o.contents.result = core::ptr::null_mut() };
15745                         CResult_ChannelUpdateDecodeErrorZPtr { result }
15746                 } else {
15747                         let err = unsafe { o.contents.err };
15748                         unsafe { o.contents.err = core::ptr::null_mut(); }
15749                         CResult_ChannelUpdateDecodeErrorZPtr { err }
15750                 };
15751                 Self {
15752                         contents,
15753                         result_ok: o.result_ok,
15754                 }
15755         }
15756 }
15757 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
15758         fn clone(&self) -> Self {
15759                 if self.result_ok {
15760                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15761                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
15762                         } }
15763                 } else {
15764                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
15765                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15766                         } }
15767                 }
15768         }
15769 }
15770 #[no_mangle]
15771 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15772 /// but with all dynamically-allocated buffers duplicated in new buffers.
15773 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
15774 #[repr(C)]
15775 /// The contents of CResult_ErrorMessageDecodeErrorZ
15776 pub union CResult_ErrorMessageDecodeErrorZPtr {
15777         /// A pointer to the contents in the success state.
15778         /// Reading from this pointer when `result_ok` is not set is undefined.
15779         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
15780         /// A pointer to the contents in the error state.
15781         /// Reading from this pointer when `result_ok` is set is undefined.
15782         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15783 }
15784 #[repr(C)]
15785 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
15786 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15787 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15788 pub struct CResult_ErrorMessageDecodeErrorZ {
15789         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
15790         /// `err` or `result` depending on the state of `result_ok`.
15791         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
15792         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
15793         pub result_ok: bool,
15794 }
15795 #[no_mangle]
15796 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15797 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
15798         CResult_ErrorMessageDecodeErrorZ {
15799                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15800                         result: Box::into_raw(Box::new(o)),
15801                 },
15802                 result_ok: true,
15803         }
15804 }
15805 #[no_mangle]
15806 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15807 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
15808         CResult_ErrorMessageDecodeErrorZ {
15809                 contents: CResult_ErrorMessageDecodeErrorZPtr {
15810                         err: Box::into_raw(Box::new(e)),
15811                 },
15812                 result_ok: false,
15813         }
15814 }
15815 /// Checks if the given object is currently in the success state
15816 #[no_mangle]
15817 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
15818         o.result_ok
15819 }
15820 #[no_mangle]
15821 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
15822 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
15823 impl Drop for CResult_ErrorMessageDecodeErrorZ {
15824         fn drop(&mut self) {
15825                 if self.result_ok {
15826                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15827                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15828                         }
15829                 } else {
15830                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15831                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15832                         }
15833                 }
15834         }
15835 }
15836 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
15837         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15838                 let contents = if o.result_ok {
15839                         let result = unsafe { o.contents.result };
15840                         unsafe { o.contents.result = core::ptr::null_mut() };
15841                         CResult_ErrorMessageDecodeErrorZPtr { result }
15842                 } else {
15843                         let err = unsafe { o.contents.err };
15844                         unsafe { o.contents.err = core::ptr::null_mut(); }
15845                         CResult_ErrorMessageDecodeErrorZPtr { err }
15846                 };
15847                 Self {
15848                         contents,
15849                         result_ok: o.result_ok,
15850                 }
15851         }
15852 }
15853 impl Clone for CResult_ErrorMessageDecodeErrorZ {
15854         fn clone(&self) -> Self {
15855                 if self.result_ok {
15856                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
15857                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
15858                         } }
15859                 } else {
15860                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
15861                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15862                         } }
15863                 }
15864         }
15865 }
15866 #[no_mangle]
15867 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
15868 /// but with all dynamically-allocated buffers duplicated in new buffers.
15869 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
15870 #[repr(C)]
15871 /// The contents of CResult_WarningMessageDecodeErrorZ
15872 pub union CResult_WarningMessageDecodeErrorZPtr {
15873         /// A pointer to the contents in the success state.
15874         /// Reading from this pointer when `result_ok` is not set is undefined.
15875         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
15876         /// A pointer to the contents in the error state.
15877         /// Reading from this pointer when `result_ok` is set is undefined.
15878         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15879 }
15880 #[repr(C)]
15881 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
15882 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
15883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15884 pub struct CResult_WarningMessageDecodeErrorZ {
15885         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
15886         /// `err` or `result` depending on the state of `result_ok`.
15887         pub contents: CResult_WarningMessageDecodeErrorZPtr,
15888         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
15889         pub result_ok: bool,
15890 }
15891 #[no_mangle]
15892 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
15893 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
15894         CResult_WarningMessageDecodeErrorZ {
15895                 contents: CResult_WarningMessageDecodeErrorZPtr {
15896                         result: Box::into_raw(Box::new(o)),
15897                 },
15898                 result_ok: true,
15899         }
15900 }
15901 #[no_mangle]
15902 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
15903 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
15904         CResult_WarningMessageDecodeErrorZ {
15905                 contents: CResult_WarningMessageDecodeErrorZPtr {
15906                         err: Box::into_raw(Box::new(e)),
15907                 },
15908                 result_ok: false,
15909         }
15910 }
15911 /// Checks if the given object is currently in the success state
15912 #[no_mangle]
15913 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15914         o.result_ok
15915 }
15916 #[no_mangle]
15917 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15918 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15919 impl Drop for CResult_WarningMessageDecodeErrorZ {
15920         fn drop(&mut self) {
15921                 if self.result_ok {
15922                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15923                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15924                         }
15925                 } else {
15926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15928                         }
15929                 }
15930         }
15931 }
15932 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15933         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15934                 let contents = if o.result_ok {
15935                         let result = unsafe { o.contents.result };
15936                         unsafe { o.contents.result = core::ptr::null_mut() };
15937                         CResult_WarningMessageDecodeErrorZPtr { result }
15938                 } else {
15939                         let err = unsafe { o.contents.err };
15940                         unsafe { o.contents.err = core::ptr::null_mut(); }
15941                         CResult_WarningMessageDecodeErrorZPtr { err }
15942                 };
15943                 Self {
15944                         contents,
15945                         result_ok: o.result_ok,
15946                 }
15947         }
15948 }
15949 impl Clone for CResult_WarningMessageDecodeErrorZ {
15950         fn clone(&self) -> Self {
15951                 if self.result_ok {
15952                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15953                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15954                         } }
15955                 } else {
15956                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15957                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15958                         } }
15959                 }
15960         }
15961 }
15962 #[no_mangle]
15963 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15964 /// but with all dynamically-allocated buffers duplicated in new buffers.
15965 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15966 #[repr(C)]
15967 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15968 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15969         /// A pointer to the contents in the success state.
15970         /// Reading from this pointer when `result_ok` is not set is undefined.
15971         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15972         /// A pointer to the contents in the error state.
15973         /// Reading from this pointer when `result_ok` is set is undefined.
15974         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15975 }
15976 #[repr(C)]
15977 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15978 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15980 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15981         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15982         /// `err` or `result` depending on the state of `result_ok`.
15983         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15984         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15985         pub result_ok: bool,
15986 }
15987 #[no_mangle]
15988 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15989 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15990         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15991                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15992                         result: Box::into_raw(Box::new(o)),
15993                 },
15994                 result_ok: true,
15995         }
15996 }
15997 #[no_mangle]
15998 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15999 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16000         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16001                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16002                         err: Box::into_raw(Box::new(e)),
16003                 },
16004                 result_ok: false,
16005         }
16006 }
16007 /// Checks if the given object is currently in the success state
16008 #[no_mangle]
16009 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
16010         o.result_ok
16011 }
16012 #[no_mangle]
16013 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16014 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
16015 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16016         fn drop(&mut self) {
16017                 if self.result_ok {
16018                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16019                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16020                         }
16021                 } else {
16022                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16023                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16024                         }
16025                 }
16026         }
16027 }
16028 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16029         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16030                 let contents = if o.result_ok {
16031                         let result = unsafe { o.contents.result };
16032                         unsafe { o.contents.result = core::ptr::null_mut() };
16033                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
16034                 } else {
16035                         let err = unsafe { o.contents.err };
16036                         unsafe { o.contents.err = core::ptr::null_mut(); }
16037                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
16038                 };
16039                 Self {
16040                         contents,
16041                         result_ok: o.result_ok,
16042                 }
16043         }
16044 }
16045 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
16046         fn clone(&self) -> Self {
16047                 if self.result_ok {
16048                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16049                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16050                         } }
16051                 } else {
16052                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
16053                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16054                         } }
16055                 }
16056         }
16057 }
16058 #[no_mangle]
16059 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16060 /// but with all dynamically-allocated buffers duplicated in new buffers.
16061 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16062 #[repr(C)]
16063 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
16064 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
16065         /// A pointer to the contents in the success state.
16066         /// Reading from this pointer when `result_ok` is not set is undefined.
16067         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
16068         /// A pointer to the contents in the error state.
16069         /// Reading from this pointer when `result_ok` is set is undefined.
16070         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16071 }
16072 #[repr(C)]
16073 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
16074 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
16075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16076 pub struct CResult_NodeAnnouncementDecodeErrorZ {
16077         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
16078         /// `err` or `result` depending on the state of `result_ok`.
16079         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
16080         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
16081         pub result_ok: bool,
16082 }
16083 #[no_mangle]
16084 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16085 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
16086         CResult_NodeAnnouncementDecodeErrorZ {
16087                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16088                         result: Box::into_raw(Box::new(o)),
16089                 },
16090                 result_ok: true,
16091         }
16092 }
16093 #[no_mangle]
16094 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16095 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
16096         CResult_NodeAnnouncementDecodeErrorZ {
16097                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16098                         err: Box::into_raw(Box::new(e)),
16099                 },
16100                 result_ok: false,
16101         }
16102 }
16103 /// Checks if the given object is currently in the success state
16104 #[no_mangle]
16105 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
16106         o.result_ok
16107 }
16108 #[no_mangle]
16109 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16110 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
16111 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
16112         fn drop(&mut self) {
16113                 if self.result_ok {
16114                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16115                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16116                         }
16117                 } else {
16118                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16119                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16120                         }
16121                 }
16122         }
16123 }
16124 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
16125         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
16126                 let contents = if o.result_ok {
16127                         let result = unsafe { o.contents.result };
16128                         unsafe { o.contents.result = core::ptr::null_mut() };
16129                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
16130                 } else {
16131                         let err = unsafe { o.contents.err };
16132                         unsafe { o.contents.err = core::ptr::null_mut(); }
16133                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
16134                 };
16135                 Self {
16136                         contents,
16137                         result_ok: o.result_ok,
16138                 }
16139         }
16140 }
16141 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
16142         fn clone(&self) -> Self {
16143                 if self.result_ok {
16144                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16145                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
16146                         } }
16147                 } else {
16148                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
16149                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16150                         } }
16151                 }
16152         }
16153 }
16154 #[no_mangle]
16155 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16156 /// but with all dynamically-allocated buffers duplicated in new buffers.
16157 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
16158 #[repr(C)]
16159 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
16160 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
16161         /// A pointer to the contents in the success state.
16162         /// Reading from this pointer when `result_ok` is not set is undefined.
16163         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
16164         /// A pointer to the contents in the error state.
16165         /// Reading from this pointer when `result_ok` is set is undefined.
16166         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16167 }
16168 #[repr(C)]
16169 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
16170 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
16171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16172 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
16173         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
16174         /// `err` or `result` depending on the state of `result_ok`.
16175         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
16176         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
16177         pub result_ok: bool,
16178 }
16179 #[no_mangle]
16180 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16181 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16182         CResult_QueryShortChannelIdsDecodeErrorZ {
16183                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16184                         result: Box::into_raw(Box::new(o)),
16185                 },
16186                 result_ok: true,
16187         }
16188 }
16189 #[no_mangle]
16190 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16191 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
16192         CResult_QueryShortChannelIdsDecodeErrorZ {
16193                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16194                         err: Box::into_raw(Box::new(e)),
16195                 },
16196                 result_ok: false,
16197         }
16198 }
16199 /// Checks if the given object is currently in the success state
16200 #[no_mangle]
16201 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
16202         o.result_ok
16203 }
16204 #[no_mangle]
16205 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16206 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
16207 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
16208         fn drop(&mut self) {
16209                 if self.result_ok {
16210                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16211                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16212                         }
16213                 } else {
16214                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16215                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16216                         }
16217                 }
16218         }
16219 }
16220 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
16221         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
16222                 let contents = if o.result_ok {
16223                         let result = unsafe { o.contents.result };
16224                         unsafe { o.contents.result = core::ptr::null_mut() };
16225                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
16226                 } else {
16227                         let err = unsafe { o.contents.err };
16228                         unsafe { o.contents.err = core::ptr::null_mut(); }
16229                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
16230                 };
16231                 Self {
16232                         contents,
16233                         result_ok: o.result_ok,
16234                 }
16235         }
16236 }
16237 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
16238         fn clone(&self) -> Self {
16239                 if self.result_ok {
16240                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16241                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
16242                         } }
16243                 } else {
16244                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
16245                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16246                         } }
16247                 }
16248         }
16249 }
16250 #[no_mangle]
16251 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16252 /// but with all dynamically-allocated buffers duplicated in new buffers.
16253 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
16254 #[repr(C)]
16255 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
16256 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16257         /// A pointer to the contents in the success state.
16258         /// Reading from this pointer when `result_ok` is not set is undefined.
16259         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
16260         /// A pointer to the contents in the error state.
16261         /// Reading from this pointer when `result_ok` is set is undefined.
16262         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16263 }
16264 #[repr(C)]
16265 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
16266 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
16267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16268 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16269         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
16270         /// `err` or `result` depending on the state of `result_ok`.
16271         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
16272         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
16273         pub result_ok: bool,
16274 }
16275 #[no_mangle]
16276 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16277 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16278         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16279                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16280                         result: Box::into_raw(Box::new(o)),
16281                 },
16282                 result_ok: true,
16283         }
16284 }
16285 #[no_mangle]
16286 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16287 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16288         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16289                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16290                         err: Box::into_raw(Box::new(e)),
16291                 },
16292                 result_ok: false,
16293         }
16294 }
16295 /// Checks if the given object is currently in the success state
16296 #[no_mangle]
16297 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
16298         o.result_ok
16299 }
16300 #[no_mangle]
16301 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16302 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
16303 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16304         fn drop(&mut self) {
16305                 if self.result_ok {
16306                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16307                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16308                         }
16309                 } else {
16310                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16311                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16312                         }
16313                 }
16314         }
16315 }
16316 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16317         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
16318                 let contents = if o.result_ok {
16319                         let result = unsafe { o.contents.result };
16320                         unsafe { o.contents.result = core::ptr::null_mut() };
16321                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
16322                 } else {
16323                         let err = unsafe { o.contents.err };
16324                         unsafe { o.contents.err = core::ptr::null_mut(); }
16325                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
16326                 };
16327                 Self {
16328                         contents,
16329                         result_ok: o.result_ok,
16330                 }
16331         }
16332 }
16333 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
16334         fn clone(&self) -> Self {
16335                 if self.result_ok {
16336                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16337                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
16338                         } }
16339                 } else {
16340                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
16341                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16342                         } }
16343                 }
16344         }
16345 }
16346 #[no_mangle]
16347 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16348 /// but with all dynamically-allocated buffers duplicated in new buffers.
16349 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
16350 #[repr(C)]
16351 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
16352 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
16353         /// A pointer to the contents in the success state.
16354         /// Reading from this pointer when `result_ok` is not set is undefined.
16355         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
16356         /// A pointer to the contents in the error state.
16357         /// Reading from this pointer when `result_ok` is set is undefined.
16358         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16359 }
16360 #[repr(C)]
16361 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
16362 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16364 pub struct CResult_QueryChannelRangeDecodeErrorZ {
16365         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
16366         /// `err` or `result` depending on the state of `result_ok`.
16367         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
16368         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
16369         pub result_ok: bool,
16370 }
16371 #[no_mangle]
16372 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16373 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
16374         CResult_QueryChannelRangeDecodeErrorZ {
16375                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16376                         result: Box::into_raw(Box::new(o)),
16377                 },
16378                 result_ok: true,
16379         }
16380 }
16381 #[no_mangle]
16382 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16383 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
16384         CResult_QueryChannelRangeDecodeErrorZ {
16385                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16386                         err: Box::into_raw(Box::new(e)),
16387                 },
16388                 result_ok: false,
16389         }
16390 }
16391 /// Checks if the given object is currently in the success state
16392 #[no_mangle]
16393 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
16394         o.result_ok
16395 }
16396 #[no_mangle]
16397 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16398 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
16399 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
16400         fn drop(&mut self) {
16401                 if self.result_ok {
16402                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16403                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16404                         }
16405                 } else {
16406                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16407                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16408                         }
16409                 }
16410         }
16411 }
16412 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
16413         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16414                 let contents = if o.result_ok {
16415                         let result = unsafe { o.contents.result };
16416                         unsafe { o.contents.result = core::ptr::null_mut() };
16417                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
16418                 } else {
16419                         let err = unsafe { o.contents.err };
16420                         unsafe { o.contents.err = core::ptr::null_mut(); }
16421                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
16422                 };
16423                 Self {
16424                         contents,
16425                         result_ok: o.result_ok,
16426                 }
16427         }
16428 }
16429 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
16430         fn clone(&self) -> Self {
16431                 if self.result_ok {
16432                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16433                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
16434                         } }
16435                 } else {
16436                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
16437                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16438                         } }
16439                 }
16440         }
16441 }
16442 #[no_mangle]
16443 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16444 /// but with all dynamically-allocated buffers duplicated in new buffers.
16445 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16446 #[repr(C)]
16447 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
16448 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
16449         /// A pointer to the contents in the success state.
16450         /// Reading from this pointer when `result_ok` is not set is undefined.
16451         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
16452         /// A pointer to the contents in the error state.
16453         /// Reading from this pointer when `result_ok` is set is undefined.
16454         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16455 }
16456 #[repr(C)]
16457 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
16458 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
16459 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16460 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
16461         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
16462         /// `err` or `result` depending on the state of `result_ok`.
16463         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
16464         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
16465         pub result_ok: bool,
16466 }
16467 #[no_mangle]
16468 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16469 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
16470         CResult_ReplyChannelRangeDecodeErrorZ {
16471                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16472                         result: Box::into_raw(Box::new(o)),
16473                 },
16474                 result_ok: true,
16475         }
16476 }
16477 #[no_mangle]
16478 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16479 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
16480         CResult_ReplyChannelRangeDecodeErrorZ {
16481                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16482                         err: Box::into_raw(Box::new(e)),
16483                 },
16484                 result_ok: false,
16485         }
16486 }
16487 /// Checks if the given object is currently in the success state
16488 #[no_mangle]
16489 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
16490         o.result_ok
16491 }
16492 #[no_mangle]
16493 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16494 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
16495 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
16496         fn drop(&mut self) {
16497                 if self.result_ok {
16498                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16499                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16500                         }
16501                 } else {
16502                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16503                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16504                         }
16505                 }
16506         }
16507 }
16508 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
16509         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
16510                 let contents = if o.result_ok {
16511                         let result = unsafe { o.contents.result };
16512                         unsafe { o.contents.result = core::ptr::null_mut() };
16513                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
16514                 } else {
16515                         let err = unsafe { o.contents.err };
16516                         unsafe { o.contents.err = core::ptr::null_mut(); }
16517                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
16518                 };
16519                 Self {
16520                         contents,
16521                         result_ok: o.result_ok,
16522                 }
16523         }
16524 }
16525 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
16526         fn clone(&self) -> Self {
16527                 if self.result_ok {
16528                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16529                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
16530                         } }
16531                 } else {
16532                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
16533                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16534                         } }
16535                 }
16536         }
16537 }
16538 #[no_mangle]
16539 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16540 /// but with all dynamically-allocated buffers duplicated in new buffers.
16541 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
16542 #[repr(C)]
16543 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
16544 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
16545         /// A pointer to the contents in the success state.
16546         /// Reading from this pointer when `result_ok` is not set is undefined.
16547         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
16548         /// A pointer to the contents in the error state.
16549         /// Reading from this pointer when `result_ok` is set is undefined.
16550         pub err: *mut crate::lightning::ln::msgs::DecodeError,
16551 }
16552 #[repr(C)]
16553 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
16554 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
16555 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16556 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
16557         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
16558         /// `err` or `result` depending on the state of `result_ok`.
16559         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
16560         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
16561         pub result_ok: bool,
16562 }
16563 #[no_mangle]
16564 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16565 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
16566         CResult_GossipTimestampFilterDecodeErrorZ {
16567                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16568                         result: Box::into_raw(Box::new(o)),
16569                 },
16570                 result_ok: true,
16571         }
16572 }
16573 #[no_mangle]
16574 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16575 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
16576         CResult_GossipTimestampFilterDecodeErrorZ {
16577                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16578                         err: Box::into_raw(Box::new(e)),
16579                 },
16580                 result_ok: false,
16581         }
16582 }
16583 /// Checks if the given object is currently in the success state
16584 #[no_mangle]
16585 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
16586         o.result_ok
16587 }
16588 #[no_mangle]
16589 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16590 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
16591 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
16592         fn drop(&mut self) {
16593                 if self.result_ok {
16594                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16595                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16596                         }
16597                 } else {
16598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16600                         }
16601                 }
16602         }
16603 }
16604 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
16605         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
16606                 let contents = if o.result_ok {
16607                         let result = unsafe { o.contents.result };
16608                         unsafe { o.contents.result = core::ptr::null_mut() };
16609                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
16610                 } else {
16611                         let err = unsafe { o.contents.err };
16612                         unsafe { o.contents.err = core::ptr::null_mut(); }
16613                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
16614                 };
16615                 Self {
16616                         contents,
16617                         result_ok: o.result_ok,
16618                 }
16619         }
16620 }
16621 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
16622         fn clone(&self) -> Self {
16623                 if self.result_ok {
16624                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16625                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
16626                         } }
16627                 } else {
16628                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
16629                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
16630                         } }
16631                 }
16632         }
16633 }
16634 #[no_mangle]
16635 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16636 /// but with all dynamically-allocated buffers duplicated in new buffers.
16637 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
16638 #[repr(C)]
16639 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
16640 /// This corresponds to std::vector in C++
16641 pub struct CVec_PhantomRouteHintsZ {
16642         /// The elements in the array.
16643         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16644         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
16645         /// The number of elements pointed to by `data`.
16646         pub datalen: usize
16647 }
16648 impl CVec_PhantomRouteHintsZ {
16649         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
16650                 if self.datalen == 0 { return Vec::new(); }
16651                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16652                 self.data = core::ptr::null_mut();
16653                 self.datalen = 0;
16654                 ret
16655         }
16656         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
16657                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16658         }
16659 }
16660 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
16661         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
16662                 let datalen = v.len();
16663                 let data = Box::into_raw(v.into_boxed_slice());
16664                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16665         }
16666 }
16667 #[no_mangle]
16668 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16669 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
16670 impl Drop for CVec_PhantomRouteHintsZ {
16671         fn drop(&mut self) {
16672                 if self.datalen == 0 { return; }
16673                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16674         }
16675 }
16676 impl Clone for CVec_PhantomRouteHintsZ {
16677         fn clone(&self) -> Self {
16678                 let mut res = Vec::new();
16679                 if self.datalen == 0 { return Self::from(res); }
16680                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16681                 Self::from(res)
16682         }
16683 }
16684 #[repr(C)]
16685 /// The contents of CResult_InvoiceSignOrCreationErrorZ
16686 pub union CResult_InvoiceSignOrCreationErrorZPtr {
16687         /// A pointer to the contents in the success state.
16688         /// Reading from this pointer when `result_ok` is not set is undefined.
16689         pub result: *mut crate::lightning_invoice::Invoice,
16690         /// A pointer to the contents in the error state.
16691         /// Reading from this pointer when `result_ok` is set is undefined.
16692         pub err: *mut crate::lightning_invoice::SignOrCreationError,
16693 }
16694 #[repr(C)]
16695 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
16696 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
16697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16698 pub struct CResult_InvoiceSignOrCreationErrorZ {
16699         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
16700         /// `err` or `result` depending on the state of `result_ok`.
16701         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
16702         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
16703         pub result_ok: bool,
16704 }
16705 #[no_mangle]
16706 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16707 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
16708         CResult_InvoiceSignOrCreationErrorZ {
16709                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16710                         result: Box::into_raw(Box::new(o)),
16711                 },
16712                 result_ok: true,
16713         }
16714 }
16715 #[no_mangle]
16716 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16717 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
16718         CResult_InvoiceSignOrCreationErrorZ {
16719                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
16720                         err: Box::into_raw(Box::new(e)),
16721                 },
16722                 result_ok: false,
16723         }
16724 }
16725 /// Checks if the given object is currently in the success state
16726 #[no_mangle]
16727 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
16728         o.result_ok
16729 }
16730 #[no_mangle]
16731 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16732 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
16733 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
16734         fn drop(&mut self) {
16735                 if self.result_ok {
16736                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16737                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16738                         }
16739                 } else {
16740                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
16741                                 let _ = unsafe { Box::from_raw(self.contents.err) };
16742                         }
16743                 }
16744         }
16745 }
16746 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
16747         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
16748                 let contents = if o.result_ok {
16749                         let result = unsafe { o.contents.result };
16750                         unsafe { o.contents.result = core::ptr::null_mut() };
16751                         CResult_InvoiceSignOrCreationErrorZPtr { result }
16752                 } else {
16753                         let err = unsafe { o.contents.err };
16754                         unsafe { o.contents.err = core::ptr::null_mut(); }
16755                         CResult_InvoiceSignOrCreationErrorZPtr { err }
16756                 };
16757                 Self {
16758                         contents,
16759                         result_ok: o.result_ok,
16760                 }
16761         }
16762 }
16763 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
16764         fn clone(&self) -> Self {
16765                 if self.result_ok {
16766                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16767                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
16768                         } }
16769                 } else {
16770                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
16771                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
16772                         } }
16773                 }
16774         }
16775 }
16776 #[no_mangle]
16777 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16778 /// but with all dynamically-allocated buffers duplicated in new buffers.
16779 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
16780 #[repr(C)]
16781 /// An enum which can either contain a crate::lightning::chain::Filter or not
16782 pub enum COption_FilterZ {
16783         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
16784         Some(crate::lightning::chain::Filter),
16785         /// When we're in this state, this COption_FilterZ contains nothing
16786         None
16787 }
16788 impl COption_FilterZ {
16789         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
16790                 if let Self::None = self { false } else { true }
16791         }
16792         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
16793                 !self.is_some()
16794         }
16795         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
16796                 if let Self::Some(v) = self { v } else { unreachable!() }
16797         }
16798 }
16799 #[no_mangle]
16800 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16801 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
16802         COption_FilterZ::Some(o)
16803 }
16804 #[no_mangle]
16805 /// Constructs a new COption_FilterZ containing nothing
16806 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
16807         COption_FilterZ::None
16808 }
16809 #[no_mangle]
16810 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16811 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
16812 #[repr(C)]
16813 /// The contents of CResult_LockedChannelMonitorNoneZ
16814 pub union CResult_LockedChannelMonitorNoneZPtr {
16815         /// A pointer to the contents in the success state.
16816         /// Reading from this pointer when `result_ok` is not set is undefined.
16817         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
16818         /// Note that this value is always NULL, as there are no contents in the Err variant
16819         pub err: *mut core::ffi::c_void,
16820 }
16821 #[repr(C)]
16822 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
16823 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
16824 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
16825 pub struct CResult_LockedChannelMonitorNoneZ {
16826         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
16827         /// `err` or `result` depending on the state of `result_ok`.
16828         pub contents: CResult_LockedChannelMonitorNoneZPtr,
16829         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
16830         pub result_ok: bool,
16831 }
16832 #[no_mangle]
16833 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16834 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
16835         CResult_LockedChannelMonitorNoneZ {
16836                 contents: CResult_LockedChannelMonitorNoneZPtr {
16837                         result: Box::into_raw(Box::new(o)),
16838                 },
16839                 result_ok: true,
16840         }
16841 }
16842 #[no_mangle]
16843 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16844 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
16845         CResult_LockedChannelMonitorNoneZ {
16846                 contents: CResult_LockedChannelMonitorNoneZPtr {
16847                         err: core::ptr::null_mut(),
16848                 },
16849                 result_ok: false,
16850         }
16851 }
16852 /// Checks if the given object is currently in the success state
16853 #[no_mangle]
16854 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
16855         o.result_ok
16856 }
16857 #[no_mangle]
16858 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16859 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
16860 impl Drop for CResult_LockedChannelMonitorNoneZ {
16861         fn drop(&mut self) {
16862                 if self.result_ok {
16863                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
16864                                 let _ = unsafe { Box::from_raw(self.contents.result) };
16865                         }
16866                 } else {
16867                 }
16868         }
16869 }
16870 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
16871         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
16872                 let contents = if o.result_ok {
16873                         let result = unsafe { o.contents.result };
16874                         unsafe { o.contents.result = core::ptr::null_mut() };
16875                         CResult_LockedChannelMonitorNoneZPtr { result }
16876                 } else {
16877                         let _ = unsafe { Box::from_raw(o.contents.err) };
16878                         o.contents.err = core::ptr::null_mut();
16879                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
16880                 };
16881                 Self {
16882                         contents,
16883                         result_ok: o.result_ok,
16884                 }
16885         }
16886 }
16887 #[repr(C)]
16888 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
16889 /// This corresponds to std::vector in C++
16890 pub struct CVec_OutPointZ {
16891         /// The elements in the array.
16892         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16893         pub data: *mut crate::lightning::chain::transaction::OutPoint,
16894         /// The number of elements pointed to by `data`.
16895         pub datalen: usize
16896 }
16897 impl CVec_OutPointZ {
16898         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
16899                 if self.datalen == 0 { return Vec::new(); }
16900                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16901                 self.data = core::ptr::null_mut();
16902                 self.datalen = 0;
16903                 ret
16904         }
16905         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
16906                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16907         }
16908 }
16909 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
16910         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
16911                 let datalen = v.len();
16912                 let data = Box::into_raw(v.into_boxed_slice());
16913                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16914         }
16915 }
16916 #[no_mangle]
16917 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16918 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16919 impl Drop for CVec_OutPointZ {
16920         fn drop(&mut self) {
16921                 if self.datalen == 0 { return; }
16922                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16923         }
16924 }
16925 impl Clone for CVec_OutPointZ {
16926         fn clone(&self) -> Self {
16927                 let mut res = Vec::new();
16928                 if self.datalen == 0 { return Self::from(res); }
16929                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16930                 Self::from(res)
16931         }
16932 }
16933 #[repr(C)]
16934 /// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size.
16935 /// This corresponds to std::vector in C++
16936 pub struct CVec_MonitorUpdateIdZ {
16937         /// The elements in the array.
16938         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
16939         pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId,
16940         /// The number of elements pointed to by `data`.
16941         pub datalen: usize
16942 }
16943 impl CVec_MonitorUpdateIdZ {
16944         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId> {
16945                 if self.datalen == 0 { return Vec::new(); }
16946                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
16947                 self.data = core::ptr::null_mut();
16948                 self.datalen = 0;
16949                 ret
16950         }
16951         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] {
16952                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
16953         }
16954 }
16955 impl From<Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>> for CVec_MonitorUpdateIdZ {
16956         fn from(v: Vec<crate::lightning::chain::chainmonitor::MonitorUpdateId>) -> Self {
16957                 let datalen = v.len();
16958                 let data = Box::into_raw(v.into_boxed_slice());
16959                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16960         }
16961 }
16962 #[no_mangle]
16963 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16964 pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { }
16965 impl Drop for CVec_MonitorUpdateIdZ {
16966         fn drop(&mut self) {
16967                 if self.datalen == 0 { return; }
16968                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16969         }
16970 }
16971 impl Clone for CVec_MonitorUpdateIdZ {
16972         fn clone(&self) -> Self {
16973                 let mut res = Vec::new();
16974                 if self.datalen == 0 { return Self::from(res); }
16975                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16976                 Self::from(res)
16977         }
16978 }
16979 #[repr(C)]
16980 /// A tuple of 2 elements. See the individual fields for the types contained.
16981 pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16982         /// The element at position 0
16983         pub a: crate::lightning::chain::transaction::OutPoint,
16984         /// The element at position 1
16985         pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ,
16986 }
16987 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16988         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self {
16989                 Self {
16990                         a: tup.0,
16991                         b: tup.1,
16992                 }
16993         }
16994 }
16995 impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
16996         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) {
16997                 (self.a, self.b)
16998         }
16999 }
17000 impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17001         fn clone(&self) -> Self {
17002                 Self {
17003                         a: Clone::clone(&self.a),
17004                         b: Clone::clone(&self.b),
17005                 }
17006         }
17007 }
17008 #[no_mangle]
17009 /// Creates a new tuple which has the same data as `orig`
17010 /// but with all dynamically-allocated buffers duplicated in new buffers.
17011 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) }
17012 /// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
17013 #[no_mangle]
17014 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ {
17015         C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, }
17016 }
17017
17018 #[no_mangle]
17019 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
17020 pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { }
17021 #[repr(C)]
17022 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size.
17023 /// This corresponds to std::vector in C++
17024 pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17025         /// The elements in the array.
17026         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
17027         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ,
17028         /// The number of elements pointed to by `data`.
17029         pub datalen: usize
17030 }
17031 impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17032         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ> {
17033                 if self.datalen == 0 { return Vec::new(); }
17034                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
17035                 self.data = core::ptr::null_mut();
17036                 self.datalen = 0;
17037                 ret
17038         }
17039         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] {
17040                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
17041         }
17042 }
17043 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17044         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ>) -> Self {
17045                 let datalen = v.len();
17046                 let data = Box::into_raw(v.into_boxed_slice());
17047                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
17048         }
17049 }
17050 #[no_mangle]
17051 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
17052 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { }
17053 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17054         fn drop(&mut self) {
17055                 if self.datalen == 0 { return; }
17056                 let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
17057         }
17058 }
17059 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ {
17060         fn clone(&self) -> Self {
17061                 let mut res = Vec::new();
17062                 if self.datalen == 0 { return Self::from(res); }
17063                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
17064                 Self::from(res)
17065         }
17066 }