Merge pull request #54 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// The contents of CResult_SecretKeyErrorZ
12 pub union CResult_SecretKeyErrorZPtr {
13         /// A pointer to the contents in the success state.
14         /// Reading from this pointer when `result_ok` is not set is undefined.
15         pub result: *mut crate::c_types::SecretKey,
16         /// A pointer to the contents in the error state.
17         /// Reading from this pointer when `result_ok` is set is undefined.
18         pub err: *mut crate::c_types::Secp256k1Error,
19 }
20 #[repr(C)]
21 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
22 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
23 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
24 pub struct CResult_SecretKeyErrorZ {
25         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
26         /// `err` or `result` depending on the state of `result_ok`.
27         pub contents: CResult_SecretKeyErrorZPtr,
28         /// Whether this CResult_SecretKeyErrorZ represents a success state.
29         pub result_ok: bool,
30 }
31 #[no_mangle]
32 /// Creates a new CResult_SecretKeyErrorZ in the success state.
33 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
34         CResult_SecretKeyErrorZ {
35                 contents: CResult_SecretKeyErrorZPtr {
36                         result: Box::into_raw(Box::new(o)),
37                 },
38                 result_ok: true,
39         }
40 }
41 #[no_mangle]
42 /// Creates a new CResult_SecretKeyErrorZ in the error state.
43 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
44         CResult_SecretKeyErrorZ {
45                 contents: CResult_SecretKeyErrorZPtr {
46                         err: Box::into_raw(Box::new(e)),
47                 },
48                 result_ok: false,
49         }
50 }
51 /// Checks if the given object is currently in the success state
52 #[no_mangle]
53 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
54         o.result_ok
55 }
56 #[no_mangle]
57 /// Frees any resources used by the CResult_SecretKeyErrorZ.
58 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
59 impl Drop for CResult_SecretKeyErrorZ {
60         fn drop(&mut self) {
61                 if self.result_ok {
62                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
63                                 let _ = unsafe { Box::from_raw(self.contents.result) };
64                         }
65                 } else {
66                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
67                                 let _ = unsafe { Box::from_raw(self.contents.err) };
68                         }
69                 }
70         }
71 }
72 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
73         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
74                 let contents = if o.result_ok {
75                         let result = unsafe { o.contents.result };
76                         unsafe { o.contents.result = core::ptr::null_mut() };
77                         CResult_SecretKeyErrorZPtr { result }
78                 } else {
79                         let err = unsafe { o.contents.err };
80                         unsafe { o.contents.err = core::ptr::null_mut(); }
81                         CResult_SecretKeyErrorZPtr { err }
82                 };
83                 Self {
84                         contents,
85                         result_ok: o.result_ok,
86                 }
87         }
88 }
89 #[repr(C)]
90 /// The contents of CResult_PublicKeyErrorZ
91 pub union CResult_PublicKeyErrorZPtr {
92         /// A pointer to the contents in the success state.
93         /// Reading from this pointer when `result_ok` is not set is undefined.
94         pub result: *mut crate::c_types::PublicKey,
95         /// A pointer to the contents in the error state.
96         /// Reading from this pointer when `result_ok` is set is undefined.
97         pub err: *mut crate::c_types::Secp256k1Error,
98 }
99 #[repr(C)]
100 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
101 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
103 pub struct CResult_PublicKeyErrorZ {
104         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
105         /// `err` or `result` depending on the state of `result_ok`.
106         pub contents: CResult_PublicKeyErrorZPtr,
107         /// Whether this CResult_PublicKeyErrorZ represents a success state.
108         pub result_ok: bool,
109 }
110 #[no_mangle]
111 /// Creates a new CResult_PublicKeyErrorZ in the success state.
112 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
113         CResult_PublicKeyErrorZ {
114                 contents: CResult_PublicKeyErrorZPtr {
115                         result: Box::into_raw(Box::new(o)),
116                 },
117                 result_ok: true,
118         }
119 }
120 #[no_mangle]
121 /// Creates a new CResult_PublicKeyErrorZ in the error state.
122 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
123         CResult_PublicKeyErrorZ {
124                 contents: CResult_PublicKeyErrorZPtr {
125                         err: Box::into_raw(Box::new(e)),
126                 },
127                 result_ok: false,
128         }
129 }
130 /// Checks if the given object is currently in the success state
131 #[no_mangle]
132 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
133         o.result_ok
134 }
135 #[no_mangle]
136 /// Frees any resources used by the CResult_PublicKeyErrorZ.
137 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
138 impl Drop for CResult_PublicKeyErrorZ {
139         fn drop(&mut self) {
140                 if self.result_ok {
141                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
142                                 let _ = unsafe { Box::from_raw(self.contents.result) };
143                         }
144                 } else {
145                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
146                                 let _ = unsafe { Box::from_raw(self.contents.err) };
147                         }
148                 }
149         }
150 }
151 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
152         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
153                 let contents = if o.result_ok {
154                         let result = unsafe { o.contents.result };
155                         unsafe { o.contents.result = core::ptr::null_mut() };
156                         CResult_PublicKeyErrorZPtr { result }
157                 } else {
158                         let err = unsafe { o.contents.err };
159                         unsafe { o.contents.err = core::ptr::null_mut(); }
160                         CResult_PublicKeyErrorZPtr { err }
161                 };
162                 Self {
163                         contents,
164                         result_ok: o.result_ok,
165                 }
166         }
167 }
168 impl Clone for CResult_PublicKeyErrorZ {
169         fn clone(&self) -> Self {
170                 if self.result_ok {
171                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
172                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
173                         } }
174                 } else {
175                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
176                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
177                         } }
178                 }
179         }
180 }
181 #[no_mangle]
182 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
183 /// but with all dynamically-allocated buffers duplicated in new buffers.
184 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
185 #[repr(C)]
186 /// The contents of CResult_TxCreationKeysDecodeErrorZ
187 pub union CResult_TxCreationKeysDecodeErrorZPtr {
188         /// A pointer to the contents in the success state.
189         /// Reading from this pointer when `result_ok` is not set is undefined.
190         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
191         /// A pointer to the contents in the error state.
192         /// Reading from this pointer when `result_ok` is set is undefined.
193         pub err: *mut crate::lightning::ln::msgs::DecodeError,
194 }
195 #[repr(C)]
196 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
197 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
199 pub struct CResult_TxCreationKeysDecodeErrorZ {
200         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
201         /// `err` or `result` depending on the state of `result_ok`.
202         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
203         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
204         pub result_ok: bool,
205 }
206 #[no_mangle]
207 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
208 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
209         CResult_TxCreationKeysDecodeErrorZ {
210                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
211                         result: Box::into_raw(Box::new(o)),
212                 },
213                 result_ok: true,
214         }
215 }
216 #[no_mangle]
217 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
218 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
219         CResult_TxCreationKeysDecodeErrorZ {
220                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
221                         err: Box::into_raw(Box::new(e)),
222                 },
223                 result_ok: false,
224         }
225 }
226 /// Checks if the given object is currently in the success state
227 #[no_mangle]
228 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
229         o.result_ok
230 }
231 #[no_mangle]
232 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
233 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
234 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
235         fn drop(&mut self) {
236                 if self.result_ok {
237                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
238                                 let _ = unsafe { Box::from_raw(self.contents.result) };
239                         }
240                 } else {
241                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
242                                 let _ = unsafe { Box::from_raw(self.contents.err) };
243                         }
244                 }
245         }
246 }
247 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
248         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
249                 let contents = if o.result_ok {
250                         let result = unsafe { o.contents.result };
251                         unsafe { o.contents.result = core::ptr::null_mut() };
252                         CResult_TxCreationKeysDecodeErrorZPtr { result }
253                 } else {
254                         let err = unsafe { o.contents.err };
255                         unsafe { o.contents.err = core::ptr::null_mut(); }
256                         CResult_TxCreationKeysDecodeErrorZPtr { err }
257                 };
258                 Self {
259                         contents,
260                         result_ok: o.result_ok,
261                 }
262         }
263 }
264 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
265         fn clone(&self) -> Self {
266                 if self.result_ok {
267                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
268                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
269                         } }
270                 } else {
271                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
272                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
273                         } }
274                 }
275         }
276 }
277 #[no_mangle]
278 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
279 /// but with all dynamically-allocated buffers duplicated in new buffers.
280 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
281 #[repr(C)]
282 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
283 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
284         /// A pointer to the contents in the success state.
285         /// Reading from this pointer when `result_ok` is not set is undefined.
286         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
287         /// A pointer to the contents in the error state.
288         /// Reading from this pointer when `result_ok` is set is undefined.
289         pub err: *mut crate::lightning::ln::msgs::DecodeError,
290 }
291 #[repr(C)]
292 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
293 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
295 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
296         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
297         /// `err` or `result` depending on the state of `result_ok`.
298         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
299         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
300         pub result_ok: bool,
301 }
302 #[no_mangle]
303 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
304 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
305         CResult_ChannelPublicKeysDecodeErrorZ {
306                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
307                         result: Box::into_raw(Box::new(o)),
308                 },
309                 result_ok: true,
310         }
311 }
312 #[no_mangle]
313 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
314 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
315         CResult_ChannelPublicKeysDecodeErrorZ {
316                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
317                         err: Box::into_raw(Box::new(e)),
318                 },
319                 result_ok: false,
320         }
321 }
322 /// Checks if the given object is currently in the success state
323 #[no_mangle]
324 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
325         o.result_ok
326 }
327 #[no_mangle]
328 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
329 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
330 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
331         fn drop(&mut self) {
332                 if self.result_ok {
333                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
334                                 let _ = unsafe { Box::from_raw(self.contents.result) };
335                         }
336                 } else {
337                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
338                                 let _ = unsafe { Box::from_raw(self.contents.err) };
339                         }
340                 }
341         }
342 }
343 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
344         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
345                 let contents = if o.result_ok {
346                         let result = unsafe { o.contents.result };
347                         unsafe { o.contents.result = core::ptr::null_mut() };
348                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
349                 } else {
350                         let err = unsafe { o.contents.err };
351                         unsafe { o.contents.err = core::ptr::null_mut(); }
352                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
353                 };
354                 Self {
355                         contents,
356                         result_ok: o.result_ok,
357                 }
358         }
359 }
360 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
361         fn clone(&self) -> Self {
362                 if self.result_ok {
363                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
364                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
365                         } }
366                 } else {
367                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
368                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
369                         } }
370                 }
371         }
372 }
373 #[no_mangle]
374 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
375 /// but with all dynamically-allocated buffers duplicated in new buffers.
376 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
377 #[repr(C)]
378 /// The contents of CResult_TxCreationKeysErrorZ
379 pub union CResult_TxCreationKeysErrorZPtr {
380         /// A pointer to the contents in the success state.
381         /// Reading from this pointer when `result_ok` is not set is undefined.
382         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
383         /// A pointer to the contents in the error state.
384         /// Reading from this pointer when `result_ok` is set is undefined.
385         pub err: *mut crate::c_types::Secp256k1Error,
386 }
387 #[repr(C)]
388 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
389 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
391 pub struct CResult_TxCreationKeysErrorZ {
392         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
393         /// `err` or `result` depending on the state of `result_ok`.
394         pub contents: CResult_TxCreationKeysErrorZPtr,
395         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
396         pub result_ok: bool,
397 }
398 #[no_mangle]
399 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
400 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
401         CResult_TxCreationKeysErrorZ {
402                 contents: CResult_TxCreationKeysErrorZPtr {
403                         result: Box::into_raw(Box::new(o)),
404                 },
405                 result_ok: true,
406         }
407 }
408 #[no_mangle]
409 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
410 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
411         CResult_TxCreationKeysErrorZ {
412                 contents: CResult_TxCreationKeysErrorZPtr {
413                         err: Box::into_raw(Box::new(e)),
414                 },
415                 result_ok: false,
416         }
417 }
418 /// Checks if the given object is currently in the success state
419 #[no_mangle]
420 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
421         o.result_ok
422 }
423 #[no_mangle]
424 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
425 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
426 impl Drop for CResult_TxCreationKeysErrorZ {
427         fn drop(&mut self) {
428                 if self.result_ok {
429                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
430                                 let _ = unsafe { Box::from_raw(self.contents.result) };
431                         }
432                 } else {
433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
435                         }
436                 }
437         }
438 }
439 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
440         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
441                 let contents = if o.result_ok {
442                         let result = unsafe { o.contents.result };
443                         unsafe { o.contents.result = core::ptr::null_mut() };
444                         CResult_TxCreationKeysErrorZPtr { result }
445                 } else {
446                         let err = unsafe { o.contents.err };
447                         unsafe { o.contents.err = core::ptr::null_mut(); }
448                         CResult_TxCreationKeysErrorZPtr { err }
449                 };
450                 Self {
451                         contents,
452                         result_ok: o.result_ok,
453                 }
454         }
455 }
456 impl Clone for CResult_TxCreationKeysErrorZ {
457         fn clone(&self) -> Self {
458                 if self.result_ok {
459                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
460                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
461                         } }
462                 } else {
463                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
464                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
465                         } }
466                 }
467         }
468 }
469 #[no_mangle]
470 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
471 /// but with all dynamically-allocated buffers duplicated in new buffers.
472 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
473 #[repr(C)]
474 #[derive(Clone)]
475 /// An enum which can either contain a u32 or not
476 pub enum COption_u32Z {
477         /// When we're in this state, this COption_u32Z contains a u32
478         Some(u32),
479         /// When we're in this state, this COption_u32Z contains nothing
480         None
481 }
482 impl COption_u32Z {
483         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
484                 if let Self::None = self { false } else { true }
485         }
486         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
487                 !self.is_some()
488         }
489         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
490                 if let Self::Some(v) = self { v } else { unreachable!() }
491         }
492 }
493 #[no_mangle]
494 /// Constructs a new COption_u32Z containing a u32
495 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
496         COption_u32Z::Some(o)
497 }
498 #[no_mangle]
499 /// Constructs a new COption_u32Z containing nothing
500 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
501         COption_u32Z::None
502 }
503 #[no_mangle]
504 /// Frees any resources associated with the u32, if we are in the Some state
505 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
506 #[no_mangle]
507 /// Creates a new COption_u32Z which has the same data as `orig`
508 /// but with all dynamically-allocated buffers duplicated in new buffers.
509 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
510 #[repr(C)]
511 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
512 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
513         /// A pointer to the contents in the success state.
514         /// Reading from this pointer when `result_ok` is not set is undefined.
515         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
516         /// A pointer to the contents in the error state.
517         /// Reading from this pointer when `result_ok` is set is undefined.
518         pub err: *mut crate::lightning::ln::msgs::DecodeError,
519 }
520 #[repr(C)]
521 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
522 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
524 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
525         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
526         /// `err` or `result` depending on the state of `result_ok`.
527         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
528         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
529         pub result_ok: bool,
530 }
531 #[no_mangle]
532 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
533 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
534         CResult_HTLCOutputInCommitmentDecodeErrorZ {
535                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
536                         result: Box::into_raw(Box::new(o)),
537                 },
538                 result_ok: true,
539         }
540 }
541 #[no_mangle]
542 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
543 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
544         CResult_HTLCOutputInCommitmentDecodeErrorZ {
545                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
546                         err: Box::into_raw(Box::new(e)),
547                 },
548                 result_ok: false,
549         }
550 }
551 /// Checks if the given object is currently in the success state
552 #[no_mangle]
553 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
554         o.result_ok
555 }
556 #[no_mangle]
557 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
558 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
559 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
560         fn drop(&mut self) {
561                 if self.result_ok {
562                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
563                                 let _ = unsafe { Box::from_raw(self.contents.result) };
564                         }
565                 } else {
566                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
567                                 let _ = unsafe { Box::from_raw(self.contents.err) };
568                         }
569                 }
570         }
571 }
572 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
573         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
574                 let contents = if o.result_ok {
575                         let result = unsafe { o.contents.result };
576                         unsafe { o.contents.result = core::ptr::null_mut() };
577                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
578                 } else {
579                         let err = unsafe { o.contents.err };
580                         unsafe { o.contents.err = core::ptr::null_mut(); }
581                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
582                 };
583                 Self {
584                         contents,
585                         result_ok: o.result_ok,
586                 }
587         }
588 }
589 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
590         fn clone(&self) -> Self {
591                 if self.result_ok {
592                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
593                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
594                         } }
595                 } else {
596                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
597                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
598                         } }
599                 }
600         }
601 }
602 #[no_mangle]
603 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
604 /// but with all dynamically-allocated buffers duplicated in new buffers.
605 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
606 #[repr(C)]
607 /// An enum which can either contain a  or not
608 pub enum COption_NoneZ {
609         /// When we're in this state, this COption_NoneZ contains a 
610         Some,
611         /// When we're in this state, this COption_NoneZ contains nothing
612         None
613 }
614 impl COption_NoneZ {
615         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
616                 if let Self::None = self { false } else { true }
617         }
618         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
619                 !self.is_some()
620         }
621 }
622 #[no_mangle]
623 /// Constructs a new COption_NoneZ containing a 
624 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
625         COption_NoneZ::Some
626 }
627 #[no_mangle]
628 /// Constructs a new COption_NoneZ containing nothing
629 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
630         COption_NoneZ::None
631 }
632 #[no_mangle]
633 /// Frees any resources associated with the , if we are in the Some state
634 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
635 #[repr(C)]
636 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
637 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
638         /// A pointer to the contents in the success state.
639         /// Reading from this pointer when `result_ok` is not set is undefined.
640         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
641         /// A pointer to the contents in the error state.
642         /// Reading from this pointer when `result_ok` is set is undefined.
643         pub err: *mut crate::lightning::ln::msgs::DecodeError,
644 }
645 #[repr(C)]
646 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
647 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
649 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
650         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
651         /// `err` or `result` depending on the state of `result_ok`.
652         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
653         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
654         pub result_ok: bool,
655 }
656 #[no_mangle]
657 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
658 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
659         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
660                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
661                         result: Box::into_raw(Box::new(o)),
662                 },
663                 result_ok: true,
664         }
665 }
666 #[no_mangle]
667 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
668 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
669         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
670                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
671                         err: Box::into_raw(Box::new(e)),
672                 },
673                 result_ok: false,
674         }
675 }
676 /// Checks if the given object is currently in the success state
677 #[no_mangle]
678 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
679         o.result_ok
680 }
681 #[no_mangle]
682 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
683 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
684 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
685         fn drop(&mut self) {
686                 if self.result_ok {
687                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
688                                 let _ = unsafe { Box::from_raw(self.contents.result) };
689                         }
690                 } else {
691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
693                         }
694                 }
695         }
696 }
697 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
698         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
699                 let contents = if o.result_ok {
700                         let result = unsafe { o.contents.result };
701                         unsafe { o.contents.result = core::ptr::null_mut() };
702                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
703                 } else {
704                         let err = unsafe { o.contents.err };
705                         unsafe { o.contents.err = core::ptr::null_mut(); }
706                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
707                 };
708                 Self {
709                         contents,
710                         result_ok: o.result_ok,
711                 }
712         }
713 }
714 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
715         fn clone(&self) -> Self {
716                 if self.result_ok {
717                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
718                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
719                         } }
720                 } else {
721                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
722                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
723                         } }
724                 }
725         }
726 }
727 #[no_mangle]
728 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
729 /// but with all dynamically-allocated buffers duplicated in new buffers.
730 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
731 #[repr(C)]
732 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
733 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
734         /// A pointer to the contents in the success state.
735         /// Reading from this pointer when `result_ok` is not set is undefined.
736         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
737         /// A pointer to the contents in the error state.
738         /// Reading from this pointer when `result_ok` is set is undefined.
739         pub err: *mut crate::lightning::ln::msgs::DecodeError,
740 }
741 #[repr(C)]
742 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
743 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
745 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
746         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
747         /// `err` or `result` depending on the state of `result_ok`.
748         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
749         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
750         pub result_ok: bool,
751 }
752 #[no_mangle]
753 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
754 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
755         CResult_ChannelTransactionParametersDecodeErrorZ {
756                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
757                         result: Box::into_raw(Box::new(o)),
758                 },
759                 result_ok: true,
760         }
761 }
762 #[no_mangle]
763 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
764 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
765         CResult_ChannelTransactionParametersDecodeErrorZ {
766                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
767                         err: Box::into_raw(Box::new(e)),
768                 },
769                 result_ok: false,
770         }
771 }
772 /// Checks if the given object is currently in the success state
773 #[no_mangle]
774 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
775         o.result_ok
776 }
777 #[no_mangle]
778 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
779 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
780 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
781         fn drop(&mut self) {
782                 if self.result_ok {
783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
785                         }
786                 } else {
787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
789                         }
790                 }
791         }
792 }
793 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
795                 let contents = if o.result_ok {
796                         let result = unsafe { o.contents.result };
797                         unsafe { o.contents.result = core::ptr::null_mut() };
798                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
799                 } else {
800                         let err = unsafe { o.contents.err };
801                         unsafe { o.contents.err = core::ptr::null_mut(); }
802                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
803                 };
804                 Self {
805                         contents,
806                         result_ok: o.result_ok,
807                 }
808         }
809 }
810 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
811         fn clone(&self) -> Self {
812                 if self.result_ok {
813                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
814                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
815                         } }
816                 } else {
817                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
819                         } }
820                 }
821         }
822 }
823 #[no_mangle]
824 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
825 /// but with all dynamically-allocated buffers duplicated in new buffers.
826 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
827 #[repr(C)]
828 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
829 /// This corresponds to std::vector in C++
830 pub struct CVec_SignatureZ {
831         /// The elements in the array.
832         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
833         pub data: *mut crate::c_types::Signature,
834         /// The number of elements pointed to by `data`.
835         pub datalen: usize
836 }
837 impl CVec_SignatureZ {
838         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
839                 if self.datalen == 0 { return Vec::new(); }
840                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
841                 self.data = core::ptr::null_mut();
842                 self.datalen = 0;
843                 ret
844         }
845         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
846                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
847         }
848 }
849 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
850         fn from(v: Vec<crate::c_types::Signature>) -> Self {
851                 let datalen = v.len();
852                 let data = Box::into_raw(v.into_boxed_slice());
853                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
854         }
855 }
856 #[no_mangle]
857 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
858 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
859 impl Drop for CVec_SignatureZ {
860         fn drop(&mut self) {
861                 if self.datalen == 0 { return; }
862                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
863         }
864 }
865 impl Clone for CVec_SignatureZ {
866         fn clone(&self) -> Self {
867                 let mut res = Vec::new();
868                 if self.datalen == 0 { return Self::from(res); }
869                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
870                 Self::from(res)
871         }
872 }
873 #[repr(C)]
874 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
875 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
876         /// A pointer to the contents in the success state.
877         /// Reading from this pointer when `result_ok` is not set is undefined.
878         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
879         /// A pointer to the contents in the error state.
880         /// Reading from this pointer when `result_ok` is set is undefined.
881         pub err: *mut crate::lightning::ln::msgs::DecodeError,
882 }
883 #[repr(C)]
884 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
885 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
887 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
888         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
889         /// `err` or `result` depending on the state of `result_ok`.
890         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
891         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
892         pub result_ok: bool,
893 }
894 #[no_mangle]
895 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
896 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
897         CResult_HolderCommitmentTransactionDecodeErrorZ {
898                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
899                         result: Box::into_raw(Box::new(o)),
900                 },
901                 result_ok: true,
902         }
903 }
904 #[no_mangle]
905 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
906 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
907         CResult_HolderCommitmentTransactionDecodeErrorZ {
908                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
909                         err: Box::into_raw(Box::new(e)),
910                 },
911                 result_ok: false,
912         }
913 }
914 /// Checks if the given object is currently in the success state
915 #[no_mangle]
916 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
917         o.result_ok
918 }
919 #[no_mangle]
920 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
921 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
922 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
923         fn drop(&mut self) {
924                 if self.result_ok {
925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
927                         }
928                 } else {
929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
931                         }
932                 }
933         }
934 }
935 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
936         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
937                 let contents = if o.result_ok {
938                         let result = unsafe { o.contents.result };
939                         unsafe { o.contents.result = core::ptr::null_mut() };
940                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
941                 } else {
942                         let err = unsafe { o.contents.err };
943                         unsafe { o.contents.err = core::ptr::null_mut(); }
944                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
945                 };
946                 Self {
947                         contents,
948                         result_ok: o.result_ok,
949                 }
950         }
951 }
952 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
953         fn clone(&self) -> Self {
954                 if self.result_ok {
955                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
956                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
957                         } }
958                 } else {
959                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
961                         } }
962                 }
963         }
964 }
965 #[no_mangle]
966 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
967 /// but with all dynamically-allocated buffers duplicated in new buffers.
968 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
969 #[repr(C)]
970 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
971 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
972         /// A pointer to the contents in the success state.
973         /// Reading from this pointer when `result_ok` is not set is undefined.
974         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
975         /// A pointer to the contents in the error state.
976         /// Reading from this pointer when `result_ok` is set is undefined.
977         pub err: *mut crate::lightning::ln::msgs::DecodeError,
978 }
979 #[repr(C)]
980 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
981 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
983 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
984         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
985         /// `err` or `result` depending on the state of `result_ok`.
986         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
987         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
988         pub result_ok: bool,
989 }
990 #[no_mangle]
991 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
992 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
993         CResult_BuiltCommitmentTransactionDecodeErrorZ {
994                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
995                         result: Box::into_raw(Box::new(o)),
996                 },
997                 result_ok: true,
998         }
999 }
1000 #[no_mangle]
1001 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1002 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1003         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1004                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1005                         err: Box::into_raw(Box::new(e)),
1006                 },
1007                 result_ok: false,
1008         }
1009 }
1010 /// Checks if the given object is currently in the success state
1011 #[no_mangle]
1012 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1013         o.result_ok
1014 }
1015 #[no_mangle]
1016 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1017 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1018 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1019         fn drop(&mut self) {
1020                 if self.result_ok {
1021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1023                         }
1024                 } else {
1025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1027                         }
1028                 }
1029         }
1030 }
1031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1032         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1033                 let contents = if o.result_ok {
1034                         let result = unsafe { o.contents.result };
1035                         unsafe { o.contents.result = core::ptr::null_mut() };
1036                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1037                 } else {
1038                         let err = unsafe { o.contents.err };
1039                         unsafe { o.contents.err = core::ptr::null_mut(); }
1040                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1041                 };
1042                 Self {
1043                         contents,
1044                         result_ok: o.result_ok,
1045                 }
1046         }
1047 }
1048 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1049         fn clone(&self) -> Self {
1050                 if self.result_ok {
1051                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1052                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1053                         } }
1054                 } else {
1055                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1057                         } }
1058                 }
1059         }
1060 }
1061 #[no_mangle]
1062 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1063 /// but with all dynamically-allocated buffers duplicated in new buffers.
1064 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1065 #[repr(C)]
1066 /// The contents of CResult_TrustedClosingTransactionNoneZ
1067 pub union CResult_TrustedClosingTransactionNoneZPtr {
1068         /// A pointer to the contents in the success state.
1069         /// Reading from this pointer when `result_ok` is not set is undefined.
1070         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1071         /// Note that this value is always NULL, as there are no contents in the Err variant
1072         pub err: *mut core::ffi::c_void,
1073 }
1074 #[repr(C)]
1075 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1076 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1078 pub struct CResult_TrustedClosingTransactionNoneZ {
1079         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1080         /// `err` or `result` depending on the state of `result_ok`.
1081         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1082         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1083         pub result_ok: bool,
1084 }
1085 #[no_mangle]
1086 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1087 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1088         CResult_TrustedClosingTransactionNoneZ {
1089                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1090                         result: Box::into_raw(Box::new(o)),
1091                 },
1092                 result_ok: true,
1093         }
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1097 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1098         CResult_TrustedClosingTransactionNoneZ {
1099                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1100                         err: core::ptr::null_mut(),
1101                 },
1102                 result_ok: false,
1103         }
1104 }
1105 /// Checks if the given object is currently in the success state
1106 #[no_mangle]
1107 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1108         o.result_ok
1109 }
1110 #[no_mangle]
1111 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1112 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1113 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1114         fn drop(&mut self) {
1115                 if self.result_ok {
1116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1118                         }
1119                 } else {
1120                 }
1121         }
1122 }
1123 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1124         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1125                 let contents = if o.result_ok {
1126                         let result = unsafe { o.contents.result };
1127                         unsafe { o.contents.result = core::ptr::null_mut() };
1128                         CResult_TrustedClosingTransactionNoneZPtr { result }
1129                 } else {
1130                         let _ = unsafe { Box::from_raw(o.contents.err) };
1131                         o.contents.err = core::ptr::null_mut();
1132                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1133                 };
1134                 Self {
1135                         contents,
1136                         result_ok: o.result_ok,
1137                 }
1138         }
1139 }
1140 #[repr(C)]
1141 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1142 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1143         /// A pointer to the contents in the success state.
1144         /// Reading from this pointer when `result_ok` is not set is undefined.
1145         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1146         /// A pointer to the contents in the error state.
1147         /// Reading from this pointer when `result_ok` is set is undefined.
1148         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1149 }
1150 #[repr(C)]
1151 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1152 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1153 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1154 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1155         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1156         /// `err` or `result` depending on the state of `result_ok`.
1157         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1158         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1159         pub result_ok: bool,
1160 }
1161 #[no_mangle]
1162 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1163 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1164         CResult_CommitmentTransactionDecodeErrorZ {
1165                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1166                         result: Box::into_raw(Box::new(o)),
1167                 },
1168                 result_ok: true,
1169         }
1170 }
1171 #[no_mangle]
1172 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1173 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1174         CResult_CommitmentTransactionDecodeErrorZ {
1175                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1176                         err: Box::into_raw(Box::new(e)),
1177                 },
1178                 result_ok: false,
1179         }
1180 }
1181 /// Checks if the given object is currently in the success state
1182 #[no_mangle]
1183 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1184         o.result_ok
1185 }
1186 #[no_mangle]
1187 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1188 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1189 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1190         fn drop(&mut self) {
1191                 if self.result_ok {
1192                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1193                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1194                         }
1195                 } else {
1196                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1197                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1198                         }
1199                 }
1200         }
1201 }
1202 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1203         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1204                 let contents = if o.result_ok {
1205                         let result = unsafe { o.contents.result };
1206                         unsafe { o.contents.result = core::ptr::null_mut() };
1207                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1208                 } else {
1209                         let err = unsafe { o.contents.err };
1210                         unsafe { o.contents.err = core::ptr::null_mut(); }
1211                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1212                 };
1213                 Self {
1214                         contents,
1215                         result_ok: o.result_ok,
1216                 }
1217         }
1218 }
1219 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1220         fn clone(&self) -> Self {
1221                 if self.result_ok {
1222                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1223                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1224                         } }
1225                 } else {
1226                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1227                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1228                         } }
1229                 }
1230         }
1231 }
1232 #[no_mangle]
1233 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1234 /// but with all dynamically-allocated buffers duplicated in new buffers.
1235 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1236 #[repr(C)]
1237 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1238 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1239         /// A pointer to the contents in the success state.
1240         /// Reading from this pointer when `result_ok` is not set is undefined.
1241         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1242         /// Note that this value is always NULL, as there are no contents in the Err variant
1243         pub err: *mut core::ffi::c_void,
1244 }
1245 #[repr(C)]
1246 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1247 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1248 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1249 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1250         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1251         /// `err` or `result` depending on the state of `result_ok`.
1252         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1253         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1254         pub result_ok: bool,
1255 }
1256 #[no_mangle]
1257 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1258 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1259         CResult_TrustedCommitmentTransactionNoneZ {
1260                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1261                         result: Box::into_raw(Box::new(o)),
1262                 },
1263                 result_ok: true,
1264         }
1265 }
1266 #[no_mangle]
1267 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1268 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1269         CResult_TrustedCommitmentTransactionNoneZ {
1270                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1271                         err: core::ptr::null_mut(),
1272                 },
1273                 result_ok: false,
1274         }
1275 }
1276 /// Checks if the given object is currently in the success state
1277 #[no_mangle]
1278 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1279         o.result_ok
1280 }
1281 #[no_mangle]
1282 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1283 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1284 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1285         fn drop(&mut self) {
1286                 if self.result_ok {
1287                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1288                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1289                         }
1290                 } else {
1291                 }
1292         }
1293 }
1294 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1295         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1296                 let contents = if o.result_ok {
1297                         let result = unsafe { o.contents.result };
1298                         unsafe { o.contents.result = core::ptr::null_mut() };
1299                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1300                 } else {
1301                         let _ = unsafe { Box::from_raw(o.contents.err) };
1302                         o.contents.err = core::ptr::null_mut();
1303                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1304                 };
1305                 Self {
1306                         contents,
1307                         result_ok: o.result_ok,
1308                 }
1309         }
1310 }
1311 #[repr(C)]
1312 /// The contents of CResult_CVec_SignatureZNoneZ
1313 pub union CResult_CVec_SignatureZNoneZPtr {
1314         /// A pointer to the contents in the success state.
1315         /// Reading from this pointer when `result_ok` is not set is undefined.
1316         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1317         /// Note that this value is always NULL, as there are no contents in the Err variant
1318         pub err: *mut core::ffi::c_void,
1319 }
1320 #[repr(C)]
1321 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1322 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1324 pub struct CResult_CVec_SignatureZNoneZ {
1325         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1326         /// `err` or `result` depending on the state of `result_ok`.
1327         pub contents: CResult_CVec_SignatureZNoneZPtr,
1328         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1329         pub result_ok: bool,
1330 }
1331 #[no_mangle]
1332 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1333 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1334         CResult_CVec_SignatureZNoneZ {
1335                 contents: CResult_CVec_SignatureZNoneZPtr {
1336                         result: Box::into_raw(Box::new(o)),
1337                 },
1338                 result_ok: true,
1339         }
1340 }
1341 #[no_mangle]
1342 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1343 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1344         CResult_CVec_SignatureZNoneZ {
1345                 contents: CResult_CVec_SignatureZNoneZPtr {
1346                         err: core::ptr::null_mut(),
1347                 },
1348                 result_ok: false,
1349         }
1350 }
1351 /// Checks if the given object is currently in the success state
1352 #[no_mangle]
1353 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1354         o.result_ok
1355 }
1356 #[no_mangle]
1357 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1358 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1359 impl Drop for CResult_CVec_SignatureZNoneZ {
1360         fn drop(&mut self) {
1361                 if self.result_ok {
1362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1364                         }
1365                 } else {
1366                 }
1367         }
1368 }
1369 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1370         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1371                 let contents = if o.result_ok {
1372                         let result = unsafe { o.contents.result };
1373                         unsafe { o.contents.result = core::ptr::null_mut() };
1374                         CResult_CVec_SignatureZNoneZPtr { result }
1375                 } else {
1376                         let _ = unsafe { Box::from_raw(o.contents.err) };
1377                         o.contents.err = core::ptr::null_mut();
1378                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1379                 };
1380                 Self {
1381                         contents,
1382                         result_ok: o.result_ok,
1383                 }
1384         }
1385 }
1386 impl Clone for CResult_CVec_SignatureZNoneZ {
1387         fn clone(&self) -> Self {
1388                 if self.result_ok {
1389                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1390                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1391                         } }
1392                 } else {
1393                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1394                                 err: core::ptr::null_mut()
1395                         } }
1396                 }
1397         }
1398 }
1399 #[no_mangle]
1400 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1401 /// but with all dynamically-allocated buffers duplicated in new buffers.
1402 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1403 #[repr(C)]
1404 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1405 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1406         /// A pointer to the contents in the success state.
1407         /// Reading from this pointer when `result_ok` is not set is undefined.
1408         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1409         /// A pointer to the contents in the error state.
1410         /// Reading from this pointer when `result_ok` is set is undefined.
1411         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1412 }
1413 #[repr(C)]
1414 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1415 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1417 pub struct CResult_ShutdownScriptDecodeErrorZ {
1418         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1419         /// `err` or `result` depending on the state of `result_ok`.
1420         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1421         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1422         pub result_ok: bool,
1423 }
1424 #[no_mangle]
1425 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1426 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1427         CResult_ShutdownScriptDecodeErrorZ {
1428                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1429                         result: Box::into_raw(Box::new(o)),
1430                 },
1431                 result_ok: true,
1432         }
1433 }
1434 #[no_mangle]
1435 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1436 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1437         CResult_ShutdownScriptDecodeErrorZ {
1438                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1439                         err: Box::into_raw(Box::new(e)),
1440                 },
1441                 result_ok: false,
1442         }
1443 }
1444 /// Checks if the given object is currently in the success state
1445 #[no_mangle]
1446 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1447         o.result_ok
1448 }
1449 #[no_mangle]
1450 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1451 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1452 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1453         fn drop(&mut self) {
1454                 if self.result_ok {
1455                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1456                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1457                         }
1458                 } else {
1459                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1460                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1461                         }
1462                 }
1463         }
1464 }
1465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1466         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1467                 let contents = if o.result_ok {
1468                         let result = unsafe { o.contents.result };
1469                         unsafe { o.contents.result = core::ptr::null_mut() };
1470                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1471                 } else {
1472                         let err = unsafe { o.contents.err };
1473                         unsafe { o.contents.err = core::ptr::null_mut(); }
1474                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1475                 };
1476                 Self {
1477                         contents,
1478                         result_ok: o.result_ok,
1479                 }
1480         }
1481 }
1482 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1483         fn clone(&self) -> Self {
1484                 if self.result_ok {
1485                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1486                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1487                         } }
1488                 } else {
1489                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1490                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1491                         } }
1492                 }
1493         }
1494 }
1495 #[no_mangle]
1496 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1497 /// but with all dynamically-allocated buffers duplicated in new buffers.
1498 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1499 #[repr(C)]
1500 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1501 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1502         /// A pointer to the contents in the success state.
1503         /// Reading from this pointer when `result_ok` is not set is undefined.
1504         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1505         /// A pointer to the contents in the error state.
1506         /// Reading from this pointer when `result_ok` is set is undefined.
1507         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1508 }
1509 #[repr(C)]
1510 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1511 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1513 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1514         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1515         /// `err` or `result` depending on the state of `result_ok`.
1516         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1517         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1518         pub result_ok: bool,
1519 }
1520 #[no_mangle]
1521 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1522 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1523         CResult_ShutdownScriptInvalidShutdownScriptZ {
1524                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1525                         result: Box::into_raw(Box::new(o)),
1526                 },
1527                 result_ok: true,
1528         }
1529 }
1530 #[no_mangle]
1531 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1532 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1533         CResult_ShutdownScriptInvalidShutdownScriptZ {
1534                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1535                         err: Box::into_raw(Box::new(e)),
1536                 },
1537                 result_ok: false,
1538         }
1539 }
1540 /// Checks if the given object is currently in the success state
1541 #[no_mangle]
1542 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1543         o.result_ok
1544 }
1545 #[no_mangle]
1546 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1547 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1548 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1549         fn drop(&mut self) {
1550                 if self.result_ok {
1551                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1552                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1553                         }
1554                 } else {
1555                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1556                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1557                         }
1558                 }
1559         }
1560 }
1561 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1562         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1563                 let contents = if o.result_ok {
1564                         let result = unsafe { o.contents.result };
1565                         unsafe { o.contents.result = core::ptr::null_mut() };
1566                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1567                 } else {
1568                         let err = unsafe { o.contents.err };
1569                         unsafe { o.contents.err = core::ptr::null_mut(); }
1570                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1571                 };
1572                 Self {
1573                         contents,
1574                         result_ok: o.result_ok,
1575                 }
1576         }
1577 }
1578 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1579         fn clone(&self) -> Self {
1580                 if self.result_ok {
1581                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1582                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1583                         } }
1584                 } else {
1585                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1586                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1587                         } }
1588                 }
1589         }
1590 }
1591 #[no_mangle]
1592 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1593 /// but with all dynamically-allocated buffers duplicated in new buffers.
1594 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1595 #[repr(C)]
1596 /// The contents of CResult_NoneErrorZ
1597 pub union CResult_NoneErrorZPtr {
1598         /// Note that this value is always NULL, as there are no contents in the OK variant
1599         pub result: *mut core::ffi::c_void,
1600         /// A pointer to the contents in the error state.
1601         /// Reading from this pointer when `result_ok` is set is undefined.
1602         pub err: *mut crate::c_types::IOError,
1603 }
1604 #[repr(C)]
1605 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1606 /// containing a () on success and a crate::c_types::IOError on failure.
1607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1608 pub struct CResult_NoneErrorZ {
1609         /// The contents of this CResult_NoneErrorZ, accessible via either
1610         /// `err` or `result` depending on the state of `result_ok`.
1611         pub contents: CResult_NoneErrorZPtr,
1612         /// Whether this CResult_NoneErrorZ represents a success state.
1613         pub result_ok: bool,
1614 }
1615 #[no_mangle]
1616 /// Creates a new CResult_NoneErrorZ in the success state.
1617 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1618         CResult_NoneErrorZ {
1619                 contents: CResult_NoneErrorZPtr {
1620                         result: core::ptr::null_mut(),
1621                 },
1622                 result_ok: true,
1623         }
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_NoneErrorZ in the error state.
1627 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1628         CResult_NoneErrorZ {
1629                 contents: CResult_NoneErrorZPtr {
1630                         err: Box::into_raw(Box::new(e)),
1631                 },
1632                 result_ok: false,
1633         }
1634 }
1635 /// Checks if the given object is currently in the success state
1636 #[no_mangle]
1637 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1638         o.result_ok
1639 }
1640 #[no_mangle]
1641 /// Frees any resources used by the CResult_NoneErrorZ.
1642 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1643 impl Drop for CResult_NoneErrorZ {
1644         fn drop(&mut self) {
1645                 if self.result_ok {
1646                 } else {
1647                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1648                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1649                         }
1650                 }
1651         }
1652 }
1653 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1654         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1655                 let contents = if o.result_ok {
1656                         let _ = unsafe { Box::from_raw(o.contents.result) };
1657                         o.contents.result = core::ptr::null_mut();
1658                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1659                 } else {
1660                         let err = unsafe { o.contents.err };
1661                         unsafe { o.contents.err = core::ptr::null_mut(); }
1662                         CResult_NoneErrorZPtr { err }
1663                 };
1664                 Self {
1665                         contents,
1666                         result_ok: o.result_ok,
1667                 }
1668         }
1669 }
1670 impl Clone for CResult_NoneErrorZ {
1671         fn clone(&self) -> Self {
1672                 if self.result_ok {
1673                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1674                                 result: core::ptr::null_mut()
1675                         } }
1676                 } else {
1677                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1678                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1679                         } }
1680                 }
1681         }
1682 }
1683 #[no_mangle]
1684 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1685 /// but with all dynamically-allocated buffers duplicated in new buffers.
1686 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1687 #[repr(C)]
1688 /// The contents of CResult_RouteHopDecodeErrorZ
1689 pub union CResult_RouteHopDecodeErrorZPtr {
1690         /// A pointer to the contents in the success state.
1691         /// Reading from this pointer when `result_ok` is not set is undefined.
1692         pub result: *mut crate::lightning::routing::router::RouteHop,
1693         /// A pointer to the contents in the error state.
1694         /// Reading from this pointer when `result_ok` is set is undefined.
1695         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1696 }
1697 #[repr(C)]
1698 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1699 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1701 pub struct CResult_RouteHopDecodeErrorZ {
1702         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1703         /// `err` or `result` depending on the state of `result_ok`.
1704         pub contents: CResult_RouteHopDecodeErrorZPtr,
1705         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1706         pub result_ok: bool,
1707 }
1708 #[no_mangle]
1709 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1710 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1711         CResult_RouteHopDecodeErrorZ {
1712                 contents: CResult_RouteHopDecodeErrorZPtr {
1713                         result: Box::into_raw(Box::new(o)),
1714                 },
1715                 result_ok: true,
1716         }
1717 }
1718 #[no_mangle]
1719 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1720 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1721         CResult_RouteHopDecodeErrorZ {
1722                 contents: CResult_RouteHopDecodeErrorZPtr {
1723                         err: Box::into_raw(Box::new(e)),
1724                 },
1725                 result_ok: false,
1726         }
1727 }
1728 /// Checks if the given object is currently in the success state
1729 #[no_mangle]
1730 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1731         o.result_ok
1732 }
1733 #[no_mangle]
1734 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1735 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1736 impl Drop for CResult_RouteHopDecodeErrorZ {
1737         fn drop(&mut self) {
1738                 if self.result_ok {
1739                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1740                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1741                         }
1742                 } else {
1743                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1744                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1745                         }
1746                 }
1747         }
1748 }
1749 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1750         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1751                 let contents = if o.result_ok {
1752                         let result = unsafe { o.contents.result };
1753                         unsafe { o.contents.result = core::ptr::null_mut() };
1754                         CResult_RouteHopDecodeErrorZPtr { result }
1755                 } else {
1756                         let err = unsafe { o.contents.err };
1757                         unsafe { o.contents.err = core::ptr::null_mut(); }
1758                         CResult_RouteHopDecodeErrorZPtr { err }
1759                 };
1760                 Self {
1761                         contents,
1762                         result_ok: o.result_ok,
1763                 }
1764         }
1765 }
1766 impl Clone for CResult_RouteHopDecodeErrorZ {
1767         fn clone(&self) -> Self {
1768                 if self.result_ok {
1769                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1770                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1771                         } }
1772                 } else {
1773                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1774                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1775                         } }
1776                 }
1777         }
1778 }
1779 #[no_mangle]
1780 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1781 /// but with all dynamically-allocated buffers duplicated in new buffers.
1782 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1783 #[repr(C)]
1784 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1785 /// This corresponds to std::vector in C++
1786 pub struct CVec_RouteHopZ {
1787         /// The elements in the array.
1788         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1789         pub data: *mut crate::lightning::routing::router::RouteHop,
1790         /// The number of elements pointed to by `data`.
1791         pub datalen: usize
1792 }
1793 impl CVec_RouteHopZ {
1794         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1795                 if self.datalen == 0 { return Vec::new(); }
1796                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1797                 self.data = core::ptr::null_mut();
1798                 self.datalen = 0;
1799                 ret
1800         }
1801         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1802                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1803         }
1804 }
1805 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1806         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1807                 let datalen = v.len();
1808                 let data = Box::into_raw(v.into_boxed_slice());
1809                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1810         }
1811 }
1812 #[no_mangle]
1813 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1814 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1815 impl Drop for CVec_RouteHopZ {
1816         fn drop(&mut self) {
1817                 if self.datalen == 0 { return; }
1818                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1819         }
1820 }
1821 impl Clone for CVec_RouteHopZ {
1822         fn clone(&self) -> Self {
1823                 let mut res = Vec::new();
1824                 if self.datalen == 0 { return Self::from(res); }
1825                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1826                 Self::from(res)
1827         }
1828 }
1829 #[repr(C)]
1830 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1831 /// This corresponds to std::vector in C++
1832 pub struct CVec_CVec_RouteHopZZ {
1833         /// The elements in the array.
1834         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1835         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
1836         /// The number of elements pointed to by `data`.
1837         pub datalen: usize
1838 }
1839 impl CVec_CVec_RouteHopZZ {
1840         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
1841                 if self.datalen == 0 { return Vec::new(); }
1842                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1843                 self.data = core::ptr::null_mut();
1844                 self.datalen = 0;
1845                 ret
1846         }
1847         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
1848                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1849         }
1850 }
1851 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
1852         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
1853                 let datalen = v.len();
1854                 let data = Box::into_raw(v.into_boxed_slice());
1855                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1856         }
1857 }
1858 #[no_mangle]
1859 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1860 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
1861 impl Drop for CVec_CVec_RouteHopZZ {
1862         fn drop(&mut self) {
1863                 if self.datalen == 0 { return; }
1864                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1865         }
1866 }
1867 impl Clone for CVec_CVec_RouteHopZZ {
1868         fn clone(&self) -> Self {
1869                 let mut res = Vec::new();
1870                 if self.datalen == 0 { return Self::from(res); }
1871                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1872                 Self::from(res)
1873         }
1874 }
1875 #[repr(C)]
1876 /// The contents of CResult_RouteDecodeErrorZ
1877 pub union CResult_RouteDecodeErrorZPtr {
1878         /// A pointer to the contents in the success state.
1879         /// Reading from this pointer when `result_ok` is not set is undefined.
1880         pub result: *mut crate::lightning::routing::router::Route,
1881         /// A pointer to the contents in the error state.
1882         /// Reading from this pointer when `result_ok` is set is undefined.
1883         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1884 }
1885 #[repr(C)]
1886 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1887 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1889 pub struct CResult_RouteDecodeErrorZ {
1890         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
1891         /// `err` or `result` depending on the state of `result_ok`.
1892         pub contents: CResult_RouteDecodeErrorZPtr,
1893         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
1894         pub result_ok: bool,
1895 }
1896 #[no_mangle]
1897 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
1898 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
1899         CResult_RouteDecodeErrorZ {
1900                 contents: CResult_RouteDecodeErrorZPtr {
1901                         result: Box::into_raw(Box::new(o)),
1902                 },
1903                 result_ok: true,
1904         }
1905 }
1906 #[no_mangle]
1907 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
1908 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
1909         CResult_RouteDecodeErrorZ {
1910                 contents: CResult_RouteDecodeErrorZPtr {
1911                         err: Box::into_raw(Box::new(e)),
1912                 },
1913                 result_ok: false,
1914         }
1915 }
1916 /// Checks if the given object is currently in the success state
1917 #[no_mangle]
1918 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
1919         o.result_ok
1920 }
1921 #[no_mangle]
1922 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
1923 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
1924 impl Drop for CResult_RouteDecodeErrorZ {
1925         fn drop(&mut self) {
1926                 if self.result_ok {
1927                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1928                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1929                         }
1930                 } else {
1931                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1932                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1933                         }
1934                 }
1935         }
1936 }
1937 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
1938         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
1939                 let contents = if o.result_ok {
1940                         let result = unsafe { o.contents.result };
1941                         unsafe { o.contents.result = core::ptr::null_mut() };
1942                         CResult_RouteDecodeErrorZPtr { result }
1943                 } else {
1944                         let err = unsafe { o.contents.err };
1945                         unsafe { o.contents.err = core::ptr::null_mut(); }
1946                         CResult_RouteDecodeErrorZPtr { err }
1947                 };
1948                 Self {
1949                         contents,
1950                         result_ok: o.result_ok,
1951                 }
1952         }
1953 }
1954 impl Clone for CResult_RouteDecodeErrorZ {
1955         fn clone(&self) -> Self {
1956                 if self.result_ok {
1957                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
1958                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
1959                         } }
1960                 } else {
1961                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
1962                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1963                         } }
1964                 }
1965         }
1966 }
1967 #[no_mangle]
1968 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
1969 /// but with all dynamically-allocated buffers duplicated in new buffers.
1970 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
1971 #[repr(C)]
1972 /// The contents of CResult_RouteParametersDecodeErrorZ
1973 pub union CResult_RouteParametersDecodeErrorZPtr {
1974         /// A pointer to the contents in the success state.
1975         /// Reading from this pointer when `result_ok` is not set is undefined.
1976         pub result: *mut crate::lightning::routing::router::RouteParameters,
1977         /// A pointer to the contents in the error state.
1978         /// Reading from this pointer when `result_ok` is set is undefined.
1979         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1980 }
1981 #[repr(C)]
1982 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1983 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1985 pub struct CResult_RouteParametersDecodeErrorZ {
1986         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1987         /// `err` or `result` depending on the state of `result_ok`.
1988         pub contents: CResult_RouteParametersDecodeErrorZPtr,
1989         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1990         pub result_ok: bool,
1991 }
1992 #[no_mangle]
1993 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
1994 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
1995         CResult_RouteParametersDecodeErrorZ {
1996                 contents: CResult_RouteParametersDecodeErrorZPtr {
1997                         result: Box::into_raw(Box::new(o)),
1998                 },
1999                 result_ok: true,
2000         }
2001 }
2002 #[no_mangle]
2003 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2004 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2005         CResult_RouteParametersDecodeErrorZ {
2006                 contents: CResult_RouteParametersDecodeErrorZPtr {
2007                         err: Box::into_raw(Box::new(e)),
2008                 },
2009                 result_ok: false,
2010         }
2011 }
2012 /// Checks if the given object is currently in the success state
2013 #[no_mangle]
2014 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2015         o.result_ok
2016 }
2017 #[no_mangle]
2018 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2019 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2020 impl Drop for CResult_RouteParametersDecodeErrorZ {
2021         fn drop(&mut self) {
2022                 if self.result_ok {
2023                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2024                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2025                         }
2026                 } else {
2027                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2028                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2029                         }
2030                 }
2031         }
2032 }
2033 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2034         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2035                 let contents = if o.result_ok {
2036                         let result = unsafe { o.contents.result };
2037                         unsafe { o.contents.result = core::ptr::null_mut() };
2038                         CResult_RouteParametersDecodeErrorZPtr { result }
2039                 } else {
2040                         let err = unsafe { o.contents.err };
2041                         unsafe { o.contents.err = core::ptr::null_mut(); }
2042                         CResult_RouteParametersDecodeErrorZPtr { err }
2043                 };
2044                 Self {
2045                         contents,
2046                         result_ok: o.result_ok,
2047                 }
2048         }
2049 }
2050 impl Clone for CResult_RouteParametersDecodeErrorZ {
2051         fn clone(&self) -> Self {
2052                 if self.result_ok {
2053                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2054                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2055                         } }
2056                 } else {
2057                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2058                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2059                         } }
2060                 }
2061         }
2062 }
2063 #[no_mangle]
2064 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2065 /// but with all dynamically-allocated buffers duplicated in new buffers.
2066 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2067 #[repr(C)]
2068 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2069 /// This corresponds to std::vector in C++
2070 pub struct CVec_RouteHintZ {
2071         /// The elements in the array.
2072         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2073         pub data: *mut crate::lightning::routing::router::RouteHint,
2074         /// The number of elements pointed to by `data`.
2075         pub datalen: usize
2076 }
2077 impl CVec_RouteHintZ {
2078         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2079                 if self.datalen == 0 { return Vec::new(); }
2080                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2081                 self.data = core::ptr::null_mut();
2082                 self.datalen = 0;
2083                 ret
2084         }
2085         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2086                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2087         }
2088 }
2089 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2090         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2091                 let datalen = v.len();
2092                 let data = Box::into_raw(v.into_boxed_slice());
2093                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2094         }
2095 }
2096 #[no_mangle]
2097 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2098 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2099 impl Drop for CVec_RouteHintZ {
2100         fn drop(&mut self) {
2101                 if self.datalen == 0 { return; }
2102                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2103         }
2104 }
2105 impl Clone for CVec_RouteHintZ {
2106         fn clone(&self) -> Self {
2107                 let mut res = Vec::new();
2108                 if self.datalen == 0 { return Self::from(res); }
2109                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2110                 Self::from(res)
2111         }
2112 }
2113 #[repr(C)]
2114 #[derive(Clone)]
2115 /// An enum which can either contain a u64 or not
2116 pub enum COption_u64Z {
2117         /// When we're in this state, this COption_u64Z contains a u64
2118         Some(u64),
2119         /// When we're in this state, this COption_u64Z contains nothing
2120         None
2121 }
2122 impl COption_u64Z {
2123         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2124                 if let Self::None = self { false } else { true }
2125         }
2126         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2127                 !self.is_some()
2128         }
2129         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2130                 if let Self::Some(v) = self { v } else { unreachable!() }
2131         }
2132 }
2133 #[no_mangle]
2134 /// Constructs a new COption_u64Z containing a u64
2135 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2136         COption_u64Z::Some(o)
2137 }
2138 #[no_mangle]
2139 /// Constructs a new COption_u64Z containing nothing
2140 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2141         COption_u64Z::None
2142 }
2143 #[no_mangle]
2144 /// Frees any resources associated with the u64, if we are in the Some state
2145 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2146 #[no_mangle]
2147 /// Creates a new COption_u64Z which has the same data as `orig`
2148 /// but with all dynamically-allocated buffers duplicated in new buffers.
2149 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2150 #[repr(C)]
2151 /// The contents of CResult_PayeeDecodeErrorZ
2152 pub union CResult_PayeeDecodeErrorZPtr {
2153         /// A pointer to the contents in the success state.
2154         /// Reading from this pointer when `result_ok` is not set is undefined.
2155         pub result: *mut crate::lightning::routing::router::Payee,
2156         /// A pointer to the contents in the error state.
2157         /// Reading from this pointer when `result_ok` is set is undefined.
2158         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2159 }
2160 #[repr(C)]
2161 /// A CResult_PayeeDecodeErrorZ represents the result of a fallible operation,
2162 /// containing a crate::lightning::routing::router::Payee on success and a crate::lightning::ln::msgs::DecodeError on failure.
2163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2164 pub struct CResult_PayeeDecodeErrorZ {
2165         /// The contents of this CResult_PayeeDecodeErrorZ, accessible via either
2166         /// `err` or `result` depending on the state of `result_ok`.
2167         pub contents: CResult_PayeeDecodeErrorZPtr,
2168         /// Whether this CResult_PayeeDecodeErrorZ represents a success state.
2169         pub result_ok: bool,
2170 }
2171 #[no_mangle]
2172 /// Creates a new CResult_PayeeDecodeErrorZ in the success state.
2173 pub extern "C" fn CResult_PayeeDecodeErrorZ_ok(o: crate::lightning::routing::router::Payee) -> CResult_PayeeDecodeErrorZ {
2174         CResult_PayeeDecodeErrorZ {
2175                 contents: CResult_PayeeDecodeErrorZPtr {
2176                         result: Box::into_raw(Box::new(o)),
2177                 },
2178                 result_ok: true,
2179         }
2180 }
2181 #[no_mangle]
2182 /// Creates a new CResult_PayeeDecodeErrorZ in the error state.
2183 pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PayeeDecodeErrorZ {
2184         CResult_PayeeDecodeErrorZ {
2185                 contents: CResult_PayeeDecodeErrorZPtr {
2186                         err: Box::into_raw(Box::new(e)),
2187                 },
2188                 result_ok: false,
2189         }
2190 }
2191 /// Checks if the given object is currently in the success state
2192 #[no_mangle]
2193 pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool {
2194         o.result_ok
2195 }
2196 #[no_mangle]
2197 /// Frees any resources used by the CResult_PayeeDecodeErrorZ.
2198 pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { }
2199 impl Drop for CResult_PayeeDecodeErrorZ {
2200         fn drop(&mut self) {
2201                 if self.result_ok {
2202                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2203                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2204                         }
2205                 } else {
2206                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2207                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2208                         }
2209                 }
2210         }
2211 }
2212 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>> for CResult_PayeeDecodeErrorZ {
2213         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Payee, crate::lightning::ln::msgs::DecodeError>) -> Self {
2214                 let contents = if o.result_ok {
2215                         let result = unsafe { o.contents.result };
2216                         unsafe { o.contents.result = core::ptr::null_mut() };
2217                         CResult_PayeeDecodeErrorZPtr { result }
2218                 } else {
2219                         let err = unsafe { o.contents.err };
2220                         unsafe { o.contents.err = core::ptr::null_mut(); }
2221                         CResult_PayeeDecodeErrorZPtr { err }
2222                 };
2223                 Self {
2224                         contents,
2225                         result_ok: o.result_ok,
2226                 }
2227         }
2228 }
2229 impl Clone for CResult_PayeeDecodeErrorZ {
2230         fn clone(&self) -> Self {
2231                 if self.result_ok {
2232                         Self { result_ok: true, contents: CResult_PayeeDecodeErrorZPtr {
2233                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Payee>::clone(unsafe { &*self.contents.result })))
2234                         } }
2235                 } else {
2236                         Self { result_ok: false, contents: CResult_PayeeDecodeErrorZPtr {
2237                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2238                         } }
2239                 }
2240         }
2241 }
2242 #[no_mangle]
2243 /// Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig`
2244 /// but with all dynamically-allocated buffers duplicated in new buffers.
2245 pub extern "C" fn CResult_PayeeDecodeErrorZ_clone(orig: &CResult_PayeeDecodeErrorZ) -> CResult_PayeeDecodeErrorZ { Clone::clone(&orig) }
2246 #[repr(C)]
2247 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2248 /// This corresponds to std::vector in C++
2249 pub struct CVec_RouteHintHopZ {
2250         /// The elements in the array.
2251         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2252         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2253         /// The number of elements pointed to by `data`.
2254         pub datalen: usize
2255 }
2256 impl CVec_RouteHintHopZ {
2257         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2258                 if self.datalen == 0 { return Vec::new(); }
2259                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2260                 self.data = core::ptr::null_mut();
2261                 self.datalen = 0;
2262                 ret
2263         }
2264         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2265                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2266         }
2267 }
2268 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2269         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2270                 let datalen = v.len();
2271                 let data = Box::into_raw(v.into_boxed_slice());
2272                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2273         }
2274 }
2275 #[no_mangle]
2276 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2277 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2278 impl Drop for CVec_RouteHintHopZ {
2279         fn drop(&mut self) {
2280                 if self.datalen == 0 { return; }
2281                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2282         }
2283 }
2284 impl Clone for CVec_RouteHintHopZ {
2285         fn clone(&self) -> Self {
2286                 let mut res = Vec::new();
2287                 if self.datalen == 0 { return Self::from(res); }
2288                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2289                 Self::from(res)
2290         }
2291 }
2292 #[repr(C)]
2293 /// The contents of CResult_RouteHintDecodeErrorZ
2294 pub union CResult_RouteHintDecodeErrorZPtr {
2295         /// A pointer to the contents in the success state.
2296         /// Reading from this pointer when `result_ok` is not set is undefined.
2297         pub result: *mut crate::lightning::routing::router::RouteHint,
2298         /// A pointer to the contents in the error state.
2299         /// Reading from this pointer when `result_ok` is set is undefined.
2300         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2301 }
2302 #[repr(C)]
2303 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2304 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2305 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2306 pub struct CResult_RouteHintDecodeErrorZ {
2307         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2308         /// `err` or `result` depending on the state of `result_ok`.
2309         pub contents: CResult_RouteHintDecodeErrorZPtr,
2310         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2311         pub result_ok: bool,
2312 }
2313 #[no_mangle]
2314 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2315 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2316         CResult_RouteHintDecodeErrorZ {
2317                 contents: CResult_RouteHintDecodeErrorZPtr {
2318                         result: Box::into_raw(Box::new(o)),
2319                 },
2320                 result_ok: true,
2321         }
2322 }
2323 #[no_mangle]
2324 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2325 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2326         CResult_RouteHintDecodeErrorZ {
2327                 contents: CResult_RouteHintDecodeErrorZPtr {
2328                         err: Box::into_raw(Box::new(e)),
2329                 },
2330                 result_ok: false,
2331         }
2332 }
2333 /// Checks if the given object is currently in the success state
2334 #[no_mangle]
2335 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2336         o.result_ok
2337 }
2338 #[no_mangle]
2339 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2340 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2341 impl Drop for CResult_RouteHintDecodeErrorZ {
2342         fn drop(&mut self) {
2343                 if self.result_ok {
2344                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2345                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2346                         }
2347                 } else {
2348                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2349                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2350                         }
2351                 }
2352         }
2353 }
2354 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2355         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2356                 let contents = if o.result_ok {
2357                         let result = unsafe { o.contents.result };
2358                         unsafe { o.contents.result = core::ptr::null_mut() };
2359                         CResult_RouteHintDecodeErrorZPtr { result }
2360                 } else {
2361                         let err = unsafe { o.contents.err };
2362                         unsafe { o.contents.err = core::ptr::null_mut(); }
2363                         CResult_RouteHintDecodeErrorZPtr { err }
2364                 };
2365                 Self {
2366                         contents,
2367                         result_ok: o.result_ok,
2368                 }
2369         }
2370 }
2371 impl Clone for CResult_RouteHintDecodeErrorZ {
2372         fn clone(&self) -> Self {
2373                 if self.result_ok {
2374                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2375                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2376                         } }
2377                 } else {
2378                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2379                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2380                         } }
2381                 }
2382         }
2383 }
2384 #[no_mangle]
2385 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2386 /// but with all dynamically-allocated buffers duplicated in new buffers.
2387 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2388 #[repr(C)]
2389 /// The contents of CResult_RouteHintHopDecodeErrorZ
2390 pub union CResult_RouteHintHopDecodeErrorZPtr {
2391         /// A pointer to the contents in the success state.
2392         /// Reading from this pointer when `result_ok` is not set is undefined.
2393         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2394         /// A pointer to the contents in the error state.
2395         /// Reading from this pointer when `result_ok` is set is undefined.
2396         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2397 }
2398 #[repr(C)]
2399 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2400 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2402 pub struct CResult_RouteHintHopDecodeErrorZ {
2403         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2404         /// `err` or `result` depending on the state of `result_ok`.
2405         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2406         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2407         pub result_ok: bool,
2408 }
2409 #[no_mangle]
2410 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2411 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2412         CResult_RouteHintHopDecodeErrorZ {
2413                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2414                         result: Box::into_raw(Box::new(o)),
2415                 },
2416                 result_ok: true,
2417         }
2418 }
2419 #[no_mangle]
2420 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2421 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2422         CResult_RouteHintHopDecodeErrorZ {
2423                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2424                         err: Box::into_raw(Box::new(e)),
2425                 },
2426                 result_ok: false,
2427         }
2428 }
2429 /// Checks if the given object is currently in the success state
2430 #[no_mangle]
2431 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2432         o.result_ok
2433 }
2434 #[no_mangle]
2435 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2436 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2437 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2438         fn drop(&mut self) {
2439                 if self.result_ok {
2440                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2441                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2442                         }
2443                 } else {
2444                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2445                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2446                         }
2447                 }
2448         }
2449 }
2450 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2451         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2452                 let contents = if o.result_ok {
2453                         let result = unsafe { o.contents.result };
2454                         unsafe { o.contents.result = core::ptr::null_mut() };
2455                         CResult_RouteHintHopDecodeErrorZPtr { result }
2456                 } else {
2457                         let err = unsafe { o.contents.err };
2458                         unsafe { o.contents.err = core::ptr::null_mut(); }
2459                         CResult_RouteHintHopDecodeErrorZPtr { err }
2460                 };
2461                 Self {
2462                         contents,
2463                         result_ok: o.result_ok,
2464                 }
2465         }
2466 }
2467 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2468         fn clone(&self) -> Self {
2469                 if self.result_ok {
2470                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2471                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2472                         } }
2473                 } else {
2474                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2475                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2476                         } }
2477                 }
2478         }
2479 }
2480 #[no_mangle]
2481 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2482 /// but with all dynamically-allocated buffers duplicated in new buffers.
2483 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2484 #[repr(C)]
2485 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2486 /// This corresponds to std::vector in C++
2487 pub struct CVec_ChannelDetailsZ {
2488         /// The elements in the array.
2489         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2490         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2491         /// The number of elements pointed to by `data`.
2492         pub datalen: usize
2493 }
2494 impl CVec_ChannelDetailsZ {
2495         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2496                 if self.datalen == 0 { return Vec::new(); }
2497                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2498                 self.data = core::ptr::null_mut();
2499                 self.datalen = 0;
2500                 ret
2501         }
2502         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2503                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2504         }
2505 }
2506 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2507         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2508                 let datalen = v.len();
2509                 let data = Box::into_raw(v.into_boxed_slice());
2510                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2511         }
2512 }
2513 #[no_mangle]
2514 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2515 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2516 impl Drop for CVec_ChannelDetailsZ {
2517         fn drop(&mut self) {
2518                 if self.datalen == 0 { return; }
2519                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2520         }
2521 }
2522 impl Clone for CVec_ChannelDetailsZ {
2523         fn clone(&self) -> Self {
2524                 let mut res = Vec::new();
2525                 if self.datalen == 0 { return Self::from(res); }
2526                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2527                 Self::from(res)
2528         }
2529 }
2530 #[repr(C)]
2531 /// The contents of CResult_RouteLightningErrorZ
2532 pub union CResult_RouteLightningErrorZPtr {
2533         /// A pointer to the contents in the success state.
2534         /// Reading from this pointer when `result_ok` is not set is undefined.
2535         pub result: *mut crate::lightning::routing::router::Route,
2536         /// A pointer to the contents in the error state.
2537         /// Reading from this pointer when `result_ok` is set is undefined.
2538         pub err: *mut crate::lightning::ln::msgs::LightningError,
2539 }
2540 #[repr(C)]
2541 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2542 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2544 pub struct CResult_RouteLightningErrorZ {
2545         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2546         /// `err` or `result` depending on the state of `result_ok`.
2547         pub contents: CResult_RouteLightningErrorZPtr,
2548         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2549         pub result_ok: bool,
2550 }
2551 #[no_mangle]
2552 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2553 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2554         CResult_RouteLightningErrorZ {
2555                 contents: CResult_RouteLightningErrorZPtr {
2556                         result: Box::into_raw(Box::new(o)),
2557                 },
2558                 result_ok: true,
2559         }
2560 }
2561 #[no_mangle]
2562 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2563 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2564         CResult_RouteLightningErrorZ {
2565                 contents: CResult_RouteLightningErrorZPtr {
2566                         err: Box::into_raw(Box::new(e)),
2567                 },
2568                 result_ok: false,
2569         }
2570 }
2571 /// Checks if the given object is currently in the success state
2572 #[no_mangle]
2573 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2574         o.result_ok
2575 }
2576 #[no_mangle]
2577 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2578 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2579 impl Drop for CResult_RouteLightningErrorZ {
2580         fn drop(&mut self) {
2581                 if self.result_ok {
2582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2584                         }
2585                 } else {
2586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2588                         }
2589                 }
2590         }
2591 }
2592 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2594                 let contents = if o.result_ok {
2595                         let result = unsafe { o.contents.result };
2596                         unsafe { o.contents.result = core::ptr::null_mut() };
2597                         CResult_RouteLightningErrorZPtr { result }
2598                 } else {
2599                         let err = unsafe { o.contents.err };
2600                         unsafe { o.contents.err = core::ptr::null_mut(); }
2601                         CResult_RouteLightningErrorZPtr { err }
2602                 };
2603                 Self {
2604                         contents,
2605                         result_ok: o.result_ok,
2606                 }
2607         }
2608 }
2609 impl Clone for CResult_RouteLightningErrorZ {
2610         fn clone(&self) -> Self {
2611                 if self.result_ok {
2612                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2613                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2614                         } }
2615                 } else {
2616                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2618                         } }
2619                 }
2620         }
2621 }
2622 #[no_mangle]
2623 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2624 /// but with all dynamically-allocated buffers duplicated in new buffers.
2625 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2626 #[repr(C)]
2627 /// The contents of CResult_TxOutAccessErrorZ
2628 pub union CResult_TxOutAccessErrorZPtr {
2629         /// A pointer to the contents in the success state.
2630         /// Reading from this pointer when `result_ok` is not set is undefined.
2631         pub result: *mut crate::c_types::TxOut,
2632         /// A pointer to the contents in the error state.
2633         /// Reading from this pointer when `result_ok` is set is undefined.
2634         pub err: *mut crate::lightning::chain::AccessError,
2635 }
2636 #[repr(C)]
2637 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2638 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2640 pub struct CResult_TxOutAccessErrorZ {
2641         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2642         /// `err` or `result` depending on the state of `result_ok`.
2643         pub contents: CResult_TxOutAccessErrorZPtr,
2644         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2645         pub result_ok: bool,
2646 }
2647 #[no_mangle]
2648 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2649 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2650         CResult_TxOutAccessErrorZ {
2651                 contents: CResult_TxOutAccessErrorZPtr {
2652                         result: Box::into_raw(Box::new(o)),
2653                 },
2654                 result_ok: true,
2655         }
2656 }
2657 #[no_mangle]
2658 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2659 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2660         CResult_TxOutAccessErrorZ {
2661                 contents: CResult_TxOutAccessErrorZPtr {
2662                         err: Box::into_raw(Box::new(e)),
2663                 },
2664                 result_ok: false,
2665         }
2666 }
2667 /// Checks if the given object is currently in the success state
2668 #[no_mangle]
2669 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2670         o.result_ok
2671 }
2672 #[no_mangle]
2673 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2674 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2675 impl Drop for CResult_TxOutAccessErrorZ {
2676         fn drop(&mut self) {
2677                 if self.result_ok {
2678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2680                         }
2681                 } else {
2682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2684                         }
2685                 }
2686         }
2687 }
2688 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2689         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2690                 let contents = if o.result_ok {
2691                         let result = unsafe { o.contents.result };
2692                         unsafe { o.contents.result = core::ptr::null_mut() };
2693                         CResult_TxOutAccessErrorZPtr { result }
2694                 } else {
2695                         let err = unsafe { o.contents.err };
2696                         unsafe { o.contents.err = core::ptr::null_mut(); }
2697                         CResult_TxOutAccessErrorZPtr { err }
2698                 };
2699                 Self {
2700                         contents,
2701                         result_ok: o.result_ok,
2702                 }
2703         }
2704 }
2705 impl Clone for CResult_TxOutAccessErrorZ {
2706         fn clone(&self) -> Self {
2707                 if self.result_ok {
2708                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2709                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2710                         } }
2711                 } else {
2712                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2713                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2714                         } }
2715                 }
2716         }
2717 }
2718 #[no_mangle]
2719 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2720 /// but with all dynamically-allocated buffers duplicated in new buffers.
2721 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2722 #[repr(C)]
2723 /// A tuple of 2 elements. See the individual fields for the types contained.
2724 pub struct C2Tuple_usizeTransactionZ {
2725         /// The element at position 0
2726         pub a: usize,
2727         /// The element at position 1
2728         pub b: crate::c_types::Transaction,
2729 }
2730 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2731         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2732                 Self {
2733                         a: tup.0,
2734                         b: tup.1,
2735                 }
2736         }
2737 }
2738 impl C2Tuple_usizeTransactionZ {
2739         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2740                 (self.a, self.b)
2741         }
2742 }
2743 impl Clone for C2Tuple_usizeTransactionZ {
2744         fn clone(&self) -> Self {
2745                 Self {
2746                         a: Clone::clone(&self.a),
2747                         b: Clone::clone(&self.b),
2748                 }
2749         }
2750 }
2751 #[no_mangle]
2752 /// Creates a new tuple which has the same data as `orig`
2753 /// but with all dynamically-allocated buffers duplicated in new buffers.
2754 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2755 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2756 #[no_mangle]
2757 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2758         C2Tuple_usizeTransactionZ { a, b, }
2759 }
2760
2761 #[no_mangle]
2762 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2763 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2764 #[repr(C)]
2765 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2766 /// This corresponds to std::vector in C++
2767 pub struct CVec_C2Tuple_usizeTransactionZZ {
2768         /// The elements in the array.
2769         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2770         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2771         /// The number of elements pointed to by `data`.
2772         pub datalen: usize
2773 }
2774 impl CVec_C2Tuple_usizeTransactionZZ {
2775         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2776                 if self.datalen == 0 { return Vec::new(); }
2777                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2778                 self.data = core::ptr::null_mut();
2779                 self.datalen = 0;
2780                 ret
2781         }
2782         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2783                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2784         }
2785 }
2786 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2787         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2788                 let datalen = v.len();
2789                 let data = Box::into_raw(v.into_boxed_slice());
2790                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2791         }
2792 }
2793 #[no_mangle]
2794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2795 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2796 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2797         fn drop(&mut self) {
2798                 if self.datalen == 0 { return; }
2799                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2800         }
2801 }
2802 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2803         fn clone(&self) -> Self {
2804                 let mut res = Vec::new();
2805                 if self.datalen == 0 { return Self::from(res); }
2806                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2807                 Self::from(res)
2808         }
2809 }
2810 #[repr(C)]
2811 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2812 /// This corresponds to std::vector in C++
2813 pub struct CVec_TxidZ {
2814         /// The elements in the array.
2815         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2816         pub data: *mut crate::c_types::ThirtyTwoBytes,
2817         /// The number of elements pointed to by `data`.
2818         pub datalen: usize
2819 }
2820 impl CVec_TxidZ {
2821         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2822                 if self.datalen == 0 { return Vec::new(); }
2823                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2824                 self.data = core::ptr::null_mut();
2825                 self.datalen = 0;
2826                 ret
2827         }
2828         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2829                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2830         }
2831 }
2832 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2833         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2834                 let datalen = v.len();
2835                 let data = Box::into_raw(v.into_boxed_slice());
2836                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2837         }
2838 }
2839 #[no_mangle]
2840 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2841 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2842 impl Drop for CVec_TxidZ {
2843         fn drop(&mut self) {
2844                 if self.datalen == 0 { return; }
2845                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2846         }
2847 }
2848 impl Clone for CVec_TxidZ {
2849         fn clone(&self) -> Self {
2850                 let mut res = Vec::new();
2851                 if self.datalen == 0 { return Self::from(res); }
2852                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2853                 Self::from(res)
2854         }
2855 }
2856 #[repr(C)]
2857 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2858 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2859         /// Note that this value is always NULL, as there are no contents in the OK variant
2860         pub result: *mut core::ffi::c_void,
2861         /// A pointer to the contents in the error state.
2862         /// Reading from this pointer when `result_ok` is set is undefined.
2863         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
2864 }
2865 #[repr(C)]
2866 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2867 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2869 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2870         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2871         /// `err` or `result` depending on the state of `result_ok`.
2872         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2873         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2874         pub result_ok: bool,
2875 }
2876 #[no_mangle]
2877 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2878 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2879         CResult_NoneChannelMonitorUpdateErrZ {
2880                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2881                         result: core::ptr::null_mut(),
2882                 },
2883                 result_ok: true,
2884         }
2885 }
2886 #[no_mangle]
2887 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2888 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2889         CResult_NoneChannelMonitorUpdateErrZ {
2890                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2891                         err: Box::into_raw(Box::new(e)),
2892                 },
2893                 result_ok: false,
2894         }
2895 }
2896 /// Checks if the given object is currently in the success state
2897 #[no_mangle]
2898 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
2899         o.result_ok
2900 }
2901 #[no_mangle]
2902 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2903 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2904 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2905         fn drop(&mut self) {
2906                 if self.result_ok {
2907                 } else {
2908                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2909                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2910                         }
2911                 }
2912         }
2913 }
2914 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2915         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
2916                 let contents = if o.result_ok {
2917                         let _ = unsafe { Box::from_raw(o.contents.result) };
2918                         o.contents.result = core::ptr::null_mut();
2919                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
2920                 } else {
2921                         let err = unsafe { o.contents.err };
2922                         unsafe { o.contents.err = core::ptr::null_mut(); }
2923                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2924                 };
2925                 Self {
2926                         contents,
2927                         result_ok: o.result_ok,
2928                 }
2929         }
2930 }
2931 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2932         fn clone(&self) -> Self {
2933                 if self.result_ok {
2934                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2935                                 result: core::ptr::null_mut()
2936                         } }
2937                 } else {
2938                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2939                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2940                         } }
2941                 }
2942         }
2943 }
2944 #[no_mangle]
2945 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2946 /// but with all dynamically-allocated buffers duplicated in new buffers.
2947 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
2948 #[repr(C)]
2949 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2950 /// This corresponds to std::vector in C++
2951 pub struct CVec_MonitorEventZ {
2952         /// The elements in the array.
2953         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2954         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
2955         /// The number of elements pointed to by `data`.
2956         pub datalen: usize
2957 }
2958 impl CVec_MonitorEventZ {
2959         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
2960                 if self.datalen == 0 { return Vec::new(); }
2961                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2962                 self.data = core::ptr::null_mut();
2963                 self.datalen = 0;
2964                 ret
2965         }
2966         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
2967                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2968         }
2969 }
2970 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2971         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
2972                 let datalen = v.len();
2973                 let data = Box::into_raw(v.into_boxed_slice());
2974                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2975         }
2976 }
2977 #[no_mangle]
2978 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2979 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2980 impl Drop for CVec_MonitorEventZ {
2981         fn drop(&mut self) {
2982                 if self.datalen == 0 { return; }
2983                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2984         }
2985 }
2986 impl Clone for CVec_MonitorEventZ {
2987         fn clone(&self) -> Self {
2988                 let mut res = Vec::new();
2989                 if self.datalen == 0 { return Self::from(res); }
2990                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2991                 Self::from(res)
2992         }
2993 }
2994 #[repr(C)]
2995 #[derive(Clone)]
2996 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2997 pub enum COption_C2Tuple_usizeTransactionZZ {
2998         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2999         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3000         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3001         None
3002 }
3003 impl COption_C2Tuple_usizeTransactionZZ {
3004         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3005                 if let Self::None = self { false } else { true }
3006         }
3007         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3008                 !self.is_some()
3009         }
3010         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3011                 if let Self::Some(v) = self { v } else { unreachable!() }
3012         }
3013 }
3014 #[no_mangle]
3015 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3016 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3017         COption_C2Tuple_usizeTransactionZZ::Some(o)
3018 }
3019 #[no_mangle]
3020 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3021 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3022         COption_C2Tuple_usizeTransactionZZ::None
3023 }
3024 #[no_mangle]
3025 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3026 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3027 #[no_mangle]
3028 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3029 /// but with all dynamically-allocated buffers duplicated in new buffers.
3030 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3031 #[repr(C)]
3032 #[derive(Clone)]
3033 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3034 pub enum COption_ClosureReasonZ {
3035         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3036         Some(crate::lightning::util::events::ClosureReason),
3037         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3038         None
3039 }
3040 impl COption_ClosureReasonZ {
3041         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3042                 if let Self::None = self { false } else { true }
3043         }
3044         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3045                 !self.is_some()
3046         }
3047         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3048                 if let Self::Some(v) = self { v } else { unreachable!() }
3049         }
3050 }
3051 #[no_mangle]
3052 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3053 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3054         COption_ClosureReasonZ::Some(o)
3055 }
3056 #[no_mangle]
3057 /// Constructs a new COption_ClosureReasonZ containing nothing
3058 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3059         COption_ClosureReasonZ::None
3060 }
3061 #[no_mangle]
3062 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3063 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3064 #[no_mangle]
3065 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3066 /// but with all dynamically-allocated buffers duplicated in new buffers.
3067 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3068 #[repr(C)]
3069 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3070 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3071         /// A pointer to the contents in the success state.
3072         /// Reading from this pointer when `result_ok` is not set is undefined.
3073         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3074         /// A pointer to the contents in the error state.
3075         /// Reading from this pointer when `result_ok` is set is undefined.
3076         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3077 }
3078 #[repr(C)]
3079 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3080 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3082 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3083         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3084         /// `err` or `result` depending on the state of `result_ok`.
3085         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3086         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3087         pub result_ok: bool,
3088 }
3089 #[no_mangle]
3090 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3091 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3092         CResult_COption_ClosureReasonZDecodeErrorZ {
3093                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3094                         result: Box::into_raw(Box::new(o)),
3095                 },
3096                 result_ok: true,
3097         }
3098 }
3099 #[no_mangle]
3100 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3101 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3102         CResult_COption_ClosureReasonZDecodeErrorZ {
3103                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3104                         err: Box::into_raw(Box::new(e)),
3105                 },
3106                 result_ok: false,
3107         }
3108 }
3109 /// Checks if the given object is currently in the success state
3110 #[no_mangle]
3111 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3112         o.result_ok
3113 }
3114 #[no_mangle]
3115 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3116 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3117 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3118         fn drop(&mut self) {
3119                 if self.result_ok {
3120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3122                         }
3123                 } else {
3124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3126                         }
3127                 }
3128         }
3129 }
3130 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3131         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3132                 let contents = if o.result_ok {
3133                         let result = unsafe { o.contents.result };
3134                         unsafe { o.contents.result = core::ptr::null_mut() };
3135                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3136                 } else {
3137                         let err = unsafe { o.contents.err };
3138                         unsafe { o.contents.err = core::ptr::null_mut(); }
3139                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3140                 };
3141                 Self {
3142                         contents,
3143                         result_ok: o.result_ok,
3144                 }
3145         }
3146 }
3147 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3148         fn clone(&self) -> Self {
3149                 if self.result_ok {
3150                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3151                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3152                         } }
3153                 } else {
3154                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3155                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3156                         } }
3157                 }
3158         }
3159 }
3160 #[no_mangle]
3161 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3162 /// but with all dynamically-allocated buffers duplicated in new buffers.
3163 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3164 #[repr(C)]
3165 #[derive(Clone)]
3166 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3167 pub enum COption_NetworkUpdateZ {
3168         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3169         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3170         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3171         None
3172 }
3173 impl COption_NetworkUpdateZ {
3174         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3175                 if let Self::None = self { false } else { true }
3176         }
3177         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3178                 !self.is_some()
3179         }
3180         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3181                 if let Self::Some(v) = self { v } else { unreachable!() }
3182         }
3183 }
3184 #[no_mangle]
3185 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3186 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3187         COption_NetworkUpdateZ::Some(o)
3188 }
3189 #[no_mangle]
3190 /// Constructs a new COption_NetworkUpdateZ containing nothing
3191 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3192         COption_NetworkUpdateZ::None
3193 }
3194 #[no_mangle]
3195 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3196 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3197 #[no_mangle]
3198 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3199 /// but with all dynamically-allocated buffers duplicated in new buffers.
3200 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3201 #[repr(C)]
3202 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3203 /// This corresponds to std::vector in C++
3204 pub struct CVec_SpendableOutputDescriptorZ {
3205         /// The elements in the array.
3206         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3207         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3208         /// The number of elements pointed to by `data`.
3209         pub datalen: usize
3210 }
3211 impl CVec_SpendableOutputDescriptorZ {
3212         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3213                 if self.datalen == 0 { return Vec::new(); }
3214                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3215                 self.data = core::ptr::null_mut();
3216                 self.datalen = 0;
3217                 ret
3218         }
3219         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3220                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3221         }
3222 }
3223 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3224         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3225                 let datalen = v.len();
3226                 let data = Box::into_raw(v.into_boxed_slice());
3227                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3228         }
3229 }
3230 #[no_mangle]
3231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3232 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3233 impl Drop for CVec_SpendableOutputDescriptorZ {
3234         fn drop(&mut self) {
3235                 if self.datalen == 0 { return; }
3236                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3237         }
3238 }
3239 impl Clone for CVec_SpendableOutputDescriptorZ {
3240         fn clone(&self) -> Self {
3241                 let mut res = Vec::new();
3242                 if self.datalen == 0 { return Self::from(res); }
3243                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3244                 Self::from(res)
3245         }
3246 }
3247 #[repr(C)]
3248 #[derive(Clone)]
3249 /// An enum which can either contain a crate::lightning::util::events::Event or not
3250 pub enum COption_EventZ {
3251         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3252         Some(crate::lightning::util::events::Event),
3253         /// When we're in this state, this COption_EventZ contains nothing
3254         None
3255 }
3256 impl COption_EventZ {
3257         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3258                 if let Self::None = self { false } else { true }
3259         }
3260         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3261                 !self.is_some()
3262         }
3263         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3264                 if let Self::Some(v) = self { v } else { unreachable!() }
3265         }
3266 }
3267 #[no_mangle]
3268 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3269 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3270         COption_EventZ::Some(o)
3271 }
3272 #[no_mangle]
3273 /// Constructs a new COption_EventZ containing nothing
3274 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3275         COption_EventZ::None
3276 }
3277 #[no_mangle]
3278 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3279 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3280 #[no_mangle]
3281 /// Creates a new COption_EventZ which has the same data as `orig`
3282 /// but with all dynamically-allocated buffers duplicated in new buffers.
3283 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3284 #[repr(C)]
3285 /// The contents of CResult_COption_EventZDecodeErrorZ
3286 pub union CResult_COption_EventZDecodeErrorZPtr {
3287         /// A pointer to the contents in the success state.
3288         /// Reading from this pointer when `result_ok` is not set is undefined.
3289         pub result: *mut crate::c_types::derived::COption_EventZ,
3290         /// A pointer to the contents in the error state.
3291         /// Reading from this pointer when `result_ok` is set is undefined.
3292         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3293 }
3294 #[repr(C)]
3295 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3296 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3297 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3298 pub struct CResult_COption_EventZDecodeErrorZ {
3299         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3300         /// `err` or `result` depending on the state of `result_ok`.
3301         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3302         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3303         pub result_ok: bool,
3304 }
3305 #[no_mangle]
3306 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3307 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3308         CResult_COption_EventZDecodeErrorZ {
3309                 contents: CResult_COption_EventZDecodeErrorZPtr {
3310                         result: Box::into_raw(Box::new(o)),
3311                 },
3312                 result_ok: true,
3313         }
3314 }
3315 #[no_mangle]
3316 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3317 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3318         CResult_COption_EventZDecodeErrorZ {
3319                 contents: CResult_COption_EventZDecodeErrorZPtr {
3320                         err: Box::into_raw(Box::new(e)),
3321                 },
3322                 result_ok: false,
3323         }
3324 }
3325 /// Checks if the given object is currently in the success state
3326 #[no_mangle]
3327 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3328         o.result_ok
3329 }
3330 #[no_mangle]
3331 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3332 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3333 impl Drop for CResult_COption_EventZDecodeErrorZ {
3334         fn drop(&mut self) {
3335                 if self.result_ok {
3336                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3337                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3338                         }
3339                 } else {
3340                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3341                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3342                         }
3343                 }
3344         }
3345 }
3346 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3347         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3348                 let contents = if o.result_ok {
3349                         let result = unsafe { o.contents.result };
3350                         unsafe { o.contents.result = core::ptr::null_mut() };
3351                         CResult_COption_EventZDecodeErrorZPtr { result }
3352                 } else {
3353                         let err = unsafe { o.contents.err };
3354                         unsafe { o.contents.err = core::ptr::null_mut(); }
3355                         CResult_COption_EventZDecodeErrorZPtr { err }
3356                 };
3357                 Self {
3358                         contents,
3359                         result_ok: o.result_ok,
3360                 }
3361         }
3362 }
3363 impl Clone for CResult_COption_EventZDecodeErrorZ {
3364         fn clone(&self) -> Self {
3365                 if self.result_ok {
3366                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3367                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3368                         } }
3369                 } else {
3370                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3371                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3372                         } }
3373                 }
3374         }
3375 }
3376 #[no_mangle]
3377 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3378 /// but with all dynamically-allocated buffers duplicated in new buffers.
3379 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3380 #[repr(C)]
3381 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3382 /// This corresponds to std::vector in C++
3383 pub struct CVec_MessageSendEventZ {
3384         /// The elements in the array.
3385         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3386         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3387         /// The number of elements pointed to by `data`.
3388         pub datalen: usize
3389 }
3390 impl CVec_MessageSendEventZ {
3391         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3392                 if self.datalen == 0 { return Vec::new(); }
3393                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3394                 self.data = core::ptr::null_mut();
3395                 self.datalen = 0;
3396                 ret
3397         }
3398         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3399                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3400         }
3401 }
3402 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3403         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3404                 let datalen = v.len();
3405                 let data = Box::into_raw(v.into_boxed_slice());
3406                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3407         }
3408 }
3409 #[no_mangle]
3410 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3411 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3412 impl Drop for CVec_MessageSendEventZ {
3413         fn drop(&mut self) {
3414                 if self.datalen == 0 { return; }
3415                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3416         }
3417 }
3418 impl Clone for CVec_MessageSendEventZ {
3419         fn clone(&self) -> Self {
3420                 let mut res = Vec::new();
3421                 if self.datalen == 0 { return Self::from(res); }
3422                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3423                 Self::from(res)
3424         }
3425 }
3426 #[repr(C)]
3427 /// The contents of CResult_ScoringParametersDecodeErrorZ
3428 pub union CResult_ScoringParametersDecodeErrorZPtr {
3429         /// A pointer to the contents in the success state.
3430         /// Reading from this pointer when `result_ok` is not set is undefined.
3431         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3432         /// A pointer to the contents in the error state.
3433         /// Reading from this pointer when `result_ok` is set is undefined.
3434         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3435 }
3436 #[repr(C)]
3437 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3438 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3440 pub struct CResult_ScoringParametersDecodeErrorZ {
3441         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3442         /// `err` or `result` depending on the state of `result_ok`.
3443         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3444         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3445         pub result_ok: bool,
3446 }
3447 #[no_mangle]
3448 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3449 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3450         CResult_ScoringParametersDecodeErrorZ {
3451                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3452                         result: Box::into_raw(Box::new(o)),
3453                 },
3454                 result_ok: true,
3455         }
3456 }
3457 #[no_mangle]
3458 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3459 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3460         CResult_ScoringParametersDecodeErrorZ {
3461                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3462                         err: Box::into_raw(Box::new(e)),
3463                 },
3464                 result_ok: false,
3465         }
3466 }
3467 /// Checks if the given object is currently in the success state
3468 #[no_mangle]
3469 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3470         o.result_ok
3471 }
3472 #[no_mangle]
3473 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3474 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3475 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3476         fn drop(&mut self) {
3477                 if self.result_ok {
3478                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3479                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3480                         }
3481                 } else {
3482                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3483                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3484                         }
3485                 }
3486         }
3487 }
3488 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3489         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3490                 let contents = if o.result_ok {
3491                         let result = unsafe { o.contents.result };
3492                         unsafe { o.contents.result = core::ptr::null_mut() };
3493                         CResult_ScoringParametersDecodeErrorZPtr { result }
3494                 } else {
3495                         let err = unsafe { o.contents.err };
3496                         unsafe { o.contents.err = core::ptr::null_mut(); }
3497                         CResult_ScoringParametersDecodeErrorZPtr { err }
3498                 };
3499                 Self {
3500                         contents,
3501                         result_ok: o.result_ok,
3502                 }
3503         }
3504 }
3505 #[repr(C)]
3506 /// The contents of CResult_ScorerDecodeErrorZ
3507 pub union CResult_ScorerDecodeErrorZPtr {
3508         /// A pointer to the contents in the success state.
3509         /// Reading from this pointer when `result_ok` is not set is undefined.
3510         pub result: *mut crate::lightning::routing::scoring::Scorer,
3511         /// A pointer to the contents in the error state.
3512         /// Reading from this pointer when `result_ok` is set is undefined.
3513         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3514 }
3515 #[repr(C)]
3516 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3517 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3519 pub struct CResult_ScorerDecodeErrorZ {
3520         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3521         /// `err` or `result` depending on the state of `result_ok`.
3522         pub contents: CResult_ScorerDecodeErrorZPtr,
3523         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3524         pub result_ok: bool,
3525 }
3526 #[no_mangle]
3527 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3528 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3529         CResult_ScorerDecodeErrorZ {
3530                 contents: CResult_ScorerDecodeErrorZPtr {
3531                         result: Box::into_raw(Box::new(o)),
3532                 },
3533                 result_ok: true,
3534         }
3535 }
3536 #[no_mangle]
3537 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3538 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3539         CResult_ScorerDecodeErrorZ {
3540                 contents: CResult_ScorerDecodeErrorZPtr {
3541                         err: Box::into_raw(Box::new(e)),
3542                 },
3543                 result_ok: false,
3544         }
3545 }
3546 /// Checks if the given object is currently in the success state
3547 #[no_mangle]
3548 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3549         o.result_ok
3550 }
3551 #[no_mangle]
3552 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3553 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3554 impl Drop for CResult_ScorerDecodeErrorZ {
3555         fn drop(&mut self) {
3556                 if self.result_ok {
3557                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3558                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3559                         }
3560                 } else {
3561                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3562                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3563                         }
3564                 }
3565         }
3566 }
3567 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3568         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3569                 let contents = if o.result_ok {
3570                         let result = unsafe { o.contents.result };
3571                         unsafe { o.contents.result = core::ptr::null_mut() };
3572                         CResult_ScorerDecodeErrorZPtr { result }
3573                 } else {
3574                         let err = unsafe { o.contents.err };
3575                         unsafe { o.contents.err = core::ptr::null_mut(); }
3576                         CResult_ScorerDecodeErrorZPtr { err }
3577                 };
3578                 Self {
3579                         contents,
3580                         result_ok: o.result_ok,
3581                 }
3582         }
3583 }
3584 #[repr(C)]
3585 /// The contents of CResult_InitFeaturesDecodeErrorZ
3586 pub union CResult_InitFeaturesDecodeErrorZPtr {
3587         /// A pointer to the contents in the success state.
3588         /// Reading from this pointer when `result_ok` is not set is undefined.
3589         pub result: *mut crate::lightning::ln::features::InitFeatures,
3590         /// A pointer to the contents in the error state.
3591         /// Reading from this pointer when `result_ok` is set is undefined.
3592         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3593 }
3594 #[repr(C)]
3595 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3596 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3597 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3598 pub struct CResult_InitFeaturesDecodeErrorZ {
3599         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3600         /// `err` or `result` depending on the state of `result_ok`.
3601         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3602         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3603         pub result_ok: bool,
3604 }
3605 #[no_mangle]
3606 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3607 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3608         CResult_InitFeaturesDecodeErrorZ {
3609                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3610                         result: Box::into_raw(Box::new(o)),
3611                 },
3612                 result_ok: true,
3613         }
3614 }
3615 #[no_mangle]
3616 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3617 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3618         CResult_InitFeaturesDecodeErrorZ {
3619                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3620                         err: Box::into_raw(Box::new(e)),
3621                 },
3622                 result_ok: false,
3623         }
3624 }
3625 /// Checks if the given object is currently in the success state
3626 #[no_mangle]
3627 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3628         o.result_ok
3629 }
3630 #[no_mangle]
3631 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3632 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3633 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3634         fn drop(&mut self) {
3635                 if self.result_ok {
3636                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3637                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3638                         }
3639                 } else {
3640                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3641                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3642                         }
3643                 }
3644         }
3645 }
3646 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
3647         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3648                 let contents = if o.result_ok {
3649                         let result = unsafe { o.contents.result };
3650                         unsafe { o.contents.result = core::ptr::null_mut() };
3651                         CResult_InitFeaturesDecodeErrorZPtr { result }
3652                 } else {
3653                         let err = unsafe { o.contents.err };
3654                         unsafe { o.contents.err = core::ptr::null_mut(); }
3655                         CResult_InitFeaturesDecodeErrorZPtr { err }
3656                 };
3657                 Self {
3658                         contents,
3659                         result_ok: o.result_ok,
3660                 }
3661         }
3662 }
3663 #[repr(C)]
3664 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
3665 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
3666         /// A pointer to the contents in the success state.
3667         /// Reading from this pointer when `result_ok` is not set is undefined.
3668         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
3669         /// A pointer to the contents in the error state.
3670         /// Reading from this pointer when `result_ok` is set is undefined.
3671         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3672 }
3673 #[repr(C)]
3674 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3675 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3677 pub struct CResult_ChannelFeaturesDecodeErrorZ {
3678         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3679         /// `err` or `result` depending on the state of `result_ok`.
3680         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
3681         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3682         pub result_ok: bool,
3683 }
3684 #[no_mangle]
3685 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
3686 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
3687         CResult_ChannelFeaturesDecodeErrorZ {
3688                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3689                         result: Box::into_raw(Box::new(o)),
3690                 },
3691                 result_ok: true,
3692         }
3693 }
3694 #[no_mangle]
3695 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
3696 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
3697         CResult_ChannelFeaturesDecodeErrorZ {
3698                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
3699                         err: Box::into_raw(Box::new(e)),
3700                 },
3701                 result_ok: false,
3702         }
3703 }
3704 /// Checks if the given object is currently in the success state
3705 #[no_mangle]
3706 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
3707         o.result_ok
3708 }
3709 #[no_mangle]
3710 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
3711 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
3712 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
3713         fn drop(&mut self) {
3714                 if self.result_ok {
3715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3717                         }
3718                 } else {
3719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3721                         }
3722                 }
3723         }
3724 }
3725 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
3726         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3727                 let contents = if o.result_ok {
3728                         let result = unsafe { o.contents.result };
3729                         unsafe { o.contents.result = core::ptr::null_mut() };
3730                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
3731                 } else {
3732                         let err = unsafe { o.contents.err };
3733                         unsafe { o.contents.err = core::ptr::null_mut(); }
3734                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
3735                 };
3736                 Self {
3737                         contents,
3738                         result_ok: o.result_ok,
3739                 }
3740         }
3741 }
3742 #[repr(C)]
3743 /// The contents of CResult_NodeFeaturesDecodeErrorZ
3744 pub union CResult_NodeFeaturesDecodeErrorZPtr {
3745         /// A pointer to the contents in the success state.
3746         /// Reading from this pointer when `result_ok` is not set is undefined.
3747         pub result: *mut crate::lightning::ln::features::NodeFeatures,
3748         /// A pointer to the contents in the error state.
3749         /// Reading from this pointer when `result_ok` is set is undefined.
3750         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3751 }
3752 #[repr(C)]
3753 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
3754 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3755 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3756 pub struct CResult_NodeFeaturesDecodeErrorZ {
3757         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
3758         /// `err` or `result` depending on the state of `result_ok`.
3759         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
3760         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
3761         pub result_ok: bool,
3762 }
3763 #[no_mangle]
3764 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
3765 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
3766         CResult_NodeFeaturesDecodeErrorZ {
3767                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3768                         result: Box::into_raw(Box::new(o)),
3769                 },
3770                 result_ok: true,
3771         }
3772 }
3773 #[no_mangle]
3774 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
3775 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
3776         CResult_NodeFeaturesDecodeErrorZ {
3777                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
3778                         err: Box::into_raw(Box::new(e)),
3779                 },
3780                 result_ok: false,
3781         }
3782 }
3783 /// Checks if the given object is currently in the success state
3784 #[no_mangle]
3785 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
3786         o.result_ok
3787 }
3788 #[no_mangle]
3789 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
3790 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
3791 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
3792         fn drop(&mut self) {
3793                 if self.result_ok {
3794                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3795                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3796                         }
3797                 } else {
3798                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3799                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3800                         }
3801                 }
3802         }
3803 }
3804 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
3805         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3806                 let contents = if o.result_ok {
3807                         let result = unsafe { o.contents.result };
3808                         unsafe { o.contents.result = core::ptr::null_mut() };
3809                         CResult_NodeFeaturesDecodeErrorZPtr { result }
3810                 } else {
3811                         let err = unsafe { o.contents.err };
3812                         unsafe { o.contents.err = core::ptr::null_mut(); }
3813                         CResult_NodeFeaturesDecodeErrorZPtr { err }
3814                 };
3815                 Self {
3816                         contents,
3817                         result_ok: o.result_ok,
3818                 }
3819         }
3820 }
3821 #[repr(C)]
3822 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
3823 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
3824         /// A pointer to the contents in the success state.
3825         /// Reading from this pointer when `result_ok` is not set is undefined.
3826         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
3827         /// A pointer to the contents in the error state.
3828         /// Reading from this pointer when `result_ok` is set is undefined.
3829         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3830 }
3831 #[repr(C)]
3832 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3833 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3835 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
3836         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3837         /// `err` or `result` depending on the state of `result_ok`.
3838         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
3839         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3840         pub result_ok: bool,
3841 }
3842 #[no_mangle]
3843 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
3844 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
3845         CResult_InvoiceFeaturesDecodeErrorZ {
3846                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3847                         result: Box::into_raw(Box::new(o)),
3848                 },
3849                 result_ok: true,
3850         }
3851 }
3852 #[no_mangle]
3853 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
3854 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
3855         CResult_InvoiceFeaturesDecodeErrorZ {
3856                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
3857                         err: Box::into_raw(Box::new(e)),
3858                 },
3859                 result_ok: false,
3860         }
3861 }
3862 /// Checks if the given object is currently in the success state
3863 #[no_mangle]
3864 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
3865         o.result_ok
3866 }
3867 #[no_mangle]
3868 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
3869 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
3870 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
3871         fn drop(&mut self) {
3872                 if self.result_ok {
3873                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3874                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3875                         }
3876                 } else {
3877                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3878                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3879                         }
3880                 }
3881         }
3882 }
3883 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
3884         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3885                 let contents = if o.result_ok {
3886                         let result = unsafe { o.contents.result };
3887                         unsafe { o.contents.result = core::ptr::null_mut() };
3888                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
3889                 } else {
3890                         let err = unsafe { o.contents.err };
3891                         unsafe { o.contents.err = core::ptr::null_mut(); }
3892                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
3893                 };
3894                 Self {
3895                         contents,
3896                         result_ok: o.result_ok,
3897                 }
3898         }
3899 }
3900 #[repr(C)]
3901 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
3902 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3903         /// A pointer to the contents in the success state.
3904         /// Reading from this pointer when `result_ok` is not set is undefined.
3905         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
3906         /// A pointer to the contents in the error state.
3907         /// Reading from this pointer when `result_ok` is set is undefined.
3908         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3909 }
3910 #[repr(C)]
3911 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
3912 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3913 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3914 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
3915         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
3916         /// `err` or `result` depending on the state of `result_ok`.
3917         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
3918         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
3919         pub result_ok: bool,
3920 }
3921 #[no_mangle]
3922 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
3923 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3924         CResult_ChannelTypeFeaturesDecodeErrorZ {
3925                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3926                         result: Box::into_raw(Box::new(o)),
3927                 },
3928                 result_ok: true,
3929         }
3930 }
3931 #[no_mangle]
3932 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
3933 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
3934         CResult_ChannelTypeFeaturesDecodeErrorZ {
3935                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
3936                         err: Box::into_raw(Box::new(e)),
3937                 },
3938                 result_ok: false,
3939         }
3940 }
3941 /// Checks if the given object is currently in the success state
3942 #[no_mangle]
3943 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
3944         o.result_ok
3945 }
3946 #[no_mangle]
3947 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
3948 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
3949 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
3950         fn drop(&mut self) {
3951                 if self.result_ok {
3952                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3953                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3954                         }
3955                 } else {
3956                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3957                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3958                         }
3959                 }
3960         }
3961 }
3962 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
3963         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
3964                 let contents = if o.result_ok {
3965                         let result = unsafe { o.contents.result };
3966                         unsafe { o.contents.result = core::ptr::null_mut() };
3967                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
3968                 } else {
3969                         let err = unsafe { o.contents.err };
3970                         unsafe { o.contents.err = core::ptr::null_mut(); }
3971                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
3972                 };
3973                 Self {
3974                         contents,
3975                         result_ok: o.result_ok,
3976                 }
3977         }
3978 }
3979 #[repr(C)]
3980 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3981 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3982         /// A pointer to the contents in the success state.
3983         /// Reading from this pointer when `result_ok` is not set is undefined.
3984         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
3985         /// A pointer to the contents in the error state.
3986         /// Reading from this pointer when `result_ok` is set is undefined.
3987         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3988 }
3989 #[repr(C)]
3990 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3991 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3993 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3994         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3995         /// `err` or `result` depending on the state of `result_ok`.
3996         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
3997         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3998         pub result_ok: bool,
3999 }
4000 #[no_mangle]
4001 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4002 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4003         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4004                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4005                         result: Box::into_raw(Box::new(o)),
4006                 },
4007                 result_ok: true,
4008         }
4009 }
4010 #[no_mangle]
4011 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4012 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4013         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4014                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4015                         err: Box::into_raw(Box::new(e)),
4016                 },
4017                 result_ok: false,
4018         }
4019 }
4020 /// Checks if the given object is currently in the success state
4021 #[no_mangle]
4022 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4023         o.result_ok
4024 }
4025 #[no_mangle]
4026 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4027 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4028 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4029         fn drop(&mut self) {
4030                 if self.result_ok {
4031                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4032                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4033                         }
4034                 } else {
4035                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4036                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4037                         }
4038                 }
4039         }
4040 }
4041 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4042         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4043                 let contents = if o.result_ok {
4044                         let result = unsafe { o.contents.result };
4045                         unsafe { o.contents.result = core::ptr::null_mut() };
4046                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4047                 } else {
4048                         let err = unsafe { o.contents.err };
4049                         unsafe { o.contents.err = core::ptr::null_mut(); }
4050                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4051                 };
4052                 Self {
4053                         contents,
4054                         result_ok: o.result_ok,
4055                 }
4056         }
4057 }
4058 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4059         fn clone(&self) -> Self {
4060                 if self.result_ok {
4061                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4062                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4063                         } }
4064                 } else {
4065                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4066                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4067                         } }
4068                 }
4069         }
4070 }
4071 #[no_mangle]
4072 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4073 /// but with all dynamically-allocated buffers duplicated in new buffers.
4074 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4075 #[repr(C)]
4076 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4077 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4078         /// A pointer to the contents in the success state.
4079         /// Reading from this pointer when `result_ok` is not set is undefined.
4080         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4081         /// A pointer to the contents in the error state.
4082         /// Reading from this pointer when `result_ok` is set is undefined.
4083         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4084 }
4085 #[repr(C)]
4086 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4087 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4089 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4090         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4091         /// `err` or `result` depending on the state of `result_ok`.
4092         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4093         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4094         pub result_ok: bool,
4095 }
4096 #[no_mangle]
4097 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4098 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4099         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4100                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4101                         result: Box::into_raw(Box::new(o)),
4102                 },
4103                 result_ok: true,
4104         }
4105 }
4106 #[no_mangle]
4107 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4108 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4109         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4110                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4111                         err: Box::into_raw(Box::new(e)),
4112                 },
4113                 result_ok: false,
4114         }
4115 }
4116 /// Checks if the given object is currently in the success state
4117 #[no_mangle]
4118 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4119         o.result_ok
4120 }
4121 #[no_mangle]
4122 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4123 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4124 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4125         fn drop(&mut self) {
4126                 if self.result_ok {
4127                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4128                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4129                         }
4130                 } else {
4131                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4132                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4133                         }
4134                 }
4135         }
4136 }
4137 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4138         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4139                 let contents = if o.result_ok {
4140                         let result = unsafe { o.contents.result };
4141                         unsafe { o.contents.result = core::ptr::null_mut() };
4142                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4143                 } else {
4144                         let err = unsafe { o.contents.err };
4145                         unsafe { o.contents.err = core::ptr::null_mut(); }
4146                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4147                 };
4148                 Self {
4149                         contents,
4150                         result_ok: o.result_ok,
4151                 }
4152         }
4153 }
4154 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4155         fn clone(&self) -> Self {
4156                 if self.result_ok {
4157                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4158                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4159                         } }
4160                 } else {
4161                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4162                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4163                         } }
4164                 }
4165         }
4166 }
4167 #[no_mangle]
4168 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4169 /// but with all dynamically-allocated buffers duplicated in new buffers.
4170 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4171 #[repr(C)]
4172 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4173 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4174         /// A pointer to the contents in the success state.
4175         /// Reading from this pointer when `result_ok` is not set is undefined.
4176         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4177         /// A pointer to the contents in the error state.
4178         /// Reading from this pointer when `result_ok` is set is undefined.
4179         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4180 }
4181 #[repr(C)]
4182 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4183 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4185 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4186         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4187         /// `err` or `result` depending on the state of `result_ok`.
4188         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4189         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4190         pub result_ok: bool,
4191 }
4192 #[no_mangle]
4193 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4194 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4195         CResult_SpendableOutputDescriptorDecodeErrorZ {
4196                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4197                         result: Box::into_raw(Box::new(o)),
4198                 },
4199                 result_ok: true,
4200         }
4201 }
4202 #[no_mangle]
4203 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4204 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4205         CResult_SpendableOutputDescriptorDecodeErrorZ {
4206                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4207                         err: Box::into_raw(Box::new(e)),
4208                 },
4209                 result_ok: false,
4210         }
4211 }
4212 /// Checks if the given object is currently in the success state
4213 #[no_mangle]
4214 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4215         o.result_ok
4216 }
4217 #[no_mangle]
4218 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4219 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4220 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4221         fn drop(&mut self) {
4222                 if self.result_ok {
4223                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4224                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4225                         }
4226                 } else {
4227                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4228                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4229                         }
4230                 }
4231         }
4232 }
4233 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4234         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4235                 let contents = if o.result_ok {
4236                         let result = unsafe { o.contents.result };
4237                         unsafe { o.contents.result = core::ptr::null_mut() };
4238                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4239                 } else {
4240                         let err = unsafe { o.contents.err };
4241                         unsafe { o.contents.err = core::ptr::null_mut(); }
4242                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4243                 };
4244                 Self {
4245                         contents,
4246                         result_ok: o.result_ok,
4247                 }
4248         }
4249 }
4250 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4251         fn clone(&self) -> Self {
4252                 if self.result_ok {
4253                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4254                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4255                         } }
4256                 } else {
4257                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4258                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4259                         } }
4260                 }
4261         }
4262 }
4263 #[no_mangle]
4264 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4265 /// but with all dynamically-allocated buffers duplicated in new buffers.
4266 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4267 #[repr(C)]
4268 /// The contents of CResult_NoneNoneZ
4269 pub union CResult_NoneNoneZPtr {
4270         /// Note that this value is always NULL, as there are no contents in the OK variant
4271         pub result: *mut core::ffi::c_void,
4272         /// Note that this value is always NULL, as there are no contents in the Err variant
4273         pub err: *mut core::ffi::c_void,
4274 }
4275 #[repr(C)]
4276 /// A CResult_NoneNoneZ represents the result of a fallible operation,
4277 /// containing a () on success and a () on failure.
4278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4279 pub struct CResult_NoneNoneZ {
4280         /// The contents of this CResult_NoneNoneZ, accessible via either
4281         /// `err` or `result` depending on the state of `result_ok`.
4282         pub contents: CResult_NoneNoneZPtr,
4283         /// Whether this CResult_NoneNoneZ represents a success state.
4284         pub result_ok: bool,
4285 }
4286 #[no_mangle]
4287 /// Creates a new CResult_NoneNoneZ in the success state.
4288 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
4289         CResult_NoneNoneZ {
4290                 contents: CResult_NoneNoneZPtr {
4291                         result: core::ptr::null_mut(),
4292                 },
4293                 result_ok: true,
4294         }
4295 }
4296 #[no_mangle]
4297 /// Creates a new CResult_NoneNoneZ in the error state.
4298 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
4299         CResult_NoneNoneZ {
4300                 contents: CResult_NoneNoneZPtr {
4301                         err: core::ptr::null_mut(),
4302                 },
4303                 result_ok: false,
4304         }
4305 }
4306 /// Checks if the given object is currently in the success state
4307 #[no_mangle]
4308 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
4309         o.result_ok
4310 }
4311 #[no_mangle]
4312 /// Frees any resources used by the CResult_NoneNoneZ.
4313 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
4314 impl Drop for CResult_NoneNoneZ {
4315         fn drop(&mut self) {
4316                 if self.result_ok {
4317                 } else {
4318                 }
4319         }
4320 }
4321 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
4322         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
4323                 let contents = if o.result_ok {
4324                         let _ = unsafe { Box::from_raw(o.contents.result) };
4325                         o.contents.result = core::ptr::null_mut();
4326                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
4327                 } else {
4328                         let _ = unsafe { Box::from_raw(o.contents.err) };
4329                         o.contents.err = core::ptr::null_mut();
4330                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
4331                 };
4332                 Self {
4333                         contents,
4334                         result_ok: o.result_ok,
4335                 }
4336         }
4337 }
4338 impl Clone for CResult_NoneNoneZ {
4339         fn clone(&self) -> Self {
4340                 if self.result_ok {
4341                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
4342                                 result: core::ptr::null_mut()
4343                         } }
4344                 } else {
4345                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
4346                                 err: core::ptr::null_mut()
4347                         } }
4348                 }
4349         }
4350 }
4351 #[no_mangle]
4352 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
4353 /// but with all dynamically-allocated buffers duplicated in new buffers.
4354 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
4355 #[repr(C)]
4356 /// A tuple of 2 elements. See the individual fields for the types contained.
4357 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4358         /// The element at position 0
4359         pub a: crate::c_types::Signature,
4360         /// The element at position 1
4361         pub b: crate::c_types::derived::CVec_SignatureZ,
4362 }
4363 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4364         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4365                 Self {
4366                         a: tup.0,
4367                         b: tup.1,
4368                 }
4369         }
4370 }
4371 impl C2Tuple_SignatureCVec_SignatureZZ {
4372         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4373                 (self.a, self.b)
4374         }
4375 }
4376 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4377         fn clone(&self) -> Self {
4378                 Self {
4379                         a: Clone::clone(&self.a),
4380                         b: Clone::clone(&self.b),
4381                 }
4382         }
4383 }
4384 #[no_mangle]
4385 /// Creates a new tuple which has the same data as `orig`
4386 /// but with all dynamically-allocated buffers duplicated in new buffers.
4387 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4388 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4389 #[no_mangle]
4390 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4391         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4392 }
4393
4394 #[no_mangle]
4395 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4396 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4397 #[repr(C)]
4398 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4399 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4400         /// A pointer to the contents in the success state.
4401         /// Reading from this pointer when `result_ok` is not set is undefined.
4402         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4403         /// Note that this value is always NULL, as there are no contents in the Err variant
4404         pub err: *mut core::ffi::c_void,
4405 }
4406 #[repr(C)]
4407 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4408 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4411         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4412         /// `err` or `result` depending on the state of `result_ok`.
4413         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4414         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4415         pub result_ok: bool,
4416 }
4417 #[no_mangle]
4418 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4419 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4420         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4421                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4422                         result: Box::into_raw(Box::new(o)),
4423                 },
4424                 result_ok: true,
4425         }
4426 }
4427 #[no_mangle]
4428 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4429 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4430         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4431                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4432                         err: core::ptr::null_mut(),
4433                 },
4434                 result_ok: false,
4435         }
4436 }
4437 /// Checks if the given object is currently in the success state
4438 #[no_mangle]
4439 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4440         o.result_ok
4441 }
4442 #[no_mangle]
4443 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4444 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4445 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4446         fn drop(&mut self) {
4447                 if self.result_ok {
4448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4450                         }
4451                 } else {
4452                 }
4453         }
4454 }
4455 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4456         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4457                 let contents = if o.result_ok {
4458                         let result = unsafe { o.contents.result };
4459                         unsafe { o.contents.result = core::ptr::null_mut() };
4460                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4461                 } else {
4462                         let _ = unsafe { Box::from_raw(o.contents.err) };
4463                         o.contents.err = core::ptr::null_mut();
4464                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4465                 };
4466                 Self {
4467                         contents,
4468                         result_ok: o.result_ok,
4469                 }
4470         }
4471 }
4472 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4473         fn clone(&self) -> Self {
4474                 if self.result_ok {
4475                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4476                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4477                         } }
4478                 } else {
4479                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4480                                 err: core::ptr::null_mut()
4481                         } }
4482                 }
4483         }
4484 }
4485 #[no_mangle]
4486 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4487 /// but with all dynamically-allocated buffers duplicated in new buffers.
4488 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4489 #[repr(C)]
4490 /// The contents of CResult_SignatureNoneZ
4491 pub union CResult_SignatureNoneZPtr {
4492         /// A pointer to the contents in the success state.
4493         /// Reading from this pointer when `result_ok` is not set is undefined.
4494         pub result: *mut crate::c_types::Signature,
4495         /// Note that this value is always NULL, as there are no contents in the Err variant
4496         pub err: *mut core::ffi::c_void,
4497 }
4498 #[repr(C)]
4499 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4500 /// containing a crate::c_types::Signature on success and a () on failure.
4501 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4502 pub struct CResult_SignatureNoneZ {
4503         /// The contents of this CResult_SignatureNoneZ, accessible via either
4504         /// `err` or `result` depending on the state of `result_ok`.
4505         pub contents: CResult_SignatureNoneZPtr,
4506         /// Whether this CResult_SignatureNoneZ represents a success state.
4507         pub result_ok: bool,
4508 }
4509 #[no_mangle]
4510 /// Creates a new CResult_SignatureNoneZ in the success state.
4511 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4512         CResult_SignatureNoneZ {
4513                 contents: CResult_SignatureNoneZPtr {
4514                         result: Box::into_raw(Box::new(o)),
4515                 },
4516                 result_ok: true,
4517         }
4518 }
4519 #[no_mangle]
4520 /// Creates a new CResult_SignatureNoneZ in the error state.
4521 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4522         CResult_SignatureNoneZ {
4523                 contents: CResult_SignatureNoneZPtr {
4524                         err: core::ptr::null_mut(),
4525                 },
4526                 result_ok: false,
4527         }
4528 }
4529 /// Checks if the given object is currently in the success state
4530 #[no_mangle]
4531 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4532         o.result_ok
4533 }
4534 #[no_mangle]
4535 /// Frees any resources used by the CResult_SignatureNoneZ.
4536 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4537 impl Drop for CResult_SignatureNoneZ {
4538         fn drop(&mut self) {
4539                 if self.result_ok {
4540                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4541                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4542                         }
4543                 } else {
4544                 }
4545         }
4546 }
4547 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4548         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4549                 let contents = if o.result_ok {
4550                         let result = unsafe { o.contents.result };
4551                         unsafe { o.contents.result = core::ptr::null_mut() };
4552                         CResult_SignatureNoneZPtr { result }
4553                 } else {
4554                         let _ = unsafe { Box::from_raw(o.contents.err) };
4555                         o.contents.err = core::ptr::null_mut();
4556                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4557                 };
4558                 Self {
4559                         contents,
4560                         result_ok: o.result_ok,
4561                 }
4562         }
4563 }
4564 impl Clone for CResult_SignatureNoneZ {
4565         fn clone(&self) -> Self {
4566                 if self.result_ok {
4567                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4568                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4569                         } }
4570                 } else {
4571                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4572                                 err: core::ptr::null_mut()
4573                         } }
4574                 }
4575         }
4576 }
4577 #[no_mangle]
4578 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4579 /// but with all dynamically-allocated buffers duplicated in new buffers.
4580 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4581 #[repr(C)]
4582 /// The contents of CResult_SignDecodeErrorZ
4583 pub union CResult_SignDecodeErrorZPtr {
4584         /// A pointer to the contents in the success state.
4585         /// Reading from this pointer when `result_ok` is not set is undefined.
4586         pub result: *mut crate::lightning::chain::keysinterface::Sign,
4587         /// A pointer to the contents in the error state.
4588         /// Reading from this pointer when `result_ok` is set is undefined.
4589         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4590 }
4591 #[repr(C)]
4592 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
4593 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
4594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4595 pub struct CResult_SignDecodeErrorZ {
4596         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
4597         /// `err` or `result` depending on the state of `result_ok`.
4598         pub contents: CResult_SignDecodeErrorZPtr,
4599         /// Whether this CResult_SignDecodeErrorZ represents a success state.
4600         pub result_ok: bool,
4601 }
4602 #[no_mangle]
4603 /// Creates a new CResult_SignDecodeErrorZ in the success state.
4604 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4605         CResult_SignDecodeErrorZ {
4606                 contents: CResult_SignDecodeErrorZPtr {
4607                         result: Box::into_raw(Box::new(o)),
4608                 },
4609                 result_ok: true,
4610         }
4611 }
4612 #[no_mangle]
4613 /// Creates a new CResult_SignDecodeErrorZ in the error state.
4614 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4615         CResult_SignDecodeErrorZ {
4616                 contents: CResult_SignDecodeErrorZPtr {
4617                         err: Box::into_raw(Box::new(e)),
4618                 },
4619                 result_ok: false,
4620         }
4621 }
4622 /// Checks if the given object is currently in the success state
4623 #[no_mangle]
4624 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
4625         o.result_ok
4626 }
4627 #[no_mangle]
4628 /// Frees any resources used by the CResult_SignDecodeErrorZ.
4629 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4630 impl Drop for CResult_SignDecodeErrorZ {
4631         fn drop(&mut self) {
4632                 if self.result_ok {
4633                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4634                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4635                         }
4636                 } else {
4637                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4638                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4639                         }
4640                 }
4641         }
4642 }
4643 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4644         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
4645                 let contents = if o.result_ok {
4646                         let result = unsafe { o.contents.result };
4647                         unsafe { o.contents.result = core::ptr::null_mut() };
4648                         CResult_SignDecodeErrorZPtr { result }
4649                 } else {
4650                         let err = unsafe { o.contents.err };
4651                         unsafe { o.contents.err = core::ptr::null_mut(); }
4652                         CResult_SignDecodeErrorZPtr { err }
4653                 };
4654                 Self {
4655                         contents,
4656                         result_ok: o.result_ok,
4657                 }
4658         }
4659 }
4660 impl Clone for CResult_SignDecodeErrorZ {
4661         fn clone(&self) -> Self {
4662                 if self.result_ok {
4663                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4664                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4665                         } }
4666                 } else {
4667                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4668                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4669                         } }
4670                 }
4671         }
4672 }
4673 #[no_mangle]
4674 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
4675 /// but with all dynamically-allocated buffers duplicated in new buffers.
4676 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
4677 #[repr(C)]
4678 /// A dynamically-allocated array of u8s of arbitrary size.
4679 /// This corresponds to std::vector in C++
4680 pub struct CVec_u8Z {
4681         /// The elements in the array.
4682         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4683         pub data: *mut u8,
4684         /// The number of elements pointed to by `data`.
4685         pub datalen: usize
4686 }
4687 impl CVec_u8Z {
4688         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
4689                 if self.datalen == 0 { return Vec::new(); }
4690                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4691                 self.data = core::ptr::null_mut();
4692                 self.datalen = 0;
4693                 ret
4694         }
4695         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
4696                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4697         }
4698 }
4699 impl From<Vec<u8>> for CVec_u8Z {
4700         fn from(v: Vec<u8>) -> Self {
4701                 let datalen = v.len();
4702                 let data = Box::into_raw(v.into_boxed_slice());
4703                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4704         }
4705 }
4706 #[no_mangle]
4707 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4708 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
4709 impl Drop for CVec_u8Z {
4710         fn drop(&mut self) {
4711                 if self.datalen == 0 { return; }
4712                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4713         }
4714 }
4715 impl Clone for CVec_u8Z {
4716         fn clone(&self) -> Self {
4717                 let mut res = Vec::new();
4718                 if self.datalen == 0 { return Self::from(res); }
4719                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4720                 Self::from(res)
4721         }
4722 }
4723 #[repr(C)]
4724 /// The contents of CResult_RecoverableSignatureNoneZ
4725 pub union CResult_RecoverableSignatureNoneZPtr {
4726         /// A pointer to the contents in the success state.
4727         /// Reading from this pointer when `result_ok` is not set is undefined.
4728         pub result: *mut crate::c_types::RecoverableSignature,
4729         /// Note that this value is always NULL, as there are no contents in the Err variant
4730         pub err: *mut core::ffi::c_void,
4731 }
4732 #[repr(C)]
4733 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
4734 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
4735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4736 pub struct CResult_RecoverableSignatureNoneZ {
4737         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
4738         /// `err` or `result` depending on the state of `result_ok`.
4739         pub contents: CResult_RecoverableSignatureNoneZPtr,
4740         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
4741         pub result_ok: bool,
4742 }
4743 #[no_mangle]
4744 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
4745 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
4746         CResult_RecoverableSignatureNoneZ {
4747                 contents: CResult_RecoverableSignatureNoneZPtr {
4748                         result: Box::into_raw(Box::new(o)),
4749                 },
4750                 result_ok: true,
4751         }
4752 }
4753 #[no_mangle]
4754 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
4755 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
4756         CResult_RecoverableSignatureNoneZ {
4757                 contents: CResult_RecoverableSignatureNoneZPtr {
4758                         err: core::ptr::null_mut(),
4759                 },
4760                 result_ok: false,
4761         }
4762 }
4763 /// Checks if the given object is currently in the success state
4764 #[no_mangle]
4765 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
4766         o.result_ok
4767 }
4768 #[no_mangle]
4769 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
4770 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
4771 impl Drop for CResult_RecoverableSignatureNoneZ {
4772         fn drop(&mut self) {
4773                 if self.result_ok {
4774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4776                         }
4777                 } else {
4778                 }
4779         }
4780 }
4781 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
4782         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
4783                 let contents = if o.result_ok {
4784                         let result = unsafe { o.contents.result };
4785                         unsafe { o.contents.result = core::ptr::null_mut() };
4786                         CResult_RecoverableSignatureNoneZPtr { result }
4787                 } else {
4788                         let _ = unsafe { Box::from_raw(o.contents.err) };
4789                         o.contents.err = core::ptr::null_mut();
4790                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
4791                 };
4792                 Self {
4793                         contents,
4794                         result_ok: o.result_ok,
4795                 }
4796         }
4797 }
4798 impl Clone for CResult_RecoverableSignatureNoneZ {
4799         fn clone(&self) -> Self {
4800                 if self.result_ok {
4801                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
4802                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
4803                         } }
4804                 } else {
4805                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
4806                                 err: core::ptr::null_mut()
4807                         } }
4808                 }
4809         }
4810 }
4811 #[no_mangle]
4812 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
4813 /// but with all dynamically-allocated buffers duplicated in new buffers.
4814 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
4815 #[repr(C)]
4816 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
4817 /// This corresponds to std::vector in C++
4818 pub struct CVec_CVec_u8ZZ {
4819         /// The elements in the array.
4820         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4821         pub data: *mut crate::c_types::derived::CVec_u8Z,
4822         /// The number of elements pointed to by `data`.
4823         pub datalen: usize
4824 }
4825 impl CVec_CVec_u8ZZ {
4826         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4827                 if self.datalen == 0 { return Vec::new(); }
4828                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4829                 self.data = core::ptr::null_mut();
4830                 self.datalen = 0;
4831                 ret
4832         }
4833         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4834                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4835         }
4836 }
4837 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4838         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4839                 let datalen = v.len();
4840                 let data = Box::into_raw(v.into_boxed_slice());
4841                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4842         }
4843 }
4844 #[no_mangle]
4845 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4846 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4847 impl Drop for CVec_CVec_u8ZZ {
4848         fn drop(&mut self) {
4849                 if self.datalen == 0 { return; }
4850                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4851         }
4852 }
4853 impl Clone for CVec_CVec_u8ZZ {
4854         fn clone(&self) -> Self {
4855                 let mut res = Vec::new();
4856                 if self.datalen == 0 { return Self::from(res); }
4857                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4858                 Self::from(res)
4859         }
4860 }
4861 #[repr(C)]
4862 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
4863 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4864         /// A pointer to the contents in the success state.
4865         /// Reading from this pointer when `result_ok` is not set is undefined.
4866         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4867         /// Note that this value is always NULL, as there are no contents in the Err variant
4868         pub err: *mut core::ffi::c_void,
4869 }
4870 #[repr(C)]
4871 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
4872 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
4873 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4874 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4875         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
4876         /// `err` or `result` depending on the state of `result_ok`.
4877         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4878         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
4879         pub result_ok: bool,
4880 }
4881 #[no_mangle]
4882 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
4883 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4884         CResult_CVec_CVec_u8ZZNoneZ {
4885                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4886                         result: Box::into_raw(Box::new(o)),
4887                 },
4888                 result_ok: true,
4889         }
4890 }
4891 #[no_mangle]
4892 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
4893 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4894         CResult_CVec_CVec_u8ZZNoneZ {
4895                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4896                         err: core::ptr::null_mut(),
4897                 },
4898                 result_ok: false,
4899         }
4900 }
4901 /// Checks if the given object is currently in the success state
4902 #[no_mangle]
4903 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
4904         o.result_ok
4905 }
4906 #[no_mangle]
4907 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
4908 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4909 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4910         fn drop(&mut self) {
4911                 if self.result_ok {
4912                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4913                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4914                         }
4915                 } else {
4916                 }
4917         }
4918 }
4919 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
4920         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
4921                 let contents = if o.result_ok {
4922                         let result = unsafe { o.contents.result };
4923                         unsafe { o.contents.result = core::ptr::null_mut() };
4924                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4925                 } else {
4926                         let _ = unsafe { Box::from_raw(o.contents.err) };
4927                         o.contents.err = core::ptr::null_mut();
4928                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
4929                 };
4930                 Self {
4931                         contents,
4932                         result_ok: o.result_ok,
4933                 }
4934         }
4935 }
4936 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4937         fn clone(&self) -> Self {
4938                 if self.result_ok {
4939                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4940                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4941                         } }
4942                 } else {
4943                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4944                                 err: core::ptr::null_mut()
4945                         } }
4946                 }
4947         }
4948 }
4949 #[no_mangle]
4950 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
4951 /// but with all dynamically-allocated buffers duplicated in new buffers.
4952 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
4953 #[repr(C)]
4954 /// The contents of CResult_InMemorySignerDecodeErrorZ
4955 pub union CResult_InMemorySignerDecodeErrorZPtr {
4956         /// A pointer to the contents in the success state.
4957         /// Reading from this pointer when `result_ok` is not set is undefined.
4958         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
4959         /// A pointer to the contents in the error state.
4960         /// Reading from this pointer when `result_ok` is set is undefined.
4961         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4962 }
4963 #[repr(C)]
4964 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
4965 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
4966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4967 pub struct CResult_InMemorySignerDecodeErrorZ {
4968         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
4969         /// `err` or `result` depending on the state of `result_ok`.
4970         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4971         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
4972         pub result_ok: bool,
4973 }
4974 #[no_mangle]
4975 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
4976 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4977         CResult_InMemorySignerDecodeErrorZ {
4978                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4979                         result: Box::into_raw(Box::new(o)),
4980                 },
4981                 result_ok: true,
4982         }
4983 }
4984 #[no_mangle]
4985 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
4986 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4987         CResult_InMemorySignerDecodeErrorZ {
4988                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4989                         err: Box::into_raw(Box::new(e)),
4990                 },
4991                 result_ok: false,
4992         }
4993 }
4994 /// Checks if the given object is currently in the success state
4995 #[no_mangle]
4996 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
4997         o.result_ok
4998 }
4999 #[no_mangle]
5000 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5001 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5002 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5003         fn drop(&mut self) {
5004                 if self.result_ok {
5005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5007                         }
5008                 } else {
5009                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5010                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5011                         }
5012                 }
5013         }
5014 }
5015 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5016         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5017                 let contents = if o.result_ok {
5018                         let result = unsafe { o.contents.result };
5019                         unsafe { o.contents.result = core::ptr::null_mut() };
5020                         CResult_InMemorySignerDecodeErrorZPtr { result }
5021                 } else {
5022                         let err = unsafe { o.contents.err };
5023                         unsafe { o.contents.err = core::ptr::null_mut(); }
5024                         CResult_InMemorySignerDecodeErrorZPtr { err }
5025                 };
5026                 Self {
5027                         contents,
5028                         result_ok: o.result_ok,
5029                 }
5030         }
5031 }
5032 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5033         fn clone(&self) -> Self {
5034                 if self.result_ok {
5035                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5036                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5037                         } }
5038                 } else {
5039                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5040                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5041                         } }
5042                 }
5043         }
5044 }
5045 #[no_mangle]
5046 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5047 /// but with all dynamically-allocated buffers duplicated in new buffers.
5048 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5049 #[repr(C)]
5050 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5051 /// This corresponds to std::vector in C++
5052 pub struct CVec_TxOutZ {
5053         /// The elements in the array.
5054         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5055         pub data: *mut crate::c_types::TxOut,
5056         /// The number of elements pointed to by `data`.
5057         pub datalen: usize
5058 }
5059 impl CVec_TxOutZ {
5060         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5061                 if self.datalen == 0 { return Vec::new(); }
5062                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5063                 self.data = core::ptr::null_mut();
5064                 self.datalen = 0;
5065                 ret
5066         }
5067         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5068                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5069         }
5070 }
5071 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5072         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5073                 let datalen = v.len();
5074                 let data = Box::into_raw(v.into_boxed_slice());
5075                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5076         }
5077 }
5078 #[no_mangle]
5079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5080 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5081 impl Drop for CVec_TxOutZ {
5082         fn drop(&mut self) {
5083                 if self.datalen == 0 { return; }
5084                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5085         }
5086 }
5087 impl Clone for CVec_TxOutZ {
5088         fn clone(&self) -> Self {
5089                 let mut res = Vec::new();
5090                 if self.datalen == 0 { return Self::from(res); }
5091                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5092                 Self::from(res)
5093         }
5094 }
5095 #[repr(C)]
5096 /// The contents of CResult_TransactionNoneZ
5097 pub union CResult_TransactionNoneZPtr {
5098         /// A pointer to the contents in the success state.
5099         /// Reading from this pointer when `result_ok` is not set is undefined.
5100         pub result: *mut crate::c_types::Transaction,
5101         /// Note that this value is always NULL, as there are no contents in the Err variant
5102         pub err: *mut core::ffi::c_void,
5103 }
5104 #[repr(C)]
5105 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5106 /// containing a crate::c_types::Transaction on success and a () on failure.
5107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5108 pub struct CResult_TransactionNoneZ {
5109         /// The contents of this CResult_TransactionNoneZ, accessible via either
5110         /// `err` or `result` depending on the state of `result_ok`.
5111         pub contents: CResult_TransactionNoneZPtr,
5112         /// Whether this CResult_TransactionNoneZ represents a success state.
5113         pub result_ok: bool,
5114 }
5115 #[no_mangle]
5116 /// Creates a new CResult_TransactionNoneZ in the success state.
5117 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5118         CResult_TransactionNoneZ {
5119                 contents: CResult_TransactionNoneZPtr {
5120                         result: Box::into_raw(Box::new(o)),
5121                 },
5122                 result_ok: true,
5123         }
5124 }
5125 #[no_mangle]
5126 /// Creates a new CResult_TransactionNoneZ in the error state.
5127 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5128         CResult_TransactionNoneZ {
5129                 contents: CResult_TransactionNoneZPtr {
5130                         err: core::ptr::null_mut(),
5131                 },
5132                 result_ok: false,
5133         }
5134 }
5135 /// Checks if the given object is currently in the success state
5136 #[no_mangle]
5137 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5138         o.result_ok
5139 }
5140 #[no_mangle]
5141 /// Frees any resources used by the CResult_TransactionNoneZ.
5142 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5143 impl Drop for CResult_TransactionNoneZ {
5144         fn drop(&mut self) {
5145                 if self.result_ok {
5146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5148                         }
5149                 } else {
5150                 }
5151         }
5152 }
5153 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5154         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5155                 let contents = if o.result_ok {
5156                         let result = unsafe { o.contents.result };
5157                         unsafe { o.contents.result = core::ptr::null_mut() };
5158                         CResult_TransactionNoneZPtr { result }
5159                 } else {
5160                         let _ = unsafe { Box::from_raw(o.contents.err) };
5161                         o.contents.err = core::ptr::null_mut();
5162                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5163                 };
5164                 Self {
5165                         contents,
5166                         result_ok: o.result_ok,
5167                 }
5168         }
5169 }
5170 impl Clone for CResult_TransactionNoneZ {
5171         fn clone(&self) -> Self {
5172                 if self.result_ok {
5173                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5174                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5175                         } }
5176                 } else {
5177                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5178                                 err: core::ptr::null_mut()
5179                         } }
5180                 }
5181         }
5182 }
5183 #[no_mangle]
5184 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5185 /// but with all dynamically-allocated buffers duplicated in new buffers.
5186 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5187 #[repr(C)]
5188 /// A tuple of 2 elements. See the individual fields for the types contained.
5189 pub struct C2Tuple_BlockHashChannelMonitorZ {
5190         /// The element at position 0
5191         pub a: crate::c_types::ThirtyTwoBytes,
5192         /// The element at position 1
5193         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5194 }
5195 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5196         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5197                 Self {
5198                         a: tup.0,
5199                         b: tup.1,
5200                 }
5201         }
5202 }
5203 impl C2Tuple_BlockHashChannelMonitorZ {
5204         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5205                 (self.a, self.b)
5206         }
5207 }
5208 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5209 #[no_mangle]
5210 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5211         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5212 }
5213
5214 #[no_mangle]
5215 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5216 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5217 #[repr(C)]
5218 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5219 /// This corresponds to std::vector in C++
5220 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5221         /// The elements in the array.
5222         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5223         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5224         /// The number of elements pointed to by `data`.
5225         pub datalen: usize
5226 }
5227 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5228         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5229                 if self.datalen == 0 { return Vec::new(); }
5230                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5231                 self.data = core::ptr::null_mut();
5232                 self.datalen = 0;
5233                 ret
5234         }
5235         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5236                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5237         }
5238 }
5239 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5240         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5241                 let datalen = v.len();
5242                 let data = Box::into_raw(v.into_boxed_slice());
5243                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5244         }
5245 }
5246 #[no_mangle]
5247 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5248 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5249 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5250         fn drop(&mut self) {
5251                 if self.datalen == 0 { return; }
5252                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5253         }
5254 }
5255 #[repr(C)]
5256 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5257 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5258         /// A pointer to the contents in the success state.
5259         /// Reading from this pointer when `result_ok` is not set is undefined.
5260         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5261         /// A pointer to the contents in the error state.
5262         /// Reading from this pointer when `result_ok` is set is undefined.
5263         pub err: *mut crate::c_types::IOError,
5264 }
5265 #[repr(C)]
5266 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5267 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5269 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5270         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5271         /// `err` or `result` depending on the state of `result_ok`.
5272         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5273         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5274         pub result_ok: bool,
5275 }
5276 #[no_mangle]
5277 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5278 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5279         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5280                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5281                         result: Box::into_raw(Box::new(o)),
5282                 },
5283                 result_ok: true,
5284         }
5285 }
5286 #[no_mangle]
5287 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5288 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5289         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5290                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5291                         err: Box::into_raw(Box::new(e)),
5292                 },
5293                 result_ok: false,
5294         }
5295 }
5296 /// Checks if the given object is currently in the success state
5297 #[no_mangle]
5298 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5299         o.result_ok
5300 }
5301 #[no_mangle]
5302 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5303 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5304 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5305         fn drop(&mut self) {
5306                 if self.result_ok {
5307                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5308                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5309                         }
5310                 } else {
5311                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5312                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5313                         }
5314                 }
5315         }
5316 }
5317 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5318         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5319                 let contents = if o.result_ok {
5320                         let result = unsafe { o.contents.result };
5321                         unsafe { o.contents.result = core::ptr::null_mut() };
5322                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5323                 } else {
5324                         let err = unsafe { o.contents.err };
5325                         unsafe { o.contents.err = core::ptr::null_mut(); }
5326                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5327                 };
5328                 Self {
5329                         contents,
5330                         result_ok: o.result_ok,
5331                 }
5332         }
5333 }
5334 #[repr(C)]
5335 #[derive(Clone)]
5336 /// An enum which can either contain a u16 or not
5337 pub enum COption_u16Z {
5338         /// When we're in this state, this COption_u16Z contains a u16
5339         Some(u16),
5340         /// When we're in this state, this COption_u16Z contains nothing
5341         None
5342 }
5343 impl COption_u16Z {
5344         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5345                 if let Self::None = self { false } else { true }
5346         }
5347         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5348                 !self.is_some()
5349         }
5350         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5351                 if let Self::Some(v) = self { v } else { unreachable!() }
5352         }
5353 }
5354 #[no_mangle]
5355 /// Constructs a new COption_u16Z containing a u16
5356 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5357         COption_u16Z::Some(o)
5358 }
5359 #[no_mangle]
5360 /// Constructs a new COption_u16Z containing nothing
5361 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5362         COption_u16Z::None
5363 }
5364 #[no_mangle]
5365 /// Frees any resources associated with the u16, if we are in the Some state
5366 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5367 #[no_mangle]
5368 /// Creates a new COption_u16Z which has the same data as `orig`
5369 /// but with all dynamically-allocated buffers duplicated in new buffers.
5370 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5371 #[repr(C)]
5372 /// The contents of CResult_NoneAPIErrorZ
5373 pub union CResult_NoneAPIErrorZPtr {
5374         /// Note that this value is always NULL, as there are no contents in the OK variant
5375         pub result: *mut core::ffi::c_void,
5376         /// A pointer to the contents in the error state.
5377         /// Reading from this pointer when `result_ok` is set is undefined.
5378         pub err: *mut crate::lightning::util::errors::APIError,
5379 }
5380 #[repr(C)]
5381 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5382 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5384 pub struct CResult_NoneAPIErrorZ {
5385         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5386         /// `err` or `result` depending on the state of `result_ok`.
5387         pub contents: CResult_NoneAPIErrorZPtr,
5388         /// Whether this CResult_NoneAPIErrorZ represents a success state.
5389         pub result_ok: bool,
5390 }
5391 #[no_mangle]
5392 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5393 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5394         CResult_NoneAPIErrorZ {
5395                 contents: CResult_NoneAPIErrorZPtr {
5396                         result: core::ptr::null_mut(),
5397                 },
5398                 result_ok: true,
5399         }
5400 }
5401 #[no_mangle]
5402 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5403 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5404         CResult_NoneAPIErrorZ {
5405                 contents: CResult_NoneAPIErrorZPtr {
5406                         err: Box::into_raw(Box::new(e)),
5407                 },
5408                 result_ok: false,
5409         }
5410 }
5411 /// Checks if the given object is currently in the success state
5412 #[no_mangle]
5413 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5414         o.result_ok
5415 }
5416 #[no_mangle]
5417 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5418 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5419 impl Drop for CResult_NoneAPIErrorZ {
5420         fn drop(&mut self) {
5421                 if self.result_ok {
5422                 } else {
5423                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5424                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5425                         }
5426                 }
5427         }
5428 }
5429 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
5430         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
5431                 let contents = if o.result_ok {
5432                         let _ = unsafe { Box::from_raw(o.contents.result) };
5433                         o.contents.result = core::ptr::null_mut();
5434                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
5435                 } else {
5436                         let err = unsafe { o.contents.err };
5437                         unsafe { o.contents.err = core::ptr::null_mut(); }
5438                         CResult_NoneAPIErrorZPtr { err }
5439                 };
5440                 Self {
5441                         contents,
5442                         result_ok: o.result_ok,
5443                 }
5444         }
5445 }
5446 impl Clone for CResult_NoneAPIErrorZ {
5447         fn clone(&self) -> Self {
5448                 if self.result_ok {
5449                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
5450                                 result: core::ptr::null_mut()
5451                         } }
5452                 } else {
5453                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
5454                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5455                         } }
5456                 }
5457         }
5458 }
5459 #[no_mangle]
5460 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
5461 /// but with all dynamically-allocated buffers duplicated in new buffers.
5462 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
5463 #[repr(C)]
5464 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5465 /// This corresponds to std::vector in C++
5466 pub struct CVec_CResult_NoneAPIErrorZZ {
5467         /// The elements in the array.
5468         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5469         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
5470         /// The number of elements pointed to by `data`.
5471         pub datalen: usize
5472 }
5473 impl CVec_CResult_NoneAPIErrorZZ {
5474         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
5475                 if self.datalen == 0 { return Vec::new(); }
5476                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5477                 self.data = core::ptr::null_mut();
5478                 self.datalen = 0;
5479                 ret
5480         }
5481         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
5482                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5483         }
5484 }
5485 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
5486         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
5487                 let datalen = v.len();
5488                 let data = Box::into_raw(v.into_boxed_slice());
5489                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5490         }
5491 }
5492 #[no_mangle]
5493 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5494 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
5495 impl Drop for CVec_CResult_NoneAPIErrorZZ {
5496         fn drop(&mut self) {
5497                 if self.datalen == 0 { return; }
5498                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5499         }
5500 }
5501 impl Clone for CVec_CResult_NoneAPIErrorZZ {
5502         fn clone(&self) -> Self {
5503                 let mut res = Vec::new();
5504                 if self.datalen == 0 { return Self::from(res); }
5505                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5506                 Self::from(res)
5507         }
5508 }
5509 #[repr(C)]
5510 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5511 /// This corresponds to std::vector in C++
5512 pub struct CVec_APIErrorZ {
5513         /// The elements in the array.
5514         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5515         pub data: *mut crate::lightning::util::errors::APIError,
5516         /// The number of elements pointed to by `data`.
5517         pub datalen: usize
5518 }
5519 impl CVec_APIErrorZ {
5520         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
5521                 if self.datalen == 0 { return Vec::new(); }
5522                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5523                 self.data = core::ptr::null_mut();
5524                 self.datalen = 0;
5525                 ret
5526         }
5527         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
5528                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5529         }
5530 }
5531 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
5532         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
5533                 let datalen = v.len();
5534                 let data = Box::into_raw(v.into_boxed_slice());
5535                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5536         }
5537 }
5538 #[no_mangle]
5539 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5540 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
5541 impl Drop for CVec_APIErrorZ {
5542         fn drop(&mut self) {
5543                 if self.datalen == 0 { return; }
5544                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5545         }
5546 }
5547 impl Clone for CVec_APIErrorZ {
5548         fn clone(&self) -> Self {
5549                 let mut res = Vec::new();
5550                 if self.datalen == 0 { return Self::from(res); }
5551                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5552                 Self::from(res)
5553         }
5554 }
5555 #[repr(C)]
5556 /// The contents of CResult__u832APIErrorZ
5557 pub union CResult__u832APIErrorZPtr {
5558         /// A pointer to the contents in the success state.
5559         /// Reading from this pointer when `result_ok` is not set is undefined.
5560         pub result: *mut crate::c_types::ThirtyTwoBytes,
5561         /// A pointer to the contents in the error state.
5562         /// Reading from this pointer when `result_ok` is set is undefined.
5563         pub err: *mut crate::lightning::util::errors::APIError,
5564 }
5565 #[repr(C)]
5566 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
5567 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5568 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5569 pub struct CResult__u832APIErrorZ {
5570         /// The contents of this CResult__u832APIErrorZ, accessible via either
5571         /// `err` or `result` depending on the state of `result_ok`.
5572         pub contents: CResult__u832APIErrorZPtr,
5573         /// Whether this CResult__u832APIErrorZ represents a success state.
5574         pub result_ok: bool,
5575 }
5576 #[no_mangle]
5577 /// Creates a new CResult__u832APIErrorZ in the success state.
5578 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
5579         CResult__u832APIErrorZ {
5580                 contents: CResult__u832APIErrorZPtr {
5581                         result: Box::into_raw(Box::new(o)),
5582                 },
5583                 result_ok: true,
5584         }
5585 }
5586 #[no_mangle]
5587 /// Creates a new CResult__u832APIErrorZ in the error state.
5588 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
5589         CResult__u832APIErrorZ {
5590                 contents: CResult__u832APIErrorZPtr {
5591                         err: Box::into_raw(Box::new(e)),
5592                 },
5593                 result_ok: false,
5594         }
5595 }
5596 /// Checks if the given object is currently in the success state
5597 #[no_mangle]
5598 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
5599         o.result_ok
5600 }
5601 #[no_mangle]
5602 /// Frees any resources used by the CResult__u832APIErrorZ.
5603 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
5604 impl Drop for CResult__u832APIErrorZ {
5605         fn drop(&mut self) {
5606                 if self.result_ok {
5607                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5608                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5609                         }
5610                 } else {
5611                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5612                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5613                         }
5614                 }
5615         }
5616 }
5617 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
5618         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
5619                 let contents = if o.result_ok {
5620                         let result = unsafe { o.contents.result };
5621                         unsafe { o.contents.result = core::ptr::null_mut() };
5622                         CResult__u832APIErrorZPtr { result }
5623                 } else {
5624                         let err = unsafe { o.contents.err };
5625                         unsafe { o.contents.err = core::ptr::null_mut(); }
5626                         CResult__u832APIErrorZPtr { err }
5627                 };
5628                 Self {
5629                         contents,
5630                         result_ok: o.result_ok,
5631                 }
5632         }
5633 }
5634 impl Clone for CResult__u832APIErrorZ {
5635         fn clone(&self) -> Self {
5636                 if self.result_ok {
5637                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
5638                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5639                         } }
5640                 } else {
5641                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
5642                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
5643                         } }
5644                 }
5645         }
5646 }
5647 #[no_mangle]
5648 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
5649 /// but with all dynamically-allocated buffers duplicated in new buffers.
5650 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
5651 #[repr(C)]
5652 /// The contents of CResult_PaymentIdPaymentSendFailureZ
5653 pub union CResult_PaymentIdPaymentSendFailureZPtr {
5654         /// A pointer to the contents in the success state.
5655         /// Reading from this pointer when `result_ok` is not set is undefined.
5656         pub result: *mut crate::c_types::ThirtyTwoBytes,
5657         /// A pointer to the contents in the error state.
5658         /// Reading from this pointer when `result_ok` is set is undefined.
5659         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5660 }
5661 #[repr(C)]
5662 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5663 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5665 pub struct CResult_PaymentIdPaymentSendFailureZ {
5666         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5667         /// `err` or `result` depending on the state of `result_ok`.
5668         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
5669         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5670         pub result_ok: bool,
5671 }
5672 #[no_mangle]
5673 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
5674 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
5675         CResult_PaymentIdPaymentSendFailureZ {
5676                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5677                         result: Box::into_raw(Box::new(o)),
5678                 },
5679                 result_ok: true,
5680         }
5681 }
5682 #[no_mangle]
5683 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
5684 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
5685         CResult_PaymentIdPaymentSendFailureZ {
5686                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
5687                         err: Box::into_raw(Box::new(e)),
5688                 },
5689                 result_ok: false,
5690         }
5691 }
5692 /// Checks if the given object is currently in the success state
5693 #[no_mangle]
5694 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
5695         o.result_ok
5696 }
5697 #[no_mangle]
5698 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
5699 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
5700 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
5701         fn drop(&mut self) {
5702                 if self.result_ok {
5703                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5704                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5705                         }
5706                 } else {
5707                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5708                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5709                         }
5710                 }
5711         }
5712 }
5713 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
5714         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5715                 let contents = if o.result_ok {
5716                         let result = unsafe { o.contents.result };
5717                         unsafe { o.contents.result = core::ptr::null_mut() };
5718                         CResult_PaymentIdPaymentSendFailureZPtr { result }
5719                 } else {
5720                         let err = unsafe { o.contents.err };
5721                         unsafe { o.contents.err = core::ptr::null_mut(); }
5722                         CResult_PaymentIdPaymentSendFailureZPtr { err }
5723                 };
5724                 Self {
5725                         contents,
5726                         result_ok: o.result_ok,
5727                 }
5728         }
5729 }
5730 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
5731         fn clone(&self) -> Self {
5732                 if self.result_ok {
5733                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5734                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
5735                         } }
5736                 } else {
5737                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
5738                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5739                         } }
5740                 }
5741         }
5742 }
5743 #[no_mangle]
5744 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
5745 /// but with all dynamically-allocated buffers duplicated in new buffers.
5746 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
5747 #[repr(C)]
5748 /// The contents of CResult_NonePaymentSendFailureZ
5749 pub union CResult_NonePaymentSendFailureZPtr {
5750         /// Note that this value is always NULL, as there are no contents in the OK variant
5751         pub result: *mut core::ffi::c_void,
5752         /// A pointer to the contents in the error state.
5753         /// Reading from this pointer when `result_ok` is set is undefined.
5754         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5755 }
5756 #[repr(C)]
5757 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5758 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5760 pub struct CResult_NonePaymentSendFailureZ {
5761         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5762         /// `err` or `result` depending on the state of `result_ok`.
5763         pub contents: CResult_NonePaymentSendFailureZPtr,
5764         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
5765         pub result_ok: bool,
5766 }
5767 #[no_mangle]
5768 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
5769 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
5770         CResult_NonePaymentSendFailureZ {
5771                 contents: CResult_NonePaymentSendFailureZPtr {
5772                         result: core::ptr::null_mut(),
5773                 },
5774                 result_ok: true,
5775         }
5776 }
5777 #[no_mangle]
5778 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
5779 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
5780         CResult_NonePaymentSendFailureZ {
5781                 contents: CResult_NonePaymentSendFailureZPtr {
5782                         err: Box::into_raw(Box::new(e)),
5783                 },
5784                 result_ok: false,
5785         }
5786 }
5787 /// Checks if the given object is currently in the success state
5788 #[no_mangle]
5789 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
5790         o.result_ok
5791 }
5792 #[no_mangle]
5793 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
5794 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
5795 impl Drop for CResult_NonePaymentSendFailureZ {
5796         fn drop(&mut self) {
5797                 if self.result_ok {
5798                 } else {
5799                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5800                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5801                         }
5802                 }
5803         }
5804 }
5805 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
5806         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5807                 let contents = if o.result_ok {
5808                         let _ = unsafe { Box::from_raw(o.contents.result) };
5809                         o.contents.result = core::ptr::null_mut();
5810                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
5811                 } else {
5812                         let err = unsafe { o.contents.err };
5813                         unsafe { o.contents.err = core::ptr::null_mut(); }
5814                         CResult_NonePaymentSendFailureZPtr { err }
5815                 };
5816                 Self {
5817                         contents,
5818                         result_ok: o.result_ok,
5819                 }
5820         }
5821 }
5822 impl Clone for CResult_NonePaymentSendFailureZ {
5823         fn clone(&self) -> Self {
5824                 if self.result_ok {
5825                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
5826                                 result: core::ptr::null_mut()
5827                         } }
5828                 } else {
5829                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
5830                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5831                         } }
5832                 }
5833         }
5834 }
5835 #[no_mangle]
5836 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
5837 /// but with all dynamically-allocated buffers duplicated in new buffers.
5838 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
5839 #[repr(C)]
5840 /// A tuple of 2 elements. See the individual fields for the types contained.
5841 pub struct C2Tuple_PaymentHashPaymentIdZ {
5842         /// The element at position 0
5843         pub a: crate::c_types::ThirtyTwoBytes,
5844         /// The element at position 1
5845         pub b: crate::c_types::ThirtyTwoBytes,
5846 }
5847 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
5848         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
5849                 Self {
5850                         a: tup.0,
5851                         b: tup.1,
5852                 }
5853         }
5854 }
5855 impl C2Tuple_PaymentHashPaymentIdZ {
5856         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
5857                 (self.a, self.b)
5858         }
5859 }
5860 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
5861         fn clone(&self) -> Self {
5862                 Self {
5863                         a: Clone::clone(&self.a),
5864                         b: Clone::clone(&self.b),
5865                 }
5866         }
5867 }
5868 #[no_mangle]
5869 /// Creates a new tuple which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
5872 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
5873 #[no_mangle]
5874 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
5875         C2Tuple_PaymentHashPaymentIdZ { a, b, }
5876 }
5877
5878 #[no_mangle]
5879 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
5880 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
5881 #[repr(C)]
5882 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5883 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5884         /// A pointer to the contents in the success state.
5885         /// Reading from this pointer when `result_ok` is not set is undefined.
5886         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
5887         /// A pointer to the contents in the error state.
5888         /// Reading from this pointer when `result_ok` is set is undefined.
5889         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
5890 }
5891 #[repr(C)]
5892 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5893 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5895 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5896         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5897         /// `err` or `result` depending on the state of `result_ok`.
5898         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
5899         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5900         pub result_ok: bool,
5901 }
5902 #[no_mangle]
5903 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
5904 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5905         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5906                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5907                         result: Box::into_raw(Box::new(o)),
5908                 },
5909                 result_ok: true,
5910         }
5911 }
5912 #[no_mangle]
5913 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
5914 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5915         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5916                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5917                         err: Box::into_raw(Box::new(e)),
5918                 },
5919                 result_ok: false,
5920         }
5921 }
5922 /// Checks if the given object is currently in the success state
5923 #[no_mangle]
5924 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
5925         o.result_ok
5926 }
5927 #[no_mangle]
5928 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
5929 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
5930 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5931         fn drop(&mut self) {
5932                 if self.result_ok {
5933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5935                         }
5936                 } else {
5937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5939                         }
5940                 }
5941         }
5942 }
5943 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5944         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
5945                 let contents = if o.result_ok {
5946                         let result = unsafe { o.contents.result };
5947                         unsafe { o.contents.result = core::ptr::null_mut() };
5948                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
5949                 } else {
5950                         let err = unsafe { o.contents.err };
5951                         unsafe { o.contents.err = core::ptr::null_mut(); }
5952                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
5953                 };
5954                 Self {
5955                         contents,
5956                         result_ok: o.result_ok,
5957                 }
5958         }
5959 }
5960 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5961         fn clone(&self) -> Self {
5962                 if self.result_ok {
5963                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5964                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
5965                         } }
5966                 } else {
5967                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5968                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
5969                         } }
5970                 }
5971         }
5972 }
5973 #[no_mangle]
5974 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
5975 /// but with all dynamically-allocated buffers duplicated in new buffers.
5976 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
5977 #[repr(C)]
5978 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5979 /// This corresponds to std::vector in C++
5980 pub struct CVec_NetAddressZ {
5981         /// The elements in the array.
5982         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5983         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5984         /// The number of elements pointed to by `data`.
5985         pub datalen: usize
5986 }
5987 impl CVec_NetAddressZ {
5988         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5989                 if self.datalen == 0 { return Vec::new(); }
5990                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5991                 self.data = core::ptr::null_mut();
5992                 self.datalen = 0;
5993                 ret
5994         }
5995         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5996                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5997         }
5998 }
5999 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6000         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6001                 let datalen = v.len();
6002                 let data = Box::into_raw(v.into_boxed_slice());
6003                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6004         }
6005 }
6006 #[no_mangle]
6007 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6008 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6009 impl Drop for CVec_NetAddressZ {
6010         fn drop(&mut self) {
6011                 if self.datalen == 0 { return; }
6012                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6013         }
6014 }
6015 impl Clone for CVec_NetAddressZ {
6016         fn clone(&self) -> Self {
6017                 let mut res = Vec::new();
6018                 if self.datalen == 0 { return Self::from(res); }
6019                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6020                 Self::from(res)
6021         }
6022 }
6023 #[repr(C)]
6024 /// A tuple of 2 elements. See the individual fields for the types contained.
6025 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6026         /// The element at position 0
6027         pub a: crate::c_types::ThirtyTwoBytes,
6028         /// The element at position 1
6029         pub b: crate::c_types::ThirtyTwoBytes,
6030 }
6031 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6032         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6033                 Self {
6034                         a: tup.0,
6035                         b: tup.1,
6036                 }
6037         }
6038 }
6039 impl C2Tuple_PaymentHashPaymentSecretZ {
6040         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6041                 (self.a, self.b)
6042         }
6043 }
6044 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6045         fn clone(&self) -> Self {
6046                 Self {
6047                         a: Clone::clone(&self.a),
6048                         b: Clone::clone(&self.b),
6049                 }
6050         }
6051 }
6052 #[no_mangle]
6053 /// Creates a new tuple which has the same data as `orig`
6054 /// but with all dynamically-allocated buffers duplicated in new buffers.
6055 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6056 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6057 #[no_mangle]
6058 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6059         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6060 }
6061
6062 #[no_mangle]
6063 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6064 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6065 #[repr(C)]
6066 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6067 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6068         /// A pointer to the contents in the success state.
6069         /// Reading from this pointer when `result_ok` is not set is undefined.
6070         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6071         /// Note that this value is always NULL, as there are no contents in the Err variant
6072         pub err: *mut core::ffi::c_void,
6073 }
6074 #[repr(C)]
6075 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6076 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6078 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6079         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6080         /// `err` or `result` depending on the state of `result_ok`.
6081         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6082         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6083         pub result_ok: bool,
6084 }
6085 #[no_mangle]
6086 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6087 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6088         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6089                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6090                         result: Box::into_raw(Box::new(o)),
6091                 },
6092                 result_ok: true,
6093         }
6094 }
6095 #[no_mangle]
6096 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6097 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6098         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6099                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6100                         err: core::ptr::null_mut(),
6101                 },
6102                 result_ok: false,
6103         }
6104 }
6105 /// Checks if the given object is currently in the success state
6106 #[no_mangle]
6107 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6108         o.result_ok
6109 }
6110 #[no_mangle]
6111 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6112 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6113 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6114         fn drop(&mut self) {
6115                 if self.result_ok {
6116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6118                         }
6119                 } else {
6120                 }
6121         }
6122 }
6123 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6124         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6125                 let contents = if o.result_ok {
6126                         let result = unsafe { o.contents.result };
6127                         unsafe { o.contents.result = core::ptr::null_mut() };
6128                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6129                 } else {
6130                         let _ = unsafe { Box::from_raw(o.contents.err) };
6131                         o.contents.err = core::ptr::null_mut();
6132                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6133                 };
6134                 Self {
6135                         contents,
6136                         result_ok: o.result_ok,
6137                 }
6138         }
6139 }
6140 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6141         fn clone(&self) -> Self {
6142                 if self.result_ok {
6143                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6144                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6145                         } }
6146                 } else {
6147                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6148                                 err: core::ptr::null_mut()
6149                         } }
6150                 }
6151         }
6152 }
6153 #[no_mangle]
6154 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6155 /// but with all dynamically-allocated buffers duplicated in new buffers.
6156 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6157 #[repr(C)]
6158 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6159 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6160         /// A pointer to the contents in the success state.
6161         /// Reading from this pointer when `result_ok` is not set is undefined.
6162         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6163         /// A pointer to the contents in the error state.
6164         /// Reading from this pointer when `result_ok` is set is undefined.
6165         pub err: *mut crate::lightning::util::errors::APIError,
6166 }
6167 #[repr(C)]
6168 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6169 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6171 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6172         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6173         /// `err` or `result` depending on the state of `result_ok`.
6174         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6175         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6176         pub result_ok: bool,
6177 }
6178 #[no_mangle]
6179 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6180 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6181         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6182                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6183                         result: Box::into_raw(Box::new(o)),
6184                 },
6185                 result_ok: true,
6186         }
6187 }
6188 #[no_mangle]
6189 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6190 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6191         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6192                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6193                         err: Box::into_raw(Box::new(e)),
6194                 },
6195                 result_ok: false,
6196         }
6197 }
6198 /// Checks if the given object is currently in the success state
6199 #[no_mangle]
6200 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6201         o.result_ok
6202 }
6203 #[no_mangle]
6204 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6205 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6206 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6207         fn drop(&mut self) {
6208                 if self.result_ok {
6209                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6210                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6211                         }
6212                 } else {
6213                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6214                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6215                         }
6216                 }
6217         }
6218 }
6219 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6220         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6221                 let contents = if o.result_ok {
6222                         let result = unsafe { o.contents.result };
6223                         unsafe { o.contents.result = core::ptr::null_mut() };
6224                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6225                 } else {
6226                         let err = unsafe { o.contents.err };
6227                         unsafe { o.contents.err = core::ptr::null_mut(); }
6228                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6229                 };
6230                 Self {
6231                         contents,
6232                         result_ok: o.result_ok,
6233                 }
6234         }
6235 }
6236 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6237         fn clone(&self) -> Self {
6238                 if self.result_ok {
6239                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6240                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6241                         } }
6242                 } else {
6243                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6244                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6245                         } }
6246                 }
6247         }
6248 }
6249 #[no_mangle]
6250 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6251 /// but with all dynamically-allocated buffers duplicated in new buffers.
6252 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6253 #[repr(C)]
6254 /// The contents of CResult_PaymentSecretNoneZ
6255 pub union CResult_PaymentSecretNoneZPtr {
6256         /// A pointer to the contents in the success state.
6257         /// Reading from this pointer when `result_ok` is not set is undefined.
6258         pub result: *mut crate::c_types::ThirtyTwoBytes,
6259         /// Note that this value is always NULL, as there are no contents in the Err variant
6260         pub err: *mut core::ffi::c_void,
6261 }
6262 #[repr(C)]
6263 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6264 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6266 pub struct CResult_PaymentSecretNoneZ {
6267         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6268         /// `err` or `result` depending on the state of `result_ok`.
6269         pub contents: CResult_PaymentSecretNoneZPtr,
6270         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6271         pub result_ok: bool,
6272 }
6273 #[no_mangle]
6274 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6275 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6276         CResult_PaymentSecretNoneZ {
6277                 contents: CResult_PaymentSecretNoneZPtr {
6278                         result: Box::into_raw(Box::new(o)),
6279                 },
6280                 result_ok: true,
6281         }
6282 }
6283 #[no_mangle]
6284 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6285 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6286         CResult_PaymentSecretNoneZ {
6287                 contents: CResult_PaymentSecretNoneZPtr {
6288                         err: core::ptr::null_mut(),
6289                 },
6290                 result_ok: false,
6291         }
6292 }
6293 /// Checks if the given object is currently in the success state
6294 #[no_mangle]
6295 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6296         o.result_ok
6297 }
6298 #[no_mangle]
6299 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6300 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6301 impl Drop for CResult_PaymentSecretNoneZ {
6302         fn drop(&mut self) {
6303                 if self.result_ok {
6304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6306                         }
6307                 } else {
6308                 }
6309         }
6310 }
6311 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6312         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6313                 let contents = if o.result_ok {
6314                         let result = unsafe { o.contents.result };
6315                         unsafe { o.contents.result = core::ptr::null_mut() };
6316                         CResult_PaymentSecretNoneZPtr { result }
6317                 } else {
6318                         let _ = unsafe { Box::from_raw(o.contents.err) };
6319                         o.contents.err = core::ptr::null_mut();
6320                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6321                 };
6322                 Self {
6323                         contents,
6324                         result_ok: o.result_ok,
6325                 }
6326         }
6327 }
6328 impl Clone for CResult_PaymentSecretNoneZ {
6329         fn clone(&self) -> Self {
6330                 if self.result_ok {
6331                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6332                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6333                         } }
6334                 } else {
6335                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6336                                 err: core::ptr::null_mut()
6337                         } }
6338                 }
6339         }
6340 }
6341 #[no_mangle]
6342 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6343 /// but with all dynamically-allocated buffers duplicated in new buffers.
6344 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6345 #[repr(C)]
6346 /// The contents of CResult_PaymentSecretAPIErrorZ
6347 pub union CResult_PaymentSecretAPIErrorZPtr {
6348         /// A pointer to the contents in the success state.
6349         /// Reading from this pointer when `result_ok` is not set is undefined.
6350         pub result: *mut crate::c_types::ThirtyTwoBytes,
6351         /// A pointer to the contents in the error state.
6352         /// Reading from this pointer when `result_ok` is set is undefined.
6353         pub err: *mut crate::lightning::util::errors::APIError,
6354 }
6355 #[repr(C)]
6356 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6357 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6358 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6359 pub struct CResult_PaymentSecretAPIErrorZ {
6360         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6361         /// `err` or `result` depending on the state of `result_ok`.
6362         pub contents: CResult_PaymentSecretAPIErrorZPtr,
6363         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6364         pub result_ok: bool,
6365 }
6366 #[no_mangle]
6367 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6368 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6369         CResult_PaymentSecretAPIErrorZ {
6370                 contents: CResult_PaymentSecretAPIErrorZPtr {
6371                         result: Box::into_raw(Box::new(o)),
6372                 },
6373                 result_ok: true,
6374         }
6375 }
6376 #[no_mangle]
6377 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
6378 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
6379         CResult_PaymentSecretAPIErrorZ {
6380                 contents: CResult_PaymentSecretAPIErrorZPtr {
6381                         err: Box::into_raw(Box::new(e)),
6382                 },
6383                 result_ok: false,
6384         }
6385 }
6386 /// Checks if the given object is currently in the success state
6387 #[no_mangle]
6388 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
6389         o.result_ok
6390 }
6391 #[no_mangle]
6392 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
6393 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
6394 impl Drop for CResult_PaymentSecretAPIErrorZ {
6395         fn drop(&mut self) {
6396                 if self.result_ok {
6397                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6398                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6399                         }
6400                 } else {
6401                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6402                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6403                         }
6404                 }
6405         }
6406 }
6407 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
6408         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6409                 let contents = if o.result_ok {
6410                         let result = unsafe { o.contents.result };
6411                         unsafe { o.contents.result = core::ptr::null_mut() };
6412                         CResult_PaymentSecretAPIErrorZPtr { result }
6413                 } else {
6414                         let err = unsafe { o.contents.err };
6415                         unsafe { o.contents.err = core::ptr::null_mut(); }
6416                         CResult_PaymentSecretAPIErrorZPtr { err }
6417                 };
6418                 Self {
6419                         contents,
6420                         result_ok: o.result_ok,
6421                 }
6422         }
6423 }
6424 impl Clone for CResult_PaymentSecretAPIErrorZ {
6425         fn clone(&self) -> Self {
6426                 if self.result_ok {
6427                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
6428                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6429                         } }
6430                 } else {
6431                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
6432                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6433                         } }
6434                 }
6435         }
6436 }
6437 #[no_mangle]
6438 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
6439 /// but with all dynamically-allocated buffers duplicated in new buffers.
6440 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
6441 #[repr(C)]
6442 /// The contents of CResult_PaymentPreimageAPIErrorZ
6443 pub union CResult_PaymentPreimageAPIErrorZPtr {
6444         /// A pointer to the contents in the success state.
6445         /// Reading from this pointer when `result_ok` is not set is undefined.
6446         pub result: *mut crate::c_types::ThirtyTwoBytes,
6447         /// A pointer to the contents in the error state.
6448         /// Reading from this pointer when `result_ok` is set is undefined.
6449         pub err: *mut crate::lightning::util::errors::APIError,
6450 }
6451 #[repr(C)]
6452 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6453 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6454 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6455 pub struct CResult_PaymentPreimageAPIErrorZ {
6456         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6457         /// `err` or `result` depending on the state of `result_ok`.
6458         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
6459         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6460         pub result_ok: bool,
6461 }
6462 #[no_mangle]
6463 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
6464 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
6465         CResult_PaymentPreimageAPIErrorZ {
6466                 contents: CResult_PaymentPreimageAPIErrorZPtr {
6467                         result: Box::into_raw(Box::new(o)),
6468                 },
6469                 result_ok: true,
6470         }
6471 }
6472 #[no_mangle]
6473 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
6474 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
6475         CResult_PaymentPreimageAPIErrorZ {
6476                 contents: CResult_PaymentPreimageAPIErrorZPtr {
6477                         err: Box::into_raw(Box::new(e)),
6478                 },
6479                 result_ok: false,
6480         }
6481 }
6482 /// Checks if the given object is currently in the success state
6483 #[no_mangle]
6484 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
6485         o.result_ok
6486 }
6487 #[no_mangle]
6488 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
6489 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
6490 impl Drop for CResult_PaymentPreimageAPIErrorZ {
6491         fn drop(&mut self) {
6492                 if self.result_ok {
6493                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6494                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6495                         }
6496                 } else {
6497                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6498                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6499                         }
6500                 }
6501         }
6502 }
6503 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
6504         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6505                 let contents = if o.result_ok {
6506                         let result = unsafe { o.contents.result };
6507                         unsafe { o.contents.result = core::ptr::null_mut() };
6508                         CResult_PaymentPreimageAPIErrorZPtr { result }
6509                 } else {
6510                         let err = unsafe { o.contents.err };
6511                         unsafe { o.contents.err = core::ptr::null_mut(); }
6512                         CResult_PaymentPreimageAPIErrorZPtr { err }
6513                 };
6514                 Self {
6515                         contents,
6516                         result_ok: o.result_ok,
6517                 }
6518         }
6519 }
6520 impl Clone for CResult_PaymentPreimageAPIErrorZ {
6521         fn clone(&self) -> Self {
6522                 if self.result_ok {
6523                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
6524                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6525                         } }
6526                 } else {
6527                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
6528                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6529                         } }
6530                 }
6531         }
6532 }
6533 #[no_mangle]
6534 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
6535 /// but with all dynamically-allocated buffers duplicated in new buffers.
6536 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
6537 #[repr(C)]
6538 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6539 /// This corresponds to std::vector in C++
6540 pub struct CVec_ChannelMonitorZ {
6541         /// The elements in the array.
6542         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6543         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
6544         /// The number of elements pointed to by `data`.
6545         pub datalen: usize
6546 }
6547 impl CVec_ChannelMonitorZ {
6548         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
6549                 if self.datalen == 0 { return Vec::new(); }
6550                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6551                 self.data = core::ptr::null_mut();
6552                 self.datalen = 0;
6553                 ret
6554         }
6555         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
6556                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6557         }
6558 }
6559 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
6560         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
6561                 let datalen = v.len();
6562                 let data = Box::into_raw(v.into_boxed_slice());
6563                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6564         }
6565 }
6566 #[no_mangle]
6567 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6568 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
6569 impl Drop for CVec_ChannelMonitorZ {
6570         fn drop(&mut self) {
6571                 if self.datalen == 0 { return; }
6572                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6573         }
6574 }
6575 #[repr(C)]
6576 /// A tuple of 2 elements. See the individual fields for the types contained.
6577 pub struct C2Tuple_BlockHashChannelManagerZ {
6578         /// The element at position 0
6579         pub a: crate::c_types::ThirtyTwoBytes,
6580         /// The element at position 1
6581         pub b: crate::lightning::ln::channelmanager::ChannelManager,
6582 }
6583 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
6584         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
6585                 Self {
6586                         a: tup.0,
6587                         b: tup.1,
6588                 }
6589         }
6590 }
6591 impl C2Tuple_BlockHashChannelManagerZ {
6592         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
6593                 (self.a, self.b)
6594         }
6595 }
6596 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
6597 #[no_mangle]
6598 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
6599         C2Tuple_BlockHashChannelManagerZ { a, b, }
6600 }
6601
6602 #[no_mangle]
6603 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
6604 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
6605 #[repr(C)]
6606 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6607 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6608         /// A pointer to the contents in the success state.
6609         /// Reading from this pointer when `result_ok` is not set is undefined.
6610         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
6611         /// A pointer to the contents in the error state.
6612         /// Reading from this pointer when `result_ok` is set is undefined.
6613         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6614 }
6615 #[repr(C)]
6616 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6617 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6619 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6620         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6621         /// `err` or `result` depending on the state of `result_ok`.
6622         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
6623         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6624         pub result_ok: bool,
6625 }
6626 #[no_mangle]
6627 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
6628 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6629         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6630                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6631                         result: Box::into_raw(Box::new(o)),
6632                 },
6633                 result_ok: true,
6634         }
6635 }
6636 #[no_mangle]
6637 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
6638 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6639         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6640                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6641                         err: Box::into_raw(Box::new(e)),
6642                 },
6643                 result_ok: false,
6644         }
6645 }
6646 /// Checks if the given object is currently in the success state
6647 #[no_mangle]
6648 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
6649         o.result_ok
6650 }
6651 #[no_mangle]
6652 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
6653 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
6654 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6655         fn drop(&mut self) {
6656                 if self.result_ok {
6657                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6658                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6659                         }
6660                 } else {
6661                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6662                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6663                         }
6664                 }
6665         }
6666 }
6667 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6668         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6669                 let contents = if o.result_ok {
6670                         let result = unsafe { o.contents.result };
6671                         unsafe { o.contents.result = core::ptr::null_mut() };
6672                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
6673                 } else {
6674                         let err = unsafe { o.contents.err };
6675                         unsafe { o.contents.err = core::ptr::null_mut(); }
6676                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
6677                 };
6678                 Self {
6679                         contents,
6680                         result_ok: o.result_ok,
6681                 }
6682         }
6683 }
6684 #[repr(C)]
6685 /// The contents of CResult_ChannelConfigDecodeErrorZ
6686 pub union CResult_ChannelConfigDecodeErrorZPtr {
6687         /// A pointer to the contents in the success state.
6688         /// Reading from this pointer when `result_ok` is not set is undefined.
6689         pub result: *mut crate::lightning::util::config::ChannelConfig,
6690         /// A pointer to the contents in the error state.
6691         /// Reading from this pointer when `result_ok` is set is undefined.
6692         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6693 }
6694 #[repr(C)]
6695 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6696 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6698 pub struct CResult_ChannelConfigDecodeErrorZ {
6699         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6700         /// `err` or `result` depending on the state of `result_ok`.
6701         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
6702         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6703         pub result_ok: bool,
6704 }
6705 #[no_mangle]
6706 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
6707 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
6708         CResult_ChannelConfigDecodeErrorZ {
6709                 contents: CResult_ChannelConfigDecodeErrorZPtr {
6710                         result: Box::into_raw(Box::new(o)),
6711                 },
6712                 result_ok: true,
6713         }
6714 }
6715 #[no_mangle]
6716 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
6717 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
6718         CResult_ChannelConfigDecodeErrorZ {
6719                 contents: CResult_ChannelConfigDecodeErrorZPtr {
6720                         err: Box::into_raw(Box::new(e)),
6721                 },
6722                 result_ok: false,
6723         }
6724 }
6725 /// Checks if the given object is currently in the success state
6726 #[no_mangle]
6727 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
6728         o.result_ok
6729 }
6730 #[no_mangle]
6731 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
6732 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
6733 impl Drop for CResult_ChannelConfigDecodeErrorZ {
6734         fn drop(&mut self) {
6735                 if self.result_ok {
6736                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6737                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6738                         }
6739                 } else {
6740                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6741                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6742                         }
6743                 }
6744         }
6745 }
6746 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
6747         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
6748                 let contents = if o.result_ok {
6749                         let result = unsafe { o.contents.result };
6750                         unsafe { o.contents.result = core::ptr::null_mut() };
6751                         CResult_ChannelConfigDecodeErrorZPtr { result }
6752                 } else {
6753                         let err = unsafe { o.contents.err };
6754                         unsafe { o.contents.err = core::ptr::null_mut(); }
6755                         CResult_ChannelConfigDecodeErrorZPtr { err }
6756                 };
6757                 Self {
6758                         contents,
6759                         result_ok: o.result_ok,
6760                 }
6761         }
6762 }
6763 impl Clone for CResult_ChannelConfigDecodeErrorZ {
6764         fn clone(&self) -> Self {
6765                 if self.result_ok {
6766                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
6767                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
6768                         } }
6769                 } else {
6770                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
6771                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6772                         } }
6773                 }
6774         }
6775 }
6776 #[no_mangle]
6777 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
6778 /// but with all dynamically-allocated buffers duplicated in new buffers.
6779 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
6780 #[repr(C)]
6781 /// The contents of CResult_OutPointDecodeErrorZ
6782 pub union CResult_OutPointDecodeErrorZPtr {
6783         /// A pointer to the contents in the success state.
6784         /// Reading from this pointer when `result_ok` is not set is undefined.
6785         pub result: *mut crate::lightning::chain::transaction::OutPoint,
6786         /// A pointer to the contents in the error state.
6787         /// Reading from this pointer when `result_ok` is set is undefined.
6788         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6789 }
6790 #[repr(C)]
6791 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6792 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6794 pub struct CResult_OutPointDecodeErrorZ {
6795         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6796         /// `err` or `result` depending on the state of `result_ok`.
6797         pub contents: CResult_OutPointDecodeErrorZPtr,
6798         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
6799         pub result_ok: bool,
6800 }
6801 #[no_mangle]
6802 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
6803 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
6804         CResult_OutPointDecodeErrorZ {
6805                 contents: CResult_OutPointDecodeErrorZPtr {
6806                         result: Box::into_raw(Box::new(o)),
6807                 },
6808                 result_ok: true,
6809         }
6810 }
6811 #[no_mangle]
6812 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
6813 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
6814         CResult_OutPointDecodeErrorZ {
6815                 contents: CResult_OutPointDecodeErrorZPtr {
6816                         err: Box::into_raw(Box::new(e)),
6817                 },
6818                 result_ok: false,
6819         }
6820 }
6821 /// Checks if the given object is currently in the success state
6822 #[no_mangle]
6823 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
6824         o.result_ok
6825 }
6826 #[no_mangle]
6827 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
6828 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
6829 impl Drop for CResult_OutPointDecodeErrorZ {
6830         fn drop(&mut self) {
6831                 if self.result_ok {
6832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6834                         }
6835                 } else {
6836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6838                         }
6839                 }
6840         }
6841 }
6842 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
6843         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
6844                 let contents = if o.result_ok {
6845                         let result = unsafe { o.contents.result };
6846                         unsafe { o.contents.result = core::ptr::null_mut() };
6847                         CResult_OutPointDecodeErrorZPtr { result }
6848                 } else {
6849                         let err = unsafe { o.contents.err };
6850                         unsafe { o.contents.err = core::ptr::null_mut(); }
6851                         CResult_OutPointDecodeErrorZPtr { err }
6852                 };
6853                 Self {
6854                         contents,
6855                         result_ok: o.result_ok,
6856                 }
6857         }
6858 }
6859 impl Clone for CResult_OutPointDecodeErrorZ {
6860         fn clone(&self) -> Self {
6861                 if self.result_ok {
6862                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
6863                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
6864                         } }
6865                 } else {
6866                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
6867                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6868                         } }
6869                 }
6870         }
6871 }
6872 #[no_mangle]
6873 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
6874 /// but with all dynamically-allocated buffers duplicated in new buffers.
6875 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
6876 #[repr(C)]
6877 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
6878 pub enum COption_TypeZ {
6879         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6880         Some(crate::lightning::ln::wire::Type),
6881         /// When we're in this state, this COption_TypeZ contains nothing
6882         None
6883 }
6884 impl COption_TypeZ {
6885         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6886                 if let Self::None = self { false } else { true }
6887         }
6888         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6889                 !self.is_some()
6890         }
6891         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
6892                 if let Self::Some(v) = self { v } else { unreachable!() }
6893         }
6894 }
6895 #[no_mangle]
6896 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
6897 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
6898         COption_TypeZ::Some(o)
6899 }
6900 #[no_mangle]
6901 /// Constructs a new COption_TypeZ containing nothing
6902 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
6903         COption_TypeZ::None
6904 }
6905 #[no_mangle]
6906 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
6907 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
6908 #[repr(C)]
6909 /// The contents of CResult_COption_TypeZDecodeErrorZ
6910 pub union CResult_COption_TypeZDecodeErrorZPtr {
6911         /// A pointer to the contents in the success state.
6912         /// Reading from this pointer when `result_ok` is not set is undefined.
6913         pub result: *mut crate::c_types::derived::COption_TypeZ,
6914         /// A pointer to the contents in the error state.
6915         /// Reading from this pointer when `result_ok` is set is undefined.
6916         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6917 }
6918 #[repr(C)]
6919 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6920 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6922 pub struct CResult_COption_TypeZDecodeErrorZ {
6923         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6924         /// `err` or `result` depending on the state of `result_ok`.
6925         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
6926         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6927         pub result_ok: bool,
6928 }
6929 #[no_mangle]
6930 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
6931 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
6932         CResult_COption_TypeZDecodeErrorZ {
6933                 contents: CResult_COption_TypeZDecodeErrorZPtr {
6934                         result: Box::into_raw(Box::new(o)),
6935                 },
6936                 result_ok: true,
6937         }
6938 }
6939 #[no_mangle]
6940 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
6941 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
6942         CResult_COption_TypeZDecodeErrorZ {
6943                 contents: CResult_COption_TypeZDecodeErrorZPtr {
6944                         err: Box::into_raw(Box::new(e)),
6945                 },
6946                 result_ok: false,
6947         }
6948 }
6949 /// Checks if the given object is currently in the success state
6950 #[no_mangle]
6951 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
6952         o.result_ok
6953 }
6954 #[no_mangle]
6955 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
6956 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
6957 impl Drop for CResult_COption_TypeZDecodeErrorZ {
6958         fn drop(&mut self) {
6959                 if self.result_ok {
6960                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6961                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6962                         }
6963                 } else {
6964                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6965                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6966                         }
6967                 }
6968         }
6969 }
6970 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
6971         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
6972                 let contents = if o.result_ok {
6973                         let result = unsafe { o.contents.result };
6974                         unsafe { o.contents.result = core::ptr::null_mut() };
6975                         CResult_COption_TypeZDecodeErrorZPtr { result }
6976                 } else {
6977                         let err = unsafe { o.contents.err };
6978                         unsafe { o.contents.err = core::ptr::null_mut(); }
6979                         CResult_COption_TypeZDecodeErrorZPtr { err }
6980                 };
6981                 Self {
6982                         contents,
6983                         result_ok: o.result_ok,
6984                 }
6985         }
6986 }
6987 #[repr(C)]
6988 /// The contents of CResult_PaymentIdPaymentErrorZ
6989 pub union CResult_PaymentIdPaymentErrorZPtr {
6990         /// A pointer to the contents in the success state.
6991         /// Reading from this pointer when `result_ok` is not set is undefined.
6992         pub result: *mut crate::c_types::ThirtyTwoBytes,
6993         /// A pointer to the contents in the error state.
6994         /// Reading from this pointer when `result_ok` is set is undefined.
6995         pub err: *mut crate::lightning_invoice::payment::PaymentError,
6996 }
6997 #[repr(C)]
6998 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
6999 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7000 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7001 pub struct CResult_PaymentIdPaymentErrorZ {
7002         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7003         /// `err` or `result` depending on the state of `result_ok`.
7004         pub contents: CResult_PaymentIdPaymentErrorZPtr,
7005         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7006         pub result_ok: bool,
7007 }
7008 #[no_mangle]
7009 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
7010 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
7011         CResult_PaymentIdPaymentErrorZ {
7012                 contents: CResult_PaymentIdPaymentErrorZPtr {
7013                         result: Box::into_raw(Box::new(o)),
7014                 },
7015                 result_ok: true,
7016         }
7017 }
7018 #[no_mangle]
7019 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
7020 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
7021         CResult_PaymentIdPaymentErrorZ {
7022                 contents: CResult_PaymentIdPaymentErrorZPtr {
7023                         err: Box::into_raw(Box::new(e)),
7024                 },
7025                 result_ok: false,
7026         }
7027 }
7028 /// Checks if the given object is currently in the success state
7029 #[no_mangle]
7030 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
7031         o.result_ok
7032 }
7033 #[no_mangle]
7034 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
7035 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
7036 impl Drop for CResult_PaymentIdPaymentErrorZ {
7037         fn drop(&mut self) {
7038                 if self.result_ok {
7039                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7040                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7041                         }
7042                 } else {
7043                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7044                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7045                         }
7046                 }
7047         }
7048 }
7049 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
7050         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
7051                 let contents = if o.result_ok {
7052                         let result = unsafe { o.contents.result };
7053                         unsafe { o.contents.result = core::ptr::null_mut() };
7054                         CResult_PaymentIdPaymentErrorZPtr { result }
7055                 } else {
7056                         let err = unsafe { o.contents.err };
7057                         unsafe { o.contents.err = core::ptr::null_mut(); }
7058                         CResult_PaymentIdPaymentErrorZPtr { err }
7059                 };
7060                 Self {
7061                         contents,
7062                         result_ok: o.result_ok,
7063                 }
7064         }
7065 }
7066 impl Clone for CResult_PaymentIdPaymentErrorZ {
7067         fn clone(&self) -> Self {
7068                 if self.result_ok {
7069                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
7070                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7071                         } }
7072                 } else {
7073                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
7074                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
7075                         } }
7076                 }
7077         }
7078 }
7079 #[no_mangle]
7080 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
7081 /// but with all dynamically-allocated buffers duplicated in new buffers.
7082 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
7083 #[repr(C)]
7084 /// The contents of CResult_SiPrefixNoneZ
7085 pub union CResult_SiPrefixNoneZPtr {
7086         /// A pointer to the contents in the success state.
7087         /// Reading from this pointer when `result_ok` is not set is undefined.
7088         pub result: *mut crate::lightning_invoice::SiPrefix,
7089         /// Note that this value is always NULL, as there are no contents in the Err variant
7090         pub err: *mut core::ffi::c_void,
7091 }
7092 #[repr(C)]
7093 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7094 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7096 pub struct CResult_SiPrefixNoneZ {
7097         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
7098         /// `err` or `result` depending on the state of `result_ok`.
7099         pub contents: CResult_SiPrefixNoneZPtr,
7100         /// Whether this CResult_SiPrefixNoneZ represents a success state.
7101         pub result_ok: bool,
7102 }
7103 #[no_mangle]
7104 /// Creates a new CResult_SiPrefixNoneZ in the success state.
7105 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
7106         CResult_SiPrefixNoneZ {
7107                 contents: CResult_SiPrefixNoneZPtr {
7108                         result: Box::into_raw(Box::new(o)),
7109                 },
7110                 result_ok: true,
7111         }
7112 }
7113 #[no_mangle]
7114 /// Creates a new CResult_SiPrefixNoneZ in the error state.
7115 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
7116         CResult_SiPrefixNoneZ {
7117                 contents: CResult_SiPrefixNoneZPtr {
7118                         err: core::ptr::null_mut(),
7119                 },
7120                 result_ok: false,
7121         }
7122 }
7123 /// Checks if the given object is currently in the success state
7124 #[no_mangle]
7125 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
7126         o.result_ok
7127 }
7128 #[no_mangle]
7129 /// Frees any resources used by the CResult_SiPrefixNoneZ.
7130 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
7131 impl Drop for CResult_SiPrefixNoneZ {
7132         fn drop(&mut self) {
7133                 if self.result_ok {
7134                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7135                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7136                         }
7137                 } else {
7138                 }
7139         }
7140 }
7141 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
7142         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
7143                 let contents = if o.result_ok {
7144                         let result = unsafe { o.contents.result };
7145                         unsafe { o.contents.result = core::ptr::null_mut() };
7146                         CResult_SiPrefixNoneZPtr { result }
7147                 } else {
7148                         let _ = unsafe { Box::from_raw(o.contents.err) };
7149                         o.contents.err = core::ptr::null_mut();
7150                         CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
7151                 };
7152                 Self {
7153                         contents,
7154                         result_ok: o.result_ok,
7155                 }
7156         }
7157 }
7158 impl Clone for CResult_SiPrefixNoneZ {
7159         fn clone(&self) -> Self {
7160                 if self.result_ok {
7161                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
7162                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
7163                         } }
7164                 } else {
7165                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
7166                                 err: core::ptr::null_mut()
7167                         } }
7168                 }
7169         }
7170 }
7171 #[no_mangle]
7172 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
7173 /// but with all dynamically-allocated buffers duplicated in new buffers.
7174 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
7175 #[repr(C)]
7176 /// The contents of CResult_InvoiceNoneZ
7177 pub union CResult_InvoiceNoneZPtr {
7178         /// A pointer to the contents in the success state.
7179         /// Reading from this pointer when `result_ok` is not set is undefined.
7180         pub result: *mut crate::lightning_invoice::Invoice,
7181         /// Note that this value is always NULL, as there are no contents in the Err variant
7182         pub err: *mut core::ffi::c_void,
7183 }
7184 #[repr(C)]
7185 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
7186 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
7187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7188 pub struct CResult_InvoiceNoneZ {
7189         /// The contents of this CResult_InvoiceNoneZ, accessible via either
7190         /// `err` or `result` depending on the state of `result_ok`.
7191         pub contents: CResult_InvoiceNoneZPtr,
7192         /// Whether this CResult_InvoiceNoneZ represents a success state.
7193         pub result_ok: bool,
7194 }
7195 #[no_mangle]
7196 /// Creates a new CResult_InvoiceNoneZ in the success state.
7197 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
7198         CResult_InvoiceNoneZ {
7199                 contents: CResult_InvoiceNoneZPtr {
7200                         result: Box::into_raw(Box::new(o)),
7201                 },
7202                 result_ok: true,
7203         }
7204 }
7205 #[no_mangle]
7206 /// Creates a new CResult_InvoiceNoneZ in the error state.
7207 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
7208         CResult_InvoiceNoneZ {
7209                 contents: CResult_InvoiceNoneZPtr {
7210                         err: core::ptr::null_mut(),
7211                 },
7212                 result_ok: false,
7213         }
7214 }
7215 /// Checks if the given object is currently in the success state
7216 #[no_mangle]
7217 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
7218         o.result_ok
7219 }
7220 #[no_mangle]
7221 /// Frees any resources used by the CResult_InvoiceNoneZ.
7222 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
7223 impl Drop for CResult_InvoiceNoneZ {
7224         fn drop(&mut self) {
7225                 if self.result_ok {
7226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7228                         }
7229                 } else {
7230                 }
7231         }
7232 }
7233 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
7234         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
7235                 let contents = if o.result_ok {
7236                         let result = unsafe { o.contents.result };
7237                         unsafe { o.contents.result = core::ptr::null_mut() };
7238                         CResult_InvoiceNoneZPtr { result }
7239                 } else {
7240                         let _ = unsafe { Box::from_raw(o.contents.err) };
7241                         o.contents.err = core::ptr::null_mut();
7242                         CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
7243                 };
7244                 Self {
7245                         contents,
7246                         result_ok: o.result_ok,
7247                 }
7248         }
7249 }
7250 impl Clone for CResult_InvoiceNoneZ {
7251         fn clone(&self) -> Self {
7252                 if self.result_ok {
7253                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
7254                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7255                         } }
7256                 } else {
7257                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
7258                                 err: core::ptr::null_mut()
7259                         } }
7260                 }
7261         }
7262 }
7263 #[no_mangle]
7264 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
7265 /// but with all dynamically-allocated buffers duplicated in new buffers.
7266 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
7267 #[repr(C)]
7268 /// The contents of CResult_SignedRawInvoiceNoneZ
7269 pub union CResult_SignedRawInvoiceNoneZPtr {
7270         /// A pointer to the contents in the success state.
7271         /// Reading from this pointer when `result_ok` is not set is undefined.
7272         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
7273         /// Note that this value is always NULL, as there are no contents in the Err variant
7274         pub err: *mut core::ffi::c_void,
7275 }
7276 #[repr(C)]
7277 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7278 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7280 pub struct CResult_SignedRawInvoiceNoneZ {
7281         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7282         /// `err` or `result` depending on the state of `result_ok`.
7283         pub contents: CResult_SignedRawInvoiceNoneZPtr,
7284         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7285         pub result_ok: bool,
7286 }
7287 #[no_mangle]
7288 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
7289 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
7290         CResult_SignedRawInvoiceNoneZ {
7291                 contents: CResult_SignedRawInvoiceNoneZPtr {
7292                         result: Box::into_raw(Box::new(o)),
7293                 },
7294                 result_ok: true,
7295         }
7296 }
7297 #[no_mangle]
7298 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
7299 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
7300         CResult_SignedRawInvoiceNoneZ {
7301                 contents: CResult_SignedRawInvoiceNoneZPtr {
7302                         err: core::ptr::null_mut(),
7303                 },
7304                 result_ok: false,
7305         }
7306 }
7307 /// Checks if the given object is currently in the success state
7308 #[no_mangle]
7309 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
7310         o.result_ok
7311 }
7312 #[no_mangle]
7313 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
7314 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
7315 impl Drop for CResult_SignedRawInvoiceNoneZ {
7316         fn drop(&mut self) {
7317                 if self.result_ok {
7318                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7319                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7320                         }
7321                 } else {
7322                 }
7323         }
7324 }
7325 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
7326         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
7327                 let contents = if o.result_ok {
7328                         let result = unsafe { o.contents.result };
7329                         unsafe { o.contents.result = core::ptr::null_mut() };
7330                         CResult_SignedRawInvoiceNoneZPtr { result }
7331                 } else {
7332                         let _ = unsafe { Box::from_raw(o.contents.err) };
7333                         o.contents.err = core::ptr::null_mut();
7334                         CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
7335                 };
7336                 Self {
7337                         contents,
7338                         result_ok: o.result_ok,
7339                 }
7340         }
7341 }
7342 impl Clone for CResult_SignedRawInvoiceNoneZ {
7343         fn clone(&self) -> Self {
7344                 if self.result_ok {
7345                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
7346                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
7347                         } }
7348                 } else {
7349                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
7350                                 err: core::ptr::null_mut()
7351                         } }
7352                 }
7353         }
7354 }
7355 #[no_mangle]
7356 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
7357 /// but with all dynamically-allocated buffers duplicated in new buffers.
7358 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
7359 #[repr(C)]
7360 /// A tuple of 3 elements. See the individual fields for the types contained.
7361 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7362         /// The element at position 0
7363         pub a: crate::lightning_invoice::RawInvoice,
7364         /// The element at position 1
7365         pub b: crate::c_types::ThirtyTwoBytes,
7366         /// The element at position 2
7367         pub c: crate::lightning_invoice::InvoiceSignature,
7368 }
7369 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7370         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
7371                 Self {
7372                         a: tup.0,
7373                         b: tup.1,
7374                         c: tup.2,
7375                 }
7376         }
7377 }
7378 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7379         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
7380                 (self.a, self.b, self.c)
7381         }
7382 }
7383 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
7384         fn clone(&self) -> Self {
7385                 Self {
7386                         a: Clone::clone(&self.a),
7387                         b: Clone::clone(&self.b),
7388                         c: Clone::clone(&self.c),
7389                 }
7390         }
7391 }
7392 #[no_mangle]
7393 /// Creates a new tuple which has the same data as `orig`
7394 /// but with all dynamically-allocated buffers duplicated in new buffers.
7395 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
7396 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
7397 #[no_mangle]
7398 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 {
7399         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
7400 }
7401
7402 #[no_mangle]
7403 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
7404 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
7405 #[repr(C)]
7406 /// The contents of CResult_PayeePubKeyErrorZ
7407 pub union CResult_PayeePubKeyErrorZPtr {
7408         /// A pointer to the contents in the success state.
7409         /// Reading from this pointer when `result_ok` is not set is undefined.
7410         pub result: *mut crate::lightning_invoice::PayeePubKey,
7411         /// A pointer to the contents in the error state.
7412         /// Reading from this pointer when `result_ok` is set is undefined.
7413         pub err: *mut crate::c_types::Secp256k1Error,
7414 }
7415 #[repr(C)]
7416 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7417 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7419 pub struct CResult_PayeePubKeyErrorZ {
7420         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7421         /// `err` or `result` depending on the state of `result_ok`.
7422         pub contents: CResult_PayeePubKeyErrorZPtr,
7423         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
7424         pub result_ok: bool,
7425 }
7426 #[no_mangle]
7427 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
7428 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
7429         CResult_PayeePubKeyErrorZ {
7430                 contents: CResult_PayeePubKeyErrorZPtr {
7431                         result: Box::into_raw(Box::new(o)),
7432                 },
7433                 result_ok: true,
7434         }
7435 }
7436 #[no_mangle]
7437 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
7438 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
7439         CResult_PayeePubKeyErrorZ {
7440                 contents: CResult_PayeePubKeyErrorZPtr {
7441                         err: Box::into_raw(Box::new(e)),
7442                 },
7443                 result_ok: false,
7444         }
7445 }
7446 /// Checks if the given object is currently in the success state
7447 #[no_mangle]
7448 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
7449         o.result_ok
7450 }
7451 #[no_mangle]
7452 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
7453 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
7454 impl Drop for CResult_PayeePubKeyErrorZ {
7455         fn drop(&mut self) {
7456                 if self.result_ok {
7457                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7458                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7459                         }
7460                 } else {
7461                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7462                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7463                         }
7464                 }
7465         }
7466 }
7467 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
7468         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
7469                 let contents = if o.result_ok {
7470                         let result = unsafe { o.contents.result };
7471                         unsafe { o.contents.result = core::ptr::null_mut() };
7472                         CResult_PayeePubKeyErrorZPtr { result }
7473                 } else {
7474                         let err = unsafe { o.contents.err };
7475                         unsafe { o.contents.err = core::ptr::null_mut(); }
7476                         CResult_PayeePubKeyErrorZPtr { err }
7477                 };
7478                 Self {
7479                         contents,
7480                         result_ok: o.result_ok,
7481                 }
7482         }
7483 }
7484 impl Clone for CResult_PayeePubKeyErrorZ {
7485         fn clone(&self) -> Self {
7486                 if self.result_ok {
7487                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
7488                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
7489                         } }
7490                 } else {
7491                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
7492                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
7493                         } }
7494                 }
7495         }
7496 }
7497 #[no_mangle]
7498 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
7499 /// but with all dynamically-allocated buffers duplicated in new buffers.
7500 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
7501 #[repr(C)]
7502 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7503 /// This corresponds to std::vector in C++
7504 pub struct CVec_PrivateRouteZ {
7505         /// The elements in the array.
7506         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7507         pub data: *mut crate::lightning_invoice::PrivateRoute,
7508         /// The number of elements pointed to by `data`.
7509         pub datalen: usize
7510 }
7511 impl CVec_PrivateRouteZ {
7512         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
7513                 if self.datalen == 0 { return Vec::new(); }
7514                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7515                 self.data = core::ptr::null_mut();
7516                 self.datalen = 0;
7517                 ret
7518         }
7519         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
7520                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7521         }
7522 }
7523 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
7524         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
7525                 let datalen = v.len();
7526                 let data = Box::into_raw(v.into_boxed_slice());
7527                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7528         }
7529 }
7530 #[no_mangle]
7531 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7532 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
7533 impl Drop for CVec_PrivateRouteZ {
7534         fn drop(&mut self) {
7535                 if self.datalen == 0 { return; }
7536                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7537         }
7538 }
7539 impl Clone for CVec_PrivateRouteZ {
7540         fn clone(&self) -> Self {
7541                 let mut res = Vec::new();
7542                 if self.datalen == 0 { return Self::from(res); }
7543                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7544                 Self::from(res)
7545         }
7546 }
7547 #[repr(C)]
7548 /// The contents of CResult_PositiveTimestampCreationErrorZ
7549 pub union CResult_PositiveTimestampCreationErrorZPtr {
7550         /// A pointer to the contents in the success state.
7551         /// Reading from this pointer when `result_ok` is not set is undefined.
7552         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
7553         /// A pointer to the contents in the error state.
7554         /// Reading from this pointer when `result_ok` is set is undefined.
7555         pub err: *mut crate::lightning_invoice::CreationError,
7556 }
7557 #[repr(C)]
7558 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7559 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7560 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7561 pub struct CResult_PositiveTimestampCreationErrorZ {
7562         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7563         /// `err` or `result` depending on the state of `result_ok`.
7564         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
7565         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7566         pub result_ok: bool,
7567 }
7568 #[no_mangle]
7569 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
7570 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
7571         CResult_PositiveTimestampCreationErrorZ {
7572                 contents: CResult_PositiveTimestampCreationErrorZPtr {
7573                         result: Box::into_raw(Box::new(o)),
7574                 },
7575                 result_ok: true,
7576         }
7577 }
7578 #[no_mangle]
7579 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
7580 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
7581         CResult_PositiveTimestampCreationErrorZ {
7582                 contents: CResult_PositiveTimestampCreationErrorZPtr {
7583                         err: Box::into_raw(Box::new(e)),
7584                 },
7585                 result_ok: false,
7586         }
7587 }
7588 /// Checks if the given object is currently in the success state
7589 #[no_mangle]
7590 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
7591         o.result_ok
7592 }
7593 #[no_mangle]
7594 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
7595 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
7596 impl Drop for CResult_PositiveTimestampCreationErrorZ {
7597         fn drop(&mut self) {
7598                 if self.result_ok {
7599                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7600                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7601                         }
7602                 } else {
7603                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7604                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7605                         }
7606                 }
7607         }
7608 }
7609 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
7610         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
7611                 let contents = if o.result_ok {
7612                         let result = unsafe { o.contents.result };
7613                         unsafe { o.contents.result = core::ptr::null_mut() };
7614                         CResult_PositiveTimestampCreationErrorZPtr { result }
7615                 } else {
7616                         let err = unsafe { o.contents.err };
7617                         unsafe { o.contents.err = core::ptr::null_mut(); }
7618                         CResult_PositiveTimestampCreationErrorZPtr { err }
7619                 };
7620                 Self {
7621                         contents,
7622                         result_ok: o.result_ok,
7623                 }
7624         }
7625 }
7626 impl Clone for CResult_PositiveTimestampCreationErrorZ {
7627         fn clone(&self) -> Self {
7628                 if self.result_ok {
7629                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
7630                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
7631                         } }
7632                 } else {
7633                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
7634                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7635                         } }
7636                 }
7637         }
7638 }
7639 #[no_mangle]
7640 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
7641 /// but with all dynamically-allocated buffers duplicated in new buffers.
7642 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
7643 #[repr(C)]
7644 /// The contents of CResult_NoneSemanticErrorZ
7645 pub union CResult_NoneSemanticErrorZPtr {
7646         /// Note that this value is always NULL, as there are no contents in the OK variant
7647         pub result: *mut core::ffi::c_void,
7648         /// A pointer to the contents in the error state.
7649         /// Reading from this pointer when `result_ok` is set is undefined.
7650         pub err: *mut crate::lightning_invoice::SemanticError,
7651 }
7652 #[repr(C)]
7653 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7654 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7655 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7656 pub struct CResult_NoneSemanticErrorZ {
7657         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
7658         /// `err` or `result` depending on the state of `result_ok`.
7659         pub contents: CResult_NoneSemanticErrorZPtr,
7660         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
7661         pub result_ok: bool,
7662 }
7663 #[no_mangle]
7664 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
7665 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
7666         CResult_NoneSemanticErrorZ {
7667                 contents: CResult_NoneSemanticErrorZPtr {
7668                         result: core::ptr::null_mut(),
7669                 },
7670                 result_ok: true,
7671         }
7672 }
7673 #[no_mangle]
7674 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
7675 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
7676         CResult_NoneSemanticErrorZ {
7677                 contents: CResult_NoneSemanticErrorZPtr {
7678                         err: Box::into_raw(Box::new(e)),
7679                 },
7680                 result_ok: false,
7681         }
7682 }
7683 /// Checks if the given object is currently in the success state
7684 #[no_mangle]
7685 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
7686         o.result_ok
7687 }
7688 #[no_mangle]
7689 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
7690 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
7691 impl Drop for CResult_NoneSemanticErrorZ {
7692         fn drop(&mut self) {
7693                 if self.result_ok {
7694                 } else {
7695                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7696                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7697                         }
7698                 }
7699         }
7700 }
7701 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
7702         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
7703                 let contents = if o.result_ok {
7704                         let _ = unsafe { Box::from_raw(o.contents.result) };
7705                         o.contents.result = core::ptr::null_mut();
7706                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
7707                 } else {
7708                         let err = unsafe { o.contents.err };
7709                         unsafe { o.contents.err = core::ptr::null_mut(); }
7710                         CResult_NoneSemanticErrorZPtr { err }
7711                 };
7712                 Self {
7713                         contents,
7714                         result_ok: o.result_ok,
7715                 }
7716         }
7717 }
7718 impl Clone for CResult_NoneSemanticErrorZ {
7719         fn clone(&self) -> Self {
7720                 if self.result_ok {
7721                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
7722                                 result: core::ptr::null_mut()
7723                         } }
7724                 } else {
7725                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
7726                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7727                         } }
7728                 }
7729         }
7730 }
7731 #[no_mangle]
7732 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
7733 /// but with all dynamically-allocated buffers duplicated in new buffers.
7734 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
7735 #[repr(C)]
7736 /// The contents of CResult_InvoiceSemanticErrorZ
7737 pub union CResult_InvoiceSemanticErrorZPtr {
7738         /// A pointer to the contents in the success state.
7739         /// Reading from this pointer when `result_ok` is not set is undefined.
7740         pub result: *mut crate::lightning_invoice::Invoice,
7741         /// A pointer to the contents in the error state.
7742         /// Reading from this pointer when `result_ok` is set is undefined.
7743         pub err: *mut crate::lightning_invoice::SemanticError,
7744 }
7745 #[repr(C)]
7746 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7747 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749 pub struct CResult_InvoiceSemanticErrorZ {
7750         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7751         /// `err` or `result` depending on the state of `result_ok`.
7752         pub contents: CResult_InvoiceSemanticErrorZPtr,
7753         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7754         pub result_ok: bool,
7755 }
7756 #[no_mangle]
7757 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
7758 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
7759         CResult_InvoiceSemanticErrorZ {
7760                 contents: CResult_InvoiceSemanticErrorZPtr {
7761                         result: Box::into_raw(Box::new(o)),
7762                 },
7763                 result_ok: true,
7764         }
7765 }
7766 #[no_mangle]
7767 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
7768 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
7769         CResult_InvoiceSemanticErrorZ {
7770                 contents: CResult_InvoiceSemanticErrorZPtr {
7771                         err: Box::into_raw(Box::new(e)),
7772                 },
7773                 result_ok: false,
7774         }
7775 }
7776 /// Checks if the given object is currently in the success state
7777 #[no_mangle]
7778 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
7779         o.result_ok
7780 }
7781 #[no_mangle]
7782 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
7783 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
7784 impl Drop for CResult_InvoiceSemanticErrorZ {
7785         fn drop(&mut self) {
7786                 if self.result_ok {
7787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7789                         }
7790                 } else {
7791                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7792                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7793                         }
7794                 }
7795         }
7796 }
7797 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
7798         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
7799                 let contents = if o.result_ok {
7800                         let result = unsafe { o.contents.result };
7801                         unsafe { o.contents.result = core::ptr::null_mut() };
7802                         CResult_InvoiceSemanticErrorZPtr { result }
7803                 } else {
7804                         let err = unsafe { o.contents.err };
7805                         unsafe { o.contents.err = core::ptr::null_mut(); }
7806                         CResult_InvoiceSemanticErrorZPtr { err }
7807                 };
7808                 Self {
7809                         contents,
7810                         result_ok: o.result_ok,
7811                 }
7812         }
7813 }
7814 impl Clone for CResult_InvoiceSemanticErrorZ {
7815         fn clone(&self) -> Self {
7816                 if self.result_ok {
7817                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
7818                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
7819                         } }
7820                 } else {
7821                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
7822                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
7823                         } }
7824                 }
7825         }
7826 }
7827 #[no_mangle]
7828 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
7829 /// but with all dynamically-allocated buffers duplicated in new buffers.
7830 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
7831 #[repr(C)]
7832 /// The contents of CResult_DescriptionCreationErrorZ
7833 pub union CResult_DescriptionCreationErrorZPtr {
7834         /// A pointer to the contents in the success state.
7835         /// Reading from this pointer when `result_ok` is not set is undefined.
7836         pub result: *mut crate::lightning_invoice::Description,
7837         /// A pointer to the contents in the error state.
7838         /// Reading from this pointer when `result_ok` is set is undefined.
7839         pub err: *mut crate::lightning_invoice::CreationError,
7840 }
7841 #[repr(C)]
7842 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7843 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7845 pub struct CResult_DescriptionCreationErrorZ {
7846         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7847         /// `err` or `result` depending on the state of `result_ok`.
7848         pub contents: CResult_DescriptionCreationErrorZPtr,
7849         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
7850         pub result_ok: bool,
7851 }
7852 #[no_mangle]
7853 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
7854 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
7855         CResult_DescriptionCreationErrorZ {
7856                 contents: CResult_DescriptionCreationErrorZPtr {
7857                         result: Box::into_raw(Box::new(o)),
7858                 },
7859                 result_ok: true,
7860         }
7861 }
7862 #[no_mangle]
7863 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
7864 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
7865         CResult_DescriptionCreationErrorZ {
7866                 contents: CResult_DescriptionCreationErrorZPtr {
7867                         err: Box::into_raw(Box::new(e)),
7868                 },
7869                 result_ok: false,
7870         }
7871 }
7872 /// Checks if the given object is currently in the success state
7873 #[no_mangle]
7874 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
7875         o.result_ok
7876 }
7877 #[no_mangle]
7878 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
7879 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
7880 impl Drop for CResult_DescriptionCreationErrorZ {
7881         fn drop(&mut self) {
7882                 if self.result_ok {
7883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7885                         }
7886                 } else {
7887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7889                         }
7890                 }
7891         }
7892 }
7893 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
7894         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
7895                 let contents = if o.result_ok {
7896                         let result = unsafe { o.contents.result };
7897                         unsafe { o.contents.result = core::ptr::null_mut() };
7898                         CResult_DescriptionCreationErrorZPtr { result }
7899                 } else {
7900                         let err = unsafe { o.contents.err };
7901                         unsafe { o.contents.err = core::ptr::null_mut(); }
7902                         CResult_DescriptionCreationErrorZPtr { err }
7903                 };
7904                 Self {
7905                         contents,
7906                         result_ok: o.result_ok,
7907                 }
7908         }
7909 }
7910 impl Clone for CResult_DescriptionCreationErrorZ {
7911         fn clone(&self) -> Self {
7912                 if self.result_ok {
7913                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
7914                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
7915                         } }
7916                 } else {
7917                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
7918                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
7919                         } }
7920                 }
7921         }
7922 }
7923 #[no_mangle]
7924 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
7925 /// but with all dynamically-allocated buffers duplicated in new buffers.
7926 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
7927 #[repr(C)]
7928 /// The contents of CResult_ExpiryTimeCreationErrorZ
7929 pub union CResult_ExpiryTimeCreationErrorZPtr {
7930         /// A pointer to the contents in the success state.
7931         /// Reading from this pointer when `result_ok` is not set is undefined.
7932         pub result: *mut crate::lightning_invoice::ExpiryTime,
7933         /// A pointer to the contents in the error state.
7934         /// Reading from this pointer when `result_ok` is set is undefined.
7935         pub err: *mut crate::lightning_invoice::CreationError,
7936 }
7937 #[repr(C)]
7938 /// A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
7939 /// containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
7940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7941 pub struct CResult_ExpiryTimeCreationErrorZ {
7942         /// The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
7943         /// `err` or `result` depending on the state of `result_ok`.
7944         pub contents: CResult_ExpiryTimeCreationErrorZPtr,
7945         /// Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
7946         pub result_ok: bool,
7947 }
7948 #[no_mangle]
7949 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
7950 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_ok(o: crate::lightning_invoice::ExpiryTime) -> CResult_ExpiryTimeCreationErrorZ {
7951         CResult_ExpiryTimeCreationErrorZ {
7952                 contents: CResult_ExpiryTimeCreationErrorZPtr {
7953                         result: Box::into_raw(Box::new(o)),
7954                 },
7955                 result_ok: true,
7956         }
7957 }
7958 #[no_mangle]
7959 /// Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
7960 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_ExpiryTimeCreationErrorZ {
7961         CResult_ExpiryTimeCreationErrorZ {
7962                 contents: CResult_ExpiryTimeCreationErrorZPtr {
7963                         err: Box::into_raw(Box::new(e)),
7964                 },
7965                 result_ok: false,
7966         }
7967 }
7968 /// Checks if the given object is currently in the success state
7969 #[no_mangle]
7970 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool {
7971         o.result_ok
7972 }
7973 #[no_mangle]
7974 /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
7975 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { }
7976 impl Drop for CResult_ExpiryTimeCreationErrorZ {
7977         fn drop(&mut self) {
7978                 if self.result_ok {
7979                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7980                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7981                         }
7982                 } else {
7983                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7984                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7985                         }
7986                 }
7987         }
7988 }
7989 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>> for CResult_ExpiryTimeCreationErrorZ {
7990         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::ExpiryTime, crate::lightning_invoice::CreationError>) -> Self {
7991                 let contents = if o.result_ok {
7992                         let result = unsafe { o.contents.result };
7993                         unsafe { o.contents.result = core::ptr::null_mut() };
7994                         CResult_ExpiryTimeCreationErrorZPtr { result }
7995                 } else {
7996                         let err = unsafe { o.contents.err };
7997                         unsafe { o.contents.err = core::ptr::null_mut(); }
7998                         CResult_ExpiryTimeCreationErrorZPtr { err }
7999                 };
8000                 Self {
8001                         contents,
8002                         result_ok: o.result_ok,
8003                 }
8004         }
8005 }
8006 impl Clone for CResult_ExpiryTimeCreationErrorZ {
8007         fn clone(&self) -> Self {
8008                 if self.result_ok {
8009                         Self { result_ok: true, contents: CResult_ExpiryTimeCreationErrorZPtr {
8010                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::ExpiryTime>::clone(unsafe { &*self.contents.result })))
8011                         } }
8012                 } else {
8013                         Self { result_ok: false, contents: CResult_ExpiryTimeCreationErrorZPtr {
8014                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8015                         } }
8016                 }
8017         }
8018 }
8019 #[no_mangle]
8020 /// Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
8021 /// but with all dynamically-allocated buffers duplicated in new buffers.
8022 pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_clone(orig: &CResult_ExpiryTimeCreationErrorZ) -> CResult_ExpiryTimeCreationErrorZ { Clone::clone(&orig) }
8023 #[repr(C)]
8024 /// The contents of CResult_PrivateRouteCreationErrorZ
8025 pub union CResult_PrivateRouteCreationErrorZPtr {
8026         /// A pointer to the contents in the success state.
8027         /// Reading from this pointer when `result_ok` is not set is undefined.
8028         pub result: *mut crate::lightning_invoice::PrivateRoute,
8029         /// A pointer to the contents in the error state.
8030         /// Reading from this pointer when `result_ok` is set is undefined.
8031         pub err: *mut crate::lightning_invoice::CreationError,
8032 }
8033 #[repr(C)]
8034 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8035 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8037 pub struct CResult_PrivateRouteCreationErrorZ {
8038         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8039         /// `err` or `result` depending on the state of `result_ok`.
8040         pub contents: CResult_PrivateRouteCreationErrorZPtr,
8041         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8042         pub result_ok: bool,
8043 }
8044 #[no_mangle]
8045 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8046 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8047         CResult_PrivateRouteCreationErrorZ {
8048                 contents: CResult_PrivateRouteCreationErrorZPtr {
8049                         result: Box::into_raw(Box::new(o)),
8050                 },
8051                 result_ok: true,
8052         }
8053 }
8054 #[no_mangle]
8055 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8056 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8057         CResult_PrivateRouteCreationErrorZ {
8058                 contents: CResult_PrivateRouteCreationErrorZPtr {
8059                         err: Box::into_raw(Box::new(e)),
8060                 },
8061                 result_ok: false,
8062         }
8063 }
8064 /// Checks if the given object is currently in the success state
8065 #[no_mangle]
8066 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8067         o.result_ok
8068 }
8069 #[no_mangle]
8070 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8071 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8072 impl Drop for CResult_PrivateRouteCreationErrorZ {
8073         fn drop(&mut self) {
8074                 if self.result_ok {
8075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8077                         }
8078                 } else {
8079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8081                         }
8082                 }
8083         }
8084 }
8085 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8087                 let contents = if o.result_ok {
8088                         let result = unsafe { o.contents.result };
8089                         unsafe { o.contents.result = core::ptr::null_mut() };
8090                         CResult_PrivateRouteCreationErrorZPtr { result }
8091                 } else {
8092                         let err = unsafe { o.contents.err };
8093                         unsafe { o.contents.err = core::ptr::null_mut(); }
8094                         CResult_PrivateRouteCreationErrorZPtr { err }
8095                 };
8096                 Self {
8097                         contents,
8098                         result_ok: o.result_ok,
8099                 }
8100         }
8101 }
8102 impl Clone for CResult_PrivateRouteCreationErrorZ {
8103         fn clone(&self) -> Self {
8104                 if self.result_ok {
8105                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
8106                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
8107                         } }
8108                 } else {
8109                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
8110                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8111                         } }
8112                 }
8113         }
8114 }
8115 #[no_mangle]
8116 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
8117 /// but with all dynamically-allocated buffers duplicated in new buffers.
8118 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
8119 #[repr(C)]
8120 /// The contents of CResult_StringErrorZ
8121 pub union CResult_StringErrorZPtr {
8122         /// A pointer to the contents in the success state.
8123         /// Reading from this pointer when `result_ok` is not set is undefined.
8124         pub result: *mut crate::c_types::Str,
8125         /// A pointer to the contents in the error state.
8126         /// Reading from this pointer when `result_ok` is set is undefined.
8127         pub err: *mut crate::c_types::Secp256k1Error,
8128 }
8129 #[repr(C)]
8130 /// A CResult_StringErrorZ represents the result of a fallible operation,
8131 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8133 pub struct CResult_StringErrorZ {
8134         /// The contents of this CResult_StringErrorZ, accessible via either
8135         /// `err` or `result` depending on the state of `result_ok`.
8136         pub contents: CResult_StringErrorZPtr,
8137         /// Whether this CResult_StringErrorZ represents a success state.
8138         pub result_ok: bool,
8139 }
8140 #[no_mangle]
8141 /// Creates a new CResult_StringErrorZ in the success state.
8142 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
8143         CResult_StringErrorZ {
8144                 contents: CResult_StringErrorZPtr {
8145                         result: Box::into_raw(Box::new(o)),
8146                 },
8147                 result_ok: true,
8148         }
8149 }
8150 #[no_mangle]
8151 /// Creates a new CResult_StringErrorZ in the error state.
8152 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
8153         CResult_StringErrorZ {
8154                 contents: CResult_StringErrorZPtr {
8155                         err: Box::into_raw(Box::new(e)),
8156                 },
8157                 result_ok: false,
8158         }
8159 }
8160 /// Checks if the given object is currently in the success state
8161 #[no_mangle]
8162 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
8163         o.result_ok
8164 }
8165 #[no_mangle]
8166 /// Frees any resources used by the CResult_StringErrorZ.
8167 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
8168 impl Drop for CResult_StringErrorZ {
8169         fn drop(&mut self) {
8170                 if self.result_ok {
8171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8173                         }
8174                 } else {
8175                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8176                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8177                         }
8178                 }
8179         }
8180 }
8181 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
8182         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
8183                 let contents = if o.result_ok {
8184                         let result = unsafe { o.contents.result };
8185                         unsafe { o.contents.result = core::ptr::null_mut() };
8186                         CResult_StringErrorZPtr { result }
8187                 } else {
8188                         let err = unsafe { o.contents.err };
8189                         unsafe { o.contents.err = core::ptr::null_mut(); }
8190                         CResult_StringErrorZPtr { err }
8191                 };
8192                 Self {
8193                         contents,
8194                         result_ok: o.result_ok,
8195                 }
8196         }
8197 }
8198 #[repr(C)]
8199 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8200 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8201         /// A pointer to the contents in the success state.
8202         /// Reading from this pointer when `result_ok` is not set is undefined.
8203         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
8204         /// A pointer to the contents in the error state.
8205         /// Reading from this pointer when `result_ok` is set is undefined.
8206         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8207 }
8208 #[repr(C)]
8209 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8210 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8211 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8212 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
8213         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8214         /// `err` or `result` depending on the state of `result_ok`.
8215         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
8216         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8217         pub result_ok: bool,
8218 }
8219 #[no_mangle]
8220 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
8221 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8222         CResult_ChannelMonitorUpdateDecodeErrorZ {
8223                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8224                         result: Box::into_raw(Box::new(o)),
8225                 },
8226                 result_ok: true,
8227         }
8228 }
8229 #[no_mangle]
8230 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
8231 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
8232         CResult_ChannelMonitorUpdateDecodeErrorZ {
8233                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8234                         err: Box::into_raw(Box::new(e)),
8235                 },
8236                 result_ok: false,
8237         }
8238 }
8239 /// Checks if the given object is currently in the success state
8240 #[no_mangle]
8241 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
8242         o.result_ok
8243 }
8244 #[no_mangle]
8245 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
8246 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
8247 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
8248         fn drop(&mut self) {
8249                 if self.result_ok {
8250                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8251                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8252                         }
8253                 } else {
8254                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8255                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8256                         }
8257                 }
8258         }
8259 }
8260 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
8261         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8262                 let contents = if o.result_ok {
8263                         let result = unsafe { o.contents.result };
8264                         unsafe { o.contents.result = core::ptr::null_mut() };
8265                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
8266                 } else {
8267                         let err = unsafe { o.contents.err };
8268                         unsafe { o.contents.err = core::ptr::null_mut(); }
8269                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
8270                 };
8271                 Self {
8272                         contents,
8273                         result_ok: o.result_ok,
8274                 }
8275         }
8276 }
8277 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
8278         fn clone(&self) -> Self {
8279                 if self.result_ok {
8280                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8281                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
8282                         } }
8283                 } else {
8284                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
8285                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8286                         } }
8287                 }
8288         }
8289 }
8290 #[no_mangle]
8291 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
8292 /// but with all dynamically-allocated buffers duplicated in new buffers.
8293 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
8294 #[repr(C)]
8295 #[derive(Clone)]
8296 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8297 pub enum COption_MonitorEventZ {
8298         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8299         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
8300         /// When we're in this state, this COption_MonitorEventZ contains nothing
8301         None
8302 }
8303 impl COption_MonitorEventZ {
8304         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
8305                 if let Self::None = self { false } else { true }
8306         }
8307         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
8308                 !self.is_some()
8309         }
8310         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
8311                 if let Self::Some(v) = self { v } else { unreachable!() }
8312         }
8313 }
8314 #[no_mangle]
8315 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
8316 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
8317         COption_MonitorEventZ::Some(o)
8318 }
8319 #[no_mangle]
8320 /// Constructs a new COption_MonitorEventZ containing nothing
8321 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
8322         COption_MonitorEventZ::None
8323 }
8324 #[no_mangle]
8325 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
8326 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
8327 #[no_mangle]
8328 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
8329 /// but with all dynamically-allocated buffers duplicated in new buffers.
8330 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
8331 #[repr(C)]
8332 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
8333 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
8334         /// A pointer to the contents in the success state.
8335         /// Reading from this pointer when `result_ok` is not set is undefined.
8336         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
8337         /// A pointer to the contents in the error state.
8338         /// Reading from this pointer when `result_ok` is set is undefined.
8339         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8340 }
8341 #[repr(C)]
8342 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8343 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8345 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
8346         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8347         /// `err` or `result` depending on the state of `result_ok`.
8348         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
8349         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8350         pub result_ok: bool,
8351 }
8352 #[no_mangle]
8353 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
8354 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
8355         CResult_COption_MonitorEventZDecodeErrorZ {
8356                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8357                         result: Box::into_raw(Box::new(o)),
8358                 },
8359                 result_ok: true,
8360         }
8361 }
8362 #[no_mangle]
8363 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
8364 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
8365         CResult_COption_MonitorEventZDecodeErrorZ {
8366                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8367                         err: Box::into_raw(Box::new(e)),
8368                 },
8369                 result_ok: false,
8370         }
8371 }
8372 /// Checks if the given object is currently in the success state
8373 #[no_mangle]
8374 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
8375         o.result_ok
8376 }
8377 #[no_mangle]
8378 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
8379 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
8380 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
8381         fn drop(&mut self) {
8382                 if self.result_ok {
8383                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8384                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8385                         }
8386                 } else {
8387                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8388                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8389                         }
8390                 }
8391         }
8392 }
8393 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
8394         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8395                 let contents = if o.result_ok {
8396                         let result = unsafe { o.contents.result };
8397                         unsafe { o.contents.result = core::ptr::null_mut() };
8398                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
8399                 } else {
8400                         let err = unsafe { o.contents.err };
8401                         unsafe { o.contents.err = core::ptr::null_mut(); }
8402                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
8403                 };
8404                 Self {
8405                         contents,
8406                         result_ok: o.result_ok,
8407                 }
8408         }
8409 }
8410 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
8411         fn clone(&self) -> Self {
8412                 if self.result_ok {
8413                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8414                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
8415                         } }
8416                 } else {
8417                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
8418                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8419                         } }
8420                 }
8421         }
8422 }
8423 #[no_mangle]
8424 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
8425 /// but with all dynamically-allocated buffers duplicated in new buffers.
8426 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
8427 #[repr(C)]
8428 /// The contents of CResult_HTLCUpdateDecodeErrorZ
8429 pub union CResult_HTLCUpdateDecodeErrorZPtr {
8430         /// A pointer to the contents in the success state.
8431         /// Reading from this pointer when `result_ok` is not set is undefined.
8432         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
8433         /// A pointer to the contents in the error state.
8434         /// Reading from this pointer when `result_ok` is set is undefined.
8435         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8436 }
8437 #[repr(C)]
8438 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8439 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8441 pub struct CResult_HTLCUpdateDecodeErrorZ {
8442         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8443         /// `err` or `result` depending on the state of `result_ok`.
8444         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
8445         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8446         pub result_ok: bool,
8447 }
8448 #[no_mangle]
8449 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
8450 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
8451         CResult_HTLCUpdateDecodeErrorZ {
8452                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8453                         result: Box::into_raw(Box::new(o)),
8454                 },
8455                 result_ok: true,
8456         }
8457 }
8458 #[no_mangle]
8459 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
8460 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
8461         CResult_HTLCUpdateDecodeErrorZ {
8462                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
8463                         err: Box::into_raw(Box::new(e)),
8464                 },
8465                 result_ok: false,
8466         }
8467 }
8468 /// Checks if the given object is currently in the success state
8469 #[no_mangle]
8470 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
8471         o.result_ok
8472 }
8473 #[no_mangle]
8474 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
8475 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
8476 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
8477         fn drop(&mut self) {
8478                 if self.result_ok {
8479                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8480                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8481                         }
8482                 } else {
8483                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8484                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8485                         }
8486                 }
8487         }
8488 }
8489 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
8490         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
8491                 let contents = if o.result_ok {
8492                         let result = unsafe { o.contents.result };
8493                         unsafe { o.contents.result = core::ptr::null_mut() };
8494                         CResult_HTLCUpdateDecodeErrorZPtr { result }
8495                 } else {
8496                         let err = unsafe { o.contents.err };
8497                         unsafe { o.contents.err = core::ptr::null_mut(); }
8498                         CResult_HTLCUpdateDecodeErrorZPtr { err }
8499                 };
8500                 Self {
8501                         contents,
8502                         result_ok: o.result_ok,
8503                 }
8504         }
8505 }
8506 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
8507         fn clone(&self) -> Self {
8508                 if self.result_ok {
8509                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8510                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
8511                         } }
8512                 } else {
8513                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
8514                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8515                         } }
8516                 }
8517         }
8518 }
8519 #[no_mangle]
8520 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
8521 /// but with all dynamically-allocated buffers duplicated in new buffers.
8522 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
8523 #[repr(C)]
8524 /// A tuple of 2 elements. See the individual fields for the types contained.
8525 pub struct C2Tuple_OutPointScriptZ {
8526         /// The element at position 0
8527         pub a: crate::lightning::chain::transaction::OutPoint,
8528         /// The element at position 1
8529         pub b: crate::c_types::derived::CVec_u8Z,
8530 }
8531 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
8532         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
8533                 Self {
8534                         a: tup.0,
8535                         b: tup.1,
8536                 }
8537         }
8538 }
8539 impl C2Tuple_OutPointScriptZ {
8540         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
8541                 (self.a, self.b)
8542         }
8543 }
8544 impl Clone for C2Tuple_OutPointScriptZ {
8545         fn clone(&self) -> Self {
8546                 Self {
8547                         a: Clone::clone(&self.a),
8548                         b: Clone::clone(&self.b),
8549                 }
8550         }
8551 }
8552 #[no_mangle]
8553 /// Creates a new tuple which has the same data as `orig`
8554 /// but with all dynamically-allocated buffers duplicated in new buffers.
8555 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
8556 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
8557 #[no_mangle]
8558 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
8559         C2Tuple_OutPointScriptZ { a, b, }
8560 }
8561
8562 #[no_mangle]
8563 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
8564 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
8565 #[repr(C)]
8566 /// A tuple of 2 elements. See the individual fields for the types contained.
8567 pub struct C2Tuple_u32ScriptZ {
8568         /// The element at position 0
8569         pub a: u32,
8570         /// The element at position 1
8571         pub b: crate::c_types::derived::CVec_u8Z,
8572 }
8573 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
8574         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
8575                 Self {
8576                         a: tup.0,
8577                         b: tup.1,
8578                 }
8579         }
8580 }
8581 impl C2Tuple_u32ScriptZ {
8582         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
8583                 (self.a, self.b)
8584         }
8585 }
8586 impl Clone for C2Tuple_u32ScriptZ {
8587         fn clone(&self) -> Self {
8588                 Self {
8589                         a: Clone::clone(&self.a),
8590                         b: Clone::clone(&self.b),
8591                 }
8592         }
8593 }
8594 #[no_mangle]
8595 /// Creates a new tuple which has the same data as `orig`
8596 /// but with all dynamically-allocated buffers duplicated in new buffers.
8597 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
8598 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
8599 #[no_mangle]
8600 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
8601         C2Tuple_u32ScriptZ { a, b, }
8602 }
8603
8604 #[no_mangle]
8605 /// Frees any resources used by the C2Tuple_u32ScriptZ.
8606 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
8607 #[repr(C)]
8608 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8609 /// This corresponds to std::vector in C++
8610 pub struct CVec_C2Tuple_u32ScriptZZ {
8611         /// The elements in the array.
8612         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8613         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
8614         /// The number of elements pointed to by `data`.
8615         pub datalen: usize
8616 }
8617 impl CVec_C2Tuple_u32ScriptZZ {
8618         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
8619                 if self.datalen == 0 { return Vec::new(); }
8620                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8621                 self.data = core::ptr::null_mut();
8622                 self.datalen = 0;
8623                 ret
8624         }
8625         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
8626                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8627         }
8628 }
8629 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
8630         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
8631                 let datalen = v.len();
8632                 let data = Box::into_raw(v.into_boxed_slice());
8633                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8634         }
8635 }
8636 #[no_mangle]
8637 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8638 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
8639 impl Drop for CVec_C2Tuple_u32ScriptZZ {
8640         fn drop(&mut self) {
8641                 if self.datalen == 0 { return; }
8642                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8643         }
8644 }
8645 impl Clone for CVec_C2Tuple_u32ScriptZZ {
8646         fn clone(&self) -> Self {
8647                 let mut res = Vec::new();
8648                 if self.datalen == 0 { return Self::from(res); }
8649                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8650                 Self::from(res)
8651         }
8652 }
8653 #[repr(C)]
8654 /// A tuple of 2 elements. See the individual fields for the types contained.
8655 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8656         /// The element at position 0
8657         pub a: crate::c_types::ThirtyTwoBytes,
8658         /// The element at position 1
8659         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
8660 }
8661 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8662         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
8663                 Self {
8664                         a: tup.0,
8665                         b: tup.1,
8666                 }
8667         }
8668 }
8669 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8670         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
8671                 (self.a, self.b)
8672         }
8673 }
8674 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8675         fn clone(&self) -> Self {
8676                 Self {
8677                         a: Clone::clone(&self.a),
8678                         b: Clone::clone(&self.b),
8679                 }
8680         }
8681 }
8682 #[no_mangle]
8683 /// Creates a new tuple which has the same data as `orig`
8684 /// but with all dynamically-allocated buffers duplicated in new buffers.
8685 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
8686 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
8687 #[no_mangle]
8688 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 {
8689         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
8690 }
8691
8692 #[no_mangle]
8693 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
8694 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
8695 #[repr(C)]
8696 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8697 /// This corresponds to std::vector in C++
8698 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8699         /// The elements in the array.
8700         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8701         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
8702         /// The number of elements pointed to by `data`.
8703         pub datalen: usize
8704 }
8705 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8706         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
8707                 if self.datalen == 0 { return Vec::new(); }
8708                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8709                 self.data = core::ptr::null_mut();
8710                 self.datalen = 0;
8711                 ret
8712         }
8713         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
8714                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8715         }
8716 }
8717 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8718         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
8719                 let datalen = v.len();
8720                 let data = Box::into_raw(v.into_boxed_slice());
8721                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8722         }
8723 }
8724 #[no_mangle]
8725 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8726 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
8727 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8728         fn drop(&mut self) {
8729                 if self.datalen == 0 { return; }
8730                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8731         }
8732 }
8733 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8734         fn clone(&self) -> Self {
8735                 let mut res = Vec::new();
8736                 if self.datalen == 0 { return Self::from(res); }
8737                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8738                 Self::from(res)
8739         }
8740 }
8741 #[repr(C)]
8742 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8743 /// This corresponds to std::vector in C++
8744 pub struct CVec_EventZ {
8745         /// The elements in the array.
8746         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8747         pub data: *mut crate::lightning::util::events::Event,
8748         /// The number of elements pointed to by `data`.
8749         pub datalen: usize
8750 }
8751 impl CVec_EventZ {
8752         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
8753                 if self.datalen == 0 { return Vec::new(); }
8754                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8755                 self.data = core::ptr::null_mut();
8756                 self.datalen = 0;
8757                 ret
8758         }
8759         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
8760                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8761         }
8762 }
8763 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
8764         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
8765                 let datalen = v.len();
8766                 let data = Box::into_raw(v.into_boxed_slice());
8767                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8768         }
8769 }
8770 #[no_mangle]
8771 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8772 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
8773 impl Drop for CVec_EventZ {
8774         fn drop(&mut self) {
8775                 if self.datalen == 0 { return; }
8776                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8777         }
8778 }
8779 impl Clone for CVec_EventZ {
8780         fn clone(&self) -> Self {
8781                 let mut res = Vec::new();
8782                 if self.datalen == 0 { return Self::from(res); }
8783                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8784                 Self::from(res)
8785         }
8786 }
8787 #[repr(C)]
8788 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8789 /// This corresponds to std::vector in C++
8790 pub struct CVec_TransactionZ {
8791         /// The elements in the array.
8792         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8793         pub data: *mut crate::c_types::Transaction,
8794         /// The number of elements pointed to by `data`.
8795         pub datalen: usize
8796 }
8797 impl CVec_TransactionZ {
8798         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
8799                 if self.datalen == 0 { return Vec::new(); }
8800                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8801                 self.data = core::ptr::null_mut();
8802                 self.datalen = 0;
8803                 ret
8804         }
8805         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
8806                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8807         }
8808 }
8809 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
8810         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
8811                 let datalen = v.len();
8812                 let data = Box::into_raw(v.into_boxed_slice());
8813                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8814         }
8815 }
8816 #[no_mangle]
8817 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8818 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
8819 impl Drop for CVec_TransactionZ {
8820         fn drop(&mut self) {
8821                 if self.datalen == 0 { return; }
8822                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8823         }
8824 }
8825 impl Clone for CVec_TransactionZ {
8826         fn clone(&self) -> Self {
8827                 let mut res = Vec::new();
8828                 if self.datalen == 0 { return Self::from(res); }
8829                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8830                 Self::from(res)
8831         }
8832 }
8833 #[repr(C)]
8834 /// A tuple of 2 elements. See the individual fields for the types contained.
8835 pub struct C2Tuple_u32TxOutZ {
8836         /// The element at position 0
8837         pub a: u32,
8838         /// The element at position 1
8839         pub b: crate::c_types::TxOut,
8840 }
8841 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
8842         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
8843                 Self {
8844                         a: tup.0,
8845                         b: tup.1,
8846                 }
8847         }
8848 }
8849 impl C2Tuple_u32TxOutZ {
8850         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
8851                 (self.a, self.b)
8852         }
8853 }
8854 impl Clone for C2Tuple_u32TxOutZ {
8855         fn clone(&self) -> Self {
8856                 Self {
8857                         a: Clone::clone(&self.a),
8858                         b: Clone::clone(&self.b),
8859                 }
8860         }
8861 }
8862 #[no_mangle]
8863 /// Creates a new tuple which has the same data as `orig`
8864 /// but with all dynamically-allocated buffers duplicated in new buffers.
8865 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
8866 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
8867 #[no_mangle]
8868 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
8869         C2Tuple_u32TxOutZ { a, b, }
8870 }
8871
8872 #[no_mangle]
8873 /// Frees any resources used by the C2Tuple_u32TxOutZ.
8874 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
8875 #[repr(C)]
8876 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8877 /// This corresponds to std::vector in C++
8878 pub struct CVec_C2Tuple_u32TxOutZZ {
8879         /// The elements in the array.
8880         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8881         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
8882         /// The number of elements pointed to by `data`.
8883         pub datalen: usize
8884 }
8885 impl CVec_C2Tuple_u32TxOutZZ {
8886         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
8887                 if self.datalen == 0 { return Vec::new(); }
8888                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8889                 self.data = core::ptr::null_mut();
8890                 self.datalen = 0;
8891                 ret
8892         }
8893         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
8894                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8895         }
8896 }
8897 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
8898         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
8899                 let datalen = v.len();
8900                 let data = Box::into_raw(v.into_boxed_slice());
8901                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8902         }
8903 }
8904 #[no_mangle]
8905 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8906 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
8907 impl Drop for CVec_C2Tuple_u32TxOutZZ {
8908         fn drop(&mut self) {
8909                 if self.datalen == 0 { return; }
8910                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8911         }
8912 }
8913 impl Clone for CVec_C2Tuple_u32TxOutZZ {
8914         fn clone(&self) -> Self {
8915                 let mut res = Vec::new();
8916                 if self.datalen == 0 { return Self::from(res); }
8917                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8918                 Self::from(res)
8919         }
8920 }
8921 #[repr(C)]
8922 /// A tuple of 2 elements. See the individual fields for the types contained.
8923 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8924         /// The element at position 0
8925         pub a: crate::c_types::ThirtyTwoBytes,
8926         /// The element at position 1
8927         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
8928 }
8929 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8930         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
8931                 Self {
8932                         a: tup.0,
8933                         b: tup.1,
8934                 }
8935         }
8936 }
8937 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8938         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
8939                 (self.a, self.b)
8940         }
8941 }
8942 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8943         fn clone(&self) -> Self {
8944                 Self {
8945                         a: Clone::clone(&self.a),
8946                         b: Clone::clone(&self.b),
8947                 }
8948         }
8949 }
8950 #[no_mangle]
8951 /// Creates a new tuple which has the same data as `orig`
8952 /// but with all dynamically-allocated buffers duplicated in new buffers.
8953 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
8954 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
8955 #[no_mangle]
8956 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 {
8957         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
8958 }
8959
8960 #[no_mangle]
8961 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
8962 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
8963 #[repr(C)]
8964 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8965 /// This corresponds to std::vector in C++
8966 pub struct CVec_TransactionOutputsZ {
8967         /// The elements in the array.
8968         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8969         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
8970         /// The number of elements pointed to by `data`.
8971         pub datalen: usize
8972 }
8973 impl CVec_TransactionOutputsZ {
8974         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
8975                 if self.datalen == 0 { return Vec::new(); }
8976                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8977                 self.data = core::ptr::null_mut();
8978                 self.datalen = 0;
8979                 ret
8980         }
8981         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
8982                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8983         }
8984 }
8985 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
8986         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
8987                 let datalen = v.len();
8988                 let data = Box::into_raw(v.into_boxed_slice());
8989                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8990         }
8991 }
8992 #[no_mangle]
8993 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8994 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
8995 impl Drop for CVec_TransactionOutputsZ {
8996         fn drop(&mut self) {
8997                 if self.datalen == 0 { return; }
8998                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8999         }
9000 }
9001 impl Clone for CVec_TransactionOutputsZ {
9002         fn clone(&self) -> Self {
9003                 let mut res = Vec::new();
9004                 if self.datalen == 0 { return Self::from(res); }
9005                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9006                 Self::from(res)
9007         }
9008 }
9009 #[repr(C)]
9010 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9011 /// This corresponds to std::vector in C++
9012 pub struct CVec_BalanceZ {
9013         /// The elements in the array.
9014         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9015         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9016         /// The number of elements pointed to by `data`.
9017         pub datalen: usize
9018 }
9019 impl CVec_BalanceZ {
9020         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9021                 if self.datalen == 0 { return Vec::new(); }
9022                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9023                 self.data = core::ptr::null_mut();
9024                 self.datalen = 0;
9025                 ret
9026         }
9027         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9028                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9029         }
9030 }
9031 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9032         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9033                 let datalen = v.len();
9034                 let data = Box::into_raw(v.into_boxed_slice());
9035                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9036         }
9037 }
9038 #[no_mangle]
9039 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9040 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9041 impl Drop for CVec_BalanceZ {
9042         fn drop(&mut self) {
9043                 if self.datalen == 0 { return; }
9044                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9045         }
9046 }
9047 impl Clone for CVec_BalanceZ {
9048         fn clone(&self) -> Self {
9049                 let mut res = Vec::new();
9050                 if self.datalen == 0 { return Self::from(res); }
9051                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9052                 Self::from(res)
9053         }
9054 }
9055 #[repr(C)]
9056 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9057 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9058         /// A pointer to the contents in the success state.
9059         /// Reading from this pointer when `result_ok` is not set is undefined.
9060         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9061         /// A pointer to the contents in the error state.
9062         /// Reading from this pointer when `result_ok` is set is undefined.
9063         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9064 }
9065 #[repr(C)]
9066 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9067 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9069 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9070         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9071         /// `err` or `result` depending on the state of `result_ok`.
9072         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9073         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9074         pub result_ok: bool,
9075 }
9076 #[no_mangle]
9077 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9078 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9079         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9080                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9081                         result: Box::into_raw(Box::new(o)),
9082                 },
9083                 result_ok: true,
9084         }
9085 }
9086 #[no_mangle]
9087 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9088 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9089         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9090                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9091                         err: Box::into_raw(Box::new(e)),
9092                 },
9093                 result_ok: false,
9094         }
9095 }
9096 /// Checks if the given object is currently in the success state
9097 #[no_mangle]
9098 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
9099         o.result_ok
9100 }
9101 #[no_mangle]
9102 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9103 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
9104 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9105         fn drop(&mut self) {
9106                 if self.result_ok {
9107                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9108                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9109                         }
9110                 } else {
9111                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9112                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9113                         }
9114                 }
9115         }
9116 }
9117 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9118         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9119                 let contents = if o.result_ok {
9120                         let result = unsafe { o.contents.result };
9121                         unsafe { o.contents.result = core::ptr::null_mut() };
9122                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
9123                 } else {
9124                         let err = unsafe { o.contents.err };
9125                         unsafe { o.contents.err = core::ptr::null_mut(); }
9126                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
9127                 };
9128                 Self {
9129                         contents,
9130                         result_ok: o.result_ok,
9131                 }
9132         }
9133 }
9134 #[repr(C)]
9135 /// The contents of CResult_NoneLightningErrorZ
9136 pub union CResult_NoneLightningErrorZPtr {
9137         /// Note that this value is always NULL, as there are no contents in the OK variant
9138         pub result: *mut core::ffi::c_void,
9139         /// A pointer to the contents in the error state.
9140         /// Reading from this pointer when `result_ok` is set is undefined.
9141         pub err: *mut crate::lightning::ln::msgs::LightningError,
9142 }
9143 #[repr(C)]
9144 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
9145 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
9146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9147 pub struct CResult_NoneLightningErrorZ {
9148         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
9149         /// `err` or `result` depending on the state of `result_ok`.
9150         pub contents: CResult_NoneLightningErrorZPtr,
9151         /// Whether this CResult_NoneLightningErrorZ represents a success state.
9152         pub result_ok: bool,
9153 }
9154 #[no_mangle]
9155 /// Creates a new CResult_NoneLightningErrorZ in the success state.
9156 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
9157         CResult_NoneLightningErrorZ {
9158                 contents: CResult_NoneLightningErrorZPtr {
9159                         result: core::ptr::null_mut(),
9160                 },
9161                 result_ok: true,
9162         }
9163 }
9164 #[no_mangle]
9165 /// Creates a new CResult_NoneLightningErrorZ in the error state.
9166 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
9167         CResult_NoneLightningErrorZ {
9168                 contents: CResult_NoneLightningErrorZPtr {
9169                         err: Box::into_raw(Box::new(e)),
9170                 },
9171                 result_ok: false,
9172         }
9173 }
9174 /// Checks if the given object is currently in the success state
9175 #[no_mangle]
9176 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
9177         o.result_ok
9178 }
9179 #[no_mangle]
9180 /// Frees any resources used by the CResult_NoneLightningErrorZ.
9181 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
9182 impl Drop for CResult_NoneLightningErrorZ {
9183         fn drop(&mut self) {
9184                 if self.result_ok {
9185                 } else {
9186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9188                         }
9189                 }
9190         }
9191 }
9192 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
9193         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
9194                 let contents = if o.result_ok {
9195                         let _ = unsafe { Box::from_raw(o.contents.result) };
9196                         o.contents.result = core::ptr::null_mut();
9197                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
9198                 } else {
9199                         let err = unsafe { o.contents.err };
9200                         unsafe { o.contents.err = core::ptr::null_mut(); }
9201                         CResult_NoneLightningErrorZPtr { err }
9202                 };
9203                 Self {
9204                         contents,
9205                         result_ok: o.result_ok,
9206                 }
9207         }
9208 }
9209 impl Clone for CResult_NoneLightningErrorZ {
9210         fn clone(&self) -> Self {
9211                 if self.result_ok {
9212                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
9213                                 result: core::ptr::null_mut()
9214                         } }
9215                 } else {
9216                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
9217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9218                         } }
9219                 }
9220         }
9221 }
9222 #[no_mangle]
9223 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
9224 /// but with all dynamically-allocated buffers duplicated in new buffers.
9225 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
9226 #[repr(C)]
9227 /// A tuple of 2 elements. See the individual fields for the types contained.
9228 pub struct C2Tuple_PublicKeyTypeZ {
9229         /// The element at position 0
9230         pub a: crate::c_types::PublicKey,
9231         /// The element at position 1
9232         pub b: crate::lightning::ln::wire::Type,
9233 }
9234 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
9235         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
9236                 Self {
9237                         a: tup.0,
9238                         b: tup.1,
9239                 }
9240         }
9241 }
9242 impl C2Tuple_PublicKeyTypeZ {
9243         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
9244                 (self.a, self.b)
9245         }
9246 }
9247 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
9248 #[no_mangle]
9249 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
9250         C2Tuple_PublicKeyTypeZ { a, b, }
9251 }
9252
9253 #[no_mangle]
9254 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
9255 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
9256 #[repr(C)]
9257 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9258 /// This corresponds to std::vector in C++
9259 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
9260         /// The elements in the array.
9261         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9262         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
9263         /// The number of elements pointed to by `data`.
9264         pub datalen: usize
9265 }
9266 impl CVec_C2Tuple_PublicKeyTypeZZ {
9267         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
9268                 if self.datalen == 0 { return Vec::new(); }
9269                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9270                 self.data = core::ptr::null_mut();
9271                 self.datalen = 0;
9272                 ret
9273         }
9274         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
9275                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9276         }
9277 }
9278 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
9279         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
9280                 let datalen = v.len();
9281                 let data = Box::into_raw(v.into_boxed_slice());
9282                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9283         }
9284 }
9285 #[no_mangle]
9286 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9287 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
9288 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
9289         fn drop(&mut self) {
9290                 if self.datalen == 0 { return; }
9291                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9292         }
9293 }
9294 #[repr(C)]
9295 /// The contents of CResult_boolLightningErrorZ
9296 pub union CResult_boolLightningErrorZPtr {
9297         /// A pointer to the contents in the success state.
9298         /// Reading from this pointer when `result_ok` is not set is undefined.
9299         pub result: *mut bool,
9300         /// A pointer to the contents in the error state.
9301         /// Reading from this pointer when `result_ok` is set is undefined.
9302         pub err: *mut crate::lightning::ln::msgs::LightningError,
9303 }
9304 #[repr(C)]
9305 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
9306 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
9307 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9308 pub struct CResult_boolLightningErrorZ {
9309         /// The contents of this CResult_boolLightningErrorZ, accessible via either
9310         /// `err` or `result` depending on the state of `result_ok`.
9311         pub contents: CResult_boolLightningErrorZPtr,
9312         /// Whether this CResult_boolLightningErrorZ represents a success state.
9313         pub result_ok: bool,
9314 }
9315 #[no_mangle]
9316 /// Creates a new CResult_boolLightningErrorZ in the success state.
9317 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
9318         CResult_boolLightningErrorZ {
9319                 contents: CResult_boolLightningErrorZPtr {
9320                         result: Box::into_raw(Box::new(o)),
9321                 },
9322                 result_ok: true,
9323         }
9324 }
9325 #[no_mangle]
9326 /// Creates a new CResult_boolLightningErrorZ in the error state.
9327 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
9328         CResult_boolLightningErrorZ {
9329                 contents: CResult_boolLightningErrorZPtr {
9330                         err: Box::into_raw(Box::new(e)),
9331                 },
9332                 result_ok: false,
9333         }
9334 }
9335 /// Checks if the given object is currently in the success state
9336 #[no_mangle]
9337 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
9338         o.result_ok
9339 }
9340 #[no_mangle]
9341 /// Frees any resources used by the CResult_boolLightningErrorZ.
9342 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
9343 impl Drop for CResult_boolLightningErrorZ {
9344         fn drop(&mut self) {
9345                 if self.result_ok {
9346                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9347                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9348                         }
9349                 } else {
9350                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9351                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9352                         }
9353                 }
9354         }
9355 }
9356 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
9357         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
9358                 let contents = if o.result_ok {
9359                         let result = unsafe { o.contents.result };
9360                         unsafe { o.contents.result = core::ptr::null_mut() };
9361                         CResult_boolLightningErrorZPtr { result }
9362                 } else {
9363                         let err = unsafe { o.contents.err };
9364                         unsafe { o.contents.err = core::ptr::null_mut(); }
9365                         CResult_boolLightningErrorZPtr { err }
9366                 };
9367                 Self {
9368                         contents,
9369                         result_ok: o.result_ok,
9370                 }
9371         }
9372 }
9373 impl Clone for CResult_boolLightningErrorZ {
9374         fn clone(&self) -> Self {
9375                 if self.result_ok {
9376                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
9377                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9378                         } }
9379                 } else {
9380                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
9381                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
9382                         } }
9383                 }
9384         }
9385 }
9386 #[no_mangle]
9387 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
9388 /// but with all dynamically-allocated buffers duplicated in new buffers.
9389 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
9390 #[repr(C)]
9391 /// A tuple of 3 elements. See the individual fields for the types contained.
9392 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9393         /// The element at position 0
9394         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
9395         /// The element at position 1
9396         pub b: crate::lightning::ln::msgs::ChannelUpdate,
9397         /// The element at position 2
9398         pub c: crate::lightning::ln::msgs::ChannelUpdate,
9399 }
9400 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9401         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
9402                 Self {
9403                         a: tup.0,
9404                         b: tup.1,
9405                         c: tup.2,
9406                 }
9407         }
9408 }
9409 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9410         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
9411                 (self.a, self.b, self.c)
9412         }
9413 }
9414 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
9415         fn clone(&self) -> Self {
9416                 Self {
9417                         a: Clone::clone(&self.a),
9418                         b: Clone::clone(&self.b),
9419                         c: Clone::clone(&self.c),
9420                 }
9421         }
9422 }
9423 #[no_mangle]
9424 /// Creates a new tuple which has the same data as `orig`
9425 /// but with all dynamically-allocated buffers duplicated in new buffers.
9426 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
9427 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
9428 #[no_mangle]
9429 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 {
9430         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
9431 }
9432
9433 #[no_mangle]
9434 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
9435 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
9436 #[repr(C)]
9437 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
9438 /// This corresponds to std::vector in C++
9439 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9440         /// The elements in the array.
9441         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9442         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
9443         /// The number of elements pointed to by `data`.
9444         pub datalen: usize
9445 }
9446 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9447         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
9448                 if self.datalen == 0 { return Vec::new(); }
9449                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9450                 self.data = core::ptr::null_mut();
9451                 self.datalen = 0;
9452                 ret
9453         }
9454         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
9455                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9456         }
9457 }
9458 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9459         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
9460                 let datalen = v.len();
9461                 let data = Box::into_raw(v.into_boxed_slice());
9462                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9463         }
9464 }
9465 #[no_mangle]
9466 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9467 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
9468 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9469         fn drop(&mut self) {
9470                 if self.datalen == 0 { return; }
9471                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9472         }
9473 }
9474 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
9475         fn clone(&self) -> Self {
9476                 let mut res = Vec::new();
9477                 if self.datalen == 0 { return Self::from(res); }
9478                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9479                 Self::from(res)
9480         }
9481 }
9482 #[repr(C)]
9483 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
9484 /// This corresponds to std::vector in C++
9485 pub struct CVec_NodeAnnouncementZ {
9486         /// The elements in the array.
9487         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9488         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
9489         /// The number of elements pointed to by `data`.
9490         pub datalen: usize
9491 }
9492 impl CVec_NodeAnnouncementZ {
9493         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
9494                 if self.datalen == 0 { return Vec::new(); }
9495                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9496                 self.data = core::ptr::null_mut();
9497                 self.datalen = 0;
9498                 ret
9499         }
9500         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
9501                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9502         }
9503 }
9504 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
9505         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
9506                 let datalen = v.len();
9507                 let data = Box::into_raw(v.into_boxed_slice());
9508                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9509         }
9510 }
9511 #[no_mangle]
9512 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9513 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
9514 impl Drop for CVec_NodeAnnouncementZ {
9515         fn drop(&mut self) {
9516                 if self.datalen == 0 { return; }
9517                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9518         }
9519 }
9520 impl Clone for CVec_NodeAnnouncementZ {
9521         fn clone(&self) -> Self {
9522                 let mut res = Vec::new();
9523                 if self.datalen == 0 { return Self::from(res); }
9524                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9525                 Self::from(res)
9526         }
9527 }
9528 #[repr(C)]
9529 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
9530 /// This corresponds to std::vector in C++
9531 pub struct CVec_PublicKeyZ {
9532         /// The elements in the array.
9533         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9534         pub data: *mut crate::c_types::PublicKey,
9535         /// The number of elements pointed to by `data`.
9536         pub datalen: usize
9537 }
9538 impl CVec_PublicKeyZ {
9539         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
9540                 if self.datalen == 0 { return Vec::new(); }
9541                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9542                 self.data = core::ptr::null_mut();
9543                 self.datalen = 0;
9544                 ret
9545         }
9546         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
9547                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9548         }
9549 }
9550 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
9551         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
9552                 let datalen = v.len();
9553                 let data = Box::into_raw(v.into_boxed_slice());
9554                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9555         }
9556 }
9557 #[no_mangle]
9558 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9559 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
9560 impl Drop for CVec_PublicKeyZ {
9561         fn drop(&mut self) {
9562                 if self.datalen == 0 { return; }
9563                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9564         }
9565 }
9566 impl Clone for CVec_PublicKeyZ {
9567         fn clone(&self) -> Self {
9568                 let mut res = Vec::new();
9569                 if self.datalen == 0 { return Self::from(res); }
9570                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9571                 Self::from(res)
9572         }
9573 }
9574 #[repr(C)]
9575 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
9576 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
9577         /// A pointer to the contents in the success state.
9578         /// Reading from this pointer when `result_ok` is not set is undefined.
9579         pub result: *mut crate::c_types::derived::CVec_u8Z,
9580         /// A pointer to the contents in the error state.
9581         /// Reading from this pointer when `result_ok` is set is undefined.
9582         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9583 }
9584 #[repr(C)]
9585 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9586 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9587 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9588 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
9589         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9590         /// `err` or `result` depending on the state of `result_ok`.
9591         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
9592         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9593         pub result_ok: bool,
9594 }
9595 #[no_mangle]
9596 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
9597 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
9598         CResult_CVec_u8ZPeerHandleErrorZ {
9599                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9600                         result: Box::into_raw(Box::new(o)),
9601                 },
9602                 result_ok: true,
9603         }
9604 }
9605 #[no_mangle]
9606 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
9607 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
9608         CResult_CVec_u8ZPeerHandleErrorZ {
9609                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9610                         err: Box::into_raw(Box::new(e)),
9611                 },
9612                 result_ok: false,
9613         }
9614 }
9615 /// Checks if the given object is currently in the success state
9616 #[no_mangle]
9617 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
9618         o.result_ok
9619 }
9620 #[no_mangle]
9621 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
9622 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
9623 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
9624         fn drop(&mut self) {
9625                 if self.result_ok {
9626                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9627                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9628                         }
9629                 } else {
9630                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9631                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9632                         }
9633                 }
9634         }
9635 }
9636 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
9637         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9638                 let contents = if o.result_ok {
9639                         let result = unsafe { o.contents.result };
9640                         unsafe { o.contents.result = core::ptr::null_mut() };
9641                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
9642                 } else {
9643                         let err = unsafe { o.contents.err };
9644                         unsafe { o.contents.err = core::ptr::null_mut(); }
9645                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
9646                 };
9647                 Self {
9648                         contents,
9649                         result_ok: o.result_ok,
9650                 }
9651         }
9652 }
9653 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
9654         fn clone(&self) -> Self {
9655                 if self.result_ok {
9656                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9657                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
9658                         } }
9659                 } else {
9660                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
9661                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9662                         } }
9663                 }
9664         }
9665 }
9666 #[no_mangle]
9667 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
9668 /// but with all dynamically-allocated buffers duplicated in new buffers.
9669 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
9670 #[repr(C)]
9671 /// The contents of CResult_NonePeerHandleErrorZ
9672 pub union CResult_NonePeerHandleErrorZPtr {
9673         /// Note that this value is always NULL, as there are no contents in the OK variant
9674         pub result: *mut core::ffi::c_void,
9675         /// A pointer to the contents in the error state.
9676         /// Reading from this pointer when `result_ok` is set is undefined.
9677         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9678 }
9679 #[repr(C)]
9680 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9681 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9683 pub struct CResult_NonePeerHandleErrorZ {
9684         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9685         /// `err` or `result` depending on the state of `result_ok`.
9686         pub contents: CResult_NonePeerHandleErrorZPtr,
9687         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
9688         pub result_ok: bool,
9689 }
9690 #[no_mangle]
9691 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
9692 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
9693         CResult_NonePeerHandleErrorZ {
9694                 contents: CResult_NonePeerHandleErrorZPtr {
9695                         result: core::ptr::null_mut(),
9696                 },
9697                 result_ok: true,
9698         }
9699 }
9700 #[no_mangle]
9701 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
9702 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
9703         CResult_NonePeerHandleErrorZ {
9704                 contents: CResult_NonePeerHandleErrorZPtr {
9705                         err: Box::into_raw(Box::new(e)),
9706                 },
9707                 result_ok: false,
9708         }
9709 }
9710 /// Checks if the given object is currently in the success state
9711 #[no_mangle]
9712 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
9713         o.result_ok
9714 }
9715 #[no_mangle]
9716 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
9717 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
9718 impl Drop for CResult_NonePeerHandleErrorZ {
9719         fn drop(&mut self) {
9720                 if self.result_ok {
9721                 } else {
9722                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9723                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9724                         }
9725                 }
9726         }
9727 }
9728 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
9729         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9730                 let contents = if o.result_ok {
9731                         let _ = unsafe { Box::from_raw(o.contents.result) };
9732                         o.contents.result = core::ptr::null_mut();
9733                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
9734                 } else {
9735                         let err = unsafe { o.contents.err };
9736                         unsafe { o.contents.err = core::ptr::null_mut(); }
9737                         CResult_NonePeerHandleErrorZPtr { err }
9738                 };
9739                 Self {
9740                         contents,
9741                         result_ok: o.result_ok,
9742                 }
9743         }
9744 }
9745 impl Clone for CResult_NonePeerHandleErrorZ {
9746         fn clone(&self) -> Self {
9747                 if self.result_ok {
9748                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
9749                                 result: core::ptr::null_mut()
9750                         } }
9751                 } else {
9752                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
9753                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9754                         } }
9755                 }
9756         }
9757 }
9758 #[no_mangle]
9759 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
9760 /// but with all dynamically-allocated buffers duplicated in new buffers.
9761 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
9762 #[repr(C)]
9763 /// The contents of CResult_boolPeerHandleErrorZ
9764 pub union CResult_boolPeerHandleErrorZPtr {
9765         /// A pointer to the contents in the success state.
9766         /// Reading from this pointer when `result_ok` is not set is undefined.
9767         pub result: *mut bool,
9768         /// A pointer to the contents in the error state.
9769         /// Reading from this pointer when `result_ok` is set is undefined.
9770         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
9771 }
9772 #[repr(C)]
9773 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9774 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9776 pub struct CResult_boolPeerHandleErrorZ {
9777         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9778         /// `err` or `result` depending on the state of `result_ok`.
9779         pub contents: CResult_boolPeerHandleErrorZPtr,
9780         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
9781         pub result_ok: bool,
9782 }
9783 #[no_mangle]
9784 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
9785 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
9786         CResult_boolPeerHandleErrorZ {
9787                 contents: CResult_boolPeerHandleErrorZPtr {
9788                         result: Box::into_raw(Box::new(o)),
9789                 },
9790                 result_ok: true,
9791         }
9792 }
9793 #[no_mangle]
9794 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
9795 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
9796         CResult_boolPeerHandleErrorZ {
9797                 contents: CResult_boolPeerHandleErrorZPtr {
9798                         err: Box::into_raw(Box::new(e)),
9799                 },
9800                 result_ok: false,
9801         }
9802 }
9803 /// Checks if the given object is currently in the success state
9804 #[no_mangle]
9805 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
9806         o.result_ok
9807 }
9808 #[no_mangle]
9809 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
9810 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
9811 impl Drop for CResult_boolPeerHandleErrorZ {
9812         fn drop(&mut self) {
9813                 if self.result_ok {
9814                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9815                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9816                         }
9817                 } else {
9818                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9819                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9820                         }
9821                 }
9822         }
9823 }
9824 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
9825         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
9826                 let contents = if o.result_ok {
9827                         let result = unsafe { o.contents.result };
9828                         unsafe { o.contents.result = core::ptr::null_mut() };
9829                         CResult_boolPeerHandleErrorZPtr { result }
9830                 } else {
9831                         let err = unsafe { o.contents.err };
9832                         unsafe { o.contents.err = core::ptr::null_mut(); }
9833                         CResult_boolPeerHandleErrorZPtr { err }
9834                 };
9835                 Self {
9836                         contents,
9837                         result_ok: o.result_ok,
9838                 }
9839         }
9840 }
9841 impl Clone for CResult_boolPeerHandleErrorZ {
9842         fn clone(&self) -> Self {
9843                 if self.result_ok {
9844                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
9845                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
9846                         } }
9847                 } else {
9848                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
9849                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
9850                         } }
9851                 }
9852         }
9853 }
9854 #[no_mangle]
9855 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
9856 /// but with all dynamically-allocated buffers duplicated in new buffers.
9857 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
9858 #[repr(C)]
9859 /// The contents of CResult_NodeIdDecodeErrorZ
9860 pub union CResult_NodeIdDecodeErrorZPtr {
9861         /// A pointer to the contents in the success state.
9862         /// Reading from this pointer when `result_ok` is not set is undefined.
9863         pub result: *mut crate::lightning::routing::network_graph::NodeId,
9864         /// A pointer to the contents in the error state.
9865         /// Reading from this pointer when `result_ok` is set is undefined.
9866         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9867 }
9868 #[repr(C)]
9869 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
9870 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
9871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9872 pub struct CResult_NodeIdDecodeErrorZ {
9873         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
9874         /// `err` or `result` depending on the state of `result_ok`.
9875         pub contents: CResult_NodeIdDecodeErrorZPtr,
9876         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
9877         pub result_ok: bool,
9878 }
9879 #[no_mangle]
9880 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
9881 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
9882         CResult_NodeIdDecodeErrorZ {
9883                 contents: CResult_NodeIdDecodeErrorZPtr {
9884                         result: Box::into_raw(Box::new(o)),
9885                 },
9886                 result_ok: true,
9887         }
9888 }
9889 #[no_mangle]
9890 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
9891 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
9892         CResult_NodeIdDecodeErrorZ {
9893                 contents: CResult_NodeIdDecodeErrorZPtr {
9894                         err: Box::into_raw(Box::new(e)),
9895                 },
9896                 result_ok: false,
9897         }
9898 }
9899 /// Checks if the given object is currently in the success state
9900 #[no_mangle]
9901 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
9902         o.result_ok
9903 }
9904 #[no_mangle]
9905 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
9906 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
9907 impl Drop for CResult_NodeIdDecodeErrorZ {
9908         fn drop(&mut self) {
9909                 if self.result_ok {
9910                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9911                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9912                         }
9913                 } else {
9914                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9915                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9916                         }
9917                 }
9918         }
9919 }
9920 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
9921         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
9922                 let contents = if o.result_ok {
9923                         let result = unsafe { o.contents.result };
9924                         unsafe { o.contents.result = core::ptr::null_mut() };
9925                         CResult_NodeIdDecodeErrorZPtr { result }
9926                 } else {
9927                         let err = unsafe { o.contents.err };
9928                         unsafe { o.contents.err = core::ptr::null_mut(); }
9929                         CResult_NodeIdDecodeErrorZPtr { err }
9930                 };
9931                 Self {
9932                         contents,
9933                         result_ok: o.result_ok,
9934                 }
9935         }
9936 }
9937 impl Clone for CResult_NodeIdDecodeErrorZ {
9938         fn clone(&self) -> Self {
9939                 if self.result_ok {
9940                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
9941                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
9942                         } }
9943                 } else {
9944                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
9945                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9946                         } }
9947                 }
9948         }
9949 }
9950 #[no_mangle]
9951 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
9952 /// but with all dynamically-allocated buffers duplicated in new buffers.
9953 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
9954 #[repr(C)]
9955 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
9956 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9957         /// A pointer to the contents in the success state.
9958         /// Reading from this pointer when `result_ok` is not set is undefined.
9959         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
9960         /// A pointer to the contents in the error state.
9961         /// Reading from this pointer when `result_ok` is set is undefined.
9962         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9963 }
9964 #[repr(C)]
9965 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
9966 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9968 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
9969         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
9970         /// `err` or `result` depending on the state of `result_ok`.
9971         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
9972         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
9973         pub result_ok: bool,
9974 }
9975 #[no_mangle]
9976 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
9977 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9978         CResult_COption_NetworkUpdateZDecodeErrorZ {
9979                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9980                         result: Box::into_raw(Box::new(o)),
9981                 },
9982                 result_ok: true,
9983         }
9984 }
9985 #[no_mangle]
9986 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
9987 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
9988         CResult_COption_NetworkUpdateZDecodeErrorZ {
9989                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
9990                         err: Box::into_raw(Box::new(e)),
9991                 },
9992                 result_ok: false,
9993         }
9994 }
9995 /// Checks if the given object is currently in the success state
9996 #[no_mangle]
9997 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
9998         o.result_ok
9999 }
10000 #[no_mangle]
10001 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10002 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10003 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10004         fn drop(&mut self) {
10005                 if self.result_ok {
10006                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10007                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10008                         }
10009                 } else {
10010                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10011                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10012                         }
10013                 }
10014         }
10015 }
10016 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10017         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10018                 let contents = if o.result_ok {
10019                         let result = unsafe { o.contents.result };
10020                         unsafe { o.contents.result = core::ptr::null_mut() };
10021                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10022                 } else {
10023                         let err = unsafe { o.contents.err };
10024                         unsafe { o.contents.err = core::ptr::null_mut(); }
10025                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10026                 };
10027                 Self {
10028                         contents,
10029                         result_ok: o.result_ok,
10030                 }
10031         }
10032 }
10033 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10034         fn clone(&self) -> Self {
10035                 if self.result_ok {
10036                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10037                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10038                         } }
10039                 } else {
10040                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10041                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10042                         } }
10043                 }
10044         }
10045 }
10046 #[no_mangle]
10047 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10048 /// but with all dynamically-allocated buffers duplicated in new buffers.
10049 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10050 #[repr(C)]
10051 /// An enum which can either contain a crate::lightning::chain::Access or not
10052 pub enum COption_AccessZ {
10053         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
10054         Some(crate::lightning::chain::Access),
10055         /// When we're in this state, this COption_AccessZ contains nothing
10056         None
10057 }
10058 impl COption_AccessZ {
10059         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10060                 if let Self::None = self { false } else { true }
10061         }
10062         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10063                 !self.is_some()
10064         }
10065         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
10066                 if let Self::Some(v) = self { v } else { unreachable!() }
10067         }
10068 }
10069 #[no_mangle]
10070 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
10071 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
10072         COption_AccessZ::Some(o)
10073 }
10074 #[no_mangle]
10075 /// Constructs a new COption_AccessZ containing nothing
10076 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
10077         COption_AccessZ::None
10078 }
10079 #[no_mangle]
10080 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
10081 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
10082 #[repr(C)]
10083 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
10084 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
10085         /// A pointer to the contents in the success state.
10086         /// Reading from this pointer when `result_ok` is not set is undefined.
10087         pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
10088         /// A pointer to the contents in the error state.
10089         /// Reading from this pointer when `result_ok` is set is undefined.
10090         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10091 }
10092 #[repr(C)]
10093 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
10094 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10096 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
10097         /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
10098         /// `err` or `result` depending on the state of `result_ok`.
10099         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
10100         /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
10101         pub result_ok: bool,
10102 }
10103 #[no_mangle]
10104 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10105 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10106         CResult_DirectionalChannelInfoDecodeErrorZ {
10107                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10108                         result: Box::into_raw(Box::new(o)),
10109                 },
10110                 result_ok: true,
10111         }
10112 }
10113 #[no_mangle]
10114 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10115 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
10116         CResult_DirectionalChannelInfoDecodeErrorZ {
10117                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10118                         err: Box::into_raw(Box::new(e)),
10119                 },
10120                 result_ok: false,
10121         }
10122 }
10123 /// Checks if the given object is currently in the success state
10124 #[no_mangle]
10125 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool {
10126         o.result_ok
10127 }
10128 #[no_mangle]
10129 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10130 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
10131 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
10132         fn drop(&mut self) {
10133                 if self.result_ok {
10134                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10135                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10136                         }
10137                 } else {
10138                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10139                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10140                         }
10141                 }
10142         }
10143 }
10144 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
10145         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10146                 let contents = if o.result_ok {
10147                         let result = unsafe { o.contents.result };
10148                         unsafe { o.contents.result = core::ptr::null_mut() };
10149                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
10150                 } else {
10151                         let err = unsafe { o.contents.err };
10152                         unsafe { o.contents.err = core::ptr::null_mut(); }
10153                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
10154                 };
10155                 Self {
10156                         contents,
10157                         result_ok: o.result_ok,
10158                 }
10159         }
10160 }
10161 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
10162         fn clone(&self) -> Self {
10163                 if self.result_ok {
10164                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10165                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
10166                         } }
10167                 } else {
10168                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
10169                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10170                         } }
10171                 }
10172         }
10173 }
10174 #[no_mangle]
10175 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10176 /// but with all dynamically-allocated buffers duplicated in new buffers.
10177 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10178 #[repr(C)]
10179 /// The contents of CResult_ChannelInfoDecodeErrorZ
10180 pub union CResult_ChannelInfoDecodeErrorZPtr {
10181         /// A pointer to the contents in the success state.
10182         /// Reading from this pointer when `result_ok` is not set is undefined.
10183         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
10184         /// A pointer to the contents in the error state.
10185         /// Reading from this pointer when `result_ok` is set is undefined.
10186         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10187 }
10188 #[repr(C)]
10189 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
10190 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10192 pub struct CResult_ChannelInfoDecodeErrorZ {
10193         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
10194         /// `err` or `result` depending on the state of `result_ok`.
10195         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
10196         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
10197         pub result_ok: bool,
10198 }
10199 #[no_mangle]
10200 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10201 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
10202         CResult_ChannelInfoDecodeErrorZ {
10203                 contents: CResult_ChannelInfoDecodeErrorZPtr {
10204                         result: Box::into_raw(Box::new(o)),
10205                 },
10206                 result_ok: true,
10207         }
10208 }
10209 #[no_mangle]
10210 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10211 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
10212         CResult_ChannelInfoDecodeErrorZ {
10213                 contents: CResult_ChannelInfoDecodeErrorZPtr {
10214                         err: Box::into_raw(Box::new(e)),
10215                 },
10216                 result_ok: false,
10217         }
10218 }
10219 /// Checks if the given object is currently in the success state
10220 #[no_mangle]
10221 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
10222         o.result_ok
10223 }
10224 #[no_mangle]
10225 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10226 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
10227 impl Drop for CResult_ChannelInfoDecodeErrorZ {
10228         fn drop(&mut self) {
10229                 if self.result_ok {
10230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10232                         }
10233                 } else {
10234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10236                         }
10237                 }
10238         }
10239 }
10240 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
10241         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10242                 let contents = if o.result_ok {
10243                         let result = unsafe { o.contents.result };
10244                         unsafe { o.contents.result = core::ptr::null_mut() };
10245                         CResult_ChannelInfoDecodeErrorZPtr { result }
10246                 } else {
10247                         let err = unsafe { o.contents.err };
10248                         unsafe { o.contents.err = core::ptr::null_mut(); }
10249                         CResult_ChannelInfoDecodeErrorZPtr { err }
10250                 };
10251                 Self {
10252                         contents,
10253                         result_ok: o.result_ok,
10254                 }
10255         }
10256 }
10257 impl Clone for CResult_ChannelInfoDecodeErrorZ {
10258         fn clone(&self) -> Self {
10259                 if self.result_ok {
10260                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
10261                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
10262                         } }
10263                 } else {
10264                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
10265                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10266                         } }
10267                 }
10268         }
10269 }
10270 #[no_mangle]
10271 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10272 /// but with all dynamically-allocated buffers duplicated in new buffers.
10273 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
10274 #[repr(C)]
10275 /// The contents of CResult_RoutingFeesDecodeErrorZ
10276 pub union CResult_RoutingFeesDecodeErrorZPtr {
10277         /// A pointer to the contents in the success state.
10278         /// Reading from this pointer when `result_ok` is not set is undefined.
10279         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
10280         /// A pointer to the contents in the error state.
10281         /// Reading from this pointer when `result_ok` is set is undefined.
10282         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10283 }
10284 #[repr(C)]
10285 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
10286 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
10287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10288 pub struct CResult_RoutingFeesDecodeErrorZ {
10289         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
10290         /// `err` or `result` depending on the state of `result_ok`.
10291         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
10292         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
10293         pub result_ok: bool,
10294 }
10295 #[no_mangle]
10296 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10297 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
10298         CResult_RoutingFeesDecodeErrorZ {
10299                 contents: CResult_RoutingFeesDecodeErrorZPtr {
10300                         result: Box::into_raw(Box::new(o)),
10301                 },
10302                 result_ok: true,
10303         }
10304 }
10305 #[no_mangle]
10306 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10307 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
10308         CResult_RoutingFeesDecodeErrorZ {
10309                 contents: CResult_RoutingFeesDecodeErrorZPtr {
10310                         err: Box::into_raw(Box::new(e)),
10311                 },
10312                 result_ok: false,
10313         }
10314 }
10315 /// Checks if the given object is currently in the success state
10316 #[no_mangle]
10317 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
10318         o.result_ok
10319 }
10320 #[no_mangle]
10321 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10322 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
10323 impl Drop for CResult_RoutingFeesDecodeErrorZ {
10324         fn drop(&mut self) {
10325                 if self.result_ok {
10326                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10327                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10328                         }
10329                 } else {
10330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10332                         }
10333                 }
10334         }
10335 }
10336 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
10337         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
10338                 let contents = if o.result_ok {
10339                         let result = unsafe { o.contents.result };
10340                         unsafe { o.contents.result = core::ptr::null_mut() };
10341                         CResult_RoutingFeesDecodeErrorZPtr { result }
10342                 } else {
10343                         let err = unsafe { o.contents.err };
10344                         unsafe { o.contents.err = core::ptr::null_mut(); }
10345                         CResult_RoutingFeesDecodeErrorZPtr { err }
10346                 };
10347                 Self {
10348                         contents,
10349                         result_ok: o.result_ok,
10350                 }
10351         }
10352 }
10353 impl Clone for CResult_RoutingFeesDecodeErrorZ {
10354         fn clone(&self) -> Self {
10355                 if self.result_ok {
10356                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
10357                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
10358                         } }
10359                 } else {
10360                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
10361                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10362                         } }
10363                 }
10364         }
10365 }
10366 #[no_mangle]
10367 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10368 /// but with all dynamically-allocated buffers duplicated in new buffers.
10369 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
10370 #[repr(C)]
10371 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
10372 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10373         /// A pointer to the contents in the success state.
10374         /// Reading from this pointer when `result_ok` is not set is undefined.
10375         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
10376         /// A pointer to the contents in the error state.
10377         /// Reading from this pointer when `result_ok` is set is undefined.
10378         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10379 }
10380 #[repr(C)]
10381 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
10382 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10384 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
10385         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
10386         /// `err` or `result` depending on the state of `result_ok`.
10387         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
10388         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
10389         pub result_ok: bool,
10390 }
10391 #[no_mangle]
10392 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10393 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10394         CResult_NodeAnnouncementInfoDecodeErrorZ {
10395                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10396                         result: Box::into_raw(Box::new(o)),
10397                 },
10398                 result_ok: true,
10399         }
10400 }
10401 #[no_mangle]
10402 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10403 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
10404         CResult_NodeAnnouncementInfoDecodeErrorZ {
10405                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10406                         err: Box::into_raw(Box::new(e)),
10407                 },
10408                 result_ok: false,
10409         }
10410 }
10411 /// Checks if the given object is currently in the success state
10412 #[no_mangle]
10413 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
10414         o.result_ok
10415 }
10416 #[no_mangle]
10417 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10418 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
10419 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
10420         fn drop(&mut self) {
10421                 if self.result_ok {
10422                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10423                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10424                         }
10425                 } else {
10426                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10427                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10428                         }
10429                 }
10430         }
10431 }
10432 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
10433         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10434                 let contents = if o.result_ok {
10435                         let result = unsafe { o.contents.result };
10436                         unsafe { o.contents.result = core::ptr::null_mut() };
10437                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
10438                 } else {
10439                         let err = unsafe { o.contents.err };
10440                         unsafe { o.contents.err = core::ptr::null_mut(); }
10441                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
10442                 };
10443                 Self {
10444                         contents,
10445                         result_ok: o.result_ok,
10446                 }
10447         }
10448 }
10449 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
10450         fn clone(&self) -> Self {
10451                 if self.result_ok {
10452                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10453                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
10454                         } }
10455                 } else {
10456                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
10457                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10458                         } }
10459                 }
10460         }
10461 }
10462 #[no_mangle]
10463 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10464 /// but with all dynamically-allocated buffers duplicated in new buffers.
10465 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
10466 #[repr(C)]
10467 /// A dynamically-allocated array of u64s of arbitrary size.
10468 /// This corresponds to std::vector in C++
10469 pub struct CVec_u64Z {
10470         /// The elements in the array.
10471         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10472         pub data: *mut u64,
10473         /// The number of elements pointed to by `data`.
10474         pub datalen: usize
10475 }
10476 impl CVec_u64Z {
10477         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
10478                 if self.datalen == 0 { return Vec::new(); }
10479                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10480                 self.data = core::ptr::null_mut();
10481                 self.datalen = 0;
10482                 ret
10483         }
10484         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
10485                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10486         }
10487 }
10488 impl From<Vec<u64>> for CVec_u64Z {
10489         fn from(v: Vec<u64>) -> Self {
10490                 let datalen = v.len();
10491                 let data = Box::into_raw(v.into_boxed_slice());
10492                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10493         }
10494 }
10495 #[no_mangle]
10496 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10497 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
10498 impl Drop for CVec_u64Z {
10499         fn drop(&mut self) {
10500                 if self.datalen == 0 { return; }
10501                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10502         }
10503 }
10504 impl Clone for CVec_u64Z {
10505         fn clone(&self) -> Self {
10506                 let mut res = Vec::new();
10507                 if self.datalen == 0 { return Self::from(res); }
10508                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10509                 Self::from(res)
10510         }
10511 }
10512 #[repr(C)]
10513 /// The contents of CResult_NodeInfoDecodeErrorZ
10514 pub union CResult_NodeInfoDecodeErrorZPtr {
10515         /// A pointer to the contents in the success state.
10516         /// Reading from this pointer when `result_ok` is not set is undefined.
10517         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
10518         /// A pointer to the contents in the error state.
10519         /// Reading from this pointer when `result_ok` is set is undefined.
10520         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10521 }
10522 #[repr(C)]
10523 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
10524 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_NodeInfoDecodeErrorZ {
10527         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
10528         /// `err` or `result` depending on the state of `result_ok`.
10529         pub contents: CResult_NodeInfoDecodeErrorZPtr,
10530         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
10531         pub result_ok: bool,
10532 }
10533 #[no_mangle]
10534 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10535 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
10536         CResult_NodeInfoDecodeErrorZ {
10537                 contents: CResult_NodeInfoDecodeErrorZPtr {
10538                         result: Box::into_raw(Box::new(o)),
10539                 },
10540                 result_ok: true,
10541         }
10542 }
10543 #[no_mangle]
10544 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10545 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
10546         CResult_NodeInfoDecodeErrorZ {
10547                 contents: CResult_NodeInfoDecodeErrorZPtr {
10548                         err: Box::into_raw(Box::new(e)),
10549                 },
10550                 result_ok: false,
10551         }
10552 }
10553 /// Checks if the given object is currently in the success state
10554 #[no_mangle]
10555 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
10556         o.result_ok
10557 }
10558 #[no_mangle]
10559 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10560 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
10561 impl Drop for CResult_NodeInfoDecodeErrorZ {
10562         fn drop(&mut self) {
10563                 if self.result_ok {
10564                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10565                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10566                         }
10567                 } else {
10568                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10569                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10570                         }
10571                 }
10572         }
10573 }
10574 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
10575         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10576                 let contents = if o.result_ok {
10577                         let result = unsafe { o.contents.result };
10578                         unsafe { o.contents.result = core::ptr::null_mut() };
10579                         CResult_NodeInfoDecodeErrorZPtr { result }
10580                 } else {
10581                         let err = unsafe { o.contents.err };
10582                         unsafe { o.contents.err = core::ptr::null_mut(); }
10583                         CResult_NodeInfoDecodeErrorZPtr { err }
10584                 };
10585                 Self {
10586                         contents,
10587                         result_ok: o.result_ok,
10588                 }
10589         }
10590 }
10591 impl Clone for CResult_NodeInfoDecodeErrorZ {
10592         fn clone(&self) -> Self {
10593                 if self.result_ok {
10594                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
10595                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
10596                         } }
10597                 } else {
10598                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
10599                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10600                         } }
10601                 }
10602         }
10603 }
10604 #[no_mangle]
10605 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10606 /// but with all dynamically-allocated buffers duplicated in new buffers.
10607 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
10608 #[repr(C)]
10609 /// The contents of CResult_NetworkGraphDecodeErrorZ
10610 pub union CResult_NetworkGraphDecodeErrorZPtr {
10611         /// A pointer to the contents in the success state.
10612         /// Reading from this pointer when `result_ok` is not set is undefined.
10613         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
10614         /// A pointer to the contents in the error state.
10615         /// Reading from this pointer when `result_ok` is set is undefined.
10616         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10617 }
10618 #[repr(C)]
10619 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
10620 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
10621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10622 pub struct CResult_NetworkGraphDecodeErrorZ {
10623         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
10624         /// `err` or `result` depending on the state of `result_ok`.
10625         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
10626         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
10627         pub result_ok: bool,
10628 }
10629 #[no_mangle]
10630 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10631 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
10632         CResult_NetworkGraphDecodeErrorZ {
10633                 contents: CResult_NetworkGraphDecodeErrorZPtr {
10634                         result: Box::into_raw(Box::new(o)),
10635                 },
10636                 result_ok: true,
10637         }
10638 }
10639 #[no_mangle]
10640 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10641 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
10642         CResult_NetworkGraphDecodeErrorZ {
10643                 contents: CResult_NetworkGraphDecodeErrorZPtr {
10644                         err: Box::into_raw(Box::new(e)),
10645                 },
10646                 result_ok: false,
10647         }
10648 }
10649 /// Checks if the given object is currently in the success state
10650 #[no_mangle]
10651 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
10652         o.result_ok
10653 }
10654 #[no_mangle]
10655 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10656 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
10657 impl Drop for CResult_NetworkGraphDecodeErrorZ {
10658         fn drop(&mut self) {
10659                 if self.result_ok {
10660                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10661                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10662                         }
10663                 } else {
10664                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10665                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10666                         }
10667                 }
10668         }
10669 }
10670 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
10671         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
10672                 let contents = if o.result_ok {
10673                         let result = unsafe { o.contents.result };
10674                         unsafe { o.contents.result = core::ptr::null_mut() };
10675                         CResult_NetworkGraphDecodeErrorZPtr { result }
10676                 } else {
10677                         let err = unsafe { o.contents.err };
10678                         unsafe { o.contents.err = core::ptr::null_mut(); }
10679                         CResult_NetworkGraphDecodeErrorZPtr { err }
10680                 };
10681                 Self {
10682                         contents,
10683                         result_ok: o.result_ok,
10684                 }
10685         }
10686 }
10687 impl Clone for CResult_NetworkGraphDecodeErrorZ {
10688         fn clone(&self) -> Self {
10689                 if self.result_ok {
10690                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
10691                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
10692                         } }
10693                 } else {
10694                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
10695                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10696                         } }
10697                 }
10698         }
10699 }
10700 #[no_mangle]
10701 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10702 /// but with all dynamically-allocated buffers duplicated in new buffers.
10703 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
10704 #[repr(C)]
10705 #[derive(Clone)]
10706 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
10707 pub enum COption_CVec_NetAddressZZ {
10708         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
10709         Some(crate::c_types::derived::CVec_NetAddressZ),
10710         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
10711         None
10712 }
10713 impl COption_CVec_NetAddressZZ {
10714         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10715                 if let Self::None = self { false } else { true }
10716         }
10717         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10718                 !self.is_some()
10719         }
10720         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
10721                 if let Self::Some(v) = self { v } else { unreachable!() }
10722         }
10723 }
10724 #[no_mangle]
10725 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
10726 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
10727         COption_CVec_NetAddressZZ::Some(o)
10728 }
10729 #[no_mangle]
10730 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
10731 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
10732         COption_CVec_NetAddressZZ::None
10733 }
10734 #[no_mangle]
10735 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
10736 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
10737 #[no_mangle]
10738 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
10739 /// but with all dynamically-allocated buffers duplicated in new buffers.
10740 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
10741 #[repr(C)]
10742 /// The contents of CResult_NetAddressDecodeErrorZ
10743 pub union CResult_NetAddressDecodeErrorZPtr {
10744         /// A pointer to the contents in the success state.
10745         /// Reading from this pointer when `result_ok` is not set is undefined.
10746         pub result: *mut crate::lightning::ln::msgs::NetAddress,
10747         /// A pointer to the contents in the error state.
10748         /// Reading from this pointer when `result_ok` is set is undefined.
10749         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10750 }
10751 #[repr(C)]
10752 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
10753 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
10754 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10755 pub struct CResult_NetAddressDecodeErrorZ {
10756         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
10757         /// `err` or `result` depending on the state of `result_ok`.
10758         pub contents: CResult_NetAddressDecodeErrorZPtr,
10759         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
10760         pub result_ok: bool,
10761 }
10762 #[no_mangle]
10763 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10764 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
10765         CResult_NetAddressDecodeErrorZ {
10766                 contents: CResult_NetAddressDecodeErrorZPtr {
10767                         result: Box::into_raw(Box::new(o)),
10768                 },
10769                 result_ok: true,
10770         }
10771 }
10772 #[no_mangle]
10773 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10774 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
10775         CResult_NetAddressDecodeErrorZ {
10776                 contents: CResult_NetAddressDecodeErrorZPtr {
10777                         err: Box::into_raw(Box::new(e)),
10778                 },
10779                 result_ok: false,
10780         }
10781 }
10782 /// Checks if the given object is currently in the success state
10783 #[no_mangle]
10784 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
10785         o.result_ok
10786 }
10787 #[no_mangle]
10788 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10789 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
10790 impl Drop for CResult_NetAddressDecodeErrorZ {
10791         fn drop(&mut self) {
10792                 if self.result_ok {
10793                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10794                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10795                         }
10796                 } else {
10797                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10798                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10799                         }
10800                 }
10801         }
10802 }
10803 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
10804         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
10805                 let contents = if o.result_ok {
10806                         let result = unsafe { o.contents.result };
10807                         unsafe { o.contents.result = core::ptr::null_mut() };
10808                         CResult_NetAddressDecodeErrorZPtr { result }
10809                 } else {
10810                         let err = unsafe { o.contents.err };
10811                         unsafe { o.contents.err = core::ptr::null_mut(); }
10812                         CResult_NetAddressDecodeErrorZPtr { err }
10813                 };
10814                 Self {
10815                         contents,
10816                         result_ok: o.result_ok,
10817                 }
10818         }
10819 }
10820 impl Clone for CResult_NetAddressDecodeErrorZ {
10821         fn clone(&self) -> Self {
10822                 if self.result_ok {
10823                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
10824                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
10825                         } }
10826                 } else {
10827                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
10828                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10829                         } }
10830                 }
10831         }
10832 }
10833 #[no_mangle]
10834 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10835 /// but with all dynamically-allocated buffers duplicated in new buffers.
10836 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
10837 #[repr(C)]
10838 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
10839 /// This corresponds to std::vector in C++
10840 pub struct CVec_UpdateAddHTLCZ {
10841         /// The elements in the array.
10842         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10843         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
10844         /// The number of elements pointed to by `data`.
10845         pub datalen: usize
10846 }
10847 impl CVec_UpdateAddHTLCZ {
10848         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
10849                 if self.datalen == 0 { return Vec::new(); }
10850                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10851                 self.data = core::ptr::null_mut();
10852                 self.datalen = 0;
10853                 ret
10854         }
10855         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
10856                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10857         }
10858 }
10859 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
10860         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
10861                 let datalen = v.len();
10862                 let data = Box::into_raw(v.into_boxed_slice());
10863                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10864         }
10865 }
10866 #[no_mangle]
10867 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10868 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
10869 impl Drop for CVec_UpdateAddHTLCZ {
10870         fn drop(&mut self) {
10871                 if self.datalen == 0 { return; }
10872                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10873         }
10874 }
10875 impl Clone for CVec_UpdateAddHTLCZ {
10876         fn clone(&self) -> Self {
10877                 let mut res = Vec::new();
10878                 if self.datalen == 0 { return Self::from(res); }
10879                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10880                 Self::from(res)
10881         }
10882 }
10883 #[repr(C)]
10884 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
10885 /// This corresponds to std::vector in C++
10886 pub struct CVec_UpdateFulfillHTLCZ {
10887         /// The elements in the array.
10888         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10889         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
10890         /// The number of elements pointed to by `data`.
10891         pub datalen: usize
10892 }
10893 impl CVec_UpdateFulfillHTLCZ {
10894         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
10895                 if self.datalen == 0 { return Vec::new(); }
10896                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10897                 self.data = core::ptr::null_mut();
10898                 self.datalen = 0;
10899                 ret
10900         }
10901         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
10902                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10903         }
10904 }
10905 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
10906         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
10907                 let datalen = v.len();
10908                 let data = Box::into_raw(v.into_boxed_slice());
10909                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10910         }
10911 }
10912 #[no_mangle]
10913 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10914 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
10915 impl Drop for CVec_UpdateFulfillHTLCZ {
10916         fn drop(&mut self) {
10917                 if self.datalen == 0 { return; }
10918                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10919         }
10920 }
10921 impl Clone for CVec_UpdateFulfillHTLCZ {
10922         fn clone(&self) -> Self {
10923                 let mut res = Vec::new();
10924                 if self.datalen == 0 { return Self::from(res); }
10925                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10926                 Self::from(res)
10927         }
10928 }
10929 #[repr(C)]
10930 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
10931 /// This corresponds to std::vector in C++
10932 pub struct CVec_UpdateFailHTLCZ {
10933         /// The elements in the array.
10934         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10935         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
10936         /// The number of elements pointed to by `data`.
10937         pub datalen: usize
10938 }
10939 impl CVec_UpdateFailHTLCZ {
10940         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
10941                 if self.datalen == 0 { return Vec::new(); }
10942                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10943                 self.data = core::ptr::null_mut();
10944                 self.datalen = 0;
10945                 ret
10946         }
10947         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
10948                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10949         }
10950 }
10951 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
10952         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
10953                 let datalen = v.len();
10954                 let data = Box::into_raw(v.into_boxed_slice());
10955                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10956         }
10957 }
10958 #[no_mangle]
10959 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10960 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
10961 impl Drop for CVec_UpdateFailHTLCZ {
10962         fn drop(&mut self) {
10963                 if self.datalen == 0 { return; }
10964                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10965         }
10966 }
10967 impl Clone for CVec_UpdateFailHTLCZ {
10968         fn clone(&self) -> Self {
10969                 let mut res = Vec::new();
10970                 if self.datalen == 0 { return Self::from(res); }
10971                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10972                 Self::from(res)
10973         }
10974 }
10975 #[repr(C)]
10976 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
10977 /// This corresponds to std::vector in C++
10978 pub struct CVec_UpdateFailMalformedHTLCZ {
10979         /// The elements in the array.
10980         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10981         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
10982         /// The number of elements pointed to by `data`.
10983         pub datalen: usize
10984 }
10985 impl CVec_UpdateFailMalformedHTLCZ {
10986         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
10987                 if self.datalen == 0 { return Vec::new(); }
10988                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10989                 self.data = core::ptr::null_mut();
10990                 self.datalen = 0;
10991                 ret
10992         }
10993         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
10994                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10995         }
10996 }
10997 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
10998         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
10999                 let datalen = v.len();
11000                 let data = Box::into_raw(v.into_boxed_slice());
11001                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11002         }
11003 }
11004 #[no_mangle]
11005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11006 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11007 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11008         fn drop(&mut self) {
11009                 if self.datalen == 0 { return; }
11010                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11011         }
11012 }
11013 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11014         fn clone(&self) -> Self {
11015                 let mut res = Vec::new();
11016                 if self.datalen == 0 { return Self::from(res); }
11017                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11018                 Self::from(res)
11019         }
11020 }
11021 #[repr(C)]
11022 /// The contents of CResult_AcceptChannelDecodeErrorZ
11023 pub union CResult_AcceptChannelDecodeErrorZPtr {
11024         /// A pointer to the contents in the success state.
11025         /// Reading from this pointer when `result_ok` is not set is undefined.
11026         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11027         /// A pointer to the contents in the error state.
11028         /// Reading from this pointer when `result_ok` is set is undefined.
11029         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11030 }
11031 #[repr(C)]
11032 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11033 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11035 pub struct CResult_AcceptChannelDecodeErrorZ {
11036         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11037         /// `err` or `result` depending on the state of `result_ok`.
11038         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11039         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11040         pub result_ok: bool,
11041 }
11042 #[no_mangle]
11043 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11044 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11045         CResult_AcceptChannelDecodeErrorZ {
11046                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11047                         result: Box::into_raw(Box::new(o)),
11048                 },
11049                 result_ok: true,
11050         }
11051 }
11052 #[no_mangle]
11053 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11054 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
11055         CResult_AcceptChannelDecodeErrorZ {
11056                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11057                         err: Box::into_raw(Box::new(e)),
11058                 },
11059                 result_ok: false,
11060         }
11061 }
11062 /// Checks if the given object is currently in the success state
11063 #[no_mangle]
11064 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
11065         o.result_ok
11066 }
11067 #[no_mangle]
11068 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11069 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
11070 impl Drop for CResult_AcceptChannelDecodeErrorZ {
11071         fn drop(&mut self) {
11072                 if self.result_ok {
11073                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11074                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11075                         }
11076                 } else {
11077                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11078                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11079                         }
11080                 }
11081         }
11082 }
11083 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
11084         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11085                 let contents = if o.result_ok {
11086                         let result = unsafe { o.contents.result };
11087                         unsafe { o.contents.result = core::ptr::null_mut() };
11088                         CResult_AcceptChannelDecodeErrorZPtr { result }
11089                 } else {
11090                         let err = unsafe { o.contents.err };
11091                         unsafe { o.contents.err = core::ptr::null_mut(); }
11092                         CResult_AcceptChannelDecodeErrorZPtr { err }
11093                 };
11094                 Self {
11095                         contents,
11096                         result_ok: o.result_ok,
11097                 }
11098         }
11099 }
11100 impl Clone for CResult_AcceptChannelDecodeErrorZ {
11101         fn clone(&self) -> Self {
11102                 if self.result_ok {
11103                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
11104                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
11105                         } }
11106                 } else {
11107                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
11108                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11109                         } }
11110                 }
11111         }
11112 }
11113 #[no_mangle]
11114 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11115 /// but with all dynamically-allocated buffers duplicated in new buffers.
11116 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
11117 #[repr(C)]
11118 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11119 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
11120         /// A pointer to the contents in the success state.
11121         /// Reading from this pointer when `result_ok` is not set is undefined.
11122         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
11123         /// A pointer to the contents in the error state.
11124         /// Reading from this pointer when `result_ok` is set is undefined.
11125         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11126 }
11127 #[repr(C)]
11128 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11129 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11131 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
11132         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11133         /// `err` or `result` depending on the state of `result_ok`.
11134         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
11135         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11136         pub result_ok: bool,
11137 }
11138 #[no_mangle]
11139 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11140 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11141         CResult_AnnouncementSignaturesDecodeErrorZ {
11142                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11143                         result: Box::into_raw(Box::new(o)),
11144                 },
11145                 result_ok: true,
11146         }
11147 }
11148 #[no_mangle]
11149 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11150 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11151         CResult_AnnouncementSignaturesDecodeErrorZ {
11152                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11153                         err: Box::into_raw(Box::new(e)),
11154                 },
11155                 result_ok: false,
11156         }
11157 }
11158 /// Checks if the given object is currently in the success state
11159 #[no_mangle]
11160 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
11161         o.result_ok
11162 }
11163 #[no_mangle]
11164 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
11165 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
11166 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
11167         fn drop(&mut self) {
11168                 if self.result_ok {
11169                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11170                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11171                         }
11172                 } else {
11173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11175                         }
11176                 }
11177         }
11178 }
11179 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
11180         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
11181                 let contents = if o.result_ok {
11182                         let result = unsafe { o.contents.result };
11183                         unsafe { o.contents.result = core::ptr::null_mut() };
11184                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
11185                 } else {
11186                         let err = unsafe { o.contents.err };
11187                         unsafe { o.contents.err = core::ptr::null_mut(); }
11188                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
11189                 };
11190                 Self {
11191                         contents,
11192                         result_ok: o.result_ok,
11193                 }
11194         }
11195 }
11196 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
11197         fn clone(&self) -> Self {
11198                 if self.result_ok {
11199                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11200                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
11201                         } }
11202                 } else {
11203                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11204                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11205                         } }
11206                 }
11207         }
11208 }
11209 #[no_mangle]
11210 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
11211 /// but with all dynamically-allocated buffers duplicated in new buffers.
11212 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
11213 #[repr(C)]
11214 /// The contents of CResult_ChannelReestablishDecodeErrorZ
11215 pub union CResult_ChannelReestablishDecodeErrorZPtr {
11216         /// A pointer to the contents in the success state.
11217         /// Reading from this pointer when `result_ok` is not set is undefined.
11218         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
11219         /// A pointer to the contents in the error state.
11220         /// Reading from this pointer when `result_ok` is set is undefined.
11221         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11222 }
11223 #[repr(C)]
11224 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
11225 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
11226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11227 pub struct CResult_ChannelReestablishDecodeErrorZ {
11228         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
11229         /// `err` or `result` depending on the state of `result_ok`.
11230         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
11231         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
11232         pub result_ok: bool,
11233 }
11234 #[no_mangle]
11235 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
11236 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
11237         CResult_ChannelReestablishDecodeErrorZ {
11238                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11239                         result: Box::into_raw(Box::new(o)),
11240                 },
11241                 result_ok: true,
11242         }
11243 }
11244 #[no_mangle]
11245 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
11246 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
11247         CResult_ChannelReestablishDecodeErrorZ {
11248                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
11249                         err: Box::into_raw(Box::new(e)),
11250                 },
11251                 result_ok: false,
11252         }
11253 }
11254 /// Checks if the given object is currently in the success state
11255 #[no_mangle]
11256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
11257         o.result_ok
11258 }
11259 #[no_mangle]
11260 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
11261 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
11262 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
11263         fn drop(&mut self) {
11264                 if self.result_ok {
11265                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11266                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11267                         }
11268                 } else {
11269                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11270                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11271                         }
11272                 }
11273         }
11274 }
11275 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
11276         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
11277                 let contents = if o.result_ok {
11278                         let result = unsafe { o.contents.result };
11279                         unsafe { o.contents.result = core::ptr::null_mut() };
11280                         CResult_ChannelReestablishDecodeErrorZPtr { result }
11281                 } else {
11282                         let err = unsafe { o.contents.err };
11283                         unsafe { o.contents.err = core::ptr::null_mut(); }
11284                         CResult_ChannelReestablishDecodeErrorZPtr { err }
11285                 };
11286                 Self {
11287                         contents,
11288                         result_ok: o.result_ok,
11289                 }
11290         }
11291 }
11292 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
11293         fn clone(&self) -> Self {
11294                 if self.result_ok {
11295                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11296                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
11297                         } }
11298                 } else {
11299                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
11300                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11301                         } }
11302                 }
11303         }
11304 }
11305 #[no_mangle]
11306 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
11307 /// but with all dynamically-allocated buffers duplicated in new buffers.
11308 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
11309 #[repr(C)]
11310 /// The contents of CResult_ClosingSignedDecodeErrorZ
11311 pub union CResult_ClosingSignedDecodeErrorZPtr {
11312         /// A pointer to the contents in the success state.
11313         /// Reading from this pointer when `result_ok` is not set is undefined.
11314         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
11315         /// A pointer to the contents in the error state.
11316         /// Reading from this pointer when `result_ok` is set is undefined.
11317         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11318 }
11319 #[repr(C)]
11320 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
11321 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11322 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11323 pub struct CResult_ClosingSignedDecodeErrorZ {
11324         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
11325         /// `err` or `result` depending on the state of `result_ok`.
11326         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
11327         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
11328         pub result_ok: bool,
11329 }
11330 #[no_mangle]
11331 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
11332 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
11333         CResult_ClosingSignedDecodeErrorZ {
11334                 contents: CResult_ClosingSignedDecodeErrorZPtr {
11335                         result: Box::into_raw(Box::new(o)),
11336                 },
11337                 result_ok: true,
11338         }
11339 }
11340 #[no_mangle]
11341 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
11342 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
11343         CResult_ClosingSignedDecodeErrorZ {
11344                 contents: CResult_ClosingSignedDecodeErrorZPtr {
11345                         err: Box::into_raw(Box::new(e)),
11346                 },
11347                 result_ok: false,
11348         }
11349 }
11350 /// Checks if the given object is currently in the success state
11351 #[no_mangle]
11352 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
11353         o.result_ok
11354 }
11355 #[no_mangle]
11356 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
11357 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
11358 impl Drop for CResult_ClosingSignedDecodeErrorZ {
11359         fn drop(&mut self) {
11360                 if self.result_ok {
11361                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11362                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11363                         }
11364                 } else {
11365                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11366                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11367                         }
11368                 }
11369         }
11370 }
11371 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
11372         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11373                 let contents = if o.result_ok {
11374                         let result = unsafe { o.contents.result };
11375                         unsafe { o.contents.result = core::ptr::null_mut() };
11376                         CResult_ClosingSignedDecodeErrorZPtr { result }
11377                 } else {
11378                         let err = unsafe { o.contents.err };
11379                         unsafe { o.contents.err = core::ptr::null_mut(); }
11380                         CResult_ClosingSignedDecodeErrorZPtr { err }
11381                 };
11382                 Self {
11383                         contents,
11384                         result_ok: o.result_ok,
11385                 }
11386         }
11387 }
11388 impl Clone for CResult_ClosingSignedDecodeErrorZ {
11389         fn clone(&self) -> Self {
11390                 if self.result_ok {
11391                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
11392                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
11393                         } }
11394                 } else {
11395                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
11396                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11397                         } }
11398                 }
11399         }
11400 }
11401 #[no_mangle]
11402 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
11403 /// but with all dynamically-allocated buffers duplicated in new buffers.
11404 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
11405 #[repr(C)]
11406 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
11407 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11408         /// A pointer to the contents in the success state.
11409         /// Reading from this pointer when `result_ok` is not set is undefined.
11410         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
11411         /// A pointer to the contents in the error state.
11412         /// Reading from this pointer when `result_ok` is set is undefined.
11413         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11414 }
11415 #[repr(C)]
11416 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
11417 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
11418 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11419 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
11420         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
11421         /// `err` or `result` depending on the state of `result_ok`.
11422         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
11423         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
11424         pub result_ok: bool,
11425 }
11426 #[no_mangle]
11427 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11428 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11429         CResult_ClosingSignedFeeRangeDecodeErrorZ {
11430                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11431                         result: Box::into_raw(Box::new(o)),
11432                 },
11433                 result_ok: true,
11434         }
11435 }
11436 #[no_mangle]
11437 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11438 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
11439         CResult_ClosingSignedFeeRangeDecodeErrorZ {
11440                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11441                         err: Box::into_raw(Box::new(e)),
11442                 },
11443                 result_ok: false,
11444         }
11445 }
11446 /// Checks if the given object is currently in the success state
11447 #[no_mangle]
11448 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
11449         o.result_ok
11450 }
11451 #[no_mangle]
11452 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11453 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
11454 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11455         fn drop(&mut self) {
11456                 if self.result_ok {
11457                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11458                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11459                         }
11460                 } else {
11461                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11462                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11463                         }
11464                 }
11465         }
11466 }
11467 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11468         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
11469                 let contents = if o.result_ok {
11470                         let result = unsafe { o.contents.result };
11471                         unsafe { o.contents.result = core::ptr::null_mut() };
11472                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
11473                 } else {
11474                         let err = unsafe { o.contents.err };
11475                         unsafe { o.contents.err = core::ptr::null_mut(); }
11476                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
11477                 };
11478                 Self {
11479                         contents,
11480                         result_ok: o.result_ok,
11481                 }
11482         }
11483 }
11484 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
11485         fn clone(&self) -> Self {
11486                 if self.result_ok {
11487                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11488                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
11489                         } }
11490                 } else {
11491                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
11492                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11493                         } }
11494                 }
11495         }
11496 }
11497 #[no_mangle]
11498 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11499 /// but with all dynamically-allocated buffers duplicated in new buffers.
11500 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
11501 #[repr(C)]
11502 /// The contents of CResult_CommitmentSignedDecodeErrorZ
11503 pub union CResult_CommitmentSignedDecodeErrorZPtr {
11504         /// A pointer to the contents in the success state.
11505         /// Reading from this pointer when `result_ok` is not set is undefined.
11506         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
11507         /// A pointer to the contents in the error state.
11508         /// Reading from this pointer when `result_ok` is set is undefined.
11509         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11510 }
11511 #[repr(C)]
11512 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
11513 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11514 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11515 pub struct CResult_CommitmentSignedDecodeErrorZ {
11516         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
11517         /// `err` or `result` depending on the state of `result_ok`.
11518         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
11519         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
11520         pub result_ok: bool,
11521 }
11522 #[no_mangle]
11523 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11524 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
11525         CResult_CommitmentSignedDecodeErrorZ {
11526                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11527                         result: Box::into_raw(Box::new(o)),
11528                 },
11529                 result_ok: true,
11530         }
11531 }
11532 #[no_mangle]
11533 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11534 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
11535         CResult_CommitmentSignedDecodeErrorZ {
11536                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
11537                         err: Box::into_raw(Box::new(e)),
11538                 },
11539                 result_ok: false,
11540         }
11541 }
11542 /// Checks if the given object is currently in the success state
11543 #[no_mangle]
11544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
11545         o.result_ok
11546 }
11547 #[no_mangle]
11548 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11549 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
11550 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
11551         fn drop(&mut self) {
11552                 if self.result_ok {
11553                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11554                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11555                         }
11556                 } else {
11557                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11558                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11559                         }
11560                 }
11561         }
11562 }
11563 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
11564         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11565                 let contents = if o.result_ok {
11566                         let result = unsafe { o.contents.result };
11567                         unsafe { o.contents.result = core::ptr::null_mut() };
11568                         CResult_CommitmentSignedDecodeErrorZPtr { result }
11569                 } else {
11570                         let err = unsafe { o.contents.err };
11571                         unsafe { o.contents.err = core::ptr::null_mut(); }
11572                         CResult_CommitmentSignedDecodeErrorZPtr { err }
11573                 };
11574                 Self {
11575                         contents,
11576                         result_ok: o.result_ok,
11577                 }
11578         }
11579 }
11580 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
11581         fn clone(&self) -> Self {
11582                 if self.result_ok {
11583                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11584                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
11585                         } }
11586                 } else {
11587                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
11588                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11589                         } }
11590                 }
11591         }
11592 }
11593 #[no_mangle]
11594 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11595 /// but with all dynamically-allocated buffers duplicated in new buffers.
11596 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
11597 #[repr(C)]
11598 /// The contents of CResult_FundingCreatedDecodeErrorZ
11599 pub union CResult_FundingCreatedDecodeErrorZPtr {
11600         /// A pointer to the contents in the success state.
11601         /// Reading from this pointer when `result_ok` is not set is undefined.
11602         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
11603         /// A pointer to the contents in the error state.
11604         /// Reading from this pointer when `result_ok` is set is undefined.
11605         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11606 }
11607 #[repr(C)]
11608 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
11609 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
11610 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11611 pub struct CResult_FundingCreatedDecodeErrorZ {
11612         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
11613         /// `err` or `result` depending on the state of `result_ok`.
11614         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
11615         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
11616         pub result_ok: bool,
11617 }
11618 #[no_mangle]
11619 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11620 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
11621         CResult_FundingCreatedDecodeErrorZ {
11622                 contents: CResult_FundingCreatedDecodeErrorZPtr {
11623                         result: Box::into_raw(Box::new(o)),
11624                 },
11625                 result_ok: true,
11626         }
11627 }
11628 #[no_mangle]
11629 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11630 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
11631         CResult_FundingCreatedDecodeErrorZ {
11632                 contents: CResult_FundingCreatedDecodeErrorZPtr {
11633                         err: Box::into_raw(Box::new(e)),
11634                 },
11635                 result_ok: false,
11636         }
11637 }
11638 /// Checks if the given object is currently in the success state
11639 #[no_mangle]
11640 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
11641         o.result_ok
11642 }
11643 #[no_mangle]
11644 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11645 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
11646 impl Drop for CResult_FundingCreatedDecodeErrorZ {
11647         fn drop(&mut self) {
11648                 if self.result_ok {
11649                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11650                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11651                         }
11652                 } else {
11653                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11654                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11655                         }
11656                 }
11657         }
11658 }
11659 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
11660         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
11661                 let contents = if o.result_ok {
11662                         let result = unsafe { o.contents.result };
11663                         unsafe { o.contents.result = core::ptr::null_mut() };
11664                         CResult_FundingCreatedDecodeErrorZPtr { result }
11665                 } else {
11666                         let err = unsafe { o.contents.err };
11667                         unsafe { o.contents.err = core::ptr::null_mut(); }
11668                         CResult_FundingCreatedDecodeErrorZPtr { err }
11669                 };
11670                 Self {
11671                         contents,
11672                         result_ok: o.result_ok,
11673                 }
11674         }
11675 }
11676 impl Clone for CResult_FundingCreatedDecodeErrorZ {
11677         fn clone(&self) -> Self {
11678                 if self.result_ok {
11679                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
11680                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
11681                         } }
11682                 } else {
11683                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
11684                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11685                         } }
11686                 }
11687         }
11688 }
11689 #[no_mangle]
11690 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11691 /// but with all dynamically-allocated buffers duplicated in new buffers.
11692 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
11693 #[repr(C)]
11694 /// The contents of CResult_FundingSignedDecodeErrorZ
11695 pub union CResult_FundingSignedDecodeErrorZPtr {
11696         /// A pointer to the contents in the success state.
11697         /// Reading from this pointer when `result_ok` is not set is undefined.
11698         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
11699         /// A pointer to the contents in the error state.
11700         /// Reading from this pointer when `result_ok` is set is undefined.
11701         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11702 }
11703 #[repr(C)]
11704 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
11705 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
11706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11707 pub struct CResult_FundingSignedDecodeErrorZ {
11708         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
11709         /// `err` or `result` depending on the state of `result_ok`.
11710         pub contents: CResult_FundingSignedDecodeErrorZPtr,
11711         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
11712         pub result_ok: bool,
11713 }
11714 #[no_mangle]
11715 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11716 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
11717         CResult_FundingSignedDecodeErrorZ {
11718                 contents: CResult_FundingSignedDecodeErrorZPtr {
11719                         result: Box::into_raw(Box::new(o)),
11720                 },
11721                 result_ok: true,
11722         }
11723 }
11724 #[no_mangle]
11725 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11726 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
11727         CResult_FundingSignedDecodeErrorZ {
11728                 contents: CResult_FundingSignedDecodeErrorZPtr {
11729                         err: Box::into_raw(Box::new(e)),
11730                 },
11731                 result_ok: false,
11732         }
11733 }
11734 /// Checks if the given object is currently in the success state
11735 #[no_mangle]
11736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
11737         o.result_ok
11738 }
11739 #[no_mangle]
11740 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11741 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
11742 impl Drop for CResult_FundingSignedDecodeErrorZ {
11743         fn drop(&mut self) {
11744                 if self.result_ok {
11745                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11746                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11747                         }
11748                 } else {
11749                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11750                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11751                         }
11752                 }
11753         }
11754 }
11755 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
11756         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
11757                 let contents = if o.result_ok {
11758                         let result = unsafe { o.contents.result };
11759                         unsafe { o.contents.result = core::ptr::null_mut() };
11760                         CResult_FundingSignedDecodeErrorZPtr { result }
11761                 } else {
11762                         let err = unsafe { o.contents.err };
11763                         unsafe { o.contents.err = core::ptr::null_mut(); }
11764                         CResult_FundingSignedDecodeErrorZPtr { err }
11765                 };
11766                 Self {
11767                         contents,
11768                         result_ok: o.result_ok,
11769                 }
11770         }
11771 }
11772 impl Clone for CResult_FundingSignedDecodeErrorZ {
11773         fn clone(&self) -> Self {
11774                 if self.result_ok {
11775                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
11776                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
11777                         } }
11778                 } else {
11779                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
11780                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11781                         } }
11782                 }
11783         }
11784 }
11785 #[no_mangle]
11786 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11787 /// but with all dynamically-allocated buffers duplicated in new buffers.
11788 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
11789 #[repr(C)]
11790 /// The contents of CResult_FundingLockedDecodeErrorZ
11791 pub union CResult_FundingLockedDecodeErrorZPtr {
11792         /// A pointer to the contents in the success state.
11793         /// Reading from this pointer when `result_ok` is not set is undefined.
11794         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
11795         /// A pointer to the contents in the error state.
11796         /// Reading from this pointer when `result_ok` is set is undefined.
11797         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11798 }
11799 #[repr(C)]
11800 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
11801 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
11802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11803 pub struct CResult_FundingLockedDecodeErrorZ {
11804         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
11805         /// `err` or `result` depending on the state of `result_ok`.
11806         pub contents: CResult_FundingLockedDecodeErrorZPtr,
11807         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
11808         pub result_ok: bool,
11809 }
11810 #[no_mangle]
11811 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11812 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
11813         CResult_FundingLockedDecodeErrorZ {
11814                 contents: CResult_FundingLockedDecodeErrorZPtr {
11815                         result: Box::into_raw(Box::new(o)),
11816                 },
11817                 result_ok: true,
11818         }
11819 }
11820 #[no_mangle]
11821 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11822 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
11823         CResult_FundingLockedDecodeErrorZ {
11824                 contents: CResult_FundingLockedDecodeErrorZPtr {
11825                         err: Box::into_raw(Box::new(e)),
11826                 },
11827                 result_ok: false,
11828         }
11829 }
11830 /// Checks if the given object is currently in the success state
11831 #[no_mangle]
11832 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
11833         o.result_ok
11834 }
11835 #[no_mangle]
11836 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11837 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
11838 impl Drop for CResult_FundingLockedDecodeErrorZ {
11839         fn drop(&mut self) {
11840                 if self.result_ok {
11841                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11842                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11843                         }
11844                 } else {
11845                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11846                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11847                         }
11848                 }
11849         }
11850 }
11851 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
11852         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
11853                 let contents = if o.result_ok {
11854                         let result = unsafe { o.contents.result };
11855                         unsafe { o.contents.result = core::ptr::null_mut() };
11856                         CResult_FundingLockedDecodeErrorZPtr { result }
11857                 } else {
11858                         let err = unsafe { o.contents.err };
11859                         unsafe { o.contents.err = core::ptr::null_mut(); }
11860                         CResult_FundingLockedDecodeErrorZPtr { err }
11861                 };
11862                 Self {
11863                         contents,
11864                         result_ok: o.result_ok,
11865                 }
11866         }
11867 }
11868 impl Clone for CResult_FundingLockedDecodeErrorZ {
11869         fn clone(&self) -> Self {
11870                 if self.result_ok {
11871                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
11872                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
11873                         } }
11874                 } else {
11875                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
11876                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11877                         } }
11878                 }
11879         }
11880 }
11881 #[no_mangle]
11882 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11883 /// but with all dynamically-allocated buffers duplicated in new buffers.
11884 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
11885 #[repr(C)]
11886 /// The contents of CResult_InitDecodeErrorZ
11887 pub union CResult_InitDecodeErrorZPtr {
11888         /// A pointer to the contents in the success state.
11889         /// Reading from this pointer when `result_ok` is not set is undefined.
11890         pub result: *mut crate::lightning::ln::msgs::Init,
11891         /// A pointer to the contents in the error state.
11892         /// Reading from this pointer when `result_ok` is set is undefined.
11893         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11894 }
11895 #[repr(C)]
11896 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
11897 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
11898 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11899 pub struct CResult_InitDecodeErrorZ {
11900         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
11901         /// `err` or `result` depending on the state of `result_ok`.
11902         pub contents: CResult_InitDecodeErrorZPtr,
11903         /// Whether this CResult_InitDecodeErrorZ represents a success state.
11904         pub result_ok: bool,
11905 }
11906 #[no_mangle]
11907 /// Creates a new CResult_InitDecodeErrorZ in the success state.
11908 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
11909         CResult_InitDecodeErrorZ {
11910                 contents: CResult_InitDecodeErrorZPtr {
11911                         result: Box::into_raw(Box::new(o)),
11912                 },
11913                 result_ok: true,
11914         }
11915 }
11916 #[no_mangle]
11917 /// Creates a new CResult_InitDecodeErrorZ in the error state.
11918 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
11919         CResult_InitDecodeErrorZ {
11920                 contents: CResult_InitDecodeErrorZPtr {
11921                         err: Box::into_raw(Box::new(e)),
11922                 },
11923                 result_ok: false,
11924         }
11925 }
11926 /// Checks if the given object is currently in the success state
11927 #[no_mangle]
11928 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
11929         o.result_ok
11930 }
11931 #[no_mangle]
11932 /// Frees any resources used by the CResult_InitDecodeErrorZ.
11933 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
11934 impl Drop for CResult_InitDecodeErrorZ {
11935         fn drop(&mut self) {
11936                 if self.result_ok {
11937                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11938                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11939                         }
11940                 } else {
11941                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11942                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11943                         }
11944                 }
11945         }
11946 }
11947 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
11948         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
11949                 let contents = if o.result_ok {
11950                         let result = unsafe { o.contents.result };
11951                         unsafe { o.contents.result = core::ptr::null_mut() };
11952                         CResult_InitDecodeErrorZPtr { result }
11953                 } else {
11954                         let err = unsafe { o.contents.err };
11955                         unsafe { o.contents.err = core::ptr::null_mut(); }
11956                         CResult_InitDecodeErrorZPtr { err }
11957                 };
11958                 Self {
11959                         contents,
11960                         result_ok: o.result_ok,
11961                 }
11962         }
11963 }
11964 impl Clone for CResult_InitDecodeErrorZ {
11965         fn clone(&self) -> Self {
11966                 if self.result_ok {
11967                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
11968                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
11969                         } }
11970                 } else {
11971                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
11972                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11973                         } }
11974                 }
11975         }
11976 }
11977 #[no_mangle]
11978 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11979 /// but with all dynamically-allocated buffers duplicated in new buffers.
11980 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
11981 #[repr(C)]
11982 /// The contents of CResult_OpenChannelDecodeErrorZ
11983 pub union CResult_OpenChannelDecodeErrorZPtr {
11984         /// A pointer to the contents in the success state.
11985         /// Reading from this pointer when `result_ok` is not set is undefined.
11986         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
11987         /// A pointer to the contents in the error state.
11988         /// Reading from this pointer when `result_ok` is set is undefined.
11989         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11990 }
11991 #[repr(C)]
11992 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
11993 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11995 pub struct CResult_OpenChannelDecodeErrorZ {
11996         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
11997         /// `err` or `result` depending on the state of `result_ok`.
11998         pub contents: CResult_OpenChannelDecodeErrorZPtr,
11999         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12000         pub result_ok: bool,
12001 }
12002 #[no_mangle]
12003 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12004 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12005         CResult_OpenChannelDecodeErrorZ {
12006                 contents: CResult_OpenChannelDecodeErrorZPtr {
12007                         result: Box::into_raw(Box::new(o)),
12008                 },
12009                 result_ok: true,
12010         }
12011 }
12012 #[no_mangle]
12013 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12014 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12015         CResult_OpenChannelDecodeErrorZ {
12016                 contents: CResult_OpenChannelDecodeErrorZPtr {
12017                         err: Box::into_raw(Box::new(e)),
12018                 },
12019                 result_ok: false,
12020         }
12021 }
12022 /// Checks if the given object is currently in the success state
12023 #[no_mangle]
12024 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12025         o.result_ok
12026 }
12027 #[no_mangle]
12028 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12029 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12030 impl Drop for CResult_OpenChannelDecodeErrorZ {
12031         fn drop(&mut self) {
12032                 if self.result_ok {
12033                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12034                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12035                         }
12036                 } else {
12037                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12038                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12039                         }
12040                 }
12041         }
12042 }
12043 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12044         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12045                 let contents = if o.result_ok {
12046                         let result = unsafe { o.contents.result };
12047                         unsafe { o.contents.result = core::ptr::null_mut() };
12048                         CResult_OpenChannelDecodeErrorZPtr { result }
12049                 } else {
12050                         let err = unsafe { o.contents.err };
12051                         unsafe { o.contents.err = core::ptr::null_mut(); }
12052                         CResult_OpenChannelDecodeErrorZPtr { err }
12053                 };
12054                 Self {
12055                         contents,
12056                         result_ok: o.result_ok,
12057                 }
12058         }
12059 }
12060 impl Clone for CResult_OpenChannelDecodeErrorZ {
12061         fn clone(&self) -> Self {
12062                 if self.result_ok {
12063                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
12064                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
12065                         } }
12066                 } else {
12067                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
12068                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12069                         } }
12070                 }
12071         }
12072 }
12073 #[no_mangle]
12074 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12075 /// but with all dynamically-allocated buffers duplicated in new buffers.
12076 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
12077 #[repr(C)]
12078 /// The contents of CResult_RevokeAndACKDecodeErrorZ
12079 pub union CResult_RevokeAndACKDecodeErrorZPtr {
12080         /// A pointer to the contents in the success state.
12081         /// Reading from this pointer when `result_ok` is not set is undefined.
12082         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
12083         /// A pointer to the contents in the error state.
12084         /// Reading from this pointer when `result_ok` is set is undefined.
12085         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12086 }
12087 #[repr(C)]
12088 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12089 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12090 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12091 pub struct CResult_RevokeAndACKDecodeErrorZ {
12092         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12093         /// `err` or `result` depending on the state of `result_ok`.
12094         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
12095         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12096         pub result_ok: bool,
12097 }
12098 #[no_mangle]
12099 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12100 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
12101         CResult_RevokeAndACKDecodeErrorZ {
12102                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12103                         result: Box::into_raw(Box::new(o)),
12104                 },
12105                 result_ok: true,
12106         }
12107 }
12108 #[no_mangle]
12109 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12110 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
12111         CResult_RevokeAndACKDecodeErrorZ {
12112                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12113                         err: Box::into_raw(Box::new(e)),
12114                 },
12115                 result_ok: false,
12116         }
12117 }
12118 /// Checks if the given object is currently in the success state
12119 #[no_mangle]
12120 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
12121         o.result_ok
12122 }
12123 #[no_mangle]
12124 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12125 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
12126 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
12127         fn drop(&mut self) {
12128                 if self.result_ok {
12129                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12130                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12131                         }
12132                 } else {
12133                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12134                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12135                         }
12136                 }
12137         }
12138 }
12139 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
12140         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
12141                 let contents = if o.result_ok {
12142                         let result = unsafe { o.contents.result };
12143                         unsafe { o.contents.result = core::ptr::null_mut() };
12144                         CResult_RevokeAndACKDecodeErrorZPtr { result }
12145                 } else {
12146                         let err = unsafe { o.contents.err };
12147                         unsafe { o.contents.err = core::ptr::null_mut(); }
12148                         CResult_RevokeAndACKDecodeErrorZPtr { err }
12149                 };
12150                 Self {
12151                         contents,
12152                         result_ok: o.result_ok,
12153                 }
12154         }
12155 }
12156 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
12157         fn clone(&self) -> Self {
12158                 if self.result_ok {
12159                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12160                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
12161                         } }
12162                 } else {
12163                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
12164                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12165                         } }
12166                 }
12167         }
12168 }
12169 #[no_mangle]
12170 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
12171 /// but with all dynamically-allocated buffers duplicated in new buffers.
12172 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
12173 #[repr(C)]
12174 /// The contents of CResult_ShutdownDecodeErrorZ
12175 pub union CResult_ShutdownDecodeErrorZPtr {
12176         /// A pointer to the contents in the success state.
12177         /// Reading from this pointer when `result_ok` is not set is undefined.
12178         pub result: *mut crate::lightning::ln::msgs::Shutdown,
12179         /// A pointer to the contents in the error state.
12180         /// Reading from this pointer when `result_ok` is set is undefined.
12181         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12182 }
12183 #[repr(C)]
12184 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
12185 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
12186 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12187 pub struct CResult_ShutdownDecodeErrorZ {
12188         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
12189         /// `err` or `result` depending on the state of `result_ok`.
12190         pub contents: CResult_ShutdownDecodeErrorZPtr,
12191         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
12192         pub result_ok: bool,
12193 }
12194 #[no_mangle]
12195 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
12196 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
12197         CResult_ShutdownDecodeErrorZ {
12198                 contents: CResult_ShutdownDecodeErrorZPtr {
12199                         result: Box::into_raw(Box::new(o)),
12200                 },
12201                 result_ok: true,
12202         }
12203 }
12204 #[no_mangle]
12205 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
12206 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
12207         CResult_ShutdownDecodeErrorZ {
12208                 contents: CResult_ShutdownDecodeErrorZPtr {
12209                         err: Box::into_raw(Box::new(e)),
12210                 },
12211                 result_ok: false,
12212         }
12213 }
12214 /// Checks if the given object is currently in the success state
12215 #[no_mangle]
12216 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
12217         o.result_ok
12218 }
12219 #[no_mangle]
12220 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
12221 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
12222 impl Drop for CResult_ShutdownDecodeErrorZ {
12223         fn drop(&mut self) {
12224                 if self.result_ok {
12225                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12226                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12227                         }
12228                 } else {
12229                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12230                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12231                         }
12232                 }
12233         }
12234 }
12235 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
12236         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
12237                 let contents = if o.result_ok {
12238                         let result = unsafe { o.contents.result };
12239                         unsafe { o.contents.result = core::ptr::null_mut() };
12240                         CResult_ShutdownDecodeErrorZPtr { result }
12241                 } else {
12242                         let err = unsafe { o.contents.err };
12243                         unsafe { o.contents.err = core::ptr::null_mut(); }
12244                         CResult_ShutdownDecodeErrorZPtr { err }
12245                 };
12246                 Self {
12247                         contents,
12248                         result_ok: o.result_ok,
12249                 }
12250         }
12251 }
12252 impl Clone for CResult_ShutdownDecodeErrorZ {
12253         fn clone(&self) -> Self {
12254                 if self.result_ok {
12255                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
12256                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
12257                         } }
12258                 } else {
12259                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
12260                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12261                         } }
12262                 }
12263         }
12264 }
12265 #[no_mangle]
12266 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
12267 /// but with all dynamically-allocated buffers duplicated in new buffers.
12268 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
12269 #[repr(C)]
12270 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
12271 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
12272         /// A pointer to the contents in the success state.
12273         /// Reading from this pointer when `result_ok` is not set is undefined.
12274         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12275         /// A pointer to the contents in the error state.
12276         /// Reading from this pointer when `result_ok` is set is undefined.
12277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12278 }
12279 #[repr(C)]
12280 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
12281 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12283 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
12284         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
12285         /// `err` or `result` depending on the state of `result_ok`.
12286         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
12287         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
12288         pub result_ok: bool,
12289 }
12290 #[no_mangle]
12291 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
12292 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
12293         CResult_UpdateFailHTLCDecodeErrorZ {
12294                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12295                         result: Box::into_raw(Box::new(o)),
12296                 },
12297                 result_ok: true,
12298         }
12299 }
12300 #[no_mangle]
12301 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
12302 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
12303         CResult_UpdateFailHTLCDecodeErrorZ {
12304                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12305                         err: Box::into_raw(Box::new(e)),
12306                 },
12307                 result_ok: false,
12308         }
12309 }
12310 /// Checks if the given object is currently in the success state
12311 #[no_mangle]
12312 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
12313         o.result_ok
12314 }
12315 #[no_mangle]
12316 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
12317 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
12318 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
12319         fn drop(&mut self) {
12320                 if self.result_ok {
12321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12323                         }
12324                 } else {
12325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12327                         }
12328                 }
12329         }
12330 }
12331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
12332         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12333                 let contents = if o.result_ok {
12334                         let result = unsafe { o.contents.result };
12335                         unsafe { o.contents.result = core::ptr::null_mut() };
12336                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
12337                 } else {
12338                         let err = unsafe { o.contents.err };
12339                         unsafe { o.contents.err = core::ptr::null_mut(); }
12340                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
12341                 };
12342                 Self {
12343                         contents,
12344                         result_ok: o.result_ok,
12345                 }
12346         }
12347 }
12348 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
12349         fn clone(&self) -> Self {
12350                 if self.result_ok {
12351                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12352                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
12353                         } }
12354                 } else {
12355                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
12356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12357                         } }
12358                 }
12359         }
12360 }
12361 #[no_mangle]
12362 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
12363 /// but with all dynamically-allocated buffers duplicated in new buffers.
12364 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
12365 #[repr(C)]
12366 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
12367 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12368         /// A pointer to the contents in the success state.
12369         /// Reading from this pointer when `result_ok` is not set is undefined.
12370         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12371         /// A pointer to the contents in the error state.
12372         /// Reading from this pointer when `result_ok` is set is undefined.
12373         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12374 }
12375 #[repr(C)]
12376 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
12377 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12379 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12380         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
12381         /// `err` or `result` depending on the state of `result_ok`.
12382         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
12383         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
12384         pub result_ok: bool,
12385 }
12386 #[no_mangle]
12387 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
12388 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12389         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12390                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12391                         result: Box::into_raw(Box::new(o)),
12392                 },
12393                 result_ok: true,
12394         }
12395 }
12396 #[no_mangle]
12397 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
12398 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12399         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12400                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12401                         err: Box::into_raw(Box::new(e)),
12402                 },
12403                 result_ok: false,
12404         }
12405 }
12406 /// Checks if the given object is currently in the success state
12407 #[no_mangle]
12408 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
12409         o.result_ok
12410 }
12411 #[no_mangle]
12412 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
12413 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
12414 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12415         fn drop(&mut self) {
12416                 if self.result_ok {
12417                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12418                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12419                         }
12420                 } else {
12421                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12422                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12423                         }
12424                 }
12425         }
12426 }
12427 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12428         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12429                 let contents = if o.result_ok {
12430                         let result = unsafe { o.contents.result };
12431                         unsafe { o.contents.result = core::ptr::null_mut() };
12432                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
12433                 } else {
12434                         let err = unsafe { o.contents.err };
12435                         unsafe { o.contents.err = core::ptr::null_mut(); }
12436                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
12437                 };
12438                 Self {
12439                         contents,
12440                         result_ok: o.result_ok,
12441                 }
12442         }
12443 }
12444 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
12445         fn clone(&self) -> Self {
12446                 if self.result_ok {
12447                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12448                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
12449                         } }
12450                 } else {
12451                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
12452                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12453                         } }
12454                 }
12455         }
12456 }
12457 #[no_mangle]
12458 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
12459 /// but with all dynamically-allocated buffers duplicated in new buffers.
12460 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
12461 #[repr(C)]
12462 /// The contents of CResult_UpdateFeeDecodeErrorZ
12463 pub union CResult_UpdateFeeDecodeErrorZPtr {
12464         /// A pointer to the contents in the success state.
12465         /// Reading from this pointer when `result_ok` is not set is undefined.
12466         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
12467         /// A pointer to the contents in the error state.
12468         /// Reading from this pointer when `result_ok` is set is undefined.
12469         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12470 }
12471 #[repr(C)]
12472 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
12473 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
12474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12475 pub struct CResult_UpdateFeeDecodeErrorZ {
12476         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
12477         /// `err` or `result` depending on the state of `result_ok`.
12478         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
12479         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
12480         pub result_ok: bool,
12481 }
12482 #[no_mangle]
12483 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
12484 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
12485         CResult_UpdateFeeDecodeErrorZ {
12486                 contents: CResult_UpdateFeeDecodeErrorZPtr {
12487                         result: Box::into_raw(Box::new(o)),
12488                 },
12489                 result_ok: true,
12490         }
12491 }
12492 #[no_mangle]
12493 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
12494 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
12495         CResult_UpdateFeeDecodeErrorZ {
12496                 contents: CResult_UpdateFeeDecodeErrorZPtr {
12497                         err: Box::into_raw(Box::new(e)),
12498                 },
12499                 result_ok: false,
12500         }
12501 }
12502 /// Checks if the given object is currently in the success state
12503 #[no_mangle]
12504 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
12505         o.result_ok
12506 }
12507 #[no_mangle]
12508 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
12509 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
12510 impl Drop for CResult_UpdateFeeDecodeErrorZ {
12511         fn drop(&mut self) {
12512                 if self.result_ok {
12513                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12514                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12515                         }
12516                 } else {
12517                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12518                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12519                         }
12520                 }
12521         }
12522 }
12523 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
12524         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
12525                 let contents = if o.result_ok {
12526                         let result = unsafe { o.contents.result };
12527                         unsafe { o.contents.result = core::ptr::null_mut() };
12528                         CResult_UpdateFeeDecodeErrorZPtr { result }
12529                 } else {
12530                         let err = unsafe { o.contents.err };
12531                         unsafe { o.contents.err = core::ptr::null_mut(); }
12532                         CResult_UpdateFeeDecodeErrorZPtr { err }
12533                 };
12534                 Self {
12535                         contents,
12536                         result_ok: o.result_ok,
12537                 }
12538         }
12539 }
12540 impl Clone for CResult_UpdateFeeDecodeErrorZ {
12541         fn clone(&self) -> Self {
12542                 if self.result_ok {
12543                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
12544                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
12545                         } }
12546                 } else {
12547                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
12548                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12549                         } }
12550                 }
12551         }
12552 }
12553 #[no_mangle]
12554 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
12555 /// but with all dynamically-allocated buffers duplicated in new buffers.
12556 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
12557 #[repr(C)]
12558 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
12559 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12560         /// A pointer to the contents in the success state.
12561         /// Reading from this pointer when `result_ok` is not set is undefined.
12562         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12563         /// A pointer to the contents in the error state.
12564         /// Reading from this pointer when `result_ok` is set is undefined.
12565         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12566 }
12567 #[repr(C)]
12568 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
12569 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12571 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
12572         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
12573         /// `err` or `result` depending on the state of `result_ok`.
12574         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
12575         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
12576         pub result_ok: bool,
12577 }
12578 #[no_mangle]
12579 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
12580 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12581         CResult_UpdateFulfillHTLCDecodeErrorZ {
12582                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12583                         result: Box::into_raw(Box::new(o)),
12584                 },
12585                 result_ok: true,
12586         }
12587 }
12588 #[no_mangle]
12589 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
12590 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
12591         CResult_UpdateFulfillHTLCDecodeErrorZ {
12592                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12593                         err: Box::into_raw(Box::new(e)),
12594                 },
12595                 result_ok: false,
12596         }
12597 }
12598 /// Checks if the given object is currently in the success state
12599 #[no_mangle]
12600 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
12601         o.result_ok
12602 }
12603 #[no_mangle]
12604 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
12605 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
12606 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
12607         fn drop(&mut self) {
12608                 if self.result_ok {
12609                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12610                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12611                         }
12612                 } else {
12613                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12614                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12615                         }
12616                 }
12617         }
12618 }
12619 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
12620         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12621                 let contents = if o.result_ok {
12622                         let result = unsafe { o.contents.result };
12623                         unsafe { o.contents.result = core::ptr::null_mut() };
12624                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
12625                 } else {
12626                         let err = unsafe { o.contents.err };
12627                         unsafe { o.contents.err = core::ptr::null_mut(); }
12628                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
12629                 };
12630                 Self {
12631                         contents,
12632                         result_ok: o.result_ok,
12633                 }
12634         }
12635 }
12636 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
12637         fn clone(&self) -> Self {
12638                 if self.result_ok {
12639                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12640                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
12641                         } }
12642                 } else {
12643                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
12644                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12645                         } }
12646                 }
12647         }
12648 }
12649 #[no_mangle]
12650 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
12651 /// but with all dynamically-allocated buffers duplicated in new buffers.
12652 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
12653 #[repr(C)]
12654 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
12655 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
12656         /// A pointer to the contents in the success state.
12657         /// Reading from this pointer when `result_ok` is not set is undefined.
12658         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12659         /// A pointer to the contents in the error state.
12660         /// Reading from this pointer when `result_ok` is set is undefined.
12661         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12662 }
12663 #[repr(C)]
12664 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
12665 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
12666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12667 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
12668         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
12669         /// `err` or `result` depending on the state of `result_ok`.
12670         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
12671         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
12672         pub result_ok: bool,
12673 }
12674 #[no_mangle]
12675 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
12676 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
12677         CResult_UpdateAddHTLCDecodeErrorZ {
12678                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12679                         result: Box::into_raw(Box::new(o)),
12680                 },
12681                 result_ok: true,
12682         }
12683 }
12684 #[no_mangle]
12685 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
12686 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
12687         CResult_UpdateAddHTLCDecodeErrorZ {
12688                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12689                         err: Box::into_raw(Box::new(e)),
12690                 },
12691                 result_ok: false,
12692         }
12693 }
12694 /// Checks if the given object is currently in the success state
12695 #[no_mangle]
12696 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
12697         o.result_ok
12698 }
12699 #[no_mangle]
12700 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
12701 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
12702 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
12703         fn drop(&mut self) {
12704                 if self.result_ok {
12705                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12706                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12707                         }
12708                 } else {
12709                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12710                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12711                         }
12712                 }
12713         }
12714 }
12715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
12716         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
12717                 let contents = if o.result_ok {
12718                         let result = unsafe { o.contents.result };
12719                         unsafe { o.contents.result = core::ptr::null_mut() };
12720                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
12721                 } else {
12722                         let err = unsafe { o.contents.err };
12723                         unsafe { o.contents.err = core::ptr::null_mut(); }
12724                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
12725                 };
12726                 Self {
12727                         contents,
12728                         result_ok: o.result_ok,
12729                 }
12730         }
12731 }
12732 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
12733         fn clone(&self) -> Self {
12734                 if self.result_ok {
12735                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12736                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
12737                         } }
12738                 } else {
12739                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
12740                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12741                         } }
12742                 }
12743         }
12744 }
12745 #[no_mangle]
12746 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
12747 /// but with all dynamically-allocated buffers duplicated in new buffers.
12748 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
12749 #[repr(C)]
12750 /// The contents of CResult_PingDecodeErrorZ
12751 pub union CResult_PingDecodeErrorZPtr {
12752         /// A pointer to the contents in the success state.
12753         /// Reading from this pointer when `result_ok` is not set is undefined.
12754         pub result: *mut crate::lightning::ln::msgs::Ping,
12755         /// A pointer to the contents in the error state.
12756         /// Reading from this pointer when `result_ok` is set is undefined.
12757         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12758 }
12759 #[repr(C)]
12760 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
12761 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
12762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12763 pub struct CResult_PingDecodeErrorZ {
12764         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
12765         /// `err` or `result` depending on the state of `result_ok`.
12766         pub contents: CResult_PingDecodeErrorZPtr,
12767         /// Whether this CResult_PingDecodeErrorZ represents a success state.
12768         pub result_ok: bool,
12769 }
12770 #[no_mangle]
12771 /// Creates a new CResult_PingDecodeErrorZ in the success state.
12772 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
12773         CResult_PingDecodeErrorZ {
12774                 contents: CResult_PingDecodeErrorZPtr {
12775                         result: Box::into_raw(Box::new(o)),
12776                 },
12777                 result_ok: true,
12778         }
12779 }
12780 #[no_mangle]
12781 /// Creates a new CResult_PingDecodeErrorZ in the error state.
12782 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
12783         CResult_PingDecodeErrorZ {
12784                 contents: CResult_PingDecodeErrorZPtr {
12785                         err: Box::into_raw(Box::new(e)),
12786                 },
12787                 result_ok: false,
12788         }
12789 }
12790 /// Checks if the given object is currently in the success state
12791 #[no_mangle]
12792 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
12793         o.result_ok
12794 }
12795 #[no_mangle]
12796 /// Frees any resources used by the CResult_PingDecodeErrorZ.
12797 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
12798 impl Drop for CResult_PingDecodeErrorZ {
12799         fn drop(&mut self) {
12800                 if self.result_ok {
12801                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12802                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12803                         }
12804                 } else {
12805                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12806                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12807                         }
12808                 }
12809         }
12810 }
12811 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
12812         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
12813                 let contents = if o.result_ok {
12814                         let result = unsafe { o.contents.result };
12815                         unsafe { o.contents.result = core::ptr::null_mut() };
12816                         CResult_PingDecodeErrorZPtr { result }
12817                 } else {
12818                         let err = unsafe { o.contents.err };
12819                         unsafe { o.contents.err = core::ptr::null_mut(); }
12820                         CResult_PingDecodeErrorZPtr { err }
12821                 };
12822                 Self {
12823                         contents,
12824                         result_ok: o.result_ok,
12825                 }
12826         }
12827 }
12828 impl Clone for CResult_PingDecodeErrorZ {
12829         fn clone(&self) -> Self {
12830                 if self.result_ok {
12831                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
12832                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
12833                         } }
12834                 } else {
12835                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
12836                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12837                         } }
12838                 }
12839         }
12840 }
12841 #[no_mangle]
12842 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
12843 /// but with all dynamically-allocated buffers duplicated in new buffers.
12844 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
12845 #[repr(C)]
12846 /// The contents of CResult_PongDecodeErrorZ
12847 pub union CResult_PongDecodeErrorZPtr {
12848         /// A pointer to the contents in the success state.
12849         /// Reading from this pointer when `result_ok` is not set is undefined.
12850         pub result: *mut crate::lightning::ln::msgs::Pong,
12851         /// A pointer to the contents in the error state.
12852         /// Reading from this pointer when `result_ok` is set is undefined.
12853         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12854 }
12855 #[repr(C)]
12856 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
12857 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
12858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12859 pub struct CResult_PongDecodeErrorZ {
12860         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
12861         /// `err` or `result` depending on the state of `result_ok`.
12862         pub contents: CResult_PongDecodeErrorZPtr,
12863         /// Whether this CResult_PongDecodeErrorZ represents a success state.
12864         pub result_ok: bool,
12865 }
12866 #[no_mangle]
12867 /// Creates a new CResult_PongDecodeErrorZ in the success state.
12868 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
12869         CResult_PongDecodeErrorZ {
12870                 contents: CResult_PongDecodeErrorZPtr {
12871                         result: Box::into_raw(Box::new(o)),
12872                 },
12873                 result_ok: true,
12874         }
12875 }
12876 #[no_mangle]
12877 /// Creates a new CResult_PongDecodeErrorZ in the error state.
12878 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
12879         CResult_PongDecodeErrorZ {
12880                 contents: CResult_PongDecodeErrorZPtr {
12881                         err: Box::into_raw(Box::new(e)),
12882                 },
12883                 result_ok: false,
12884         }
12885 }
12886 /// Checks if the given object is currently in the success state
12887 #[no_mangle]
12888 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
12889         o.result_ok
12890 }
12891 #[no_mangle]
12892 /// Frees any resources used by the CResult_PongDecodeErrorZ.
12893 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
12894 impl Drop for CResult_PongDecodeErrorZ {
12895         fn drop(&mut self) {
12896                 if self.result_ok {
12897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12899                         }
12900                 } else {
12901                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12902                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12903                         }
12904                 }
12905         }
12906 }
12907 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
12908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
12909                 let contents = if o.result_ok {
12910                         let result = unsafe { o.contents.result };
12911                         unsafe { o.contents.result = core::ptr::null_mut() };
12912                         CResult_PongDecodeErrorZPtr { result }
12913                 } else {
12914                         let err = unsafe { o.contents.err };
12915                         unsafe { o.contents.err = core::ptr::null_mut(); }
12916                         CResult_PongDecodeErrorZPtr { err }
12917                 };
12918                 Self {
12919                         contents,
12920                         result_ok: o.result_ok,
12921                 }
12922         }
12923 }
12924 impl Clone for CResult_PongDecodeErrorZ {
12925         fn clone(&self) -> Self {
12926                 if self.result_ok {
12927                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
12928                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
12929                         } }
12930                 } else {
12931                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
12932                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12933                         } }
12934                 }
12935         }
12936 }
12937 #[no_mangle]
12938 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
12939 /// but with all dynamically-allocated buffers duplicated in new buffers.
12940 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
12941 #[repr(C)]
12942 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
12943 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12944         /// A pointer to the contents in the success state.
12945         /// Reading from this pointer when `result_ok` is not set is undefined.
12946         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
12947         /// A pointer to the contents in the error state.
12948         /// Reading from this pointer when `result_ok` is set is undefined.
12949         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12950 }
12951 #[repr(C)]
12952 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
12953 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
12954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12955 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12956         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
12957         /// `err` or `result` depending on the state of `result_ok`.
12958         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
12959         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
12960         pub result_ok: bool,
12961 }
12962 #[no_mangle]
12963 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
12964 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12965         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12966                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12967                         result: Box::into_raw(Box::new(o)),
12968                 },
12969                 result_ok: true,
12970         }
12971 }
12972 #[no_mangle]
12973 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
12974 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12975         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12976                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
12977                         err: Box::into_raw(Box::new(e)),
12978                 },
12979                 result_ok: false,
12980         }
12981 }
12982 /// Checks if the given object is currently in the success state
12983 #[no_mangle]
12984 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
12985         o.result_ok
12986 }
12987 #[no_mangle]
12988 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
12989 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
12990 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
12991         fn drop(&mut self) {
12992                 if self.result_ok {
12993                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12994                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12995                         }
12996                 } else {
12997                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12998                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12999                         }
13000                 }
13001         }
13002 }
13003 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13004         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13005                 let contents = if o.result_ok {
13006                         let result = unsafe { o.contents.result };
13007                         unsafe { o.contents.result = core::ptr::null_mut() };
13008                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13009                 } else {
13010                         let err = unsafe { o.contents.err };
13011                         unsafe { o.contents.err = core::ptr::null_mut(); }
13012                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13013                 };
13014                 Self {
13015                         contents,
13016                         result_ok: o.result_ok,
13017                 }
13018         }
13019 }
13020 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13021         fn clone(&self) -> Self {
13022                 if self.result_ok {
13023                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13024                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13025                         } }
13026                 } else {
13027                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13028                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13029                         } }
13030                 }
13031         }
13032 }
13033 #[no_mangle]
13034 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13035 /// but with all dynamically-allocated buffers duplicated in new buffers.
13036 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13037 #[repr(C)]
13038 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13039 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13040         /// A pointer to the contents in the success state.
13041         /// Reading from this pointer when `result_ok` is not set is undefined.
13042         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13043         /// A pointer to the contents in the error state.
13044         /// Reading from this pointer when `result_ok` is set is undefined.
13045         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13046 }
13047 #[repr(C)]
13048 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13049 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13051 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
13052         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
13053         /// `err` or `result` depending on the state of `result_ok`.
13054         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
13055         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
13056         pub result_ok: bool,
13057 }
13058 #[no_mangle]
13059 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13060 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
13061         CResult_ChannelAnnouncementDecodeErrorZ {
13062                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13063                         result: Box::into_raw(Box::new(o)),
13064                 },
13065                 result_ok: true,
13066         }
13067 }
13068 #[no_mangle]
13069 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13070 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
13071         CResult_ChannelAnnouncementDecodeErrorZ {
13072                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13073                         err: Box::into_raw(Box::new(e)),
13074                 },
13075                 result_ok: false,
13076         }
13077 }
13078 /// Checks if the given object is currently in the success state
13079 #[no_mangle]
13080 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
13081         o.result_ok
13082 }
13083 #[no_mangle]
13084 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13085 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
13086 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
13087         fn drop(&mut self) {
13088                 if self.result_ok {
13089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13091                         }
13092                 } else {
13093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13095                         }
13096                 }
13097         }
13098 }
13099 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
13100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13101                 let contents = if o.result_ok {
13102                         let result = unsafe { o.contents.result };
13103                         unsafe { o.contents.result = core::ptr::null_mut() };
13104                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
13105                 } else {
13106                         let err = unsafe { o.contents.err };
13107                         unsafe { o.contents.err = core::ptr::null_mut(); }
13108                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
13109                 };
13110                 Self {
13111                         contents,
13112                         result_ok: o.result_ok,
13113                 }
13114         }
13115 }
13116 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
13117         fn clone(&self) -> Self {
13118                 if self.result_ok {
13119                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13120                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13121                         } }
13122                 } else {
13123                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13124                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13125                         } }
13126                 }
13127         }
13128 }
13129 #[no_mangle]
13130 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13131 /// but with all dynamically-allocated buffers duplicated in new buffers.
13132 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13133 #[repr(C)]
13134 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
13135 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13136         /// A pointer to the contents in the success state.
13137         /// Reading from this pointer when `result_ok` is not set is undefined.
13138         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
13139         /// A pointer to the contents in the error state.
13140         /// Reading from this pointer when `result_ok` is set is undefined.
13141         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13142 }
13143 #[repr(C)]
13144 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13145 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13147 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
13148         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
13149         /// `err` or `result` depending on the state of `result_ok`.
13150         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
13151         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
13152         pub result_ok: bool,
13153 }
13154 #[no_mangle]
13155 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13156 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13157         CResult_UnsignedChannelUpdateDecodeErrorZ {
13158                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13159                         result: Box::into_raw(Box::new(o)),
13160                 },
13161                 result_ok: true,
13162         }
13163 }
13164 #[no_mangle]
13165 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
13166 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
13167         CResult_UnsignedChannelUpdateDecodeErrorZ {
13168                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13169                         err: Box::into_raw(Box::new(e)),
13170                 },
13171                 result_ok: false,
13172         }
13173 }
13174 /// Checks if the given object is currently in the success state
13175 #[no_mangle]
13176 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
13177         o.result_ok
13178 }
13179 #[no_mangle]
13180 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
13181 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
13182 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
13183         fn drop(&mut self) {
13184                 if self.result_ok {
13185                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13186                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13187                         }
13188                 } else {
13189                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13190                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13191                         }
13192                 }
13193         }
13194 }
13195 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
13196         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13197                 let contents = if o.result_ok {
13198                         let result = unsafe { o.contents.result };
13199                         unsafe { o.contents.result = core::ptr::null_mut() };
13200                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
13201                 } else {
13202                         let err = unsafe { o.contents.err };
13203                         unsafe { o.contents.err = core::ptr::null_mut(); }
13204                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
13205                 };
13206                 Self {
13207                         contents,
13208                         result_ok: o.result_ok,
13209                 }
13210         }
13211 }
13212 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
13213         fn clone(&self) -> Self {
13214                 if self.result_ok {
13215                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13216                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
13217                         } }
13218                 } else {
13219                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13220                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13221                         } }
13222                 }
13223         }
13224 }
13225 #[no_mangle]
13226 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
13227 /// but with all dynamically-allocated buffers duplicated in new buffers.
13228 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13229 #[repr(C)]
13230 /// The contents of CResult_ChannelUpdateDecodeErrorZ
13231 pub union CResult_ChannelUpdateDecodeErrorZPtr {
13232         /// A pointer to the contents in the success state.
13233         /// Reading from this pointer when `result_ok` is not set is undefined.
13234         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
13235         /// A pointer to the contents in the error state.
13236         /// Reading from this pointer when `result_ok` is set is undefined.
13237         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13238 }
13239 #[repr(C)]
13240 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13241 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13243 pub struct CResult_ChannelUpdateDecodeErrorZ {
13244         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
13245         /// `err` or `result` depending on the state of `result_ok`.
13246         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
13247         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
13248         pub result_ok: bool,
13249 }
13250 #[no_mangle]
13251 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
13252 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
13253         CResult_ChannelUpdateDecodeErrorZ {
13254                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13255                         result: Box::into_raw(Box::new(o)),
13256                 },
13257                 result_ok: true,
13258         }
13259 }
13260 #[no_mangle]
13261 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
13262 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
13263         CResult_ChannelUpdateDecodeErrorZ {
13264                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
13265                         err: Box::into_raw(Box::new(e)),
13266                 },
13267                 result_ok: false,
13268         }
13269 }
13270 /// Checks if the given object is currently in the success state
13271 #[no_mangle]
13272 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
13273         o.result_ok
13274 }
13275 #[no_mangle]
13276 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
13277 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
13278 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
13279         fn drop(&mut self) {
13280                 if self.result_ok {
13281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13283                         }
13284                 } else {
13285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13287                         }
13288                 }
13289         }
13290 }
13291 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
13292         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
13293                 let contents = if o.result_ok {
13294                         let result = unsafe { o.contents.result };
13295                         unsafe { o.contents.result = core::ptr::null_mut() };
13296                         CResult_ChannelUpdateDecodeErrorZPtr { result }
13297                 } else {
13298                         let err = unsafe { o.contents.err };
13299                         unsafe { o.contents.err = core::ptr::null_mut(); }
13300                         CResult_ChannelUpdateDecodeErrorZPtr { err }
13301                 };
13302                 Self {
13303                         contents,
13304                         result_ok: o.result_ok,
13305                 }
13306         }
13307 }
13308 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
13309         fn clone(&self) -> Self {
13310                 if self.result_ok {
13311                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13312                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
13313                         } }
13314                 } else {
13315                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
13316                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13317                         } }
13318                 }
13319         }
13320 }
13321 #[no_mangle]
13322 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
13323 /// but with all dynamically-allocated buffers duplicated in new buffers.
13324 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
13325 #[repr(C)]
13326 /// The contents of CResult_ErrorMessageDecodeErrorZ
13327 pub union CResult_ErrorMessageDecodeErrorZPtr {
13328         /// A pointer to the contents in the success state.
13329         /// Reading from this pointer when `result_ok` is not set is undefined.
13330         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
13331         /// A pointer to the contents in the error state.
13332         /// Reading from this pointer when `result_ok` is set is undefined.
13333         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13334 }
13335 #[repr(C)]
13336 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
13337 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
13338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13339 pub struct CResult_ErrorMessageDecodeErrorZ {
13340         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
13341         /// `err` or `result` depending on the state of `result_ok`.
13342         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
13343         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
13344         pub result_ok: bool,
13345 }
13346 #[no_mangle]
13347 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
13348 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
13349         CResult_ErrorMessageDecodeErrorZ {
13350                 contents: CResult_ErrorMessageDecodeErrorZPtr {
13351                         result: Box::into_raw(Box::new(o)),
13352                 },
13353                 result_ok: true,
13354         }
13355 }
13356 #[no_mangle]
13357 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
13358 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
13359         CResult_ErrorMessageDecodeErrorZ {
13360                 contents: CResult_ErrorMessageDecodeErrorZPtr {
13361                         err: Box::into_raw(Box::new(e)),
13362                 },
13363                 result_ok: false,
13364         }
13365 }
13366 /// Checks if the given object is currently in the success state
13367 #[no_mangle]
13368 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
13369         o.result_ok
13370 }
13371 #[no_mangle]
13372 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
13373 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
13374 impl Drop for CResult_ErrorMessageDecodeErrorZ {
13375         fn drop(&mut self) {
13376                 if self.result_ok {
13377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13379                         }
13380                 } else {
13381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13383                         }
13384                 }
13385         }
13386 }
13387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
13388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
13389                 let contents = if o.result_ok {
13390                         let result = unsafe { o.contents.result };
13391                         unsafe { o.contents.result = core::ptr::null_mut() };
13392                         CResult_ErrorMessageDecodeErrorZPtr { result }
13393                 } else {
13394                         let err = unsafe { o.contents.err };
13395                         unsafe { o.contents.err = core::ptr::null_mut(); }
13396                         CResult_ErrorMessageDecodeErrorZPtr { err }
13397                 };
13398                 Self {
13399                         contents,
13400                         result_ok: o.result_ok,
13401                 }
13402         }
13403 }
13404 impl Clone for CResult_ErrorMessageDecodeErrorZ {
13405         fn clone(&self) -> Self {
13406                 if self.result_ok {
13407                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
13408                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
13409                         } }
13410                 } else {
13411                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
13412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13413                         } }
13414                 }
13415         }
13416 }
13417 #[no_mangle]
13418 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
13419 /// but with all dynamically-allocated buffers duplicated in new buffers.
13420 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
13421 #[repr(C)]
13422 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
13423 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13424         /// A pointer to the contents in the success state.
13425         /// Reading from this pointer when `result_ok` is not set is undefined.
13426         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
13427         /// A pointer to the contents in the error state.
13428         /// Reading from this pointer when `result_ok` is set is undefined.
13429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13430 }
13431 #[repr(C)]
13432 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13433 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13435 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13436         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
13437         /// `err` or `result` depending on the state of `result_ok`.
13438         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
13439         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
13440         pub result_ok: bool,
13441 }
13442 #[no_mangle]
13443 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
13444 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13445         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13446                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13447                         result: Box::into_raw(Box::new(o)),
13448                 },
13449                 result_ok: true,
13450         }
13451 }
13452 #[no_mangle]
13453 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
13454 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13455         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13456                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13457                         err: Box::into_raw(Box::new(e)),
13458                 },
13459                 result_ok: false,
13460         }
13461 }
13462 /// Checks if the given object is currently in the success state
13463 #[no_mangle]
13464 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
13465         o.result_ok
13466 }
13467 #[no_mangle]
13468 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
13469 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
13470 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13471         fn drop(&mut self) {
13472                 if self.result_ok {
13473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13475                         }
13476                 } else {
13477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13479                         }
13480                 }
13481         }
13482 }
13483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13485                 let contents = if o.result_ok {
13486                         let result = unsafe { o.contents.result };
13487                         unsafe { o.contents.result = core::ptr::null_mut() };
13488                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
13489                 } else {
13490                         let err = unsafe { o.contents.err };
13491                         unsafe { o.contents.err = core::ptr::null_mut(); }
13492                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
13493                 };
13494                 Self {
13495                         contents,
13496                         result_ok: o.result_ok,
13497                 }
13498         }
13499 }
13500 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
13501         fn clone(&self) -> Self {
13502                 if self.result_ok {
13503                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13504                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13505                         } }
13506                 } else {
13507                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
13508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13509                         } }
13510                 }
13511         }
13512 }
13513 #[no_mangle]
13514 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
13515 /// but with all dynamically-allocated buffers duplicated in new buffers.
13516 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13517 #[repr(C)]
13518 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
13519 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
13520         /// A pointer to the contents in the success state.
13521         /// Reading from this pointer when `result_ok` is not set is undefined.
13522         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
13523         /// A pointer to the contents in the error state.
13524         /// Reading from this pointer when `result_ok` is set is undefined.
13525         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13526 }
13527 #[repr(C)]
13528 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
13529 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13531 pub struct CResult_NodeAnnouncementDecodeErrorZ {
13532         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
13533         /// `err` or `result` depending on the state of `result_ok`.
13534         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
13535         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
13536         pub result_ok: bool,
13537 }
13538 #[no_mangle]
13539 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
13540 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
13541         CResult_NodeAnnouncementDecodeErrorZ {
13542                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13543                         result: Box::into_raw(Box::new(o)),
13544                 },
13545                 result_ok: true,
13546         }
13547 }
13548 #[no_mangle]
13549 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
13550 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
13551         CResult_NodeAnnouncementDecodeErrorZ {
13552                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13553                         err: Box::into_raw(Box::new(e)),
13554                 },
13555                 result_ok: false,
13556         }
13557 }
13558 /// Checks if the given object is currently in the success state
13559 #[no_mangle]
13560 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
13561         o.result_ok
13562 }
13563 #[no_mangle]
13564 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
13565 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
13566 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
13567         fn drop(&mut self) {
13568                 if self.result_ok {
13569                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13570                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13571                         }
13572                 } else {
13573                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13574                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13575                         }
13576                 }
13577         }
13578 }
13579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
13580         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13581                 let contents = if o.result_ok {
13582                         let result = unsafe { o.contents.result };
13583                         unsafe { o.contents.result = core::ptr::null_mut() };
13584                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
13585                 } else {
13586                         let err = unsafe { o.contents.err };
13587                         unsafe { o.contents.err = core::ptr::null_mut(); }
13588                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
13589                 };
13590                 Self {
13591                         contents,
13592                         result_ok: o.result_ok,
13593                 }
13594         }
13595 }
13596 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
13597         fn clone(&self) -> Self {
13598                 if self.result_ok {
13599                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13600                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
13601                         } }
13602                 } else {
13603                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
13604                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13605                         } }
13606                 }
13607         }
13608 }
13609 #[no_mangle]
13610 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
13611 /// but with all dynamically-allocated buffers duplicated in new buffers.
13612 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13613 #[repr(C)]
13614 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
13615 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
13616         /// A pointer to the contents in the success state.
13617         /// Reading from this pointer when `result_ok` is not set is undefined.
13618         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
13619         /// A pointer to the contents in the error state.
13620         /// Reading from this pointer when `result_ok` is set is undefined.
13621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13622 }
13623 #[repr(C)]
13624 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
13625 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
13626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13627 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
13628         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
13629         /// `err` or `result` depending on the state of `result_ok`.
13630         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
13631         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
13632         pub result_ok: bool,
13633 }
13634 #[no_mangle]
13635 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
13636 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13637         CResult_QueryShortChannelIdsDecodeErrorZ {
13638                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13639                         result: Box::into_raw(Box::new(o)),
13640                 },
13641                 result_ok: true,
13642         }
13643 }
13644 #[no_mangle]
13645 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
13646 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
13647         CResult_QueryShortChannelIdsDecodeErrorZ {
13648                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13649                         err: Box::into_raw(Box::new(e)),
13650                 },
13651                 result_ok: false,
13652         }
13653 }
13654 /// Checks if the given object is currently in the success state
13655 #[no_mangle]
13656 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
13657         o.result_ok
13658 }
13659 #[no_mangle]
13660 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
13661 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
13662 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
13663         fn drop(&mut self) {
13664                 if self.result_ok {
13665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13667                         }
13668                 } else {
13669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13671                         }
13672                 }
13673         }
13674 }
13675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
13676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
13677                 let contents = if o.result_ok {
13678                         let result = unsafe { o.contents.result };
13679                         unsafe { o.contents.result = core::ptr::null_mut() };
13680                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
13681                 } else {
13682                         let err = unsafe { o.contents.err };
13683                         unsafe { o.contents.err = core::ptr::null_mut(); }
13684                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
13685                 };
13686                 Self {
13687                         contents,
13688                         result_ok: o.result_ok,
13689                 }
13690         }
13691 }
13692 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
13693         fn clone(&self) -> Self {
13694                 if self.result_ok {
13695                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13696                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
13697                         } }
13698                 } else {
13699                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
13700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13701                         } }
13702                 }
13703         }
13704 }
13705 #[no_mangle]
13706 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
13707 /// but with all dynamically-allocated buffers duplicated in new buffers.
13708 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
13709 #[repr(C)]
13710 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
13711 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13712         /// A pointer to the contents in the success state.
13713         /// Reading from this pointer when `result_ok` is not set is undefined.
13714         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
13715         /// A pointer to the contents in the error state.
13716         /// Reading from this pointer when `result_ok` is set is undefined.
13717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13718 }
13719 #[repr(C)]
13720 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
13721 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
13722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13723 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13724         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
13725         /// `err` or `result` depending on the state of `result_ok`.
13726         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
13727         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
13728         pub result_ok: bool,
13729 }
13730 #[no_mangle]
13731 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
13732 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13733         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13734                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13735                         result: Box::into_raw(Box::new(o)),
13736                 },
13737                 result_ok: true,
13738         }
13739 }
13740 #[no_mangle]
13741 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
13742 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13743         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13744                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13745                         err: Box::into_raw(Box::new(e)),
13746                 },
13747                 result_ok: false,
13748         }
13749 }
13750 /// Checks if the given object is currently in the success state
13751 #[no_mangle]
13752 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
13753         o.result_ok
13754 }
13755 #[no_mangle]
13756 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
13757 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
13758 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13759         fn drop(&mut self) {
13760                 if self.result_ok {
13761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13763                         }
13764                 } else {
13765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13767                         }
13768                 }
13769         }
13770 }
13771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
13773                 let contents = if o.result_ok {
13774                         let result = unsafe { o.contents.result };
13775                         unsafe { o.contents.result = core::ptr::null_mut() };
13776                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
13777                 } else {
13778                         let err = unsafe { o.contents.err };
13779                         unsafe { o.contents.err = core::ptr::null_mut(); }
13780                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
13781                 };
13782                 Self {
13783                         contents,
13784                         result_ok: o.result_ok,
13785                 }
13786         }
13787 }
13788 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
13789         fn clone(&self) -> Self {
13790                 if self.result_ok {
13791                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13792                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
13793                         } }
13794                 } else {
13795                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
13796                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13797                         } }
13798                 }
13799         }
13800 }
13801 #[no_mangle]
13802 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
13803 /// but with all dynamically-allocated buffers duplicated in new buffers.
13804 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
13805 #[repr(C)]
13806 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
13807 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
13808         /// A pointer to the contents in the success state.
13809         /// Reading from this pointer when `result_ok` is not set is undefined.
13810         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
13811         /// A pointer to the contents in the error state.
13812         /// Reading from this pointer when `result_ok` is set is undefined.
13813         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13814 }
13815 #[repr(C)]
13816 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
13817 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13819 pub struct CResult_QueryChannelRangeDecodeErrorZ {
13820         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
13821         /// `err` or `result` depending on the state of `result_ok`.
13822         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
13823         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
13824         pub result_ok: bool,
13825 }
13826 #[no_mangle]
13827 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
13828 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
13829         CResult_QueryChannelRangeDecodeErrorZ {
13830                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13831                         result: Box::into_raw(Box::new(o)),
13832                 },
13833                 result_ok: true,
13834         }
13835 }
13836 #[no_mangle]
13837 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
13838 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
13839         CResult_QueryChannelRangeDecodeErrorZ {
13840                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13841                         err: Box::into_raw(Box::new(e)),
13842                 },
13843                 result_ok: false,
13844         }
13845 }
13846 /// Checks if the given object is currently in the success state
13847 #[no_mangle]
13848 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
13849         o.result_ok
13850 }
13851 #[no_mangle]
13852 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
13853 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
13854 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
13855         fn drop(&mut self) {
13856                 if self.result_ok {
13857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13859                         }
13860                 } else {
13861                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13862                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13863                         }
13864                 }
13865         }
13866 }
13867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
13868         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13869                 let contents = if o.result_ok {
13870                         let result = unsafe { o.contents.result };
13871                         unsafe { o.contents.result = core::ptr::null_mut() };
13872                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
13873                 } else {
13874                         let err = unsafe { o.contents.err };
13875                         unsafe { o.contents.err = core::ptr::null_mut(); }
13876                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
13877                 };
13878                 Self {
13879                         contents,
13880                         result_ok: o.result_ok,
13881                 }
13882         }
13883 }
13884 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
13885         fn clone(&self) -> Self {
13886                 if self.result_ok {
13887                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13888                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
13889                         } }
13890                 } else {
13891                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
13892                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13893                         } }
13894                 }
13895         }
13896 }
13897 #[no_mangle]
13898 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
13899 /// but with all dynamically-allocated buffers duplicated in new buffers.
13900 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13901 #[repr(C)]
13902 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
13903 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
13904         /// A pointer to the contents in the success state.
13905         /// Reading from this pointer when `result_ok` is not set is undefined.
13906         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
13907         /// A pointer to the contents in the error state.
13908         /// Reading from this pointer when `result_ok` is set is undefined.
13909         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13910 }
13911 #[repr(C)]
13912 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
13913 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
13914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13915 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
13916         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
13917         /// `err` or `result` depending on the state of `result_ok`.
13918         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
13919         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
13920         pub result_ok: bool,
13921 }
13922 #[no_mangle]
13923 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
13924 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
13925         CResult_ReplyChannelRangeDecodeErrorZ {
13926                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13927                         result: Box::into_raw(Box::new(o)),
13928                 },
13929                 result_ok: true,
13930         }
13931 }
13932 #[no_mangle]
13933 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
13934 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
13935         CResult_ReplyChannelRangeDecodeErrorZ {
13936                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13937                         err: Box::into_raw(Box::new(e)),
13938                 },
13939                 result_ok: false,
13940         }
13941 }
13942 /// Checks if the given object is currently in the success state
13943 #[no_mangle]
13944 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
13945         o.result_ok
13946 }
13947 #[no_mangle]
13948 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
13949 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
13950 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
13951         fn drop(&mut self) {
13952                 if self.result_ok {
13953                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13954                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13955                         }
13956                 } else {
13957                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13958                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13959                         }
13960                 }
13961         }
13962 }
13963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
13964         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13965                 let contents = if o.result_ok {
13966                         let result = unsafe { o.contents.result };
13967                         unsafe { o.contents.result = core::ptr::null_mut() };
13968                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
13969                 } else {
13970                         let err = unsafe { o.contents.err };
13971                         unsafe { o.contents.err = core::ptr::null_mut(); }
13972                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
13973                 };
13974                 Self {
13975                         contents,
13976                         result_ok: o.result_ok,
13977                 }
13978         }
13979 }
13980 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
13981         fn clone(&self) -> Self {
13982                 if self.result_ok {
13983                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13984                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
13985                         } }
13986                 } else {
13987                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
13988                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13989                         } }
13990                 }
13991         }
13992 }
13993 #[no_mangle]
13994 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
13995 /// but with all dynamically-allocated buffers duplicated in new buffers.
13996 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
13997 #[repr(C)]
13998 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
13999 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
14000         /// A pointer to the contents in the success state.
14001         /// Reading from this pointer when `result_ok` is not set is undefined.
14002         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
14003         /// A pointer to the contents in the error state.
14004         /// Reading from this pointer when `result_ok` is set is undefined.
14005         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14006 }
14007 #[repr(C)]
14008 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
14009 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
14010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14011 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
14012         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
14013         /// `err` or `result` depending on the state of `result_ok`.
14014         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
14015         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
14016         pub result_ok: bool,
14017 }
14018 #[no_mangle]
14019 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14020 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
14021         CResult_GossipTimestampFilterDecodeErrorZ {
14022                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14023                         result: Box::into_raw(Box::new(o)),
14024                 },
14025                 result_ok: true,
14026         }
14027 }
14028 #[no_mangle]
14029 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14030 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
14031         CResult_GossipTimestampFilterDecodeErrorZ {
14032                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14033                         err: Box::into_raw(Box::new(e)),
14034                 },
14035                 result_ok: false,
14036         }
14037 }
14038 /// Checks if the given object is currently in the success state
14039 #[no_mangle]
14040 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
14041         o.result_ok
14042 }
14043 #[no_mangle]
14044 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14045 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
14046 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
14047         fn drop(&mut self) {
14048                 if self.result_ok {
14049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14051                         }
14052                 } else {
14053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14055                         }
14056                 }
14057         }
14058 }
14059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
14060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
14061                 let contents = if o.result_ok {
14062                         let result = unsafe { o.contents.result };
14063                         unsafe { o.contents.result = core::ptr::null_mut() };
14064                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
14065                 } else {
14066                         let err = unsafe { o.contents.err };
14067                         unsafe { o.contents.err = core::ptr::null_mut(); }
14068                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
14069                 };
14070                 Self {
14071                         contents,
14072                         result_ok: o.result_ok,
14073                 }
14074         }
14075 }
14076 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
14077         fn clone(&self) -> Self {
14078                 if self.result_ok {
14079                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14080                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
14081                         } }
14082                 } else {
14083                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14085                         } }
14086                 }
14087         }
14088 }
14089 #[no_mangle]
14090 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
14091 /// but with all dynamically-allocated buffers duplicated in new buffers.
14092 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
14093 #[repr(C)]
14094 /// The contents of CResult_InvoiceSignOrCreationErrorZ
14095 pub union CResult_InvoiceSignOrCreationErrorZPtr {
14096         /// A pointer to the contents in the success state.
14097         /// Reading from this pointer when `result_ok` is not set is undefined.
14098         pub result: *mut crate::lightning_invoice::Invoice,
14099         /// A pointer to the contents in the error state.
14100         /// Reading from this pointer when `result_ok` is set is undefined.
14101         pub err: *mut crate::lightning_invoice::SignOrCreationError,
14102 }
14103 #[repr(C)]
14104 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
14105 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
14106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14107 pub struct CResult_InvoiceSignOrCreationErrorZ {
14108         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
14109         /// `err` or `result` depending on the state of `result_ok`.
14110         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
14111         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
14112         pub result_ok: bool,
14113 }
14114 #[no_mangle]
14115 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
14116 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
14117         CResult_InvoiceSignOrCreationErrorZ {
14118                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14119                         result: Box::into_raw(Box::new(o)),
14120                 },
14121                 result_ok: true,
14122         }
14123 }
14124 #[no_mangle]
14125 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
14126 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
14127         CResult_InvoiceSignOrCreationErrorZ {
14128                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
14129                         err: Box::into_raw(Box::new(e)),
14130                 },
14131                 result_ok: false,
14132         }
14133 }
14134 /// Checks if the given object is currently in the success state
14135 #[no_mangle]
14136 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
14137         o.result_ok
14138 }
14139 #[no_mangle]
14140 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
14141 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
14142 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
14143         fn drop(&mut self) {
14144                 if self.result_ok {
14145                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14146                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14147                         }
14148                 } else {
14149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14151                         }
14152                 }
14153         }
14154 }
14155 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
14156         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
14157                 let contents = if o.result_ok {
14158                         let result = unsafe { o.contents.result };
14159                         unsafe { o.contents.result = core::ptr::null_mut() };
14160                         CResult_InvoiceSignOrCreationErrorZPtr { result }
14161                 } else {
14162                         let err = unsafe { o.contents.err };
14163                         unsafe { o.contents.err = core::ptr::null_mut(); }
14164                         CResult_InvoiceSignOrCreationErrorZPtr { err }
14165                 };
14166                 Self {
14167                         contents,
14168                         result_ok: o.result_ok,
14169                 }
14170         }
14171 }
14172 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
14173         fn clone(&self) -> Self {
14174                 if self.result_ok {
14175                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14176                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
14177                         } }
14178                 } else {
14179                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
14180                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
14181                         } }
14182                 }
14183         }
14184 }
14185 #[no_mangle]
14186 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
14187 /// but with all dynamically-allocated buffers duplicated in new buffers.
14188 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
14189 #[repr(C)]
14190 /// An enum which can either contain a crate::lightning::chain::Filter or not
14191 pub enum COption_FilterZ {
14192         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
14193         Some(crate::lightning::chain::Filter),
14194         /// When we're in this state, this COption_FilterZ contains nothing
14195         None
14196 }
14197 impl COption_FilterZ {
14198         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
14199                 if let Self::None = self { false } else { true }
14200         }
14201         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
14202                 !self.is_some()
14203         }
14204         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
14205                 if let Self::Some(v) = self { v } else { unreachable!() }
14206         }
14207 }
14208 #[no_mangle]
14209 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
14210 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
14211         COption_FilterZ::Some(o)
14212 }
14213 #[no_mangle]
14214 /// Constructs a new COption_FilterZ containing nothing
14215 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
14216         COption_FilterZ::None
14217 }
14218 #[no_mangle]
14219 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
14220 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
14221 #[repr(C)]
14222 /// The contents of CResult_LockedChannelMonitorNoneZ
14223 pub union CResult_LockedChannelMonitorNoneZPtr {
14224         /// A pointer to the contents in the success state.
14225         /// Reading from this pointer when `result_ok` is not set is undefined.
14226         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
14227         /// Note that this value is always NULL, as there are no contents in the Err variant
14228         pub err: *mut core::ffi::c_void,
14229 }
14230 #[repr(C)]
14231 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
14232 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
14233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14234 pub struct CResult_LockedChannelMonitorNoneZ {
14235         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
14236         /// `err` or `result` depending on the state of `result_ok`.
14237         pub contents: CResult_LockedChannelMonitorNoneZPtr,
14238         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
14239         pub result_ok: bool,
14240 }
14241 #[no_mangle]
14242 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
14243 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
14244         CResult_LockedChannelMonitorNoneZ {
14245                 contents: CResult_LockedChannelMonitorNoneZPtr {
14246                         result: Box::into_raw(Box::new(o)),
14247                 },
14248                 result_ok: true,
14249         }
14250 }
14251 #[no_mangle]
14252 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
14253 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
14254         CResult_LockedChannelMonitorNoneZ {
14255                 contents: CResult_LockedChannelMonitorNoneZPtr {
14256                         err: core::ptr::null_mut(),
14257                 },
14258                 result_ok: false,
14259         }
14260 }
14261 /// Checks if the given object is currently in the success state
14262 #[no_mangle]
14263 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
14264         o.result_ok
14265 }
14266 #[no_mangle]
14267 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
14268 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
14269 impl Drop for CResult_LockedChannelMonitorNoneZ {
14270         fn drop(&mut self) {
14271                 if self.result_ok {
14272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14274                         }
14275                 } else {
14276                 }
14277         }
14278 }
14279 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
14280         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
14281                 let contents = if o.result_ok {
14282                         let result = unsafe { o.contents.result };
14283                         unsafe { o.contents.result = core::ptr::null_mut() };
14284                         CResult_LockedChannelMonitorNoneZPtr { result }
14285                 } else {
14286                         let _ = unsafe { Box::from_raw(o.contents.err) };
14287                         o.contents.err = core::ptr::null_mut();
14288                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
14289                 };
14290                 Self {
14291                         contents,
14292                         result_ok: o.result_ok,
14293                 }
14294         }
14295 }
14296 #[repr(C)]
14297 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
14298 /// This corresponds to std::vector in C++
14299 pub struct CVec_OutPointZ {
14300         /// The elements in the array.
14301         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
14302         pub data: *mut crate::lightning::chain::transaction::OutPoint,
14303         /// The number of elements pointed to by `data`.
14304         pub datalen: usize
14305 }
14306 impl CVec_OutPointZ {
14307         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
14308                 if self.datalen == 0 { return Vec::new(); }
14309                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
14310                 self.data = core::ptr::null_mut();
14311                 self.datalen = 0;
14312                 ret
14313         }
14314         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
14315                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
14316         }
14317 }
14318 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
14319         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
14320                 let datalen = v.len();
14321                 let data = Box::into_raw(v.into_boxed_slice());
14322                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
14323         }
14324 }
14325 #[no_mangle]
14326 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
14327 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
14328 impl Drop for CVec_OutPointZ {
14329         fn drop(&mut self) {
14330                 if self.datalen == 0 { return; }
14331                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
14332         }
14333 }
14334 impl Clone for CVec_OutPointZ {
14335         fn clone(&self) -> Self {
14336                 let mut res = Vec::new();
14337                 if self.datalen == 0 { return Self::from(res); }
14338                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
14339                 Self::from(res)
14340         }
14341 }