6c184463ee7c27bc2bd41999278cc0d86da43860
[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_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// Note that this value is always NULL, as there are no contents in the Err variant
16         pub err: *mut core::ffi::c_void,
17 }
18 #[repr(C)]
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23         /// The contents of this CResult_NoneNoneZ, accessible via either
24         /// `err` or `result` depending on the state of `result_ok`.
25         pub contents: CResult_NoneNoneZPtr,
26         /// Whether this CResult_NoneNoneZ represents a success state.
27         pub result_ok: bool,
28 }
29 #[no_mangle]
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
32         CResult_NoneNoneZ {
33                 contents: CResult_NoneNoneZPtr {
34                         result: core::ptr::null_mut(),
35                 },
36                 result_ok: true,
37         }
38 }
39 #[no_mangle]
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
42         CResult_NoneNoneZ {
43                 contents: CResult_NoneNoneZPtr {
44                         err: core::ptr::null_mut(),
45                 },
46                 result_ok: false,
47         }
48 }
49 /// Checks if the given object is currently in the success state
50 #[no_mangle]
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
52         o.result_ok
53 }
54 #[no_mangle]
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
58         fn drop(&mut self) {
59                 if self.result_ok {
60                 } else {
61                 }
62         }
63 }
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66                 let contents = if o.result_ok {
67                         let _ = unsafe { Box::from_raw(o.contents.result) };
68                         o.contents.result = core::ptr::null_mut();
69                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
70                 } else {
71                         let _ = unsafe { Box::from_raw(o.contents.err) };
72                         o.contents.err = core::ptr::null_mut();
73                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
74                 };
75                 Self {
76                         contents,
77                         result_ok: o.result_ok,
78                 }
79         }
80 }
81 impl Clone for CResult_NoneNoneZ {
82         fn clone(&self) -> Self {
83                 if self.result_ok {
84                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85                                 result: core::ptr::null_mut()
86                         } }
87                 } else {
88                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89                                 err: core::ptr::null_mut()
90                         } }
91                 }
92         }
93 }
94 #[no_mangle]
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
98 #[repr(C)]
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101         /// A pointer to the contents in the success state.
102         /// Reading from this pointer when `result_ok` is not set is undefined.
103         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104         /// A pointer to the contents in the error state.
105         /// Reading from this pointer when `result_ok` is set is undefined.
106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
107 }
108 #[repr(C)]
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114         /// `err` or `result` depending on the state of `result_ok`.
115         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
117         pub result_ok: bool,
118 }
119 #[no_mangle]
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124                         result: Box::into_raw(Box::new(o)),
125                 },
126                 result_ok: true,
127         }
128 }
129 #[no_mangle]
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134                         err: Box::into_raw(Box::new(e)),
135                 },
136                 result_ok: false,
137         }
138 }
139 /// Checks if the given object is currently in the success state
140 #[no_mangle]
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
142         o.result_ok
143 }
144 #[no_mangle]
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
148         fn drop(&mut self) {
149                 if self.result_ok {
150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
152                         }
153                 } else {
154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
156                         }
157                 }
158         }
159 }
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162                 let contents = if o.result_ok {
163                         let result = unsafe { o.contents.result };
164                         unsafe { o.contents.result = core::ptr::null_mut() };
165                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
166                 } else {
167                         let err = unsafe { o.contents.err };
168                         unsafe { o.contents.err = core::ptr::null_mut(); }
169                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
170                 };
171                 Self {
172                         contents,
173                         result_ok: o.result_ok,
174                 }
175         }
176 }
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178         fn clone(&self) -> Self {
179                 if self.result_ok {
180                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
182                         } }
183                 } else {
184                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
186                         } }
187                 }
188         }
189 }
190 #[no_mangle]
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
194 #[repr(C)]
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197         /// A pointer to the contents in the success state.
198         /// Reading from this pointer when `result_ok` is not set is undefined.
199         pub result: *mut crate::c_types::SecretKey,
200         /// A pointer to the contents in the error state.
201         /// Reading from this pointer when `result_ok` is set is undefined.
202         pub err: *mut crate::c_types::Secp256k1Error,
203 }
204 #[repr(C)]
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210         /// `err` or `result` depending on the state of `result_ok`.
211         pub contents: CResult_SecretKeyErrorZPtr,
212         /// Whether this CResult_SecretKeyErrorZ represents a success state.
213         pub result_ok: bool,
214 }
215 #[no_mangle]
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218         CResult_SecretKeyErrorZ {
219                 contents: CResult_SecretKeyErrorZPtr {
220                         result: Box::into_raw(Box::new(o)),
221                 },
222                 result_ok: true,
223         }
224 }
225 #[no_mangle]
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228         CResult_SecretKeyErrorZ {
229                 contents: CResult_SecretKeyErrorZPtr {
230                         err: Box::into_raw(Box::new(e)),
231                 },
232                 result_ok: false,
233         }
234 }
235 /// Checks if the given object is currently in the success state
236 #[no_mangle]
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
238         o.result_ok
239 }
240 #[no_mangle]
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
244         fn drop(&mut self) {
245                 if self.result_ok {
246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
248                         }
249                 } else {
250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
252                         }
253                 }
254         }
255 }
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258                 let contents = if o.result_ok {
259                         let result = unsafe { o.contents.result };
260                         unsafe { o.contents.result = core::ptr::null_mut() };
261                         CResult_SecretKeyErrorZPtr { result }
262                 } else {
263                         let err = unsafe { o.contents.err };
264                         unsafe { o.contents.err = core::ptr::null_mut(); }
265                         CResult_SecretKeyErrorZPtr { err }
266                 };
267                 Self {
268                         contents,
269                         result_ok: o.result_ok,
270                 }
271         }
272 }
273 impl Clone for CResult_SecretKeyErrorZ {
274         fn clone(&self) -> Self {
275                 if self.result_ok {
276                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
278                         } }
279                 } else {
280                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
282                         } }
283                 }
284         }
285 }
286 #[no_mangle]
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
290 #[repr(C)]
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293         /// A pointer to the contents in the success state.
294         /// Reading from this pointer when `result_ok` is not set is undefined.
295         pub result: *mut crate::c_types::PublicKey,
296         /// A pointer to the contents in the error state.
297         /// Reading from this pointer when `result_ok` is set is undefined.
298         pub err: *mut crate::c_types::Secp256k1Error,
299 }
300 #[repr(C)]
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306         /// `err` or `result` depending on the state of `result_ok`.
307         pub contents: CResult_PublicKeyErrorZPtr,
308         /// Whether this CResult_PublicKeyErrorZ represents a success state.
309         pub result_ok: bool,
310 }
311 #[no_mangle]
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314         CResult_PublicKeyErrorZ {
315                 contents: CResult_PublicKeyErrorZPtr {
316                         result: Box::into_raw(Box::new(o)),
317                 },
318                 result_ok: true,
319         }
320 }
321 #[no_mangle]
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324         CResult_PublicKeyErrorZ {
325                 contents: CResult_PublicKeyErrorZPtr {
326                         err: Box::into_raw(Box::new(e)),
327                 },
328                 result_ok: false,
329         }
330 }
331 /// Checks if the given object is currently in the success state
332 #[no_mangle]
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
334         o.result_ok
335 }
336 #[no_mangle]
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
340         fn drop(&mut self) {
341                 if self.result_ok {
342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
344                         }
345                 } else {
346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
348                         }
349                 }
350         }
351 }
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354                 let contents = if o.result_ok {
355                         let result = unsafe { o.contents.result };
356                         unsafe { o.contents.result = core::ptr::null_mut() };
357                         CResult_PublicKeyErrorZPtr { result }
358                 } else {
359                         let err = unsafe { o.contents.err };
360                         unsafe { o.contents.err = core::ptr::null_mut(); }
361                         CResult_PublicKeyErrorZPtr { err }
362                 };
363                 Self {
364                         contents,
365                         result_ok: o.result_ok,
366                 }
367         }
368 }
369 impl Clone for CResult_PublicKeyErrorZ {
370         fn clone(&self) -> Self {
371                 if self.result_ok {
372                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
374                         } }
375                 } else {
376                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
378                         } }
379                 }
380         }
381 }
382 #[no_mangle]
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
386 #[repr(C)]
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389         /// A pointer to the contents in the success state.
390         /// Reading from this pointer when `result_ok` is not set is undefined.
391         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392         /// A pointer to the contents in the error state.
393         /// Reading from this pointer when `result_ok` is set is undefined.
394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
395 }
396 #[repr(C)]
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402         /// `err` or `result` depending on the state of `result_ok`.
403         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
405         pub result_ok: bool,
406 }
407 #[no_mangle]
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410         CResult_TxCreationKeysDecodeErrorZ {
411                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412                         result: Box::into_raw(Box::new(o)),
413                 },
414                 result_ok: true,
415         }
416 }
417 #[no_mangle]
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420         CResult_TxCreationKeysDecodeErrorZ {
421                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422                         err: Box::into_raw(Box::new(e)),
423                 },
424                 result_ok: false,
425         }
426 }
427 /// Checks if the given object is currently in the success state
428 #[no_mangle]
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
430         o.result_ok
431 }
432 #[no_mangle]
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
436         fn drop(&mut self) {
437                 if self.result_ok {
438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
440                         }
441                 } else {
442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
444                         }
445                 }
446         }
447 }
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450                 let contents = if o.result_ok {
451                         let result = unsafe { o.contents.result };
452                         unsafe { o.contents.result = core::ptr::null_mut() };
453                         CResult_TxCreationKeysDecodeErrorZPtr { result }
454                 } else {
455                         let err = unsafe { o.contents.err };
456                         unsafe { o.contents.err = core::ptr::null_mut(); }
457                         CResult_TxCreationKeysDecodeErrorZPtr { err }
458                 };
459                 Self {
460                         contents,
461                         result_ok: o.result_ok,
462                 }
463         }
464 }
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466         fn clone(&self) -> Self {
467                 if self.result_ok {
468                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
470                         } }
471                 } else {
472                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
474                         } }
475                 }
476         }
477 }
478 #[no_mangle]
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
482 #[repr(C)]
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485         /// A pointer to the contents in the success state.
486         /// Reading from this pointer when `result_ok` is not set is undefined.
487         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488         /// A pointer to the contents in the error state.
489         /// Reading from this pointer when `result_ok` is set is undefined.
490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
491 }
492 #[repr(C)]
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498         /// `err` or `result` depending on the state of `result_ok`.
499         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
501         pub result_ok: bool,
502 }
503 #[no_mangle]
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506         CResult_ChannelPublicKeysDecodeErrorZ {
507                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508                         result: Box::into_raw(Box::new(o)),
509                 },
510                 result_ok: true,
511         }
512 }
513 #[no_mangle]
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516         CResult_ChannelPublicKeysDecodeErrorZ {
517                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518                         err: Box::into_raw(Box::new(e)),
519                 },
520                 result_ok: false,
521         }
522 }
523 /// Checks if the given object is currently in the success state
524 #[no_mangle]
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
526         o.result_ok
527 }
528 #[no_mangle]
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
532         fn drop(&mut self) {
533                 if self.result_ok {
534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
536                         }
537                 } else {
538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
540                         }
541                 }
542         }
543 }
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546                 let contents = if o.result_ok {
547                         let result = unsafe { o.contents.result };
548                         unsafe { o.contents.result = core::ptr::null_mut() };
549                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
550                 } else {
551                         let err = unsafe { o.contents.err };
552                         unsafe { o.contents.err = core::ptr::null_mut(); }
553                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
554                 };
555                 Self {
556                         contents,
557                         result_ok: o.result_ok,
558                 }
559         }
560 }
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562         fn clone(&self) -> Self {
563                 if self.result_ok {
564                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
566                         } }
567                 } else {
568                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
570                         } }
571                 }
572         }
573 }
574 #[no_mangle]
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
578 #[repr(C)]
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581         /// A pointer to the contents in the success state.
582         /// Reading from this pointer when `result_ok` is not set is undefined.
583         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584         /// A pointer to the contents in the error state.
585         /// Reading from this pointer when `result_ok` is set is undefined.
586         pub err: *mut crate::c_types::Secp256k1Error,
587 }
588 #[repr(C)]
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594         /// `err` or `result` depending on the state of `result_ok`.
595         pub contents: CResult_TxCreationKeysErrorZPtr,
596         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
597         pub result_ok: bool,
598 }
599 #[no_mangle]
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602         CResult_TxCreationKeysErrorZ {
603                 contents: CResult_TxCreationKeysErrorZPtr {
604                         result: Box::into_raw(Box::new(o)),
605                 },
606                 result_ok: true,
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612         CResult_TxCreationKeysErrorZ {
613                 contents: CResult_TxCreationKeysErrorZPtr {
614                         err: Box::into_raw(Box::new(e)),
615                 },
616                 result_ok: false,
617         }
618 }
619 /// Checks if the given object is currently in the success state
620 #[no_mangle]
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
622         o.result_ok
623 }
624 #[no_mangle]
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
628         fn drop(&mut self) {
629                 if self.result_ok {
630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
632                         }
633                 } else {
634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
636                         }
637                 }
638         }
639 }
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642                 let contents = if o.result_ok {
643                         let result = unsafe { o.contents.result };
644                         unsafe { o.contents.result = core::ptr::null_mut() };
645                         CResult_TxCreationKeysErrorZPtr { result }
646                 } else {
647                         let err = unsafe { o.contents.err };
648                         unsafe { o.contents.err = core::ptr::null_mut(); }
649                         CResult_TxCreationKeysErrorZPtr { err }
650                 };
651                 Self {
652                         contents,
653                         result_ok: o.result_ok,
654                 }
655         }
656 }
657 impl Clone for CResult_TxCreationKeysErrorZ {
658         fn clone(&self) -> Self {
659                 if self.result_ok {
660                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
662                         } }
663                 } else {
664                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
666                         } }
667                 }
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
674 #[repr(C)]
675 #[derive(Clone)]
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678         /// When we're in this state, this COption_u32Z contains a u32
679         Some(u32),
680         /// When we're in this state, this COption_u32Z contains nothing
681         None
682 }
683 impl COption_u32Z {
684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685                 if let Self::None = self { false } else { true }
686         }
687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
688                 !self.is_some()
689         }
690         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691                 if let Self::Some(v) = self { v } else { unreachable!() }
692         }
693 }
694 #[no_mangle]
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697         COption_u32Z::Some(o)
698 }
699 #[no_mangle]
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
702         COption_u32Z::None
703 }
704 #[no_mangle]
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
707 #[no_mangle]
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
711 #[repr(C)]
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714         /// A pointer to the contents in the success state.
715         /// Reading from this pointer when `result_ok` is not set is undefined.
716         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717         /// A pointer to the contents in the error state.
718         /// Reading from this pointer when `result_ok` is set is undefined.
719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 }
721 #[repr(C)]
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727         /// `err` or `result` depending on the state of `result_ok`.
728         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
730         pub result_ok: bool,
731 }
732 #[no_mangle]
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735         CResult_HTLCOutputInCommitmentDecodeErrorZ {
736                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737                         result: Box::into_raw(Box::new(o)),
738                 },
739                 result_ok: true,
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745         CResult_HTLCOutputInCommitmentDecodeErrorZ {
746                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747                         err: Box::into_raw(Box::new(e)),
748                 },
749                 result_ok: false,
750         }
751 }
752 /// Checks if the given object is currently in the success state
753 #[no_mangle]
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
755         o.result_ok
756 }
757 #[no_mangle]
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
761         fn drop(&mut self) {
762                 if self.result_ok {
763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
765                         }
766                 } else {
767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
769                         }
770                 }
771         }
772 }
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775                 let contents = if o.result_ok {
776                         let result = unsafe { o.contents.result };
777                         unsafe { o.contents.result = core::ptr::null_mut() };
778                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
779                 } else {
780                         let err = unsafe { o.contents.err };
781                         unsafe { o.contents.err = core::ptr::null_mut(); }
782                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
783                 };
784                 Self {
785                         contents,
786                         result_ok: o.result_ok,
787                 }
788         }
789 }
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791         fn clone(&self) -> Self {
792                 if self.result_ok {
793                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
795                         } }
796                 } else {
797                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
799                         } }
800                 }
801         }
802 }
803 #[no_mangle]
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
807 #[repr(C)]
808 /// An enum which can either contain a  or not
809 pub enum COption_NoneZ {
810         /// When we're in this state, this COption_NoneZ contains a 
811         Some,
812         /// When we're in this state, this COption_NoneZ contains nothing
813         None
814 }
815 impl COption_NoneZ {
816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817                 if let Self::None = self { false } else { true }
818         }
819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
820                 !self.is_some()
821         }
822 }
823 #[no_mangle]
824 /// Constructs a new COption_NoneZ containing a 
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
826         COption_NoneZ::Some
827 }
828 #[no_mangle]
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
831         COption_NoneZ::None
832 }
833 #[no_mangle]
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
836 #[repr(C)]
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839         /// A pointer to the contents in the success state.
840         /// Reading from this pointer when `result_ok` is not set is undefined.
841         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842         /// A pointer to the contents in the error state.
843         /// Reading from this pointer when `result_ok` is set is undefined.
844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
845 }
846 #[repr(C)]
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852         /// `err` or `result` depending on the state of `result_ok`.
853         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
855         pub result_ok: bool,
856 }
857 #[no_mangle]
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862                         result: Box::into_raw(Box::new(o)),
863                 },
864                 result_ok: true,
865         }
866 }
867 #[no_mangle]
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872                         err: Box::into_raw(Box::new(e)),
873                 },
874                 result_ok: false,
875         }
876 }
877 /// Checks if the given object is currently in the success state
878 #[no_mangle]
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
880         o.result_ok
881 }
882 #[no_mangle]
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
886         fn drop(&mut self) {
887                 if self.result_ok {
888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
890                         }
891                 } else {
892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
894                         }
895                 }
896         }
897 }
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900                 let contents = if o.result_ok {
901                         let result = unsafe { o.contents.result };
902                         unsafe { o.contents.result = core::ptr::null_mut() };
903                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
904                 } else {
905                         let err = unsafe { o.contents.err };
906                         unsafe { o.contents.err = core::ptr::null_mut(); }
907                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
908                 };
909                 Self {
910                         contents,
911                         result_ok: o.result_ok,
912                 }
913         }
914 }
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916         fn clone(&self) -> Self {
917                 if self.result_ok {
918                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
920                         } }
921                 } else {
922                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
924                         } }
925                 }
926         }
927 }
928 #[no_mangle]
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
932 #[repr(C)]
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935         /// A pointer to the contents in the success state.
936         /// Reading from this pointer when `result_ok` is not set is undefined.
937         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938         /// A pointer to the contents in the error state.
939         /// Reading from this pointer when `result_ok` is set is undefined.
940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
941 }
942 #[repr(C)]
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948         /// `err` or `result` depending on the state of `result_ok`.
949         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956         CResult_ChannelTransactionParametersDecodeErrorZ {
957                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958                         result: Box::into_raw(Box::new(o)),
959                 },
960                 result_ok: true,
961         }
962 }
963 #[no_mangle]
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966         CResult_ChannelTransactionParametersDecodeErrorZ {
967                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968                         err: Box::into_raw(Box::new(e)),
969                 },
970                 result_ok: false,
971         }
972 }
973 /// Checks if the given object is currently in the success state
974 #[no_mangle]
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
976         o.result_ok
977 }
978 #[no_mangle]
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
982         fn drop(&mut self) {
983                 if self.result_ok {
984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
986                         }
987                 } else {
988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
990                         }
991                 }
992         }
993 }
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996                 let contents = if o.result_ok {
997                         let result = unsafe { o.contents.result };
998                         unsafe { o.contents.result = core::ptr::null_mut() };
999                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1000                 } else {
1001                         let err = unsafe { o.contents.err };
1002                         unsafe { o.contents.err = core::ptr::null_mut(); }
1003                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1004                 };
1005                 Self {
1006                         contents,
1007                         result_ok: o.result_ok,
1008                 }
1009         }
1010 }
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012         fn clone(&self) -> Self {
1013                 if self.result_ok {
1014                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1016                         } }
1017                 } else {
1018                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1020                         } }
1021                 }
1022         }
1023 }
1024 #[no_mangle]
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1028 #[repr(C)]
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032         /// The elements in the array.
1033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034         pub data: *mut crate::c_types::Signature,
1035         /// The number of elements pointed to by `data`.
1036         pub datalen: usize
1037 }
1038 impl CVec_SignatureZ {
1039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040                 if self.datalen == 0 { return Vec::new(); }
1041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042                 self.data = core::ptr::null_mut();
1043                 self.datalen = 0;
1044                 ret
1045         }
1046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1048         }
1049 }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052                 let datalen = v.len();
1053                 let data = Box::into_raw(v.into_boxed_slice());
1054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1055         }
1056 }
1057 #[no_mangle]
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061         fn drop(&mut self) {
1062                 if self.datalen == 0 { return; }
1063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1064         }
1065 }
1066 impl Clone for CVec_SignatureZ {
1067         fn clone(&self) -> Self {
1068                 let mut res = Vec::new();
1069                 if self.datalen == 0 { return Self::from(res); }
1070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1071                 Self::from(res)
1072         }
1073 }
1074 #[repr(C)]
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077         /// A pointer to the contents in the success state.
1078         /// Reading from this pointer when `result_ok` is not set is undefined.
1079         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080         /// A pointer to the contents in the error state.
1081         /// Reading from this pointer when `result_ok` is set is undefined.
1082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1083 }
1084 #[repr(C)]
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090         /// `err` or `result` depending on the state of `result_ok`.
1091         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093         pub result_ok: bool,
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098         CResult_HolderCommitmentTransactionDecodeErrorZ {
1099                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100                         result: Box::into_raw(Box::new(o)),
1101                 },
1102                 result_ok: true,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108         CResult_HolderCommitmentTransactionDecodeErrorZ {
1109                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110                         err: Box::into_raw(Box::new(e)),
1111                 },
1112                 result_ok: false,
1113         }
1114 }
1115 /// Checks if the given object is currently in the success state
1116 #[no_mangle]
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1118         o.result_ok
1119 }
1120 #[no_mangle]
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124         fn drop(&mut self) {
1125                 if self.result_ok {
1126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1128                         }
1129                 } else {
1130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1132                         }
1133                 }
1134         }
1135 }
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138                 let contents = if o.result_ok {
1139                         let result = unsafe { o.contents.result };
1140                         unsafe { o.contents.result = core::ptr::null_mut() };
1141                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1142                 } else {
1143                         let err = unsafe { o.contents.err };
1144                         unsafe { o.contents.err = core::ptr::null_mut(); }
1145                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1146                 };
1147                 Self {
1148                         contents,
1149                         result_ok: o.result_ok,
1150                 }
1151         }
1152 }
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154         fn clone(&self) -> Self {
1155                 if self.result_ok {
1156                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1158                         } }
1159                 } else {
1160                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1162                         } }
1163                 }
1164         }
1165 }
1166 #[no_mangle]
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1170 #[repr(C)]
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173         /// A pointer to the contents in the success state.
1174         /// Reading from this pointer when `result_ok` is not set is undefined.
1175         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176         /// A pointer to the contents in the error state.
1177         /// Reading from this pointer when `result_ok` is set is undefined.
1178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1179 }
1180 #[repr(C)]
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186         /// `err` or `result` depending on the state of `result_ok`.
1187         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189         pub result_ok: bool,
1190 }
1191 #[no_mangle]
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196                         result: Box::into_raw(Box::new(o)),
1197                 },
1198                 result_ok: true,
1199         }
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206                         err: Box::into_raw(Box::new(e)),
1207                 },
1208                 result_ok: false,
1209         }
1210 }
1211 /// Checks if the given object is currently in the success state
1212 #[no_mangle]
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1214         o.result_ok
1215 }
1216 #[no_mangle]
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220         fn drop(&mut self) {
1221                 if self.result_ok {
1222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1224                         }
1225                 } else {
1226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1228                         }
1229                 }
1230         }
1231 }
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234                 let contents = if o.result_ok {
1235                         let result = unsafe { o.contents.result };
1236                         unsafe { o.contents.result = core::ptr::null_mut() };
1237                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1238                 } else {
1239                         let err = unsafe { o.contents.err };
1240                         unsafe { o.contents.err = core::ptr::null_mut(); }
1241                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1242                 };
1243                 Self {
1244                         contents,
1245                         result_ok: o.result_ok,
1246                 }
1247         }
1248 }
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250         fn clone(&self) -> Self {
1251                 if self.result_ok {
1252                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1254                         } }
1255                 } else {
1256                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1258                         } }
1259                 }
1260         }
1261 }
1262 #[no_mangle]
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1266 #[repr(C)]
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269         /// A pointer to the contents in the success state.
1270         /// Reading from this pointer when `result_ok` is not set is undefined.
1271         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272         /// Note that this value is always NULL, as there are no contents in the Err variant
1273         pub err: *mut core::ffi::c_void,
1274 }
1275 #[repr(C)]
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281         /// `err` or `result` depending on the state of `result_ok`.
1282         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284         pub result_ok: bool,
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289         CResult_TrustedClosingTransactionNoneZ {
1290                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291                         result: Box::into_raw(Box::new(o)),
1292                 },
1293                 result_ok: true,
1294         }
1295 }
1296 #[no_mangle]
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299         CResult_TrustedClosingTransactionNoneZ {
1300                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301                         err: core::ptr::null_mut(),
1302                 },
1303                 result_ok: false,
1304         }
1305 }
1306 /// Checks if the given object is currently in the success state
1307 #[no_mangle]
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1309         o.result_ok
1310 }
1311 #[no_mangle]
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315         fn drop(&mut self) {
1316                 if self.result_ok {
1317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1319                         }
1320                 } else {
1321                 }
1322         }
1323 }
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326                 let contents = if o.result_ok {
1327                         let result = unsafe { o.contents.result };
1328                         unsafe { o.contents.result = core::ptr::null_mut() };
1329                         CResult_TrustedClosingTransactionNoneZPtr { result }
1330                 } else {
1331                         let _ = unsafe { Box::from_raw(o.contents.err) };
1332                         o.contents.err = core::ptr::null_mut();
1333                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1334                 };
1335                 Self {
1336                         contents,
1337                         result_ok: o.result_ok,
1338                 }
1339         }
1340 }
1341 #[repr(C)]
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344         /// A pointer to the contents in the success state.
1345         /// Reading from this pointer when `result_ok` is not set is undefined.
1346         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347         /// A pointer to the contents in the error state.
1348         /// Reading from this pointer when `result_ok` is set is undefined.
1349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1350 }
1351 #[repr(C)]
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357         /// `err` or `result` depending on the state of `result_ok`.
1358         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360         pub result_ok: bool,
1361 }
1362 #[no_mangle]
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365         CResult_CommitmentTransactionDecodeErrorZ {
1366                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367                         result: Box::into_raw(Box::new(o)),
1368                 },
1369                 result_ok: true,
1370         }
1371 }
1372 #[no_mangle]
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375         CResult_CommitmentTransactionDecodeErrorZ {
1376                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377                         err: Box::into_raw(Box::new(e)),
1378                 },
1379                 result_ok: false,
1380         }
1381 }
1382 /// Checks if the given object is currently in the success state
1383 #[no_mangle]
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1385         o.result_ok
1386 }
1387 #[no_mangle]
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391         fn drop(&mut self) {
1392                 if self.result_ok {
1393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1395                         }
1396                 } else {
1397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1399                         }
1400                 }
1401         }
1402 }
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405                 let contents = if o.result_ok {
1406                         let result = unsafe { o.contents.result };
1407                         unsafe { o.contents.result = core::ptr::null_mut() };
1408                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1409                 } else {
1410                         let err = unsafe { o.contents.err };
1411                         unsafe { o.contents.err = core::ptr::null_mut(); }
1412                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1413                 };
1414                 Self {
1415                         contents,
1416                         result_ok: o.result_ok,
1417                 }
1418         }
1419 }
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421         fn clone(&self) -> Self {
1422                 if self.result_ok {
1423                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1425                         } }
1426                 } else {
1427                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1429                         } }
1430                 }
1431         }
1432 }
1433 #[no_mangle]
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1437 #[repr(C)]
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440         /// A pointer to the contents in the success state.
1441         /// Reading from this pointer when `result_ok` is not set is undefined.
1442         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443         /// Note that this value is always NULL, as there are no contents in the Err variant
1444         pub err: *mut core::ffi::c_void,
1445 }
1446 #[repr(C)]
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452         /// `err` or `result` depending on the state of `result_ok`.
1453         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455         pub result_ok: bool,
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460         CResult_TrustedCommitmentTransactionNoneZ {
1461                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462                         result: Box::into_raw(Box::new(o)),
1463                 },
1464                 result_ok: true,
1465         }
1466 }
1467 #[no_mangle]
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470         CResult_TrustedCommitmentTransactionNoneZ {
1471                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472                         err: core::ptr::null_mut(),
1473                 },
1474                 result_ok: false,
1475         }
1476 }
1477 /// Checks if the given object is currently in the success state
1478 #[no_mangle]
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1480         o.result_ok
1481 }
1482 #[no_mangle]
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486         fn drop(&mut self) {
1487                 if self.result_ok {
1488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1490                         }
1491                 } else {
1492                 }
1493         }
1494 }
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497                 let contents = if o.result_ok {
1498                         let result = unsafe { o.contents.result };
1499                         unsafe { o.contents.result = core::ptr::null_mut() };
1500                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1501                 } else {
1502                         let _ = unsafe { Box::from_raw(o.contents.err) };
1503                         o.contents.err = core::ptr::null_mut();
1504                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1505                 };
1506                 Self {
1507                         contents,
1508                         result_ok: o.result_ok,
1509                 }
1510         }
1511 }
1512 #[repr(C)]
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515         /// A pointer to the contents in the success state.
1516         /// Reading from this pointer when `result_ok` is not set is undefined.
1517         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518         /// Note that this value is always NULL, as there are no contents in the Err variant
1519         pub err: *mut core::ffi::c_void,
1520 }
1521 #[repr(C)]
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527         /// `err` or `result` depending on the state of `result_ok`.
1528         pub contents: CResult_CVec_SignatureZNoneZPtr,
1529         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530         pub result_ok: bool,
1531 }
1532 #[no_mangle]
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535         CResult_CVec_SignatureZNoneZ {
1536                 contents: CResult_CVec_SignatureZNoneZPtr {
1537                         result: Box::into_raw(Box::new(o)),
1538                 },
1539                 result_ok: true,
1540         }
1541 }
1542 #[no_mangle]
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545         CResult_CVec_SignatureZNoneZ {
1546                 contents: CResult_CVec_SignatureZNoneZPtr {
1547                         err: core::ptr::null_mut(),
1548                 },
1549                 result_ok: false,
1550         }
1551 }
1552 /// Checks if the given object is currently in the success state
1553 #[no_mangle]
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1555         o.result_ok
1556 }
1557 #[no_mangle]
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561         fn drop(&mut self) {
1562                 if self.result_ok {
1563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1565                         }
1566                 } else {
1567                 }
1568         }
1569 }
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572                 let contents = if o.result_ok {
1573                         let result = unsafe { o.contents.result };
1574                         unsafe { o.contents.result = core::ptr::null_mut() };
1575                         CResult_CVec_SignatureZNoneZPtr { result }
1576                 } else {
1577                         let _ = unsafe { Box::from_raw(o.contents.err) };
1578                         o.contents.err = core::ptr::null_mut();
1579                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1580                 };
1581                 Self {
1582                         contents,
1583                         result_ok: o.result_ok,
1584                 }
1585         }
1586 }
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588         fn clone(&self) -> Self {
1589                 if self.result_ok {
1590                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1592                         } }
1593                 } else {
1594                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595                                 err: core::ptr::null_mut()
1596                         } }
1597                 }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1604 #[repr(C)]
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607         /// A pointer to the contents in the success state.
1608         /// Reading from this pointer when `result_ok` is not set is undefined.
1609         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610         /// A pointer to the contents in the error state.
1611         /// Reading from this pointer when `result_ok` is set is undefined.
1612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1613 }
1614 #[repr(C)]
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620         /// `err` or `result` depending on the state of `result_ok`.
1621         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623         pub result_ok: bool,
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628         CResult_ShutdownScriptDecodeErrorZ {
1629                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630                         result: Box::into_raw(Box::new(o)),
1631                 },
1632                 result_ok: true,
1633         }
1634 }
1635 #[no_mangle]
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638         CResult_ShutdownScriptDecodeErrorZ {
1639                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640                         err: Box::into_raw(Box::new(e)),
1641                 },
1642                 result_ok: false,
1643         }
1644 }
1645 /// Checks if the given object is currently in the success state
1646 #[no_mangle]
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1648         o.result_ok
1649 }
1650 #[no_mangle]
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654         fn drop(&mut self) {
1655                 if self.result_ok {
1656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1658                         }
1659                 } else {
1660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1662                         }
1663                 }
1664         }
1665 }
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668                 let contents = if o.result_ok {
1669                         let result = unsafe { o.contents.result };
1670                         unsafe { o.contents.result = core::ptr::null_mut() };
1671                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1672                 } else {
1673                         let err = unsafe { o.contents.err };
1674                         unsafe { o.contents.err = core::ptr::null_mut(); }
1675                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1676                 };
1677                 Self {
1678                         contents,
1679                         result_ok: o.result_ok,
1680                 }
1681         }
1682 }
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684         fn clone(&self) -> Self {
1685                 if self.result_ok {
1686                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1688                         } }
1689                 } else {
1690                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1692                         } }
1693                 }
1694         }
1695 }
1696 #[no_mangle]
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1700 #[repr(C)]
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703         /// A pointer to the contents in the success state.
1704         /// Reading from this pointer when `result_ok` is not set is undefined.
1705         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706         /// A pointer to the contents in the error state.
1707         /// Reading from this pointer when `result_ok` is set is undefined.
1708         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1709 }
1710 #[repr(C)]
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716         /// `err` or `result` depending on the state of `result_ok`.
1717         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719         pub result_ok: bool,
1720 }
1721 #[no_mangle]
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724         CResult_ShutdownScriptInvalidShutdownScriptZ {
1725                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726                         result: Box::into_raw(Box::new(o)),
1727                 },
1728                 result_ok: true,
1729         }
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734         CResult_ShutdownScriptInvalidShutdownScriptZ {
1735                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736                         err: Box::into_raw(Box::new(e)),
1737                 },
1738                 result_ok: false,
1739         }
1740 }
1741 /// Checks if the given object is currently in the success state
1742 #[no_mangle]
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1744         o.result_ok
1745 }
1746 #[no_mangle]
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750         fn drop(&mut self) {
1751                 if self.result_ok {
1752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1754                         }
1755                 } else {
1756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1758                         }
1759                 }
1760         }
1761 }
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764                 let contents = if o.result_ok {
1765                         let result = unsafe { o.contents.result };
1766                         unsafe { o.contents.result = core::ptr::null_mut() };
1767                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1768                 } else {
1769                         let err = unsafe { o.contents.err };
1770                         unsafe { o.contents.err = core::ptr::null_mut(); }
1771                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1772                 };
1773                 Self {
1774                         contents,
1775                         result_ok: o.result_ok,
1776                 }
1777         }
1778 }
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780         fn clone(&self) -> Self {
1781                 if self.result_ok {
1782                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1784                         } }
1785                 } else {
1786                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1788                         } }
1789                 }
1790         }
1791 }
1792 #[no_mangle]
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1796 #[repr(C)]
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799         /// Note that this value is always NULL, as there are no contents in the OK variant
1800         pub result: *mut core::ffi::c_void,
1801         /// A pointer to the contents in the error state.
1802         /// Reading from this pointer when `result_ok` is set is undefined.
1803         pub err: *mut crate::c_types::IOError,
1804 }
1805 #[repr(C)]
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810         /// The contents of this CResult_NoneErrorZ, accessible via either
1811         /// `err` or `result` depending on the state of `result_ok`.
1812         pub contents: CResult_NoneErrorZPtr,
1813         /// Whether this CResult_NoneErrorZ represents a success state.
1814         pub result_ok: bool,
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819         CResult_NoneErrorZ {
1820                 contents: CResult_NoneErrorZPtr {
1821                         result: core::ptr::null_mut(),
1822                 },
1823                 result_ok: true,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829         CResult_NoneErrorZ {
1830                 contents: CResult_NoneErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 /// Checks if the given object is currently in the success state
1837 #[no_mangle]
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1839         o.result_ok
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                 } else {
1848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1850                         }
1851                 }
1852         }
1853 }
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856                 let contents = if o.result_ok {
1857                         let _ = unsafe { Box::from_raw(o.contents.result) };
1858                         o.contents.result = core::ptr::null_mut();
1859                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1860                 } else {
1861                         let err = unsafe { o.contents.err };
1862                         unsafe { o.contents.err = core::ptr::null_mut(); }
1863                         CResult_NoneErrorZPtr { err }
1864                 };
1865                 Self {
1866                         contents,
1867                         result_ok: o.result_ok,
1868                 }
1869         }
1870 }
1871 impl Clone for CResult_NoneErrorZ {
1872         fn clone(&self) -> Self {
1873                 if self.result_ok {
1874                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875                                 result: core::ptr::null_mut()
1876                         } }
1877                 } else {
1878                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1880                         } }
1881                 }
1882         }
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1888 #[repr(C)]
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891         /// A pointer to the contents in the success state.
1892         /// Reading from this pointer when `result_ok` is not set is undefined.
1893         pub result: *mut crate::lightning::routing::router::RouteHop,
1894         /// A pointer to the contents in the error state.
1895         /// Reading from this pointer when `result_ok` is set is undefined.
1896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1897 }
1898 #[repr(C)]
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904         /// `err` or `result` depending on the state of `result_ok`.
1905         pub contents: CResult_RouteHopDecodeErrorZPtr,
1906         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907         pub result_ok: bool,
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912         CResult_RouteHopDecodeErrorZ {
1913                 contents: CResult_RouteHopDecodeErrorZPtr {
1914                         result: Box::into_raw(Box::new(o)),
1915                 },
1916                 result_ok: true,
1917         }
1918 }
1919 #[no_mangle]
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922         CResult_RouteHopDecodeErrorZ {
1923                 contents: CResult_RouteHopDecodeErrorZPtr {
1924                         err: Box::into_raw(Box::new(e)),
1925                 },
1926                 result_ok: false,
1927         }
1928 }
1929 /// Checks if the given object is currently in the success state
1930 #[no_mangle]
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1932         o.result_ok
1933 }
1934 #[no_mangle]
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938         fn drop(&mut self) {
1939                 if self.result_ok {
1940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1942                         }
1943                 } else {
1944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1946                         }
1947                 }
1948         }
1949 }
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952                 let contents = if o.result_ok {
1953                         let result = unsafe { o.contents.result };
1954                         unsafe { o.contents.result = core::ptr::null_mut() };
1955                         CResult_RouteHopDecodeErrorZPtr { result }
1956                 } else {
1957                         let err = unsafe { o.contents.err };
1958                         unsafe { o.contents.err = core::ptr::null_mut(); }
1959                         CResult_RouteHopDecodeErrorZPtr { err }
1960                 };
1961                 Self {
1962                         contents,
1963                         result_ok: o.result_ok,
1964                 }
1965         }
1966 }
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968         fn clone(&self) -> Self {
1969                 if self.result_ok {
1970                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1972                         } }
1973                 } else {
1974                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976                         } }
1977                 }
1978         }
1979 }
1980 #[no_mangle]
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1984 #[repr(C)]
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988         /// The elements in the array.
1989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990         pub data: *mut crate::lightning::routing::router::RouteHop,
1991         /// The number of elements pointed to by `data`.
1992         pub datalen: usize
1993 }
1994 impl CVec_RouteHopZ {
1995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996                 if self.datalen == 0 { return Vec::new(); }
1997                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998                 self.data = core::ptr::null_mut();
1999                 self.datalen = 0;
2000                 ret
2001         }
2002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2004         }
2005 }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008                 let datalen = v.len();
2009                 let data = Box::into_raw(v.into_boxed_slice());
2010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2011         }
2012 }
2013 #[no_mangle]
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017         fn drop(&mut self) {
2018                 if self.datalen == 0 { return; }
2019                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2020         }
2021 }
2022 impl Clone for CVec_RouteHopZ {
2023         fn clone(&self) -> Self {
2024                 let mut res = Vec::new();
2025                 if self.datalen == 0 { return Self::from(res); }
2026                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2027                 Self::from(res)
2028         }
2029 }
2030 #[repr(C)]
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034         /// The elements in the array.
2035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037         /// The number of elements pointed to by `data`.
2038         pub datalen: usize
2039 }
2040 impl CVec_CVec_RouteHopZZ {
2041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042                 if self.datalen == 0 { return Vec::new(); }
2043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044                 self.data = core::ptr::null_mut();
2045                 self.datalen = 0;
2046                 ret
2047         }
2048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2050         }
2051 }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054                 let datalen = v.len();
2055                 let data = Box::into_raw(v.into_boxed_slice());
2056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2057         }
2058 }
2059 #[no_mangle]
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063         fn drop(&mut self) {
2064                 if self.datalen == 0 { return; }
2065                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2066         }
2067 }
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069         fn clone(&self) -> Self {
2070                 let mut res = Vec::new();
2071                 if self.datalen == 0 { return Self::from(res); }
2072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2073                 Self::from(res)
2074         }
2075 }
2076 #[repr(C)]
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079         /// A pointer to the contents in the success state.
2080         /// Reading from this pointer when `result_ok` is not set is undefined.
2081         pub result: *mut crate::lightning::routing::router::Route,
2082         /// A pointer to the contents in the error state.
2083         /// Reading from this pointer when `result_ok` is set is undefined.
2084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2085 }
2086 #[repr(C)]
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092         /// `err` or `result` depending on the state of `result_ok`.
2093         pub contents: CResult_RouteDecodeErrorZPtr,
2094         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095         pub result_ok: bool,
2096 }
2097 #[no_mangle]
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100         CResult_RouteDecodeErrorZ {
2101                 contents: CResult_RouteDecodeErrorZPtr {
2102                         result: Box::into_raw(Box::new(o)),
2103                 },
2104                 result_ok: true,
2105         }
2106 }
2107 #[no_mangle]
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110         CResult_RouteDecodeErrorZ {
2111                 contents: CResult_RouteDecodeErrorZPtr {
2112                         err: Box::into_raw(Box::new(e)),
2113                 },
2114                 result_ok: false,
2115         }
2116 }
2117 /// Checks if the given object is currently in the success state
2118 #[no_mangle]
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2120         o.result_ok
2121 }
2122 #[no_mangle]
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126         fn drop(&mut self) {
2127                 if self.result_ok {
2128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2130                         }
2131                 } else {
2132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2134                         }
2135                 }
2136         }
2137 }
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140                 let contents = if o.result_ok {
2141                         let result = unsafe { o.contents.result };
2142                         unsafe { o.contents.result = core::ptr::null_mut() };
2143                         CResult_RouteDecodeErrorZPtr { result }
2144                 } else {
2145                         let err = unsafe { o.contents.err };
2146                         unsafe { o.contents.err = core::ptr::null_mut(); }
2147                         CResult_RouteDecodeErrorZPtr { err }
2148                 };
2149                 Self {
2150                         contents,
2151                         result_ok: o.result_ok,
2152                 }
2153         }
2154 }
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156         fn clone(&self) -> Self {
2157                 if self.result_ok {
2158                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2160                         } }
2161                 } else {
2162                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2164                         } }
2165                 }
2166         }
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2172 #[repr(C)]
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175         /// A pointer to the contents in the success state.
2176         /// Reading from this pointer when `result_ok` is not set is undefined.
2177         pub result: *mut crate::lightning::routing::router::RouteParameters,
2178         /// A pointer to the contents in the error state.
2179         /// Reading from this pointer when `result_ok` is set is undefined.
2180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2181 }
2182 #[repr(C)]
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188         /// `err` or `result` depending on the state of `result_ok`.
2189         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191         pub result_ok: bool,
2192 }
2193 #[no_mangle]
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196         CResult_RouteParametersDecodeErrorZ {
2197                 contents: CResult_RouteParametersDecodeErrorZPtr {
2198                         result: Box::into_raw(Box::new(o)),
2199                 },
2200                 result_ok: true,
2201         }
2202 }
2203 #[no_mangle]
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206         CResult_RouteParametersDecodeErrorZ {
2207                 contents: CResult_RouteParametersDecodeErrorZPtr {
2208                         err: Box::into_raw(Box::new(e)),
2209                 },
2210                 result_ok: false,
2211         }
2212 }
2213 /// Checks if the given object is currently in the success state
2214 #[no_mangle]
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2216         o.result_ok
2217 }
2218 #[no_mangle]
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222         fn drop(&mut self) {
2223                 if self.result_ok {
2224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2226                         }
2227                 } else {
2228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2230                         }
2231                 }
2232         }
2233 }
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236                 let contents = if o.result_ok {
2237                         let result = unsafe { o.contents.result };
2238                         unsafe { o.contents.result = core::ptr::null_mut() };
2239                         CResult_RouteParametersDecodeErrorZPtr { result }
2240                 } else {
2241                         let err = unsafe { o.contents.err };
2242                         unsafe { o.contents.err = core::ptr::null_mut(); }
2243                         CResult_RouteParametersDecodeErrorZPtr { err }
2244                 };
2245                 Self {
2246                         contents,
2247                         result_ok: o.result_ok,
2248                 }
2249         }
2250 }
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252         fn clone(&self) -> Self {
2253                 if self.result_ok {
2254                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2256                         } }
2257                 } else {
2258                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2260                         } }
2261                 }
2262         }
2263 }
2264 #[no_mangle]
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2268 #[repr(C)]
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272         /// The elements in the array.
2273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274         pub data: *mut crate::lightning::routing::router::RouteHint,
2275         /// The number of elements pointed to by `data`.
2276         pub datalen: usize
2277 }
2278 impl CVec_RouteHintZ {
2279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280                 if self.datalen == 0 { return Vec::new(); }
2281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282                 self.data = core::ptr::null_mut();
2283                 self.datalen = 0;
2284                 ret
2285         }
2286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2288         }
2289 }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292                 let datalen = v.len();
2293                 let data = Box::into_raw(v.into_boxed_slice());
2294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301         fn drop(&mut self) {
2302                 if self.datalen == 0 { return; }
2303                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2304         }
2305 }
2306 impl Clone for CVec_RouteHintZ {
2307         fn clone(&self) -> Self {
2308                 let mut res = Vec::new();
2309                 if self.datalen == 0 { return Self::from(res); }
2310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2311                 Self::from(res)
2312         }
2313 }
2314 #[repr(C)]
2315 #[derive(Clone)]
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318         /// When we're in this state, this COption_u64Z contains a u64
2319         Some(u64),
2320         /// When we're in this state, this COption_u64Z contains nothing
2321         None
2322 }
2323 impl COption_u64Z {
2324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325                 if let Self::None = self { false } else { true }
2326         }
2327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2328                 !self.is_some()
2329         }
2330         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331                 if let Self::Some(v) = self { v } else { unreachable!() }
2332         }
2333 }
2334 #[no_mangle]
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337         COption_u64Z::Some(o)
2338 }
2339 #[no_mangle]
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2342         COption_u64Z::None
2343 }
2344 #[no_mangle]
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2347 #[no_mangle]
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2351 #[repr(C)]
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354         /// A pointer to the contents in the success state.
2355         /// Reading from this pointer when `result_ok` is not set is undefined.
2356         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357         /// A pointer to the contents in the error state.
2358         /// Reading from this pointer when `result_ok` is set is undefined.
2359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2360 }
2361 #[repr(C)]
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367         /// `err` or `result` depending on the state of `result_ok`.
2368         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370         pub result_ok: bool,
2371 }
2372 #[no_mangle]
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375         CResult_PaymentParametersDecodeErrorZ {
2376                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377                         result: Box::into_raw(Box::new(o)),
2378                 },
2379                 result_ok: true,
2380         }
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385         CResult_PaymentParametersDecodeErrorZ {
2386                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387                         err: Box::into_raw(Box::new(e)),
2388                 },
2389                 result_ok: false,
2390         }
2391 }
2392 /// Checks if the given object is currently in the success state
2393 #[no_mangle]
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2395         o.result_ok
2396 }
2397 #[no_mangle]
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401         fn drop(&mut self) {
2402                 if self.result_ok {
2403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2405                         }
2406                 } else {
2407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2409                         }
2410                 }
2411         }
2412 }
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415                 let contents = if o.result_ok {
2416                         let result = unsafe { o.contents.result };
2417                         unsafe { o.contents.result = core::ptr::null_mut() };
2418                         CResult_PaymentParametersDecodeErrorZPtr { result }
2419                 } else {
2420                         let err = unsafe { o.contents.err };
2421                         unsafe { o.contents.err = core::ptr::null_mut(); }
2422                         CResult_PaymentParametersDecodeErrorZPtr { err }
2423                 };
2424                 Self {
2425                         contents,
2426                         result_ok: o.result_ok,
2427                 }
2428         }
2429 }
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431         fn clone(&self) -> Self {
2432                 if self.result_ok {
2433                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2435                         } }
2436                 } else {
2437                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2439                         } }
2440                 }
2441         }
2442 }
2443 #[no_mangle]
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2447 #[repr(C)]
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451         /// The elements in the array.
2452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454         /// The number of elements pointed to by `data`.
2455         pub datalen: usize
2456 }
2457 impl CVec_RouteHintHopZ {
2458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459                 if self.datalen == 0 { return Vec::new(); }
2460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461                 self.data = core::ptr::null_mut();
2462                 self.datalen = 0;
2463                 ret
2464         }
2465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2467         }
2468 }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471                 let datalen = v.len();
2472                 let data = Box::into_raw(v.into_boxed_slice());
2473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2474         }
2475 }
2476 #[no_mangle]
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480         fn drop(&mut self) {
2481                 if self.datalen == 0 { return; }
2482                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2483         }
2484 }
2485 impl Clone for CVec_RouteHintHopZ {
2486         fn clone(&self) -> Self {
2487                 let mut res = Vec::new();
2488                 if self.datalen == 0 { return Self::from(res); }
2489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2490                 Self::from(res)
2491         }
2492 }
2493 #[repr(C)]
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496         /// A pointer to the contents in the success state.
2497         /// Reading from this pointer when `result_ok` is not set is undefined.
2498         pub result: *mut crate::lightning::routing::router::RouteHint,
2499         /// A pointer to the contents in the error state.
2500         /// Reading from this pointer when `result_ok` is set is undefined.
2501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2502 }
2503 #[repr(C)]
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509         /// `err` or `result` depending on the state of `result_ok`.
2510         pub contents: CResult_RouteHintDecodeErrorZPtr,
2511         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512         pub result_ok: bool,
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517         CResult_RouteHintDecodeErrorZ {
2518                 contents: CResult_RouteHintDecodeErrorZPtr {
2519                         result: Box::into_raw(Box::new(o)),
2520                 },
2521                 result_ok: true,
2522         }
2523 }
2524 #[no_mangle]
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527         CResult_RouteHintDecodeErrorZ {
2528                 contents: CResult_RouteHintDecodeErrorZPtr {
2529                         err: Box::into_raw(Box::new(e)),
2530                 },
2531                 result_ok: false,
2532         }
2533 }
2534 /// Checks if the given object is currently in the success state
2535 #[no_mangle]
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2537         o.result_ok
2538 }
2539 #[no_mangle]
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543         fn drop(&mut self) {
2544                 if self.result_ok {
2545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2547                         }
2548                 } else {
2549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2551                         }
2552                 }
2553         }
2554 }
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557                 let contents = if o.result_ok {
2558                         let result = unsafe { o.contents.result };
2559                         unsafe { o.contents.result = core::ptr::null_mut() };
2560                         CResult_RouteHintDecodeErrorZPtr { result }
2561                 } else {
2562                         let err = unsafe { o.contents.err };
2563                         unsafe { o.contents.err = core::ptr::null_mut(); }
2564                         CResult_RouteHintDecodeErrorZPtr { err }
2565                 };
2566                 Self {
2567                         contents,
2568                         result_ok: o.result_ok,
2569                 }
2570         }
2571 }
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573         fn clone(&self) -> Self {
2574                 if self.result_ok {
2575                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2577                         } }
2578                 } else {
2579                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2581                         } }
2582                 }
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2589 #[repr(C)]
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592         /// A pointer to the contents in the success state.
2593         /// Reading from this pointer when `result_ok` is not set is undefined.
2594         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595         /// A pointer to the contents in the error state.
2596         /// Reading from this pointer when `result_ok` is set is undefined.
2597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2598 }
2599 #[repr(C)]
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605         /// `err` or `result` depending on the state of `result_ok`.
2606         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608         pub result_ok: bool,
2609 }
2610 #[no_mangle]
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613         CResult_RouteHintHopDecodeErrorZ {
2614                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615                         result: Box::into_raw(Box::new(o)),
2616                 },
2617                 result_ok: true,
2618         }
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623         CResult_RouteHintHopDecodeErrorZ {
2624                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625                         err: Box::into_raw(Box::new(e)),
2626                 },
2627                 result_ok: false,
2628         }
2629 }
2630 /// Checks if the given object is currently in the success state
2631 #[no_mangle]
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2633         o.result_ok
2634 }
2635 #[no_mangle]
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = core::ptr::null_mut() };
2656                         CResult_RouteHintHopDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = core::ptr::null_mut(); }
2660                         CResult_RouteHintHopDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2685 #[repr(C)]
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689         /// The elements in the array.
2690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692         /// The number of elements pointed to by `data`.
2693         pub datalen: usize
2694 }
2695 impl CVec_ChannelDetailsZ {
2696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697                 if self.datalen == 0 { return Vec::new(); }
2698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699                 self.data = core::ptr::null_mut();
2700                 self.datalen = 0;
2701                 ret
2702         }
2703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2705         }
2706 }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709                 let datalen = v.len();
2710                 let data = Box::into_raw(v.into_boxed_slice());
2711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2712         }
2713 }
2714 #[no_mangle]
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718         fn drop(&mut self) {
2719                 if self.datalen == 0 { return; }
2720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2721         }
2722 }
2723 impl Clone for CVec_ChannelDetailsZ {
2724         fn clone(&self) -> Self {
2725                 let mut res = Vec::new();
2726                 if self.datalen == 0 { return Self::from(res); }
2727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2728                 Self::from(res)
2729         }
2730 }
2731 #[repr(C)]
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734         /// A pointer to the contents in the success state.
2735         /// Reading from this pointer when `result_ok` is not set is undefined.
2736         pub result: *mut crate::lightning::routing::router::Route,
2737         /// A pointer to the contents in the error state.
2738         /// Reading from this pointer when `result_ok` is set is undefined.
2739         pub err: *mut crate::lightning::ln::msgs::LightningError,
2740 }
2741 #[repr(C)]
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747         /// `err` or `result` depending on the state of `result_ok`.
2748         pub contents: CResult_RouteLightningErrorZPtr,
2749         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750         pub result_ok: bool,
2751 }
2752 #[no_mangle]
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755         CResult_RouteLightningErrorZ {
2756                 contents: CResult_RouteLightningErrorZPtr {
2757                         result: Box::into_raw(Box::new(o)),
2758                 },
2759                 result_ok: true,
2760         }
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765         CResult_RouteLightningErrorZ {
2766                 contents: CResult_RouteLightningErrorZPtr {
2767                         err: Box::into_raw(Box::new(e)),
2768                 },
2769                 result_ok: false,
2770         }
2771 }
2772 /// Checks if the given object is currently in the success state
2773 #[no_mangle]
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2775         o.result_ok
2776 }
2777 #[no_mangle]
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781         fn drop(&mut self) {
2782                 if self.result_ok {
2783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2785                         }
2786                 } else {
2787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2789                         }
2790                 }
2791         }
2792 }
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795                 let contents = if o.result_ok {
2796                         let result = unsafe { o.contents.result };
2797                         unsafe { o.contents.result = core::ptr::null_mut() };
2798                         CResult_RouteLightningErrorZPtr { result }
2799                 } else {
2800                         let err = unsafe { o.contents.err };
2801                         unsafe { o.contents.err = core::ptr::null_mut(); }
2802                         CResult_RouteLightningErrorZPtr { err }
2803                 };
2804                 Self {
2805                         contents,
2806                         result_ok: o.result_ok,
2807                 }
2808         }
2809 }
2810 impl Clone for CResult_RouteLightningErrorZ {
2811         fn clone(&self) -> Self {
2812                 if self.result_ok {
2813                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2815                         } }
2816                 } else {
2817                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2819                         } }
2820                 }
2821         }
2822 }
2823 #[no_mangle]
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2827 #[repr(C)]
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830         /// A pointer to the contents in the success state.
2831         /// Reading from this pointer when `result_ok` is not set is undefined.
2832         pub result: *mut crate::c_types::TxOut,
2833         /// A pointer to the contents in the error state.
2834         /// Reading from this pointer when `result_ok` is set is undefined.
2835         pub err: *mut crate::lightning::chain::AccessError,
2836 }
2837 #[repr(C)]
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843         /// `err` or `result` depending on the state of `result_ok`.
2844         pub contents: CResult_TxOutAccessErrorZPtr,
2845         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846         pub result_ok: bool,
2847 }
2848 #[no_mangle]
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851         CResult_TxOutAccessErrorZ {
2852                 contents: CResult_TxOutAccessErrorZPtr {
2853                         result: Box::into_raw(Box::new(o)),
2854                 },
2855                 result_ok: true,
2856         }
2857 }
2858 #[no_mangle]
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861         CResult_TxOutAccessErrorZ {
2862                 contents: CResult_TxOutAccessErrorZPtr {
2863                         err: Box::into_raw(Box::new(e)),
2864                 },
2865                 result_ok: false,
2866         }
2867 }
2868 /// Checks if the given object is currently in the success state
2869 #[no_mangle]
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2871         o.result_ok
2872 }
2873 #[no_mangle]
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877         fn drop(&mut self) {
2878                 if self.result_ok {
2879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2881                         }
2882                 } else {
2883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2885                         }
2886                 }
2887         }
2888 }
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891                 let contents = if o.result_ok {
2892                         let result = unsafe { o.contents.result };
2893                         unsafe { o.contents.result = core::ptr::null_mut() };
2894                         CResult_TxOutAccessErrorZPtr { result }
2895                 } else {
2896                         let err = unsafe { o.contents.err };
2897                         unsafe { o.contents.err = core::ptr::null_mut(); }
2898                         CResult_TxOutAccessErrorZPtr { err }
2899                 };
2900                 Self {
2901                         contents,
2902                         result_ok: o.result_ok,
2903                 }
2904         }
2905 }
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907         fn clone(&self) -> Self {
2908                 if self.result_ok {
2909                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2911                         } }
2912                 } else {
2913                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2915                         } }
2916                 }
2917         }
2918 }
2919 #[no_mangle]
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2923 #[repr(C)]
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926         /// The element at position 0
2927         pub a: usize,
2928         /// The element at position 1
2929         pub b: crate::c_types::Transaction,
2930 }
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2933                 Self {
2934                         a: tup.0,
2935                         b: tup.1,
2936                 }
2937         }
2938 }
2939 impl C2Tuple_usizeTransactionZ {
2940         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2941                 (self.a, self.b)
2942         }
2943 }
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945         fn clone(&self) -> Self {
2946                 Self {
2947                         a: Clone::clone(&self.a),
2948                         b: Clone::clone(&self.b),
2949                 }
2950         }
2951 }
2952 #[no_mangle]
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2957 #[no_mangle]
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959         C2Tuple_usizeTransactionZ { a, b, }
2960 }
2961
2962 #[no_mangle]
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2965 #[repr(C)]
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969         /// The elements in the array.
2970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972         /// The number of elements pointed to by `data`.
2973         pub datalen: usize
2974 }
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977                 if self.datalen == 0 { return Vec::new(); }
2978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979                 self.data = core::ptr::null_mut();
2980                 self.datalen = 0;
2981                 ret
2982         }
2983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2985         }
2986 }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989                 let datalen = v.len();
2990                 let data = Box::into_raw(v.into_boxed_slice());
2991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2992         }
2993 }
2994 #[no_mangle]
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998         fn drop(&mut self) {
2999                 if self.datalen == 0 { return; }
3000                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3001         }
3002 }
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004         fn clone(&self) -> Self {
3005                 let mut res = Vec::new();
3006                 if self.datalen == 0 { return Self::from(res); }
3007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3008                 Self::from(res)
3009         }
3010 }
3011 #[repr(C)]
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015         /// The elements in the array.
3016         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017         pub data: *mut crate::c_types::ThirtyTwoBytes,
3018         /// The number of elements pointed to by `data`.
3019         pub datalen: usize
3020 }
3021 impl CVec_TxidZ {
3022         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023                 if self.datalen == 0 { return Vec::new(); }
3024                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025                 self.data = core::ptr::null_mut();
3026                 self.datalen = 0;
3027                 ret
3028         }
3029         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3031         }
3032 }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035                 let datalen = v.len();
3036                 let data = Box::into_raw(v.into_boxed_slice());
3037                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3038         }
3039 }
3040 #[no_mangle]
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044         fn drop(&mut self) {
3045                 if self.datalen == 0 { return; }
3046                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3047         }
3048 }
3049 impl Clone for CVec_TxidZ {
3050         fn clone(&self) -> Self {
3051                 let mut res = Vec::new();
3052                 if self.datalen == 0 { return Self::from(res); }
3053                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3054                 Self::from(res)
3055         }
3056 }
3057 #[repr(C)]
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060         /// Note that this value is always NULL, as there are no contents in the OK variant
3061         pub result: *mut core::ffi::c_void,
3062         /// A pointer to the contents in the error state.
3063         /// Reading from this pointer when `result_ok` is set is undefined.
3064         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3065 }
3066 #[repr(C)]
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072         /// `err` or `result` depending on the state of `result_ok`.
3073         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075         pub result_ok: bool,
3076 }
3077 #[no_mangle]
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080         CResult_NoneChannelMonitorUpdateErrZ {
3081                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082                         result: core::ptr::null_mut(),
3083                 },
3084                 result_ok: true,
3085         }
3086 }
3087 #[no_mangle]
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090         CResult_NoneChannelMonitorUpdateErrZ {
3091                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092                         err: Box::into_raw(Box::new(e)),
3093                 },
3094                 result_ok: false,
3095         }
3096 }
3097 /// Checks if the given object is currently in the success state
3098 #[no_mangle]
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3100         o.result_ok
3101 }
3102 #[no_mangle]
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106         fn drop(&mut self) {
3107                 if self.result_ok {
3108                 } else {
3109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3111                         }
3112                 }
3113         }
3114 }
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117                 let contents = if o.result_ok {
3118                         let _ = unsafe { Box::from_raw(o.contents.result) };
3119                         o.contents.result = core::ptr::null_mut();
3120                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3121                 } else {
3122                         let err = unsafe { o.contents.err };
3123                         unsafe { o.contents.err = core::ptr::null_mut(); }
3124                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3125                 };
3126                 Self {
3127                         contents,
3128                         result_ok: o.result_ok,
3129                 }
3130         }
3131 }
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133         fn clone(&self) -> Self {
3134                 if self.result_ok {
3135                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136                                 result: core::ptr::null_mut()
3137                         } }
3138                 } else {
3139                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3141                         } }
3142                 }
3143         }
3144 }
3145 #[no_mangle]
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3149 #[repr(C)]
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153         /// The elements in the array.
3154         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156         /// The number of elements pointed to by `data`.
3157         pub datalen: usize
3158 }
3159 impl CVec_MonitorEventZ {
3160         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161                 if self.datalen == 0 { return Vec::new(); }
3162                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163                 self.data = core::ptr::null_mut();
3164                 self.datalen = 0;
3165                 ret
3166         }
3167         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3169         }
3170 }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173                 let datalen = v.len();
3174                 let data = Box::into_raw(v.into_boxed_slice());
3175                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3176         }
3177 }
3178 #[no_mangle]
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182         fn drop(&mut self) {
3183                 if self.datalen == 0 { return; }
3184                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3185         }
3186 }
3187 impl Clone for CVec_MonitorEventZ {
3188         fn clone(&self) -> Self {
3189                 let mut res = Vec::new();
3190                 if self.datalen == 0 { return Self::from(res); }
3191                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3192                 Self::from(res)
3193         }
3194 }
3195 #[repr(C)]
3196 #[derive(Clone)]
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3202         None
3203 }
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206                 if let Self::None = self { false } else { true }
3207         }
3208         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3209                 !self.is_some()
3210         }
3211         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212                 if let Self::Some(v) = self { v } else { unreachable!() }
3213         }
3214 }
3215 #[no_mangle]
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218         COption_C2Tuple_usizeTransactionZZ::Some(o)
3219 }
3220 #[no_mangle]
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223         COption_C2Tuple_usizeTransactionZZ::None
3224 }
3225 #[no_mangle]
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3228 #[no_mangle]
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3232 #[repr(C)]
3233 #[derive(Clone)]
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237         Some(crate::lightning::util::events::ClosureReason),
3238         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3239         None
3240 }
3241 impl COption_ClosureReasonZ {
3242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243                 if let Self::None = self { false } else { true }
3244         }
3245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3246                 !self.is_some()
3247         }
3248         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249                 if let Self::Some(v) = self { v } else { unreachable!() }
3250         }
3251 }
3252 #[no_mangle]
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255         COption_ClosureReasonZ::Some(o)
3256 }
3257 #[no_mangle]
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260         COption_ClosureReasonZ::None
3261 }
3262 #[no_mangle]
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3265 #[no_mangle]
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3269 #[repr(C)]
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272         /// A pointer to the contents in the success state.
3273         /// Reading from this pointer when `result_ok` is not set is undefined.
3274         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275         /// A pointer to the contents in the error state.
3276         /// Reading from this pointer when `result_ok` is set is undefined.
3277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3278 }
3279 #[repr(C)]
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285         /// `err` or `result` depending on the state of `result_ok`.
3286         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288         pub result_ok: bool,
3289 }
3290 #[no_mangle]
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293         CResult_COption_ClosureReasonZDecodeErrorZ {
3294                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295                         result: Box::into_raw(Box::new(o)),
3296                 },
3297                 result_ok: true,
3298         }
3299 }
3300 #[no_mangle]
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303         CResult_COption_ClosureReasonZDecodeErrorZ {
3304                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305                         err: Box::into_raw(Box::new(e)),
3306                 },
3307                 result_ok: false,
3308         }
3309 }
3310 /// Checks if the given object is currently in the success state
3311 #[no_mangle]
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3313         o.result_ok
3314 }
3315 #[no_mangle]
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319         fn drop(&mut self) {
3320                 if self.result_ok {
3321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3323                         }
3324                 } else {
3325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3327                         }
3328                 }
3329         }
3330 }
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333                 let contents = if o.result_ok {
3334                         let result = unsafe { o.contents.result };
3335                         unsafe { o.contents.result = core::ptr::null_mut() };
3336                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3337                 } else {
3338                         let err = unsafe { o.contents.err };
3339                         unsafe { o.contents.err = core::ptr::null_mut(); }
3340                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3341                 };
3342                 Self {
3343                         contents,
3344                         result_ok: o.result_ok,
3345                 }
3346         }
3347 }
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349         fn clone(&self) -> Self {
3350                 if self.result_ok {
3351                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3353                         } }
3354                 } else {
3355                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3357                         } }
3358                 }
3359         }
3360 }
3361 #[no_mangle]
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3365 #[repr(C)]
3366 #[derive(Clone)]
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3372         None
3373 }
3374 impl COption_NetworkUpdateZ {
3375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376                 if let Self::None = self { false } else { true }
3377         }
3378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3379                 !self.is_some()
3380         }
3381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382                 if let Self::Some(v) = self { v } else { unreachable!() }
3383         }
3384 }
3385 #[no_mangle]
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388         COption_NetworkUpdateZ::Some(o)
3389 }
3390 #[no_mangle]
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393         COption_NetworkUpdateZ::None
3394 }
3395 #[no_mangle]
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3398 #[no_mangle]
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3402 #[repr(C)]
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406         /// The elements in the array.
3407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409         /// The number of elements pointed to by `data`.
3410         pub datalen: usize
3411 }
3412 impl CVec_SpendableOutputDescriptorZ {
3413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414                 if self.datalen == 0 { return Vec::new(); }
3415                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416                 self.data = core::ptr::null_mut();
3417                 self.datalen = 0;
3418                 ret
3419         }
3420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3422         }
3423 }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426                 let datalen = v.len();
3427                 let data = Box::into_raw(v.into_boxed_slice());
3428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3429         }
3430 }
3431 #[no_mangle]
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435         fn drop(&mut self) {
3436                 if self.datalen == 0 { return; }
3437                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3438         }
3439 }
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441         fn clone(&self) -> Self {
3442                 let mut res = Vec::new();
3443                 if self.datalen == 0 { return Self::from(res); }
3444                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3445                 Self::from(res)
3446         }
3447 }
3448 #[repr(C)]
3449 #[derive(Clone)]
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453         Some(crate::lightning::util::events::Event),
3454         /// When we're in this state, this COption_EventZ contains nothing
3455         None
3456 }
3457 impl COption_EventZ {
3458         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459                 if let Self::None = self { false } else { true }
3460         }
3461         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3462                 !self.is_some()
3463         }
3464         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465                 if let Self::Some(v) = self { v } else { unreachable!() }
3466         }
3467 }
3468 #[no_mangle]
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471         COption_EventZ::Some(o)
3472 }
3473 #[no_mangle]
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476         COption_EventZ::None
3477 }
3478 #[no_mangle]
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3481 #[no_mangle]
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3485 #[repr(C)]
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488         /// A pointer to the contents in the success state.
3489         /// Reading from this pointer when `result_ok` is not set is undefined.
3490         pub result: *mut crate::c_types::derived::COption_EventZ,
3491         /// A pointer to the contents in the error state.
3492         /// Reading from this pointer when `result_ok` is set is undefined.
3493         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3494 }
3495 #[repr(C)]
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501         /// `err` or `result` depending on the state of `result_ok`.
3502         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504         pub result_ok: bool,
3505 }
3506 #[no_mangle]
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509         CResult_COption_EventZDecodeErrorZ {
3510                 contents: CResult_COption_EventZDecodeErrorZPtr {
3511                         result: Box::into_raw(Box::new(o)),
3512                 },
3513                 result_ok: true,
3514         }
3515 }
3516 #[no_mangle]
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519         CResult_COption_EventZDecodeErrorZ {
3520                 contents: CResult_COption_EventZDecodeErrorZPtr {
3521                         err: Box::into_raw(Box::new(e)),
3522                 },
3523                 result_ok: false,
3524         }
3525 }
3526 /// Checks if the given object is currently in the success state
3527 #[no_mangle]
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3529         o.result_ok
3530 }
3531 #[no_mangle]
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535         fn drop(&mut self) {
3536                 if self.result_ok {
3537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3539                         }
3540                 } else {
3541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3543                         }
3544                 }
3545         }
3546 }
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549                 let contents = if o.result_ok {
3550                         let result = unsafe { o.contents.result };
3551                         unsafe { o.contents.result = core::ptr::null_mut() };
3552                         CResult_COption_EventZDecodeErrorZPtr { result }
3553                 } else {
3554                         let err = unsafe { o.contents.err };
3555                         unsafe { o.contents.err = core::ptr::null_mut(); }
3556                         CResult_COption_EventZDecodeErrorZPtr { err }
3557                 };
3558                 Self {
3559                         contents,
3560                         result_ok: o.result_ok,
3561                 }
3562         }
3563 }
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565         fn clone(&self) -> Self {
3566                 if self.result_ok {
3567                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3569                         } }
3570                 } else {
3571                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3573                         } }
3574                 }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3581 #[repr(C)]
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585         /// The elements in the array.
3586         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588         /// The number of elements pointed to by `data`.
3589         pub datalen: usize
3590 }
3591 impl CVec_MessageSendEventZ {
3592         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593                 if self.datalen == 0 { return Vec::new(); }
3594                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595                 self.data = core::ptr::null_mut();
3596                 self.datalen = 0;
3597                 ret
3598         }
3599         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3601         }
3602 }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605                 let datalen = v.len();
3606                 let data = Box::into_raw(v.into_boxed_slice());
3607                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3608         }
3609 }
3610 #[no_mangle]
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614         fn drop(&mut self) {
3615                 if self.datalen == 0 { return; }
3616                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3617         }
3618 }
3619 impl Clone for CVec_MessageSendEventZ {
3620         fn clone(&self) -> Self {
3621                 let mut res = Vec::new();
3622                 if self.datalen == 0 { return Self::from(res); }
3623                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3624                 Self::from(res)
3625         }
3626 }
3627 #[repr(C)]
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630         /// A pointer to the contents in the success state.
3631         /// Reading from this pointer when `result_ok` is not set is undefined.
3632         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633         /// A pointer to the contents in the error state.
3634         /// Reading from this pointer when `result_ok` is set is undefined.
3635         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3636 }
3637 #[repr(C)]
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643         /// `err` or `result` depending on the state of `result_ok`.
3644         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646         pub result_ok: bool,
3647 }
3648 #[no_mangle]
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651         CResult_FixedPenaltyScorerDecodeErrorZ {
3652                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653                         result: Box::into_raw(Box::new(o)),
3654                 },
3655                 result_ok: true,
3656         }
3657 }
3658 #[no_mangle]
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661         CResult_FixedPenaltyScorerDecodeErrorZ {
3662                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663                         err: Box::into_raw(Box::new(e)),
3664                 },
3665                 result_ok: false,
3666         }
3667 }
3668 /// Checks if the given object is currently in the success state
3669 #[no_mangle]
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3671         o.result_ok
3672 }
3673 #[no_mangle]
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677         fn drop(&mut self) {
3678                 if self.result_ok {
3679                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3681                         }
3682                 } else {
3683                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3685                         }
3686                 }
3687         }
3688 }
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691                 let contents = if o.result_ok {
3692                         let result = unsafe { o.contents.result };
3693                         unsafe { o.contents.result = core::ptr::null_mut() };
3694                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3695                 } else {
3696                         let err = unsafe { o.contents.err };
3697                         unsafe { o.contents.err = core::ptr::null_mut(); }
3698                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3699                 };
3700                 Self {
3701                         contents,
3702                         result_ok: o.result_ok,
3703                 }
3704         }
3705 }
3706 #[repr(C)]
3707 /// The contents of CResult_ScoringParametersDecodeErrorZ
3708 pub union CResult_ScoringParametersDecodeErrorZPtr {
3709         /// A pointer to the contents in the success state.
3710         /// Reading from this pointer when `result_ok` is not set is undefined.
3711         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3712         /// A pointer to the contents in the error state.
3713         /// Reading from this pointer when `result_ok` is set is undefined.
3714         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3715 }
3716 #[repr(C)]
3717 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3718 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3720 pub struct CResult_ScoringParametersDecodeErrorZ {
3721         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3722         /// `err` or `result` depending on the state of `result_ok`.
3723         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3724         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3725         pub result_ok: bool,
3726 }
3727 #[no_mangle]
3728 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3729 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3730         CResult_ScoringParametersDecodeErrorZ {
3731                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3732                         result: Box::into_raw(Box::new(o)),
3733                 },
3734                 result_ok: true,
3735         }
3736 }
3737 #[no_mangle]
3738 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3739 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3740         CResult_ScoringParametersDecodeErrorZ {
3741                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3742                         err: Box::into_raw(Box::new(e)),
3743                 },
3744                 result_ok: false,
3745         }
3746 }
3747 /// Checks if the given object is currently in the success state
3748 #[no_mangle]
3749 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3750         o.result_ok
3751 }
3752 #[no_mangle]
3753 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3754 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3755 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3756         fn drop(&mut self) {
3757                 if self.result_ok {
3758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3760                         }
3761                 } else {
3762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3764                         }
3765                 }
3766         }
3767 }
3768 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3769         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3770                 let contents = if o.result_ok {
3771                         let result = unsafe { o.contents.result };
3772                         unsafe { o.contents.result = core::ptr::null_mut() };
3773                         CResult_ScoringParametersDecodeErrorZPtr { result }
3774                 } else {
3775                         let err = unsafe { o.contents.err };
3776                         unsafe { o.contents.err = core::ptr::null_mut(); }
3777                         CResult_ScoringParametersDecodeErrorZPtr { err }
3778                 };
3779                 Self {
3780                         contents,
3781                         result_ok: o.result_ok,
3782                 }
3783         }
3784 }
3785 #[repr(C)]
3786 /// The contents of CResult_ScorerDecodeErrorZ
3787 pub union CResult_ScorerDecodeErrorZPtr {
3788         /// A pointer to the contents in the success state.
3789         /// Reading from this pointer when `result_ok` is not set is undefined.
3790         pub result: *mut crate::lightning::routing::scoring::Scorer,
3791         /// A pointer to the contents in the error state.
3792         /// Reading from this pointer when `result_ok` is set is undefined.
3793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3794 }
3795 #[repr(C)]
3796 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3797 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3799 pub struct CResult_ScorerDecodeErrorZ {
3800         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3801         /// `err` or `result` depending on the state of `result_ok`.
3802         pub contents: CResult_ScorerDecodeErrorZPtr,
3803         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3804         pub result_ok: bool,
3805 }
3806 #[no_mangle]
3807 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3808 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3809         CResult_ScorerDecodeErrorZ {
3810                 contents: CResult_ScorerDecodeErrorZPtr {
3811                         result: Box::into_raw(Box::new(o)),
3812                 },
3813                 result_ok: true,
3814         }
3815 }
3816 #[no_mangle]
3817 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3818 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3819         CResult_ScorerDecodeErrorZ {
3820                 contents: CResult_ScorerDecodeErrorZPtr {
3821                         err: Box::into_raw(Box::new(e)),
3822                 },
3823                 result_ok: false,
3824         }
3825 }
3826 /// Checks if the given object is currently in the success state
3827 #[no_mangle]
3828 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3829         o.result_ok
3830 }
3831 #[no_mangle]
3832 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3833 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3834 impl Drop for CResult_ScorerDecodeErrorZ {
3835         fn drop(&mut self) {
3836                 if self.result_ok {
3837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3839                         }
3840                 } else {
3841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3843                         }
3844                 }
3845         }
3846 }
3847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849                 let contents = if o.result_ok {
3850                         let result = unsafe { o.contents.result };
3851                         unsafe { o.contents.result = core::ptr::null_mut() };
3852                         CResult_ScorerDecodeErrorZPtr { result }
3853                 } else {
3854                         let err = unsafe { o.contents.err };
3855                         unsafe { o.contents.err = core::ptr::null_mut(); }
3856                         CResult_ScorerDecodeErrorZPtr { err }
3857                 };
3858                 Self {
3859                         contents,
3860                         result_ok: o.result_ok,
3861                 }
3862         }
3863 }
3864 #[repr(C)]
3865 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3866 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3867         /// A pointer to the contents in the success state.
3868         /// Reading from this pointer when `result_ok` is not set is undefined.
3869         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3870         /// A pointer to the contents in the error state.
3871         /// Reading from this pointer when `result_ok` is set is undefined.
3872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3873 }
3874 #[repr(C)]
3875 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3876 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3878 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3879         /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3880         /// `err` or `result` depending on the state of `result_ok`.
3881         pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3882         /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3883         pub result_ok: bool,
3884 }
3885 #[no_mangle]
3886 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3887 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3888         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3889                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3890                         result: Box::into_raw(Box::new(o)),
3891                 },
3892                 result_ok: true,
3893         }
3894 }
3895 #[no_mangle]
3896 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3897 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3898         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3899                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3900                         err: Box::into_raw(Box::new(e)),
3901                 },
3902                 result_ok: false,
3903         }
3904 }
3905 /// Checks if the given object is currently in the success state
3906 #[no_mangle]
3907 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3908         o.result_ok
3909 }
3910 #[no_mangle]
3911 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3912 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3913 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3914         fn drop(&mut self) {
3915                 if self.result_ok {
3916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3918                         }
3919                 } else {
3920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3922                         }
3923                 }
3924         }
3925 }
3926 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3928                 let contents = if o.result_ok {
3929                         let result = unsafe { o.contents.result };
3930                         unsafe { o.contents.result = core::ptr::null_mut() };
3931                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3932                 } else {
3933                         let err = unsafe { o.contents.err };
3934                         unsafe { o.contents.err = core::ptr::null_mut(); }
3935                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3936                 };
3937                 Self {
3938                         contents,
3939                         result_ok: o.result_ok,
3940                 }
3941         }
3942 }
3943 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3944         fn clone(&self) -> Self {
3945                 if self.result_ok {
3946                         Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3947                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3948                         } }
3949                 } else {
3950                         Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3952                         } }
3953                 }
3954         }
3955 }
3956 #[no_mangle]
3957 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3958 /// but with all dynamically-allocated buffers duplicated in new buffers.
3959 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3960 #[repr(C)]
3961 /// A tuple of 2 elements. See the individual fields for the types contained.
3962 pub struct C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3963         /// The element at position 0
3964         pub a: crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3965         /// The element at position 1
3966         pub b: &'static crate::lightning::routing::network_graph::NetworkGraph,
3967 }
3968 impl From<(crate::lightning::routing::scoring::ProbabilisticScoringParameters, &'static crate::lightning::routing::network_graph::NetworkGraph)> for C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3969         fn from (tup: (crate::lightning::routing::scoring::ProbabilisticScoringParameters, &'static crate::lightning::routing::network_graph::NetworkGraph)) -> Self {
3970                 Self {
3971                         a: tup.0,
3972                         b: tup.1,
3973                 }
3974         }
3975 }
3976 impl C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3977         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::routing::scoring::ProbabilisticScoringParameters, &'static crate::lightning::routing::network_graph::NetworkGraph) {
3978                 (self.a, self.b)
3979         }
3980 }
3981 /// Creates a new C2Tuple_ProbabilisticScoringParametersNetworkGraphZ from the contained elements.
3982 #[no_mangle]
3983 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a: crate::lightning::routing::scoring::ProbabilisticScoringParameters, b: &'static crate::lightning::routing::network_graph::NetworkGraph) -> C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3984         C2Tuple_ProbabilisticScoringParametersNetworkGraphZ { a, b, }
3985 }
3986
3987 #[no_mangle]
3988 /// Frees any resources used by the C2Tuple_ProbabilisticScoringParametersNetworkGraphZ.
3989 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ) { }
3990 #[repr(C)]
3991 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3992 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3993         /// A pointer to the contents in the success state.
3994         /// Reading from this pointer when `result_ok` is not set is undefined.
3995         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3996         /// A pointer to the contents in the error state.
3997         /// Reading from this pointer when `result_ok` is set is undefined.
3998         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3999 }
4000 #[repr(C)]
4001 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4002 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4004 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4005         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4006         /// `err` or `result` depending on the state of `result_ok`.
4007         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4008         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4009         pub result_ok: bool,
4010 }
4011 #[no_mangle]
4012 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4013 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4014         CResult_ProbabilisticScorerDecodeErrorZ {
4015                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4016                         result: Box::into_raw(Box::new(o)),
4017                 },
4018                 result_ok: true,
4019         }
4020 }
4021 #[no_mangle]
4022 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4023 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4024         CResult_ProbabilisticScorerDecodeErrorZ {
4025                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4026                         err: Box::into_raw(Box::new(e)),
4027                 },
4028                 result_ok: false,
4029         }
4030 }
4031 /// Checks if the given object is currently in the success state
4032 #[no_mangle]
4033 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4034         o.result_ok
4035 }
4036 #[no_mangle]
4037 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4038 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4039 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4040         fn drop(&mut self) {
4041                 if self.result_ok {
4042                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4043                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4044                         }
4045                 } else {
4046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4048                         }
4049                 }
4050         }
4051 }
4052 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4053         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4054                 let contents = if o.result_ok {
4055                         let result = unsafe { o.contents.result };
4056                         unsafe { o.contents.result = core::ptr::null_mut() };
4057                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4058                 } else {
4059                         let err = unsafe { o.contents.err };
4060                         unsafe { o.contents.err = core::ptr::null_mut(); }
4061                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4062                 };
4063                 Self {
4064                         contents,
4065                         result_ok: o.result_ok,
4066                 }
4067         }
4068 }
4069 #[repr(C)]
4070 /// The contents of CResult_InitFeaturesDecodeErrorZ
4071 pub union CResult_InitFeaturesDecodeErrorZPtr {
4072         /// A pointer to the contents in the success state.
4073         /// Reading from this pointer when `result_ok` is not set is undefined.
4074         pub result: *mut crate::lightning::ln::features::InitFeatures,
4075         /// A pointer to the contents in the error state.
4076         /// Reading from this pointer when `result_ok` is set is undefined.
4077         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4078 }
4079 #[repr(C)]
4080 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4081 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4083 pub struct CResult_InitFeaturesDecodeErrorZ {
4084         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4085         /// `err` or `result` depending on the state of `result_ok`.
4086         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4087         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4088         pub result_ok: bool,
4089 }
4090 #[no_mangle]
4091 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4092 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4093         CResult_InitFeaturesDecodeErrorZ {
4094                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4095                         result: Box::into_raw(Box::new(o)),
4096                 },
4097                 result_ok: true,
4098         }
4099 }
4100 #[no_mangle]
4101 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4102 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4103         CResult_InitFeaturesDecodeErrorZ {
4104                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4105                         err: Box::into_raw(Box::new(e)),
4106                 },
4107                 result_ok: false,
4108         }
4109 }
4110 /// Checks if the given object is currently in the success state
4111 #[no_mangle]
4112 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4113         o.result_ok
4114 }
4115 #[no_mangle]
4116 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4117 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4118 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4119         fn drop(&mut self) {
4120                 if self.result_ok {
4121                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4122                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4123                         }
4124                 } else {
4125                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4126                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4127                         }
4128                 }
4129         }
4130 }
4131 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4132         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4133                 let contents = if o.result_ok {
4134                         let result = unsafe { o.contents.result };
4135                         unsafe { o.contents.result = core::ptr::null_mut() };
4136                         CResult_InitFeaturesDecodeErrorZPtr { result }
4137                 } else {
4138                         let err = unsafe { o.contents.err };
4139                         unsafe { o.contents.err = core::ptr::null_mut(); }
4140                         CResult_InitFeaturesDecodeErrorZPtr { err }
4141                 };
4142                 Self {
4143                         contents,
4144                         result_ok: o.result_ok,
4145                 }
4146         }
4147 }
4148 #[repr(C)]
4149 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4150 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4151         /// A pointer to the contents in the success state.
4152         /// Reading from this pointer when `result_ok` is not set is undefined.
4153         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4154         /// A pointer to the contents in the error state.
4155         /// Reading from this pointer when `result_ok` is set is undefined.
4156         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4157 }
4158 #[repr(C)]
4159 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4160 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4162 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4163         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4164         /// `err` or `result` depending on the state of `result_ok`.
4165         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4166         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4167         pub result_ok: bool,
4168 }
4169 #[no_mangle]
4170 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4171 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4172         CResult_ChannelFeaturesDecodeErrorZ {
4173                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4174                         result: Box::into_raw(Box::new(o)),
4175                 },
4176                 result_ok: true,
4177         }
4178 }
4179 #[no_mangle]
4180 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4181 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4182         CResult_ChannelFeaturesDecodeErrorZ {
4183                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4184                         err: Box::into_raw(Box::new(e)),
4185                 },
4186                 result_ok: false,
4187         }
4188 }
4189 /// Checks if the given object is currently in the success state
4190 #[no_mangle]
4191 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4192         o.result_ok
4193 }
4194 #[no_mangle]
4195 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4196 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4197 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4198         fn drop(&mut self) {
4199                 if self.result_ok {
4200                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4201                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4202                         }
4203                 } else {
4204                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4205                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4206                         }
4207                 }
4208         }
4209 }
4210 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4211         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4212                 let contents = if o.result_ok {
4213                         let result = unsafe { o.contents.result };
4214                         unsafe { o.contents.result = core::ptr::null_mut() };
4215                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4216                 } else {
4217                         let err = unsafe { o.contents.err };
4218                         unsafe { o.contents.err = core::ptr::null_mut(); }
4219                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4220                 };
4221                 Self {
4222                         contents,
4223                         result_ok: o.result_ok,
4224                 }
4225         }
4226 }
4227 #[repr(C)]
4228 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4229 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4230         /// A pointer to the contents in the success state.
4231         /// Reading from this pointer when `result_ok` is not set is undefined.
4232         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4233         /// A pointer to the contents in the error state.
4234         /// Reading from this pointer when `result_ok` is set is undefined.
4235         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4236 }
4237 #[repr(C)]
4238 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4239 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4241 pub struct CResult_NodeFeaturesDecodeErrorZ {
4242         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4243         /// `err` or `result` depending on the state of `result_ok`.
4244         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4245         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4246         pub result_ok: bool,
4247 }
4248 #[no_mangle]
4249 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4250 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4251         CResult_NodeFeaturesDecodeErrorZ {
4252                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4253                         result: Box::into_raw(Box::new(o)),
4254                 },
4255                 result_ok: true,
4256         }
4257 }
4258 #[no_mangle]
4259 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4260 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4261         CResult_NodeFeaturesDecodeErrorZ {
4262                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4263                         err: Box::into_raw(Box::new(e)),
4264                 },
4265                 result_ok: false,
4266         }
4267 }
4268 /// Checks if the given object is currently in the success state
4269 #[no_mangle]
4270 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4271         o.result_ok
4272 }
4273 #[no_mangle]
4274 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4275 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4276 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4277         fn drop(&mut self) {
4278                 if self.result_ok {
4279                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4280                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4281                         }
4282                 } else {
4283                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4284                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4285                         }
4286                 }
4287         }
4288 }
4289 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4290         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4291                 let contents = if o.result_ok {
4292                         let result = unsafe { o.contents.result };
4293                         unsafe { o.contents.result = core::ptr::null_mut() };
4294                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4295                 } else {
4296                         let err = unsafe { o.contents.err };
4297                         unsafe { o.contents.err = core::ptr::null_mut(); }
4298                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4299                 };
4300                 Self {
4301                         contents,
4302                         result_ok: o.result_ok,
4303                 }
4304         }
4305 }
4306 #[repr(C)]
4307 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4308 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4309         /// A pointer to the contents in the success state.
4310         /// Reading from this pointer when `result_ok` is not set is undefined.
4311         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4312         /// A pointer to the contents in the error state.
4313         /// Reading from this pointer when `result_ok` is set is undefined.
4314         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4315 }
4316 #[repr(C)]
4317 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4318 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4320 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4321         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4322         /// `err` or `result` depending on the state of `result_ok`.
4323         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4324         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4325         pub result_ok: bool,
4326 }
4327 #[no_mangle]
4328 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4329 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4330         CResult_InvoiceFeaturesDecodeErrorZ {
4331                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4332                         result: Box::into_raw(Box::new(o)),
4333                 },
4334                 result_ok: true,
4335         }
4336 }
4337 #[no_mangle]
4338 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4339 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4340         CResult_InvoiceFeaturesDecodeErrorZ {
4341                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4342                         err: Box::into_raw(Box::new(e)),
4343                 },
4344                 result_ok: false,
4345         }
4346 }
4347 /// Checks if the given object is currently in the success state
4348 #[no_mangle]
4349 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4350         o.result_ok
4351 }
4352 #[no_mangle]
4353 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4354 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4355 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4356         fn drop(&mut self) {
4357                 if self.result_ok {
4358                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4359                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4360                         }
4361                 } else {
4362                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4363                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4364                         }
4365                 }
4366         }
4367 }
4368 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4369         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4370                 let contents = if o.result_ok {
4371                         let result = unsafe { o.contents.result };
4372                         unsafe { o.contents.result = core::ptr::null_mut() };
4373                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4374                 } else {
4375                         let err = unsafe { o.contents.err };
4376                         unsafe { o.contents.err = core::ptr::null_mut(); }
4377                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4378                 };
4379                 Self {
4380                         contents,
4381                         result_ok: o.result_ok,
4382                 }
4383         }
4384 }
4385 #[repr(C)]
4386 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4387 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4388         /// A pointer to the contents in the success state.
4389         /// Reading from this pointer when `result_ok` is not set is undefined.
4390         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4391         /// A pointer to the contents in the error state.
4392         /// Reading from this pointer when `result_ok` is set is undefined.
4393         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4394 }
4395 #[repr(C)]
4396 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4397 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4398 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4399 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4400         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4401         /// `err` or `result` depending on the state of `result_ok`.
4402         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4403         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4404         pub result_ok: bool,
4405 }
4406 #[no_mangle]
4407 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4408 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4409         CResult_ChannelTypeFeaturesDecodeErrorZ {
4410                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4411                         result: Box::into_raw(Box::new(o)),
4412                 },
4413                 result_ok: true,
4414         }
4415 }
4416 #[no_mangle]
4417 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4418 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4419         CResult_ChannelTypeFeaturesDecodeErrorZ {
4420                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4421                         err: Box::into_raw(Box::new(e)),
4422                 },
4423                 result_ok: false,
4424         }
4425 }
4426 /// Checks if the given object is currently in the success state
4427 #[no_mangle]
4428 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4429         o.result_ok
4430 }
4431 #[no_mangle]
4432 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4433 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4434 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4435         fn drop(&mut self) {
4436                 if self.result_ok {
4437                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4438                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4439                         }
4440                 } else {
4441                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4442                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4443                         }
4444                 }
4445         }
4446 }
4447 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4448         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4449                 let contents = if o.result_ok {
4450                         let result = unsafe { o.contents.result };
4451                         unsafe { o.contents.result = core::ptr::null_mut() };
4452                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4453                 } else {
4454                         let err = unsafe { o.contents.err };
4455                         unsafe { o.contents.err = core::ptr::null_mut(); }
4456                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4457                 };
4458                 Self {
4459                         contents,
4460                         result_ok: o.result_ok,
4461                 }
4462         }
4463 }
4464 #[repr(C)]
4465 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4466 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4467         /// A pointer to the contents in the success state.
4468         /// Reading from this pointer when `result_ok` is not set is undefined.
4469         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4470         /// A pointer to the contents in the error state.
4471         /// Reading from this pointer when `result_ok` is set is undefined.
4472         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4473 }
4474 #[repr(C)]
4475 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4476 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4477 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4478 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4479         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4480         /// `err` or `result` depending on the state of `result_ok`.
4481         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4482         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4483         pub result_ok: bool,
4484 }
4485 #[no_mangle]
4486 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4487 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4488         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4489                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4490                         result: Box::into_raw(Box::new(o)),
4491                 },
4492                 result_ok: true,
4493         }
4494 }
4495 #[no_mangle]
4496 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4497 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4498         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4499                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4500                         err: Box::into_raw(Box::new(e)),
4501                 },
4502                 result_ok: false,
4503         }
4504 }
4505 /// Checks if the given object is currently in the success state
4506 #[no_mangle]
4507 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4508         o.result_ok
4509 }
4510 #[no_mangle]
4511 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4512 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4513 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4514         fn drop(&mut self) {
4515                 if self.result_ok {
4516                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4517                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4518                         }
4519                 } else {
4520                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4521                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4522                         }
4523                 }
4524         }
4525 }
4526 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4527         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4528                 let contents = if o.result_ok {
4529                         let result = unsafe { o.contents.result };
4530                         unsafe { o.contents.result = core::ptr::null_mut() };
4531                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4532                 } else {
4533                         let err = unsafe { o.contents.err };
4534                         unsafe { o.contents.err = core::ptr::null_mut(); }
4535                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4536                 };
4537                 Self {
4538                         contents,
4539                         result_ok: o.result_ok,
4540                 }
4541         }
4542 }
4543 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4544         fn clone(&self) -> Self {
4545                 if self.result_ok {
4546                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4547                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4548                         } }
4549                 } else {
4550                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4551                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4552                         } }
4553                 }
4554         }
4555 }
4556 #[no_mangle]
4557 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4558 /// but with all dynamically-allocated buffers duplicated in new buffers.
4559 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4560 #[repr(C)]
4561 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4562 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4563         /// A pointer to the contents in the success state.
4564         /// Reading from this pointer when `result_ok` is not set is undefined.
4565         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4566         /// A pointer to the contents in the error state.
4567         /// Reading from this pointer when `result_ok` is set is undefined.
4568         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4569 }
4570 #[repr(C)]
4571 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4572 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4574 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4575         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4576         /// `err` or `result` depending on the state of `result_ok`.
4577         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4578         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4579         pub result_ok: bool,
4580 }
4581 #[no_mangle]
4582 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4583 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4584         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4585                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4586                         result: Box::into_raw(Box::new(o)),
4587                 },
4588                 result_ok: true,
4589         }
4590 }
4591 #[no_mangle]
4592 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4593 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4594         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4595                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4596                         err: Box::into_raw(Box::new(e)),
4597                 },
4598                 result_ok: false,
4599         }
4600 }
4601 /// Checks if the given object is currently in the success state
4602 #[no_mangle]
4603 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4604         o.result_ok
4605 }
4606 #[no_mangle]
4607 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4608 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4609 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4610         fn drop(&mut self) {
4611                 if self.result_ok {
4612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4614                         }
4615                 } else {
4616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4618                         }
4619                 }
4620         }
4621 }
4622 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4623         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4624                 let contents = if o.result_ok {
4625                         let result = unsafe { o.contents.result };
4626                         unsafe { o.contents.result = core::ptr::null_mut() };
4627                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4628                 } else {
4629                         let err = unsafe { o.contents.err };
4630                         unsafe { o.contents.err = core::ptr::null_mut(); }
4631                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4632                 };
4633                 Self {
4634                         contents,
4635                         result_ok: o.result_ok,
4636                 }
4637         }
4638 }
4639 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4640         fn clone(&self) -> Self {
4641                 if self.result_ok {
4642                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4643                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4644                         } }
4645                 } else {
4646                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4647                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4648                         } }
4649                 }
4650         }
4651 }
4652 #[no_mangle]
4653 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4654 /// but with all dynamically-allocated buffers duplicated in new buffers.
4655 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4656 #[repr(C)]
4657 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4658 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4659         /// A pointer to the contents in the success state.
4660         /// Reading from this pointer when `result_ok` is not set is undefined.
4661         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4662         /// A pointer to the contents in the error state.
4663         /// Reading from this pointer when `result_ok` is set is undefined.
4664         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4665 }
4666 #[repr(C)]
4667 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4668 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4670 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4671         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4672         /// `err` or `result` depending on the state of `result_ok`.
4673         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4674         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4675         pub result_ok: bool,
4676 }
4677 #[no_mangle]
4678 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4679 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4680         CResult_SpendableOutputDescriptorDecodeErrorZ {
4681                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4682                         result: Box::into_raw(Box::new(o)),
4683                 },
4684                 result_ok: true,
4685         }
4686 }
4687 #[no_mangle]
4688 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4689 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4690         CResult_SpendableOutputDescriptorDecodeErrorZ {
4691                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4692                         err: Box::into_raw(Box::new(e)),
4693                 },
4694                 result_ok: false,
4695         }
4696 }
4697 /// Checks if the given object is currently in the success state
4698 #[no_mangle]
4699 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4700         o.result_ok
4701 }
4702 #[no_mangle]
4703 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4704 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4705 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4706         fn drop(&mut self) {
4707                 if self.result_ok {
4708                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4709                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4710                         }
4711                 } else {
4712                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4713                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4714                         }
4715                 }
4716         }
4717 }
4718 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4719         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4720                 let contents = if o.result_ok {
4721                         let result = unsafe { o.contents.result };
4722                         unsafe { o.contents.result = core::ptr::null_mut() };
4723                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4724                 } else {
4725                         let err = unsafe { o.contents.err };
4726                         unsafe { o.contents.err = core::ptr::null_mut(); }
4727                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4728                 };
4729                 Self {
4730                         contents,
4731                         result_ok: o.result_ok,
4732                 }
4733         }
4734 }
4735 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4736         fn clone(&self) -> Self {
4737                 if self.result_ok {
4738                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4739                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4740                         } }
4741                 } else {
4742                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4743                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4744                         } }
4745                 }
4746         }
4747 }
4748 #[no_mangle]
4749 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4750 /// but with all dynamically-allocated buffers duplicated in new buffers.
4751 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4752 #[repr(C)]
4753 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4754 /// This corresponds to std::vector in C++
4755 pub struct CVec_PaymentPreimageZ {
4756         /// The elements in the array.
4757         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4758         pub data: *mut crate::c_types::ThirtyTwoBytes,
4759         /// The number of elements pointed to by `data`.
4760         pub datalen: usize
4761 }
4762 impl CVec_PaymentPreimageZ {
4763         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4764                 if self.datalen == 0 { return Vec::new(); }
4765                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4766                 self.data = core::ptr::null_mut();
4767                 self.datalen = 0;
4768                 ret
4769         }
4770         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4771                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4772         }
4773 }
4774 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4775         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4776                 let datalen = v.len();
4777                 let data = Box::into_raw(v.into_boxed_slice());
4778                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4779         }
4780 }
4781 #[no_mangle]
4782 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4783 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4784 impl Drop for CVec_PaymentPreimageZ {
4785         fn drop(&mut self) {
4786                 if self.datalen == 0 { return; }
4787                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4788         }
4789 }
4790 impl Clone for CVec_PaymentPreimageZ {
4791         fn clone(&self) -> Self {
4792                 let mut res = Vec::new();
4793                 if self.datalen == 0 { return Self::from(res); }
4794                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4795                 Self::from(res)
4796         }
4797 }
4798 #[repr(C)]
4799 /// A tuple of 2 elements. See the individual fields for the types contained.
4800 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4801         /// The element at position 0
4802         pub a: crate::c_types::Signature,
4803         /// The element at position 1
4804         pub b: crate::c_types::derived::CVec_SignatureZ,
4805 }
4806 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4807         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4808                 Self {
4809                         a: tup.0,
4810                         b: tup.1,
4811                 }
4812         }
4813 }
4814 impl C2Tuple_SignatureCVec_SignatureZZ {
4815         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4816                 (self.a, self.b)
4817         }
4818 }
4819 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4820         fn clone(&self) -> Self {
4821                 Self {
4822                         a: Clone::clone(&self.a),
4823                         b: Clone::clone(&self.b),
4824                 }
4825         }
4826 }
4827 #[no_mangle]
4828 /// Creates a new tuple which has the same data as `orig`
4829 /// but with all dynamically-allocated buffers duplicated in new buffers.
4830 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4831 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4832 #[no_mangle]
4833 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4834         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4835 }
4836
4837 #[no_mangle]
4838 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4839 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4840 #[repr(C)]
4841 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4842 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4843         /// A pointer to the contents in the success state.
4844         /// Reading from this pointer when `result_ok` is not set is undefined.
4845         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4846         /// Note that this value is always NULL, as there are no contents in the Err variant
4847         pub err: *mut core::ffi::c_void,
4848 }
4849 #[repr(C)]
4850 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4851 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4853 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4854         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4855         /// `err` or `result` depending on the state of `result_ok`.
4856         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4857         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4858         pub result_ok: bool,
4859 }
4860 #[no_mangle]
4861 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4862 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4863         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4864                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4865                         result: Box::into_raw(Box::new(o)),
4866                 },
4867                 result_ok: true,
4868         }
4869 }
4870 #[no_mangle]
4871 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4872 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4873         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4874                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4875                         err: core::ptr::null_mut(),
4876                 },
4877                 result_ok: false,
4878         }
4879 }
4880 /// Checks if the given object is currently in the success state
4881 #[no_mangle]
4882 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4883         o.result_ok
4884 }
4885 #[no_mangle]
4886 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4887 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4888 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4889         fn drop(&mut self) {
4890                 if self.result_ok {
4891                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4892                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4893                         }
4894                 } else {
4895                 }
4896         }
4897 }
4898 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4899         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4900                 let contents = if o.result_ok {
4901                         let result = unsafe { o.contents.result };
4902                         unsafe { o.contents.result = core::ptr::null_mut() };
4903                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4904                 } else {
4905                         let _ = unsafe { Box::from_raw(o.contents.err) };
4906                         o.contents.err = core::ptr::null_mut();
4907                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4908                 };
4909                 Self {
4910                         contents,
4911                         result_ok: o.result_ok,
4912                 }
4913         }
4914 }
4915 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4916         fn clone(&self) -> Self {
4917                 if self.result_ok {
4918                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4919                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4920                         } }
4921                 } else {
4922                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4923                                 err: core::ptr::null_mut()
4924                         } }
4925                 }
4926         }
4927 }
4928 #[no_mangle]
4929 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4930 /// but with all dynamically-allocated buffers duplicated in new buffers.
4931 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4932 #[repr(C)]
4933 /// The contents of CResult_SignatureNoneZ
4934 pub union CResult_SignatureNoneZPtr {
4935         /// A pointer to the contents in the success state.
4936         /// Reading from this pointer when `result_ok` is not set is undefined.
4937         pub result: *mut crate::c_types::Signature,
4938         /// Note that this value is always NULL, as there are no contents in the Err variant
4939         pub err: *mut core::ffi::c_void,
4940 }
4941 #[repr(C)]
4942 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4943 /// containing a crate::c_types::Signature on success and a () on failure.
4944 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4945 pub struct CResult_SignatureNoneZ {
4946         /// The contents of this CResult_SignatureNoneZ, accessible via either
4947         /// `err` or `result` depending on the state of `result_ok`.
4948         pub contents: CResult_SignatureNoneZPtr,
4949         /// Whether this CResult_SignatureNoneZ represents a success state.
4950         pub result_ok: bool,
4951 }
4952 #[no_mangle]
4953 /// Creates a new CResult_SignatureNoneZ in the success state.
4954 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4955         CResult_SignatureNoneZ {
4956                 contents: CResult_SignatureNoneZPtr {
4957                         result: Box::into_raw(Box::new(o)),
4958                 },
4959                 result_ok: true,
4960         }
4961 }
4962 #[no_mangle]
4963 /// Creates a new CResult_SignatureNoneZ in the error state.
4964 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4965         CResult_SignatureNoneZ {
4966                 contents: CResult_SignatureNoneZPtr {
4967                         err: core::ptr::null_mut(),
4968                 },
4969                 result_ok: false,
4970         }
4971 }
4972 /// Checks if the given object is currently in the success state
4973 #[no_mangle]
4974 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4975         o.result_ok
4976 }
4977 #[no_mangle]
4978 /// Frees any resources used by the CResult_SignatureNoneZ.
4979 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4980 impl Drop for CResult_SignatureNoneZ {
4981         fn drop(&mut self) {
4982                 if self.result_ok {
4983                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4984                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4985                         }
4986                 } else {
4987                 }
4988         }
4989 }
4990 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4991         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4992                 let contents = if o.result_ok {
4993                         let result = unsafe { o.contents.result };
4994                         unsafe { o.contents.result = core::ptr::null_mut() };
4995                         CResult_SignatureNoneZPtr { result }
4996                 } else {
4997                         let _ = unsafe { Box::from_raw(o.contents.err) };
4998                         o.contents.err = core::ptr::null_mut();
4999                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
5000                 };
5001                 Self {
5002                         contents,
5003                         result_ok: o.result_ok,
5004                 }
5005         }
5006 }
5007 impl Clone for CResult_SignatureNoneZ {
5008         fn clone(&self) -> Self {
5009                 if self.result_ok {
5010                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
5011                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
5012                         } }
5013                 } else {
5014                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
5015                                 err: core::ptr::null_mut()
5016                         } }
5017                 }
5018         }
5019 }
5020 #[no_mangle]
5021 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
5022 /// but with all dynamically-allocated buffers duplicated in new buffers.
5023 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
5024 #[repr(C)]
5025 /// A tuple of 2 elements. See the individual fields for the types contained.
5026 pub struct C2Tuple_SignatureSignatureZ {
5027         /// The element at position 0
5028         pub a: crate::c_types::Signature,
5029         /// The element at position 1
5030         pub b: crate::c_types::Signature,
5031 }
5032 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
5033         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
5034                 Self {
5035                         a: tup.0,
5036                         b: tup.1,
5037                 }
5038         }
5039 }
5040 impl C2Tuple_SignatureSignatureZ {
5041         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
5042                 (self.a, self.b)
5043         }
5044 }
5045 impl Clone for C2Tuple_SignatureSignatureZ {
5046         fn clone(&self) -> Self {
5047                 Self {
5048                         a: Clone::clone(&self.a),
5049                         b: Clone::clone(&self.b),
5050                 }
5051         }
5052 }
5053 #[no_mangle]
5054 /// Creates a new tuple which has the same data as `orig`
5055 /// but with all dynamically-allocated buffers duplicated in new buffers.
5056 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
5057 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
5058 #[no_mangle]
5059 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
5060         C2Tuple_SignatureSignatureZ { a, b, }
5061 }
5062
5063 #[no_mangle]
5064 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
5065 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
5066 #[repr(C)]
5067 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5068 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5069         /// A pointer to the contents in the success state.
5070         /// Reading from this pointer when `result_ok` is not set is undefined.
5071         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
5072         /// Note that this value is always NULL, as there are no contents in the Err variant
5073         pub err: *mut core::ffi::c_void,
5074 }
5075 #[repr(C)]
5076 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5077 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5079 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
5080         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5081         /// `err` or `result` depending on the state of `result_ok`.
5082         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
5083         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5084         pub result_ok: bool,
5085 }
5086 #[no_mangle]
5087 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
5088 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5089         CResult_C2Tuple_SignatureSignatureZNoneZ {
5090                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5091                         result: Box::into_raw(Box::new(o)),
5092                 },
5093                 result_ok: true,
5094         }
5095 }
5096 #[no_mangle]
5097 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5098 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5099         CResult_C2Tuple_SignatureSignatureZNoneZ {
5100                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5101                         err: core::ptr::null_mut(),
5102                 },
5103                 result_ok: false,
5104         }
5105 }
5106 /// Checks if the given object is currently in the success state
5107 #[no_mangle]
5108 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5109         o.result_ok
5110 }
5111 #[no_mangle]
5112 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5113 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5114 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5115         fn drop(&mut self) {
5116                 if self.result_ok {
5117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5119                         }
5120                 } else {
5121                 }
5122         }
5123 }
5124 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5125         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5126                 let contents = if o.result_ok {
5127                         let result = unsafe { o.contents.result };
5128                         unsafe { o.contents.result = core::ptr::null_mut() };
5129                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5130                 } else {
5131                         let _ = unsafe { Box::from_raw(o.contents.err) };
5132                         o.contents.err = core::ptr::null_mut();
5133                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5134                 };
5135                 Self {
5136                         contents,
5137                         result_ok: o.result_ok,
5138                 }
5139         }
5140 }
5141 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5142         fn clone(&self) -> Self {
5143                 if self.result_ok {
5144                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5145                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5146                         } }
5147                 } else {
5148                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5149                                 err: core::ptr::null_mut()
5150                         } }
5151                 }
5152         }
5153 }
5154 #[no_mangle]
5155 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5158 #[repr(C)]
5159 /// The contents of CResult_SecretKeyNoneZ
5160 pub union CResult_SecretKeyNoneZPtr {
5161         /// A pointer to the contents in the success state.
5162         /// Reading from this pointer when `result_ok` is not set is undefined.
5163         pub result: *mut crate::c_types::SecretKey,
5164         /// Note that this value is always NULL, as there are no contents in the Err variant
5165         pub err: *mut core::ffi::c_void,
5166 }
5167 #[repr(C)]
5168 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5169 /// containing a crate::c_types::SecretKey on success and a () on failure.
5170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5171 pub struct CResult_SecretKeyNoneZ {
5172         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5173         /// `err` or `result` depending on the state of `result_ok`.
5174         pub contents: CResult_SecretKeyNoneZPtr,
5175         /// Whether this CResult_SecretKeyNoneZ represents a success state.
5176         pub result_ok: bool,
5177 }
5178 #[no_mangle]
5179 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5180 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5181         CResult_SecretKeyNoneZ {
5182                 contents: CResult_SecretKeyNoneZPtr {
5183                         result: Box::into_raw(Box::new(o)),
5184                 },
5185                 result_ok: true,
5186         }
5187 }
5188 #[no_mangle]
5189 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5190 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5191         CResult_SecretKeyNoneZ {
5192                 contents: CResult_SecretKeyNoneZPtr {
5193                         err: core::ptr::null_mut(),
5194                 },
5195                 result_ok: false,
5196         }
5197 }
5198 /// Checks if the given object is currently in the success state
5199 #[no_mangle]
5200 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5201         o.result_ok
5202 }
5203 #[no_mangle]
5204 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5205 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5206 impl Drop for CResult_SecretKeyNoneZ {
5207         fn drop(&mut self) {
5208                 if self.result_ok {
5209                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5210                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5211                         }
5212                 } else {
5213                 }
5214         }
5215 }
5216 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5217         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5218                 let contents = if o.result_ok {
5219                         let result = unsafe { o.contents.result };
5220                         unsafe { o.contents.result = core::ptr::null_mut() };
5221                         CResult_SecretKeyNoneZPtr { result }
5222                 } else {
5223                         let _ = unsafe { Box::from_raw(o.contents.err) };
5224                         o.contents.err = core::ptr::null_mut();
5225                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5226                 };
5227                 Self {
5228                         contents,
5229                         result_ok: o.result_ok,
5230                 }
5231         }
5232 }
5233 impl Clone for CResult_SecretKeyNoneZ {
5234         fn clone(&self) -> Self {
5235                 if self.result_ok {
5236                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5237                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5238                         } }
5239                 } else {
5240                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5241                                 err: core::ptr::null_mut()
5242                         } }
5243                 }
5244         }
5245 }
5246 #[no_mangle]
5247 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5248 /// but with all dynamically-allocated buffers duplicated in new buffers.
5249 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5250 #[repr(C)]
5251 /// The contents of CResult_SignDecodeErrorZ
5252 pub union CResult_SignDecodeErrorZPtr {
5253         /// A pointer to the contents in the success state.
5254         /// Reading from this pointer when `result_ok` is not set is undefined.
5255         pub result: *mut crate::lightning::chain::keysinterface::Sign,
5256         /// A pointer to the contents in the error state.
5257         /// Reading from this pointer when `result_ok` is set is undefined.
5258         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5259 }
5260 #[repr(C)]
5261 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5262 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5264 pub struct CResult_SignDecodeErrorZ {
5265         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5266         /// `err` or `result` depending on the state of `result_ok`.
5267         pub contents: CResult_SignDecodeErrorZPtr,
5268         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5269         pub result_ok: bool,
5270 }
5271 #[no_mangle]
5272 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5273 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5274         CResult_SignDecodeErrorZ {
5275                 contents: CResult_SignDecodeErrorZPtr {
5276                         result: Box::into_raw(Box::new(o)),
5277                 },
5278                 result_ok: true,
5279         }
5280 }
5281 #[no_mangle]
5282 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5283 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5284         CResult_SignDecodeErrorZ {
5285                 contents: CResult_SignDecodeErrorZPtr {
5286                         err: Box::into_raw(Box::new(e)),
5287                 },
5288                 result_ok: false,
5289         }
5290 }
5291 /// Checks if the given object is currently in the success state
5292 #[no_mangle]
5293 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5294         o.result_ok
5295 }
5296 #[no_mangle]
5297 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5298 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5299 impl Drop for CResult_SignDecodeErrorZ {
5300         fn drop(&mut self) {
5301                 if self.result_ok {
5302                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5303                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5304                         }
5305                 } else {
5306                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5307                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5308                         }
5309                 }
5310         }
5311 }
5312 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5313         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5314                 let contents = if o.result_ok {
5315                         let result = unsafe { o.contents.result };
5316                         unsafe { o.contents.result = core::ptr::null_mut() };
5317                         CResult_SignDecodeErrorZPtr { result }
5318                 } else {
5319                         let err = unsafe { o.contents.err };
5320                         unsafe { o.contents.err = core::ptr::null_mut(); }
5321                         CResult_SignDecodeErrorZPtr { err }
5322                 };
5323                 Self {
5324                         contents,
5325                         result_ok: o.result_ok,
5326                 }
5327         }
5328 }
5329 impl Clone for CResult_SignDecodeErrorZ {
5330         fn clone(&self) -> Self {
5331                 if self.result_ok {
5332                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5333                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5334                         } }
5335                 } else {
5336                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5337                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5338                         } }
5339                 }
5340         }
5341 }
5342 #[no_mangle]
5343 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5344 /// but with all dynamically-allocated buffers duplicated in new buffers.
5345 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5346 #[repr(C)]
5347 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5348 /// This corresponds to std::vector in C++
5349 pub struct CVec_u5Z {
5350         /// The elements in the array.
5351         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5352         pub data: *mut crate::c_types::u5,
5353         /// The number of elements pointed to by `data`.
5354         pub datalen: usize
5355 }
5356 impl CVec_u5Z {
5357         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5358                 if self.datalen == 0 { return Vec::new(); }
5359                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5360                 self.data = core::ptr::null_mut();
5361                 self.datalen = 0;
5362                 ret
5363         }
5364         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5365                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5366         }
5367 }
5368 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5369         fn from(v: Vec<crate::c_types::u5>) -> Self {
5370                 let datalen = v.len();
5371                 let data = Box::into_raw(v.into_boxed_slice());
5372                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5373         }
5374 }
5375 #[no_mangle]
5376 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5377 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5378 impl Drop for CVec_u5Z {
5379         fn drop(&mut self) {
5380                 if self.datalen == 0 { return; }
5381                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5382         }
5383 }
5384 impl Clone for CVec_u5Z {
5385         fn clone(&self) -> Self {
5386                 let mut res = Vec::new();
5387                 if self.datalen == 0 { return Self::from(res); }
5388                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5389                 Self::from(res)
5390         }
5391 }
5392 #[repr(C)]
5393 /// The contents of CResult_RecoverableSignatureNoneZ
5394 pub union CResult_RecoverableSignatureNoneZPtr {
5395         /// A pointer to the contents in the success state.
5396         /// Reading from this pointer when `result_ok` is not set is undefined.
5397         pub result: *mut crate::c_types::RecoverableSignature,
5398         /// Note that this value is always NULL, as there are no contents in the Err variant
5399         pub err: *mut core::ffi::c_void,
5400 }
5401 #[repr(C)]
5402 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5403 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5405 pub struct CResult_RecoverableSignatureNoneZ {
5406         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5407         /// `err` or `result` depending on the state of `result_ok`.
5408         pub contents: CResult_RecoverableSignatureNoneZPtr,
5409         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5410         pub result_ok: bool,
5411 }
5412 #[no_mangle]
5413 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5414 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5415         CResult_RecoverableSignatureNoneZ {
5416                 contents: CResult_RecoverableSignatureNoneZPtr {
5417                         result: Box::into_raw(Box::new(o)),
5418                 },
5419                 result_ok: true,
5420         }
5421 }
5422 #[no_mangle]
5423 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5424 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5425         CResult_RecoverableSignatureNoneZ {
5426                 contents: CResult_RecoverableSignatureNoneZPtr {
5427                         err: core::ptr::null_mut(),
5428                 },
5429                 result_ok: false,
5430         }
5431 }
5432 /// Checks if the given object is currently in the success state
5433 #[no_mangle]
5434 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5435         o.result_ok
5436 }
5437 #[no_mangle]
5438 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5439 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5440 impl Drop for CResult_RecoverableSignatureNoneZ {
5441         fn drop(&mut self) {
5442                 if self.result_ok {
5443                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5444                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5445                         }
5446                 } else {
5447                 }
5448         }
5449 }
5450 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5451         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5452                 let contents = if o.result_ok {
5453                         let result = unsafe { o.contents.result };
5454                         unsafe { o.contents.result = core::ptr::null_mut() };
5455                         CResult_RecoverableSignatureNoneZPtr { result }
5456                 } else {
5457                         let _ = unsafe { Box::from_raw(o.contents.err) };
5458                         o.contents.err = core::ptr::null_mut();
5459                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5460                 };
5461                 Self {
5462                         contents,
5463                         result_ok: o.result_ok,
5464                 }
5465         }
5466 }
5467 impl Clone for CResult_RecoverableSignatureNoneZ {
5468         fn clone(&self) -> Self {
5469                 if self.result_ok {
5470                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5471                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5472                         } }
5473                 } else {
5474                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5475                                 err: core::ptr::null_mut()
5476                         } }
5477                 }
5478         }
5479 }
5480 #[no_mangle]
5481 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5482 /// but with all dynamically-allocated buffers duplicated in new buffers.
5483 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5484 #[repr(C)]
5485 /// A dynamically-allocated array of u8s of arbitrary size.
5486 /// This corresponds to std::vector in C++
5487 pub struct CVec_u8Z {
5488         /// The elements in the array.
5489         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5490         pub data: *mut u8,
5491         /// The number of elements pointed to by `data`.
5492         pub datalen: usize
5493 }
5494 impl CVec_u8Z {
5495         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5496                 if self.datalen == 0 { return Vec::new(); }
5497                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5498                 self.data = core::ptr::null_mut();
5499                 self.datalen = 0;
5500                 ret
5501         }
5502         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5503                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5504         }
5505 }
5506 impl From<Vec<u8>> for CVec_u8Z {
5507         fn from(v: Vec<u8>) -> Self {
5508                 let datalen = v.len();
5509                 let data = Box::into_raw(v.into_boxed_slice());
5510                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5511         }
5512 }
5513 #[no_mangle]
5514 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5515 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5516 impl Drop for CVec_u8Z {
5517         fn drop(&mut self) {
5518                 if self.datalen == 0 { return; }
5519                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5520         }
5521 }
5522 impl Clone for CVec_u8Z {
5523         fn clone(&self) -> Self {
5524                 let mut res = Vec::new();
5525                 if self.datalen == 0 { return Self::from(res); }
5526                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5527                 Self::from(res)
5528         }
5529 }
5530 #[repr(C)]
5531 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5532 /// This corresponds to std::vector in C++
5533 pub struct CVec_CVec_u8ZZ {
5534         /// The elements in the array.
5535         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5536         pub data: *mut crate::c_types::derived::CVec_u8Z,
5537         /// The number of elements pointed to by `data`.
5538         pub datalen: usize
5539 }
5540 impl CVec_CVec_u8ZZ {
5541         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5542                 if self.datalen == 0 { return Vec::new(); }
5543                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5544                 self.data = core::ptr::null_mut();
5545                 self.datalen = 0;
5546                 ret
5547         }
5548         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5549                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5550         }
5551 }
5552 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5553         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5554                 let datalen = v.len();
5555                 let data = Box::into_raw(v.into_boxed_slice());
5556                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5557         }
5558 }
5559 #[no_mangle]
5560 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5561 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5562 impl Drop for CVec_CVec_u8ZZ {
5563         fn drop(&mut self) {
5564                 if self.datalen == 0 { return; }
5565                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5566         }
5567 }
5568 impl Clone for CVec_CVec_u8ZZ {
5569         fn clone(&self) -> Self {
5570                 let mut res = Vec::new();
5571                 if self.datalen == 0 { return Self::from(res); }
5572                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5573                 Self::from(res)
5574         }
5575 }
5576 #[repr(C)]
5577 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5578 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5579         /// A pointer to the contents in the success state.
5580         /// Reading from this pointer when `result_ok` is not set is undefined.
5581         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5582         /// Note that this value is always NULL, as there are no contents in the Err variant
5583         pub err: *mut core::ffi::c_void,
5584 }
5585 #[repr(C)]
5586 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5587 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5589 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5590         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5591         /// `err` or `result` depending on the state of `result_ok`.
5592         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5593         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5594         pub result_ok: bool,
5595 }
5596 #[no_mangle]
5597 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5598 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5599         CResult_CVec_CVec_u8ZZNoneZ {
5600                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5601                         result: Box::into_raw(Box::new(o)),
5602                 },
5603                 result_ok: true,
5604         }
5605 }
5606 #[no_mangle]
5607 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5608 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5609         CResult_CVec_CVec_u8ZZNoneZ {
5610                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5611                         err: core::ptr::null_mut(),
5612                 },
5613                 result_ok: false,
5614         }
5615 }
5616 /// Checks if the given object is currently in the success state
5617 #[no_mangle]
5618 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5619         o.result_ok
5620 }
5621 #[no_mangle]
5622 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5623 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5624 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5625         fn drop(&mut self) {
5626                 if self.result_ok {
5627                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5628                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5629                         }
5630                 } else {
5631                 }
5632         }
5633 }
5634 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5635         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5636                 let contents = if o.result_ok {
5637                         let result = unsafe { o.contents.result };
5638                         unsafe { o.contents.result = core::ptr::null_mut() };
5639                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5640                 } else {
5641                         let _ = unsafe { Box::from_raw(o.contents.err) };
5642                         o.contents.err = core::ptr::null_mut();
5643                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5644                 };
5645                 Self {
5646                         contents,
5647                         result_ok: o.result_ok,
5648                 }
5649         }
5650 }
5651 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5652         fn clone(&self) -> Self {
5653                 if self.result_ok {
5654                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5655                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5656                         } }
5657                 } else {
5658                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5659                                 err: core::ptr::null_mut()
5660                         } }
5661                 }
5662         }
5663 }
5664 #[no_mangle]
5665 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5666 /// but with all dynamically-allocated buffers duplicated in new buffers.
5667 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5668 #[repr(C)]
5669 /// The contents of CResult_InMemorySignerDecodeErrorZ
5670 pub union CResult_InMemorySignerDecodeErrorZPtr {
5671         /// A pointer to the contents in the success state.
5672         /// Reading from this pointer when `result_ok` is not set is undefined.
5673         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5674         /// A pointer to the contents in the error state.
5675         /// Reading from this pointer when `result_ok` is set is undefined.
5676         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5677 }
5678 #[repr(C)]
5679 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5680 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5681 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5682 pub struct CResult_InMemorySignerDecodeErrorZ {
5683         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5684         /// `err` or `result` depending on the state of `result_ok`.
5685         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5686         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5687         pub result_ok: bool,
5688 }
5689 #[no_mangle]
5690 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5691 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5692         CResult_InMemorySignerDecodeErrorZ {
5693                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5694                         result: Box::into_raw(Box::new(o)),
5695                 },
5696                 result_ok: true,
5697         }
5698 }
5699 #[no_mangle]
5700 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5701 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5702         CResult_InMemorySignerDecodeErrorZ {
5703                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5704                         err: Box::into_raw(Box::new(e)),
5705                 },
5706                 result_ok: false,
5707         }
5708 }
5709 /// Checks if the given object is currently in the success state
5710 #[no_mangle]
5711 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5712         o.result_ok
5713 }
5714 #[no_mangle]
5715 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5716 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5717 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5718         fn drop(&mut self) {
5719                 if self.result_ok {
5720                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5721                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5722                         }
5723                 } else {
5724                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5725                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5726                         }
5727                 }
5728         }
5729 }
5730 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5731         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5732                 let contents = if o.result_ok {
5733                         let result = unsafe { o.contents.result };
5734                         unsafe { o.contents.result = core::ptr::null_mut() };
5735                         CResult_InMemorySignerDecodeErrorZPtr { result }
5736                 } else {
5737                         let err = unsafe { o.contents.err };
5738                         unsafe { o.contents.err = core::ptr::null_mut(); }
5739                         CResult_InMemorySignerDecodeErrorZPtr { err }
5740                 };
5741                 Self {
5742                         contents,
5743                         result_ok: o.result_ok,
5744                 }
5745         }
5746 }
5747 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5748         fn clone(&self) -> Self {
5749                 if self.result_ok {
5750                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5751                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5752                         } }
5753                 } else {
5754                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5755                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5756                         } }
5757                 }
5758         }
5759 }
5760 #[no_mangle]
5761 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5762 /// but with all dynamically-allocated buffers duplicated in new buffers.
5763 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5764 #[repr(C)]
5765 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5766 /// This corresponds to std::vector in C++
5767 pub struct CVec_TxOutZ {
5768         /// The elements in the array.
5769         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5770         pub data: *mut crate::c_types::TxOut,
5771         /// The number of elements pointed to by `data`.
5772         pub datalen: usize
5773 }
5774 impl CVec_TxOutZ {
5775         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5776                 if self.datalen == 0 { return Vec::new(); }
5777                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5778                 self.data = core::ptr::null_mut();
5779                 self.datalen = 0;
5780                 ret
5781         }
5782         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5783                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5784         }
5785 }
5786 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5787         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5788                 let datalen = v.len();
5789                 let data = Box::into_raw(v.into_boxed_slice());
5790                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5791         }
5792 }
5793 #[no_mangle]
5794 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5795 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5796 impl Drop for CVec_TxOutZ {
5797         fn drop(&mut self) {
5798                 if self.datalen == 0 { return; }
5799                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5800         }
5801 }
5802 impl Clone for CVec_TxOutZ {
5803         fn clone(&self) -> Self {
5804                 let mut res = Vec::new();
5805                 if self.datalen == 0 { return Self::from(res); }
5806                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5807                 Self::from(res)
5808         }
5809 }
5810 #[repr(C)]
5811 /// The contents of CResult_TransactionNoneZ
5812 pub union CResult_TransactionNoneZPtr {
5813         /// A pointer to the contents in the success state.
5814         /// Reading from this pointer when `result_ok` is not set is undefined.
5815         pub result: *mut crate::c_types::Transaction,
5816         /// Note that this value is always NULL, as there are no contents in the Err variant
5817         pub err: *mut core::ffi::c_void,
5818 }
5819 #[repr(C)]
5820 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5821 /// containing a crate::c_types::Transaction on success and a () on failure.
5822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5823 pub struct CResult_TransactionNoneZ {
5824         /// The contents of this CResult_TransactionNoneZ, accessible via either
5825         /// `err` or `result` depending on the state of `result_ok`.
5826         pub contents: CResult_TransactionNoneZPtr,
5827         /// Whether this CResult_TransactionNoneZ represents a success state.
5828         pub result_ok: bool,
5829 }
5830 #[no_mangle]
5831 /// Creates a new CResult_TransactionNoneZ in the success state.
5832 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5833         CResult_TransactionNoneZ {
5834                 contents: CResult_TransactionNoneZPtr {
5835                         result: Box::into_raw(Box::new(o)),
5836                 },
5837                 result_ok: true,
5838         }
5839 }
5840 #[no_mangle]
5841 /// Creates a new CResult_TransactionNoneZ in the error state.
5842 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5843         CResult_TransactionNoneZ {
5844                 contents: CResult_TransactionNoneZPtr {
5845                         err: core::ptr::null_mut(),
5846                 },
5847                 result_ok: false,
5848         }
5849 }
5850 /// Checks if the given object is currently in the success state
5851 #[no_mangle]
5852 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5853         o.result_ok
5854 }
5855 #[no_mangle]
5856 /// Frees any resources used by the CResult_TransactionNoneZ.
5857 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5858 impl Drop for CResult_TransactionNoneZ {
5859         fn drop(&mut self) {
5860                 if self.result_ok {
5861                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5862                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5863                         }
5864                 } else {
5865                 }
5866         }
5867 }
5868 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5869         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5870                 let contents = if o.result_ok {
5871                         let result = unsafe { o.contents.result };
5872                         unsafe { o.contents.result = core::ptr::null_mut() };
5873                         CResult_TransactionNoneZPtr { result }
5874                 } else {
5875                         let _ = unsafe { Box::from_raw(o.contents.err) };
5876                         o.contents.err = core::ptr::null_mut();
5877                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5878                 };
5879                 Self {
5880                         contents,
5881                         result_ok: o.result_ok,
5882                 }
5883         }
5884 }
5885 impl Clone for CResult_TransactionNoneZ {
5886         fn clone(&self) -> Self {
5887                 if self.result_ok {
5888                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5889                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5890                         } }
5891                 } else {
5892                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5893                                 err: core::ptr::null_mut()
5894                         } }
5895                 }
5896         }
5897 }
5898 #[no_mangle]
5899 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5900 /// but with all dynamically-allocated buffers duplicated in new buffers.
5901 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5902 #[repr(C)]
5903 /// A tuple of 2 elements. See the individual fields for the types contained.
5904 pub struct C2Tuple_BlockHashChannelMonitorZ {
5905         /// The element at position 0
5906         pub a: crate::c_types::ThirtyTwoBytes,
5907         /// The element at position 1
5908         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5909 }
5910 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5911         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5912                 Self {
5913                         a: tup.0,
5914                         b: tup.1,
5915                 }
5916         }
5917 }
5918 impl C2Tuple_BlockHashChannelMonitorZ {
5919         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5920                 (self.a, self.b)
5921         }
5922 }
5923 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5924 #[no_mangle]
5925 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5926         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5927 }
5928
5929 #[no_mangle]
5930 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5931 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5932 #[repr(C)]
5933 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5934 /// This corresponds to std::vector in C++
5935 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5936         /// The elements in the array.
5937         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5938         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5939         /// The number of elements pointed to by `data`.
5940         pub datalen: usize
5941 }
5942 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5943         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5944                 if self.datalen == 0 { return Vec::new(); }
5945                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5946                 self.data = core::ptr::null_mut();
5947                 self.datalen = 0;
5948                 ret
5949         }
5950         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5951                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5952         }
5953 }
5954 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5955         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5956                 let datalen = v.len();
5957                 let data = Box::into_raw(v.into_boxed_slice());
5958                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5959         }
5960 }
5961 #[no_mangle]
5962 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5963 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5964 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5965         fn drop(&mut self) {
5966                 if self.datalen == 0 { return; }
5967                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5968         }
5969 }
5970 #[repr(C)]
5971 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5972 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5973         /// A pointer to the contents in the success state.
5974         /// Reading from this pointer when `result_ok` is not set is undefined.
5975         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5976         /// A pointer to the contents in the error state.
5977         /// Reading from this pointer when `result_ok` is set is undefined.
5978         pub err: *mut crate::c_types::IOError,
5979 }
5980 #[repr(C)]
5981 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5982 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5984 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5985         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5986         /// `err` or `result` depending on the state of `result_ok`.
5987         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5988         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5989         pub result_ok: bool,
5990 }
5991 #[no_mangle]
5992 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5993 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5994         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5995                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5996                         result: Box::into_raw(Box::new(o)),
5997                 },
5998                 result_ok: true,
5999         }
6000 }
6001 #[no_mangle]
6002 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
6003 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6004         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6005                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6006                         err: Box::into_raw(Box::new(e)),
6007                 },
6008                 result_ok: false,
6009         }
6010 }
6011 /// Checks if the given object is currently in the success state
6012 #[no_mangle]
6013 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
6014         o.result_ok
6015 }
6016 #[no_mangle]
6017 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
6018 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
6019 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6020         fn drop(&mut self) {
6021                 if self.result_ok {
6022                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6023                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6024                         }
6025                 } else {
6026                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6027                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6028                         }
6029                 }
6030         }
6031 }
6032 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6033         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
6034                 let contents = if o.result_ok {
6035                         let result = unsafe { o.contents.result };
6036                         unsafe { o.contents.result = core::ptr::null_mut() };
6037                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
6038                 } else {
6039                         let err = unsafe { o.contents.err };
6040                         unsafe { o.contents.err = core::ptr::null_mut(); }
6041                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
6042                 };
6043                 Self {
6044                         contents,
6045                         result_ok: o.result_ok,
6046                 }
6047         }
6048 }
6049 #[repr(C)]
6050 #[derive(Clone)]
6051 /// An enum which can either contain a u16 or not
6052 pub enum COption_u16Z {
6053         /// When we're in this state, this COption_u16Z contains a u16
6054         Some(u16),
6055         /// When we're in this state, this COption_u16Z contains nothing
6056         None
6057 }
6058 impl COption_u16Z {
6059         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6060                 if let Self::None = self { false } else { true }
6061         }
6062         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6063                 !self.is_some()
6064         }
6065         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
6066                 if let Self::Some(v) = self { v } else { unreachable!() }
6067         }
6068 }
6069 #[no_mangle]
6070 /// Constructs a new COption_u16Z containing a u16
6071 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
6072         COption_u16Z::Some(o)
6073 }
6074 #[no_mangle]
6075 /// Constructs a new COption_u16Z containing nothing
6076 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
6077         COption_u16Z::None
6078 }
6079 #[no_mangle]
6080 /// Frees any resources associated with the u16, if we are in the Some state
6081 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
6082 #[no_mangle]
6083 /// Creates a new COption_u16Z which has the same data as `orig`
6084 /// but with all dynamically-allocated buffers duplicated in new buffers.
6085 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
6086 #[repr(C)]
6087 /// The contents of CResult_NoneAPIErrorZ
6088 pub union CResult_NoneAPIErrorZPtr {
6089         /// Note that this value is always NULL, as there are no contents in the OK variant
6090         pub result: *mut core::ffi::c_void,
6091         /// A pointer to the contents in the error state.
6092         /// Reading from this pointer when `result_ok` is set is undefined.
6093         pub err: *mut crate::lightning::util::errors::APIError,
6094 }
6095 #[repr(C)]
6096 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6097 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6098 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6099 pub struct CResult_NoneAPIErrorZ {
6100         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6101         /// `err` or `result` depending on the state of `result_ok`.
6102         pub contents: CResult_NoneAPIErrorZPtr,
6103         /// Whether this CResult_NoneAPIErrorZ represents a success state.
6104         pub result_ok: bool,
6105 }
6106 #[no_mangle]
6107 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6108 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6109         CResult_NoneAPIErrorZ {
6110                 contents: CResult_NoneAPIErrorZPtr {
6111                         result: core::ptr::null_mut(),
6112                 },
6113                 result_ok: true,
6114         }
6115 }
6116 #[no_mangle]
6117 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6118 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6119         CResult_NoneAPIErrorZ {
6120                 contents: CResult_NoneAPIErrorZPtr {
6121                         err: Box::into_raw(Box::new(e)),
6122                 },
6123                 result_ok: false,
6124         }
6125 }
6126 /// Checks if the given object is currently in the success state
6127 #[no_mangle]
6128 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6129         o.result_ok
6130 }
6131 #[no_mangle]
6132 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6133 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6134 impl Drop for CResult_NoneAPIErrorZ {
6135         fn drop(&mut self) {
6136                 if self.result_ok {
6137                 } else {
6138                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6139                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6140                         }
6141                 }
6142         }
6143 }
6144 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6145         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6146                 let contents = if o.result_ok {
6147                         let _ = unsafe { Box::from_raw(o.contents.result) };
6148                         o.contents.result = core::ptr::null_mut();
6149                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6150                 } else {
6151                         let err = unsafe { o.contents.err };
6152                         unsafe { o.contents.err = core::ptr::null_mut(); }
6153                         CResult_NoneAPIErrorZPtr { err }
6154                 };
6155                 Self {
6156                         contents,
6157                         result_ok: o.result_ok,
6158                 }
6159         }
6160 }
6161 impl Clone for CResult_NoneAPIErrorZ {
6162         fn clone(&self) -> Self {
6163                 if self.result_ok {
6164                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6165                                 result: core::ptr::null_mut()
6166                         } }
6167                 } else {
6168                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6169                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6170                         } }
6171                 }
6172         }
6173 }
6174 #[no_mangle]
6175 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6176 /// but with all dynamically-allocated buffers duplicated in new buffers.
6177 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6178 #[repr(C)]
6179 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6180 /// This corresponds to std::vector in C++
6181 pub struct CVec_CResult_NoneAPIErrorZZ {
6182         /// The elements in the array.
6183         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6184         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6185         /// The number of elements pointed to by `data`.
6186         pub datalen: usize
6187 }
6188 impl CVec_CResult_NoneAPIErrorZZ {
6189         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6190                 if self.datalen == 0 { return Vec::new(); }
6191                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6192                 self.data = core::ptr::null_mut();
6193                 self.datalen = 0;
6194                 ret
6195         }
6196         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6197                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6198         }
6199 }
6200 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6201         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6202                 let datalen = v.len();
6203                 let data = Box::into_raw(v.into_boxed_slice());
6204                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6205         }
6206 }
6207 #[no_mangle]
6208 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6209 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6210 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6211         fn drop(&mut self) {
6212                 if self.datalen == 0 { return; }
6213                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6214         }
6215 }
6216 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6217         fn clone(&self) -> Self {
6218                 let mut res = Vec::new();
6219                 if self.datalen == 0 { return Self::from(res); }
6220                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6221                 Self::from(res)
6222         }
6223 }
6224 #[repr(C)]
6225 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6226 /// This corresponds to std::vector in C++
6227 pub struct CVec_APIErrorZ {
6228         /// The elements in the array.
6229         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6230         pub data: *mut crate::lightning::util::errors::APIError,
6231         /// The number of elements pointed to by `data`.
6232         pub datalen: usize
6233 }
6234 impl CVec_APIErrorZ {
6235         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6236                 if self.datalen == 0 { return Vec::new(); }
6237                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6238                 self.data = core::ptr::null_mut();
6239                 self.datalen = 0;
6240                 ret
6241         }
6242         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6243                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6244         }
6245 }
6246 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6247         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6248                 let datalen = v.len();
6249                 let data = Box::into_raw(v.into_boxed_slice());
6250                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6251         }
6252 }
6253 #[no_mangle]
6254 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6255 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6256 impl Drop for CVec_APIErrorZ {
6257         fn drop(&mut self) {
6258                 if self.datalen == 0 { return; }
6259                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6260         }
6261 }
6262 impl Clone for CVec_APIErrorZ {
6263         fn clone(&self) -> Self {
6264                 let mut res = Vec::new();
6265                 if self.datalen == 0 { return Self::from(res); }
6266                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6267                 Self::from(res)
6268         }
6269 }
6270 #[repr(C)]
6271 /// The contents of CResult__u832APIErrorZ
6272 pub union CResult__u832APIErrorZPtr {
6273         /// A pointer to the contents in the success state.
6274         /// Reading from this pointer when `result_ok` is not set is undefined.
6275         pub result: *mut crate::c_types::ThirtyTwoBytes,
6276         /// A pointer to the contents in the error state.
6277         /// Reading from this pointer when `result_ok` is set is undefined.
6278         pub err: *mut crate::lightning::util::errors::APIError,
6279 }
6280 #[repr(C)]
6281 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6282 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6284 pub struct CResult__u832APIErrorZ {
6285         /// The contents of this CResult__u832APIErrorZ, accessible via either
6286         /// `err` or `result` depending on the state of `result_ok`.
6287         pub contents: CResult__u832APIErrorZPtr,
6288         /// Whether this CResult__u832APIErrorZ represents a success state.
6289         pub result_ok: bool,
6290 }
6291 #[no_mangle]
6292 /// Creates a new CResult__u832APIErrorZ in the success state.
6293 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6294         CResult__u832APIErrorZ {
6295                 contents: CResult__u832APIErrorZPtr {
6296                         result: Box::into_raw(Box::new(o)),
6297                 },
6298                 result_ok: true,
6299         }
6300 }
6301 #[no_mangle]
6302 /// Creates a new CResult__u832APIErrorZ in the error state.
6303 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6304         CResult__u832APIErrorZ {
6305                 contents: CResult__u832APIErrorZPtr {
6306                         err: Box::into_raw(Box::new(e)),
6307                 },
6308                 result_ok: false,
6309         }
6310 }
6311 /// Checks if the given object is currently in the success state
6312 #[no_mangle]
6313 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6314         o.result_ok
6315 }
6316 #[no_mangle]
6317 /// Frees any resources used by the CResult__u832APIErrorZ.
6318 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6319 impl Drop for CResult__u832APIErrorZ {
6320         fn drop(&mut self) {
6321                 if self.result_ok {
6322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6324                         }
6325                 } else {
6326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6328                         }
6329                 }
6330         }
6331 }
6332 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6333         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6334                 let contents = if o.result_ok {
6335                         let result = unsafe { o.contents.result };
6336                         unsafe { o.contents.result = core::ptr::null_mut() };
6337                         CResult__u832APIErrorZPtr { result }
6338                 } else {
6339                         let err = unsafe { o.contents.err };
6340                         unsafe { o.contents.err = core::ptr::null_mut(); }
6341                         CResult__u832APIErrorZPtr { err }
6342                 };
6343                 Self {
6344                         contents,
6345                         result_ok: o.result_ok,
6346                 }
6347         }
6348 }
6349 impl Clone for CResult__u832APIErrorZ {
6350         fn clone(&self) -> Self {
6351                 if self.result_ok {
6352                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6353                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6354                         } }
6355                 } else {
6356                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6357                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6358                         } }
6359                 }
6360         }
6361 }
6362 #[no_mangle]
6363 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6364 /// but with all dynamically-allocated buffers duplicated in new buffers.
6365 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6366 #[repr(C)]
6367 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6368 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6369         /// A pointer to the contents in the success state.
6370         /// Reading from this pointer when `result_ok` is not set is undefined.
6371         pub result: *mut crate::c_types::ThirtyTwoBytes,
6372         /// A pointer to the contents in the error state.
6373         /// Reading from this pointer when `result_ok` is set is undefined.
6374         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6375 }
6376 #[repr(C)]
6377 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6378 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6379 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6380 pub struct CResult_PaymentIdPaymentSendFailureZ {
6381         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6382         /// `err` or `result` depending on the state of `result_ok`.
6383         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6384         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6385         pub result_ok: bool,
6386 }
6387 #[no_mangle]
6388 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6389 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6390         CResult_PaymentIdPaymentSendFailureZ {
6391                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6392                         result: Box::into_raw(Box::new(o)),
6393                 },
6394                 result_ok: true,
6395         }
6396 }
6397 #[no_mangle]
6398 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6399 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6400         CResult_PaymentIdPaymentSendFailureZ {
6401                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6402                         err: Box::into_raw(Box::new(e)),
6403                 },
6404                 result_ok: false,
6405         }
6406 }
6407 /// Checks if the given object is currently in the success state
6408 #[no_mangle]
6409 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6410         o.result_ok
6411 }
6412 #[no_mangle]
6413 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6414 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6415 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6416         fn drop(&mut self) {
6417                 if self.result_ok {
6418                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6419                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6420                         }
6421                 } else {
6422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6424                         }
6425                 }
6426         }
6427 }
6428 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6429         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6430                 let contents = if o.result_ok {
6431                         let result = unsafe { o.contents.result };
6432                         unsafe { o.contents.result = core::ptr::null_mut() };
6433                         CResult_PaymentIdPaymentSendFailureZPtr { result }
6434                 } else {
6435                         let err = unsafe { o.contents.err };
6436                         unsafe { o.contents.err = core::ptr::null_mut(); }
6437                         CResult_PaymentIdPaymentSendFailureZPtr { err }
6438                 };
6439                 Self {
6440                         contents,
6441                         result_ok: o.result_ok,
6442                 }
6443         }
6444 }
6445 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6446         fn clone(&self) -> Self {
6447                 if self.result_ok {
6448                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6449                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6450                         } }
6451                 } else {
6452                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6454                         } }
6455                 }
6456         }
6457 }
6458 #[no_mangle]
6459 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6460 /// but with all dynamically-allocated buffers duplicated in new buffers.
6461 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6462 #[repr(C)]
6463 /// The contents of CResult_NonePaymentSendFailureZ
6464 pub union CResult_NonePaymentSendFailureZPtr {
6465         /// Note that this value is always NULL, as there are no contents in the OK variant
6466         pub result: *mut core::ffi::c_void,
6467         /// A pointer to the contents in the error state.
6468         /// Reading from this pointer when `result_ok` is set is undefined.
6469         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6470 }
6471 #[repr(C)]
6472 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6473 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6475 pub struct CResult_NonePaymentSendFailureZ {
6476         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6477         /// `err` or `result` depending on the state of `result_ok`.
6478         pub contents: CResult_NonePaymentSendFailureZPtr,
6479         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6480         pub result_ok: bool,
6481 }
6482 #[no_mangle]
6483 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6484 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6485         CResult_NonePaymentSendFailureZ {
6486                 contents: CResult_NonePaymentSendFailureZPtr {
6487                         result: core::ptr::null_mut(),
6488                 },
6489                 result_ok: true,
6490         }
6491 }
6492 #[no_mangle]
6493 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6494 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6495         CResult_NonePaymentSendFailureZ {
6496                 contents: CResult_NonePaymentSendFailureZPtr {
6497                         err: Box::into_raw(Box::new(e)),
6498                 },
6499                 result_ok: false,
6500         }
6501 }
6502 /// Checks if the given object is currently in the success state
6503 #[no_mangle]
6504 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6505         o.result_ok
6506 }
6507 #[no_mangle]
6508 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6509 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6510 impl Drop for CResult_NonePaymentSendFailureZ {
6511         fn drop(&mut self) {
6512                 if self.result_ok {
6513                 } else {
6514                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6515                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6516                         }
6517                 }
6518         }
6519 }
6520 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6521         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6522                 let contents = if o.result_ok {
6523                         let _ = unsafe { Box::from_raw(o.contents.result) };
6524                         o.contents.result = core::ptr::null_mut();
6525                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6526                 } else {
6527                         let err = unsafe { o.contents.err };
6528                         unsafe { o.contents.err = core::ptr::null_mut(); }
6529                         CResult_NonePaymentSendFailureZPtr { err }
6530                 };
6531                 Self {
6532                         contents,
6533                         result_ok: o.result_ok,
6534                 }
6535         }
6536 }
6537 impl Clone for CResult_NonePaymentSendFailureZ {
6538         fn clone(&self) -> Self {
6539                 if self.result_ok {
6540                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6541                                 result: core::ptr::null_mut()
6542                         } }
6543                 } else {
6544                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6545                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6546                         } }
6547                 }
6548         }
6549 }
6550 #[no_mangle]
6551 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6552 /// but with all dynamically-allocated buffers duplicated in new buffers.
6553 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6554 #[repr(C)]
6555 /// A tuple of 2 elements. See the individual fields for the types contained.
6556 pub struct C2Tuple_PaymentHashPaymentIdZ {
6557         /// The element at position 0
6558         pub a: crate::c_types::ThirtyTwoBytes,
6559         /// The element at position 1
6560         pub b: crate::c_types::ThirtyTwoBytes,
6561 }
6562 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6563         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6564                 Self {
6565                         a: tup.0,
6566                         b: tup.1,
6567                 }
6568         }
6569 }
6570 impl C2Tuple_PaymentHashPaymentIdZ {
6571         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6572                 (self.a, self.b)
6573         }
6574 }
6575 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6576         fn clone(&self) -> Self {
6577                 Self {
6578                         a: Clone::clone(&self.a),
6579                         b: Clone::clone(&self.b),
6580                 }
6581         }
6582 }
6583 #[no_mangle]
6584 /// Creates a new tuple which has the same data as `orig`
6585 /// but with all dynamically-allocated buffers duplicated in new buffers.
6586 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6587 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6588 #[no_mangle]
6589 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6590         C2Tuple_PaymentHashPaymentIdZ { a, b, }
6591 }
6592
6593 #[no_mangle]
6594 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6595 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6596 #[repr(C)]
6597 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6598 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6599         /// A pointer to the contents in the success state.
6600         /// Reading from this pointer when `result_ok` is not set is undefined.
6601         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6602         /// A pointer to the contents in the error state.
6603         /// Reading from this pointer when `result_ok` is set is undefined.
6604         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6605 }
6606 #[repr(C)]
6607 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6608 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6609 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6610 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6611         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6612         /// `err` or `result` depending on the state of `result_ok`.
6613         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6614         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6615         pub result_ok: bool,
6616 }
6617 #[no_mangle]
6618 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6619 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6620         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6621                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6622                         result: Box::into_raw(Box::new(o)),
6623                 },
6624                 result_ok: true,
6625         }
6626 }
6627 #[no_mangle]
6628 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6629 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6630         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6631                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6632                         err: Box::into_raw(Box::new(e)),
6633                 },
6634                 result_ok: false,
6635         }
6636 }
6637 /// Checks if the given object is currently in the success state
6638 #[no_mangle]
6639 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6640         o.result_ok
6641 }
6642 #[no_mangle]
6643 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6644 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6645 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6646         fn drop(&mut self) {
6647                 if self.result_ok {
6648                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6649                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6650                         }
6651                 } else {
6652                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6653                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6654                         }
6655                 }
6656         }
6657 }
6658 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6659         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6660                 let contents = if o.result_ok {
6661                         let result = unsafe { o.contents.result };
6662                         unsafe { o.contents.result = core::ptr::null_mut() };
6663                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6664                 } else {
6665                         let err = unsafe { o.contents.err };
6666                         unsafe { o.contents.err = core::ptr::null_mut(); }
6667                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6668                 };
6669                 Self {
6670                         contents,
6671                         result_ok: o.result_ok,
6672                 }
6673         }
6674 }
6675 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6676         fn clone(&self) -> Self {
6677                 if self.result_ok {
6678                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6679                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6680                         } }
6681                 } else {
6682                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6683                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6684                         } }
6685                 }
6686         }
6687 }
6688 #[no_mangle]
6689 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6690 /// but with all dynamically-allocated buffers duplicated in new buffers.
6691 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6692 #[repr(C)]
6693 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6694 /// This corresponds to std::vector in C++
6695 pub struct CVec_NetAddressZ {
6696         /// The elements in the array.
6697         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6698         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6699         /// The number of elements pointed to by `data`.
6700         pub datalen: usize
6701 }
6702 impl CVec_NetAddressZ {
6703         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6704                 if self.datalen == 0 { return Vec::new(); }
6705                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6706                 self.data = core::ptr::null_mut();
6707                 self.datalen = 0;
6708                 ret
6709         }
6710         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6711                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6712         }
6713 }
6714 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6715         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6716                 let datalen = v.len();
6717                 let data = Box::into_raw(v.into_boxed_slice());
6718                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6719         }
6720 }
6721 #[no_mangle]
6722 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6723 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6724 impl Drop for CVec_NetAddressZ {
6725         fn drop(&mut self) {
6726                 if self.datalen == 0 { return; }
6727                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6728         }
6729 }
6730 impl Clone for CVec_NetAddressZ {
6731         fn clone(&self) -> Self {
6732                 let mut res = Vec::new();
6733                 if self.datalen == 0 { return Self::from(res); }
6734                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6735                 Self::from(res)
6736         }
6737 }
6738 #[repr(C)]
6739 /// A tuple of 2 elements. See the individual fields for the types contained.
6740 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6741         /// The element at position 0
6742         pub a: crate::c_types::ThirtyTwoBytes,
6743         /// The element at position 1
6744         pub b: crate::c_types::ThirtyTwoBytes,
6745 }
6746 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6747         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6748                 Self {
6749                         a: tup.0,
6750                         b: tup.1,
6751                 }
6752         }
6753 }
6754 impl C2Tuple_PaymentHashPaymentSecretZ {
6755         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6756                 (self.a, self.b)
6757         }
6758 }
6759 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6760         fn clone(&self) -> Self {
6761                 Self {
6762                         a: Clone::clone(&self.a),
6763                         b: Clone::clone(&self.b),
6764                 }
6765         }
6766 }
6767 #[no_mangle]
6768 /// Creates a new tuple which has the same data as `orig`
6769 /// but with all dynamically-allocated buffers duplicated in new buffers.
6770 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6771 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6772 #[no_mangle]
6773 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6774         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6775 }
6776
6777 #[no_mangle]
6778 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6779 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6780 #[repr(C)]
6781 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6782 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
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::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6786         /// Note that this value is always NULL, as there are no contents in the Err variant
6787         pub err: *mut core::ffi::c_void,
6788 }
6789 #[repr(C)]
6790 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6791 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6793 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6794         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6795         /// `err` or `result` depending on the state of `result_ok`.
6796         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6797         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6798         pub result_ok: bool,
6799 }
6800 #[no_mangle]
6801 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6802 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6803         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6804                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6805                         result: Box::into_raw(Box::new(o)),
6806                 },
6807                 result_ok: true,
6808         }
6809 }
6810 #[no_mangle]
6811 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6812 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6813         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6814                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6815                         err: core::ptr::null_mut(),
6816                 },
6817                 result_ok: false,
6818         }
6819 }
6820 /// Checks if the given object is currently in the success state
6821 #[no_mangle]
6822 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6823         o.result_ok
6824 }
6825 #[no_mangle]
6826 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6827 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6828 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6829         fn drop(&mut self) {
6830                 if self.result_ok {
6831                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6832                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6833                         }
6834                 } else {
6835                 }
6836         }
6837 }
6838 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6839         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6840                 let contents = if o.result_ok {
6841                         let result = unsafe { o.contents.result };
6842                         unsafe { o.contents.result = core::ptr::null_mut() };
6843                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6844                 } else {
6845                         let _ = unsafe { Box::from_raw(o.contents.err) };
6846                         o.contents.err = core::ptr::null_mut();
6847                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6848                 };
6849                 Self {
6850                         contents,
6851                         result_ok: o.result_ok,
6852                 }
6853         }
6854 }
6855 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6856         fn clone(&self) -> Self {
6857                 if self.result_ok {
6858                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6859                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6860                         } }
6861                 } else {
6862                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6863                                 err: core::ptr::null_mut()
6864                         } }
6865                 }
6866         }
6867 }
6868 #[no_mangle]
6869 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6870 /// but with all dynamically-allocated buffers duplicated in new buffers.
6871 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6872 #[repr(C)]
6873 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6874 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6875         /// A pointer to the contents in the success state.
6876         /// Reading from this pointer when `result_ok` is not set is undefined.
6877         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6878         /// A pointer to the contents in the error state.
6879         /// Reading from this pointer when `result_ok` is set is undefined.
6880         pub err: *mut crate::lightning::util::errors::APIError,
6881 }
6882 #[repr(C)]
6883 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6884 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6886 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6887         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6888         /// `err` or `result` depending on the state of `result_ok`.
6889         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6890         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6891         pub result_ok: bool,
6892 }
6893 #[no_mangle]
6894 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6895 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6896         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6897                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6898                         result: Box::into_raw(Box::new(o)),
6899                 },
6900                 result_ok: true,
6901         }
6902 }
6903 #[no_mangle]
6904 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6905 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6906         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6907                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6908                         err: Box::into_raw(Box::new(e)),
6909                 },
6910                 result_ok: false,
6911         }
6912 }
6913 /// Checks if the given object is currently in the success state
6914 #[no_mangle]
6915 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6916         o.result_ok
6917 }
6918 #[no_mangle]
6919 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6920 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6921 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6922         fn drop(&mut self) {
6923                 if self.result_ok {
6924                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6925                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6926                         }
6927                 } else {
6928                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6929                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6930                         }
6931                 }
6932         }
6933 }
6934 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6935         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6936                 let contents = if o.result_ok {
6937                         let result = unsafe { o.contents.result };
6938                         unsafe { o.contents.result = core::ptr::null_mut() };
6939                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6940                 } else {
6941                         let err = unsafe { o.contents.err };
6942                         unsafe { o.contents.err = core::ptr::null_mut(); }
6943                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6944                 };
6945                 Self {
6946                         contents,
6947                         result_ok: o.result_ok,
6948                 }
6949         }
6950 }
6951 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6952         fn clone(&self) -> Self {
6953                 if self.result_ok {
6954                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6955                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6956                         } }
6957                 } else {
6958                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6959                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6960                         } }
6961                 }
6962         }
6963 }
6964 #[no_mangle]
6965 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6966 /// but with all dynamically-allocated buffers duplicated in new buffers.
6967 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6968 #[repr(C)]
6969 /// The contents of CResult_PaymentSecretNoneZ
6970 pub union CResult_PaymentSecretNoneZPtr {
6971         /// A pointer to the contents in the success state.
6972         /// Reading from this pointer when `result_ok` is not set is undefined.
6973         pub result: *mut crate::c_types::ThirtyTwoBytes,
6974         /// Note that this value is always NULL, as there are no contents in the Err variant
6975         pub err: *mut core::ffi::c_void,
6976 }
6977 #[repr(C)]
6978 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6979 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6981 pub struct CResult_PaymentSecretNoneZ {
6982         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6983         /// `err` or `result` depending on the state of `result_ok`.
6984         pub contents: CResult_PaymentSecretNoneZPtr,
6985         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6986         pub result_ok: bool,
6987 }
6988 #[no_mangle]
6989 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6990 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6991         CResult_PaymentSecretNoneZ {
6992                 contents: CResult_PaymentSecretNoneZPtr {
6993                         result: Box::into_raw(Box::new(o)),
6994                 },
6995                 result_ok: true,
6996         }
6997 }
6998 #[no_mangle]
6999 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
7000 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
7001         CResult_PaymentSecretNoneZ {
7002                 contents: CResult_PaymentSecretNoneZPtr {
7003                         err: core::ptr::null_mut(),
7004                 },
7005                 result_ok: false,
7006         }
7007 }
7008 /// Checks if the given object is currently in the success state
7009 #[no_mangle]
7010 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
7011         o.result_ok
7012 }
7013 #[no_mangle]
7014 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
7015 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
7016 impl Drop for CResult_PaymentSecretNoneZ {
7017         fn drop(&mut self) {
7018                 if self.result_ok {
7019                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7020                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7021                         }
7022                 } else {
7023                 }
7024         }
7025 }
7026 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
7027         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7028                 let contents = if o.result_ok {
7029                         let result = unsafe { o.contents.result };
7030                         unsafe { o.contents.result = core::ptr::null_mut() };
7031                         CResult_PaymentSecretNoneZPtr { result }
7032                 } else {
7033                         let _ = unsafe { Box::from_raw(o.contents.err) };
7034                         o.contents.err = core::ptr::null_mut();
7035                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
7036                 };
7037                 Self {
7038                         contents,
7039                         result_ok: o.result_ok,
7040                 }
7041         }
7042 }
7043 impl Clone for CResult_PaymentSecretNoneZ {
7044         fn clone(&self) -> Self {
7045                 if self.result_ok {
7046                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
7047                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7048                         } }
7049                 } else {
7050                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
7051                                 err: core::ptr::null_mut()
7052                         } }
7053                 }
7054         }
7055 }
7056 #[no_mangle]
7057 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
7058 /// but with all dynamically-allocated buffers duplicated in new buffers.
7059 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
7060 #[repr(C)]
7061 /// The contents of CResult_PaymentSecretAPIErrorZ
7062 pub union CResult_PaymentSecretAPIErrorZPtr {
7063         /// A pointer to the contents in the success state.
7064         /// Reading from this pointer when `result_ok` is not set is undefined.
7065         pub result: *mut crate::c_types::ThirtyTwoBytes,
7066         /// A pointer to the contents in the error state.
7067         /// Reading from this pointer when `result_ok` is set is undefined.
7068         pub err: *mut crate::lightning::util::errors::APIError,
7069 }
7070 #[repr(C)]
7071 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7072 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7073 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7074 pub struct CResult_PaymentSecretAPIErrorZ {
7075         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7076         /// `err` or `result` depending on the state of `result_ok`.
7077         pub contents: CResult_PaymentSecretAPIErrorZPtr,
7078         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7079         pub result_ok: bool,
7080 }
7081 #[no_mangle]
7082 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
7083 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
7084         CResult_PaymentSecretAPIErrorZ {
7085                 contents: CResult_PaymentSecretAPIErrorZPtr {
7086                         result: Box::into_raw(Box::new(o)),
7087                 },
7088                 result_ok: true,
7089         }
7090 }
7091 #[no_mangle]
7092 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7093 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7094         CResult_PaymentSecretAPIErrorZ {
7095                 contents: CResult_PaymentSecretAPIErrorZPtr {
7096                         err: Box::into_raw(Box::new(e)),
7097                 },
7098                 result_ok: false,
7099         }
7100 }
7101 /// Checks if the given object is currently in the success state
7102 #[no_mangle]
7103 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7104         o.result_ok
7105 }
7106 #[no_mangle]
7107 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7108 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7109 impl Drop for CResult_PaymentSecretAPIErrorZ {
7110         fn drop(&mut self) {
7111                 if self.result_ok {
7112                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7113                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7114                         }
7115                 } else {
7116                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7117                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7118                         }
7119                 }
7120         }
7121 }
7122 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7123         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7124                 let contents = if o.result_ok {
7125                         let result = unsafe { o.contents.result };
7126                         unsafe { o.contents.result = core::ptr::null_mut() };
7127                         CResult_PaymentSecretAPIErrorZPtr { result }
7128                 } else {
7129                         let err = unsafe { o.contents.err };
7130                         unsafe { o.contents.err = core::ptr::null_mut(); }
7131                         CResult_PaymentSecretAPIErrorZPtr { err }
7132                 };
7133                 Self {
7134                         contents,
7135                         result_ok: o.result_ok,
7136                 }
7137         }
7138 }
7139 impl Clone for CResult_PaymentSecretAPIErrorZ {
7140         fn clone(&self) -> Self {
7141                 if self.result_ok {
7142                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7143                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7144                         } }
7145                 } else {
7146                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7147                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7148                         } }
7149                 }
7150         }
7151 }
7152 #[no_mangle]
7153 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7154 /// but with all dynamically-allocated buffers duplicated in new buffers.
7155 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7156 #[repr(C)]
7157 /// The contents of CResult_PaymentPreimageAPIErrorZ
7158 pub union CResult_PaymentPreimageAPIErrorZPtr {
7159         /// A pointer to the contents in the success state.
7160         /// Reading from this pointer when `result_ok` is not set is undefined.
7161         pub result: *mut crate::c_types::ThirtyTwoBytes,
7162         /// A pointer to the contents in the error state.
7163         /// Reading from this pointer when `result_ok` is set is undefined.
7164         pub err: *mut crate::lightning::util::errors::APIError,
7165 }
7166 #[repr(C)]
7167 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7168 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7169 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7170 pub struct CResult_PaymentPreimageAPIErrorZ {
7171         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7172         /// `err` or `result` depending on the state of `result_ok`.
7173         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7174         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7175         pub result_ok: bool,
7176 }
7177 #[no_mangle]
7178 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7179 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7180         CResult_PaymentPreimageAPIErrorZ {
7181                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7182                         result: Box::into_raw(Box::new(o)),
7183                 },
7184                 result_ok: true,
7185         }
7186 }
7187 #[no_mangle]
7188 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7189 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7190         CResult_PaymentPreimageAPIErrorZ {
7191                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7192                         err: Box::into_raw(Box::new(e)),
7193                 },
7194                 result_ok: false,
7195         }
7196 }
7197 /// Checks if the given object is currently in the success state
7198 #[no_mangle]
7199 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7200         o.result_ok
7201 }
7202 #[no_mangle]
7203 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7204 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7205 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7206         fn drop(&mut self) {
7207                 if self.result_ok {
7208                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7209                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7210                         }
7211                 } else {
7212                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7213                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7214                         }
7215                 }
7216         }
7217 }
7218 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7219         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7220                 let contents = if o.result_ok {
7221                         let result = unsafe { o.contents.result };
7222                         unsafe { o.contents.result = core::ptr::null_mut() };
7223                         CResult_PaymentPreimageAPIErrorZPtr { result }
7224                 } else {
7225                         let err = unsafe { o.contents.err };
7226                         unsafe { o.contents.err = core::ptr::null_mut(); }
7227                         CResult_PaymentPreimageAPIErrorZPtr { err }
7228                 };
7229                 Self {
7230                         contents,
7231                         result_ok: o.result_ok,
7232                 }
7233         }
7234 }
7235 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7236         fn clone(&self) -> Self {
7237                 if self.result_ok {
7238                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7239                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7240                         } }
7241                 } else {
7242                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7243                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7244                         } }
7245                 }
7246         }
7247 }
7248 #[no_mangle]
7249 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7250 /// but with all dynamically-allocated buffers duplicated in new buffers.
7251 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7252 #[repr(C)]
7253 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7254 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7255         /// A pointer to the contents in the success state.
7256         /// Reading from this pointer when `result_ok` is not set is undefined.
7257         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7258         /// A pointer to the contents in the error state.
7259         /// Reading from this pointer when `result_ok` is set is undefined.
7260         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7261 }
7262 #[repr(C)]
7263 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7264 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7266 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7267         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7268         /// `err` or `result` depending on the state of `result_ok`.
7269         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7270         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7271         pub result_ok: bool,
7272 }
7273 #[no_mangle]
7274 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7275 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7276         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7277                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7278                         result: Box::into_raw(Box::new(o)),
7279                 },
7280                 result_ok: true,
7281         }
7282 }
7283 #[no_mangle]
7284 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7285 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7286         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7287                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7288                         err: Box::into_raw(Box::new(e)),
7289                 },
7290                 result_ok: false,
7291         }
7292 }
7293 /// Checks if the given object is currently in the success state
7294 #[no_mangle]
7295 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7296         o.result_ok
7297 }
7298 #[no_mangle]
7299 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7300 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7301 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7302         fn drop(&mut self) {
7303                 if self.result_ok {
7304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7306                         }
7307                 } else {
7308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7310                         }
7311                 }
7312         }
7313 }
7314 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7315         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7316                 let contents = if o.result_ok {
7317                         let result = unsafe { o.contents.result };
7318                         unsafe { o.contents.result = core::ptr::null_mut() };
7319                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7320                 } else {
7321                         let err = unsafe { o.contents.err };
7322                         unsafe { o.contents.err = core::ptr::null_mut(); }
7323                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7324                 };
7325                 Self {
7326                         contents,
7327                         result_ok: o.result_ok,
7328                 }
7329         }
7330 }
7331 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7332         fn clone(&self) -> Self {
7333                 if self.result_ok {
7334                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7335                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7336                         } }
7337                 } else {
7338                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7340                         } }
7341                 }
7342         }
7343 }
7344 #[no_mangle]
7345 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7346 /// but with all dynamically-allocated buffers duplicated in new buffers.
7347 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7348 #[repr(C)]
7349 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7350 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7351         /// A pointer to the contents in the success state.
7352         /// Reading from this pointer when `result_ok` is not set is undefined.
7353         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7354         /// A pointer to the contents in the error state.
7355         /// Reading from this pointer when `result_ok` is set is undefined.
7356         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7357 }
7358 #[repr(C)]
7359 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7360 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7362 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7363         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7364         /// `err` or `result` depending on the state of `result_ok`.
7365         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7366         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7367         pub result_ok: bool,
7368 }
7369 #[no_mangle]
7370 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7371 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7372         CResult_ChannelCounterpartyDecodeErrorZ {
7373                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7374                         result: Box::into_raw(Box::new(o)),
7375                 },
7376                 result_ok: true,
7377         }
7378 }
7379 #[no_mangle]
7380 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7381 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7382         CResult_ChannelCounterpartyDecodeErrorZ {
7383                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7384                         err: Box::into_raw(Box::new(e)),
7385                 },
7386                 result_ok: false,
7387         }
7388 }
7389 /// Checks if the given object is currently in the success state
7390 #[no_mangle]
7391 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7392         o.result_ok
7393 }
7394 #[no_mangle]
7395 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7396 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7397 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7398         fn drop(&mut self) {
7399                 if self.result_ok {
7400                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7401                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7402                         }
7403                 } else {
7404                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7405                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7406                         }
7407                 }
7408         }
7409 }
7410 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7411         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7412                 let contents = if o.result_ok {
7413                         let result = unsafe { o.contents.result };
7414                         unsafe { o.contents.result = core::ptr::null_mut() };
7415                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7416                 } else {
7417                         let err = unsafe { o.contents.err };
7418                         unsafe { o.contents.err = core::ptr::null_mut(); }
7419                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7420                 };
7421                 Self {
7422                         contents,
7423                         result_ok: o.result_ok,
7424                 }
7425         }
7426 }
7427 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7428         fn clone(&self) -> Self {
7429                 if self.result_ok {
7430                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7431                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7432                         } }
7433                 } else {
7434                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7435                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7436                         } }
7437                 }
7438         }
7439 }
7440 #[no_mangle]
7441 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7442 /// but with all dynamically-allocated buffers duplicated in new buffers.
7443 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7444 #[repr(C)]
7445 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7446 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7447         /// A pointer to the contents in the success state.
7448         /// Reading from this pointer when `result_ok` is not set is undefined.
7449         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7450         /// A pointer to the contents in the error state.
7451         /// Reading from this pointer when `result_ok` is set is undefined.
7452         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7453 }
7454 #[repr(C)]
7455 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7456 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7458 pub struct CResult_ChannelDetailsDecodeErrorZ {
7459         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7460         /// `err` or `result` depending on the state of `result_ok`.
7461         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7462         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7463         pub result_ok: bool,
7464 }
7465 #[no_mangle]
7466 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7467 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7468         CResult_ChannelDetailsDecodeErrorZ {
7469                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7470                         result: Box::into_raw(Box::new(o)),
7471                 },
7472                 result_ok: true,
7473         }
7474 }
7475 #[no_mangle]
7476 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7477 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7478         CResult_ChannelDetailsDecodeErrorZ {
7479                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7480                         err: Box::into_raw(Box::new(e)),
7481                 },
7482                 result_ok: false,
7483         }
7484 }
7485 /// Checks if the given object is currently in the success state
7486 #[no_mangle]
7487 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7488         o.result_ok
7489 }
7490 #[no_mangle]
7491 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7492 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7493 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7494         fn drop(&mut self) {
7495                 if self.result_ok {
7496                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7497                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7498                         }
7499                 } else {
7500                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7501                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7502                         }
7503                 }
7504         }
7505 }
7506 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7507         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7508                 let contents = if o.result_ok {
7509                         let result = unsafe { o.contents.result };
7510                         unsafe { o.contents.result = core::ptr::null_mut() };
7511                         CResult_ChannelDetailsDecodeErrorZPtr { result }
7512                 } else {
7513                         let err = unsafe { o.contents.err };
7514                         unsafe { o.contents.err = core::ptr::null_mut(); }
7515                         CResult_ChannelDetailsDecodeErrorZPtr { err }
7516                 };
7517                 Self {
7518                         contents,
7519                         result_ok: o.result_ok,
7520                 }
7521         }
7522 }
7523 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7524         fn clone(&self) -> Self {
7525                 if self.result_ok {
7526                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7527                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7528                         } }
7529                 } else {
7530                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7531                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7532                         } }
7533                 }
7534         }
7535 }
7536 #[no_mangle]
7537 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7538 /// but with all dynamically-allocated buffers duplicated in new buffers.
7539 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7540 #[repr(C)]
7541 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7542 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7543         /// A pointer to the contents in the success state.
7544         /// Reading from this pointer when `result_ok` is not set is undefined.
7545         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7546         /// A pointer to the contents in the error state.
7547         /// Reading from this pointer when `result_ok` is set is undefined.
7548         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7549 }
7550 #[repr(C)]
7551 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7552 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7553 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7554 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7555         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7556         /// `err` or `result` depending on the state of `result_ok`.
7557         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7558         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7559         pub result_ok: bool,
7560 }
7561 #[no_mangle]
7562 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7563 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7564         CResult_PhantomRouteHintsDecodeErrorZ {
7565                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7566                         result: Box::into_raw(Box::new(o)),
7567                 },
7568                 result_ok: true,
7569         }
7570 }
7571 #[no_mangle]
7572 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7573 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7574         CResult_PhantomRouteHintsDecodeErrorZ {
7575                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7576                         err: Box::into_raw(Box::new(e)),
7577                 },
7578                 result_ok: false,
7579         }
7580 }
7581 /// Checks if the given object is currently in the success state
7582 #[no_mangle]
7583 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7584         o.result_ok
7585 }
7586 #[no_mangle]
7587 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7588 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7589 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7590         fn drop(&mut self) {
7591                 if self.result_ok {
7592                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7593                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7594                         }
7595                 } else {
7596                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7597                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7598                         }
7599                 }
7600         }
7601 }
7602 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7603         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7604                 let contents = if o.result_ok {
7605                         let result = unsafe { o.contents.result };
7606                         unsafe { o.contents.result = core::ptr::null_mut() };
7607                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7608                 } else {
7609                         let err = unsafe { o.contents.err };
7610                         unsafe { o.contents.err = core::ptr::null_mut(); }
7611                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7612                 };
7613                 Self {
7614                         contents,
7615                         result_ok: o.result_ok,
7616                 }
7617         }
7618 }
7619 #[repr(C)]
7620 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7621 /// This corresponds to std::vector in C++
7622 pub struct CVec_ChannelMonitorZ {
7623         /// The elements in the array.
7624         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7625         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7626         /// The number of elements pointed to by `data`.
7627         pub datalen: usize
7628 }
7629 impl CVec_ChannelMonitorZ {
7630         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7631                 if self.datalen == 0 { return Vec::new(); }
7632                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7633                 self.data = core::ptr::null_mut();
7634                 self.datalen = 0;
7635                 ret
7636         }
7637         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7638                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7639         }
7640 }
7641 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7642         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7643                 let datalen = v.len();
7644                 let data = Box::into_raw(v.into_boxed_slice());
7645                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7646         }
7647 }
7648 #[no_mangle]
7649 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7650 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7651 impl Drop for CVec_ChannelMonitorZ {
7652         fn drop(&mut self) {
7653                 if self.datalen == 0 { return; }
7654                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7655         }
7656 }
7657 #[repr(C)]
7658 /// A tuple of 2 elements. See the individual fields for the types contained.
7659 pub struct C2Tuple_BlockHashChannelManagerZ {
7660         /// The element at position 0
7661         pub a: crate::c_types::ThirtyTwoBytes,
7662         /// The element at position 1
7663         pub b: crate::lightning::ln::channelmanager::ChannelManager,
7664 }
7665 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7666         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7667                 Self {
7668                         a: tup.0,
7669                         b: tup.1,
7670                 }
7671         }
7672 }
7673 impl C2Tuple_BlockHashChannelManagerZ {
7674         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7675                 (self.a, self.b)
7676         }
7677 }
7678 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7679 #[no_mangle]
7680 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7681         C2Tuple_BlockHashChannelManagerZ { a, b, }
7682 }
7683
7684 #[no_mangle]
7685 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7686 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7687 #[repr(C)]
7688 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7689 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7690         /// A pointer to the contents in the success state.
7691         /// Reading from this pointer when `result_ok` is not set is undefined.
7692         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7693         /// A pointer to the contents in the error state.
7694         /// Reading from this pointer when `result_ok` is set is undefined.
7695         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7696 }
7697 #[repr(C)]
7698 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7699 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7701 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7702         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7703         /// `err` or `result` depending on the state of `result_ok`.
7704         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7705         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7706         pub result_ok: bool,
7707 }
7708 #[no_mangle]
7709 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7710 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7711         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7712                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7713                         result: Box::into_raw(Box::new(o)),
7714                 },
7715                 result_ok: true,
7716         }
7717 }
7718 #[no_mangle]
7719 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7720 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7721         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7722                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7723                         err: Box::into_raw(Box::new(e)),
7724                 },
7725                 result_ok: false,
7726         }
7727 }
7728 /// Checks if the given object is currently in the success state
7729 #[no_mangle]
7730 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7731         o.result_ok
7732 }
7733 #[no_mangle]
7734 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7735 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7736 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7737         fn drop(&mut self) {
7738                 if self.result_ok {
7739                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7740                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7741                         }
7742                 } else {
7743                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7744                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7745                         }
7746                 }
7747         }
7748 }
7749 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7750         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7751                 let contents = if o.result_ok {
7752                         let result = unsafe { o.contents.result };
7753                         unsafe { o.contents.result = core::ptr::null_mut() };
7754                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7755                 } else {
7756                         let err = unsafe { o.contents.err };
7757                         unsafe { o.contents.err = core::ptr::null_mut(); }
7758                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7759                 };
7760                 Self {
7761                         contents,
7762                         result_ok: o.result_ok,
7763                 }
7764         }
7765 }
7766 #[repr(C)]
7767 /// The contents of CResult_ChannelConfigDecodeErrorZ
7768 pub union CResult_ChannelConfigDecodeErrorZPtr {
7769         /// A pointer to the contents in the success state.
7770         /// Reading from this pointer when `result_ok` is not set is undefined.
7771         pub result: *mut crate::lightning::util::config::ChannelConfig,
7772         /// A pointer to the contents in the error state.
7773         /// Reading from this pointer when `result_ok` is set is undefined.
7774         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7775 }
7776 #[repr(C)]
7777 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7778 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7780 pub struct CResult_ChannelConfigDecodeErrorZ {
7781         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7782         /// `err` or `result` depending on the state of `result_ok`.
7783         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7784         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7785         pub result_ok: bool,
7786 }
7787 #[no_mangle]
7788 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7789 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7790         CResult_ChannelConfigDecodeErrorZ {
7791                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7792                         result: Box::into_raw(Box::new(o)),
7793                 },
7794                 result_ok: true,
7795         }
7796 }
7797 #[no_mangle]
7798 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7799 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7800         CResult_ChannelConfigDecodeErrorZ {
7801                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7802                         err: Box::into_raw(Box::new(e)),
7803                 },
7804                 result_ok: false,
7805         }
7806 }
7807 /// Checks if the given object is currently in the success state
7808 #[no_mangle]
7809 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7810         o.result_ok
7811 }
7812 #[no_mangle]
7813 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7814 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7815 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7816         fn drop(&mut self) {
7817                 if self.result_ok {
7818                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7819                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7820                         }
7821                 } else {
7822                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7823                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7824                         }
7825                 }
7826         }
7827 }
7828 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7829         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7830                 let contents = if o.result_ok {
7831                         let result = unsafe { o.contents.result };
7832                         unsafe { o.contents.result = core::ptr::null_mut() };
7833                         CResult_ChannelConfigDecodeErrorZPtr { result }
7834                 } else {
7835                         let err = unsafe { o.contents.err };
7836                         unsafe { o.contents.err = core::ptr::null_mut(); }
7837                         CResult_ChannelConfigDecodeErrorZPtr { err }
7838                 };
7839                 Self {
7840                         contents,
7841                         result_ok: o.result_ok,
7842                 }
7843         }
7844 }
7845 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7846         fn clone(&self) -> Self {
7847                 if self.result_ok {
7848                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7849                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7850                         } }
7851                 } else {
7852                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7853                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7854                         } }
7855                 }
7856         }
7857 }
7858 #[no_mangle]
7859 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7860 /// but with all dynamically-allocated buffers duplicated in new buffers.
7861 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7862 #[repr(C)]
7863 /// The contents of CResult_OutPointDecodeErrorZ
7864 pub union CResult_OutPointDecodeErrorZPtr {
7865         /// A pointer to the contents in the success state.
7866         /// Reading from this pointer when `result_ok` is not set is undefined.
7867         pub result: *mut crate::lightning::chain::transaction::OutPoint,
7868         /// A pointer to the contents in the error state.
7869         /// Reading from this pointer when `result_ok` is set is undefined.
7870         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7871 }
7872 #[repr(C)]
7873 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7874 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7876 pub struct CResult_OutPointDecodeErrorZ {
7877         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7878         /// `err` or `result` depending on the state of `result_ok`.
7879         pub contents: CResult_OutPointDecodeErrorZPtr,
7880         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7881         pub result_ok: bool,
7882 }
7883 #[no_mangle]
7884 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7885 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7886         CResult_OutPointDecodeErrorZ {
7887                 contents: CResult_OutPointDecodeErrorZPtr {
7888                         result: Box::into_raw(Box::new(o)),
7889                 },
7890                 result_ok: true,
7891         }
7892 }
7893 #[no_mangle]
7894 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7895 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7896         CResult_OutPointDecodeErrorZ {
7897                 contents: CResult_OutPointDecodeErrorZPtr {
7898                         err: Box::into_raw(Box::new(e)),
7899                 },
7900                 result_ok: false,
7901         }
7902 }
7903 /// Checks if the given object is currently in the success state
7904 #[no_mangle]
7905 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7906         o.result_ok
7907 }
7908 #[no_mangle]
7909 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7910 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7911 impl Drop for CResult_OutPointDecodeErrorZ {
7912         fn drop(&mut self) {
7913                 if self.result_ok {
7914                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7915                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7916                         }
7917                 } else {
7918                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7919                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7920                         }
7921                 }
7922         }
7923 }
7924 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7925         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7926                 let contents = if o.result_ok {
7927                         let result = unsafe { o.contents.result };
7928                         unsafe { o.contents.result = core::ptr::null_mut() };
7929                         CResult_OutPointDecodeErrorZPtr { result }
7930                 } else {
7931                         let err = unsafe { o.contents.err };
7932                         unsafe { o.contents.err = core::ptr::null_mut(); }
7933                         CResult_OutPointDecodeErrorZPtr { err }
7934                 };
7935                 Self {
7936                         contents,
7937                         result_ok: o.result_ok,
7938                 }
7939         }
7940 }
7941 impl Clone for CResult_OutPointDecodeErrorZ {
7942         fn clone(&self) -> Self {
7943                 if self.result_ok {
7944                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7945                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7946                         } }
7947                 } else {
7948                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7949                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7950                         } }
7951                 }
7952         }
7953 }
7954 #[no_mangle]
7955 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7956 /// but with all dynamically-allocated buffers duplicated in new buffers.
7957 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7958 #[repr(C)]
7959 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7960 pub enum COption_TypeZ {
7961         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7962         Some(crate::lightning::ln::wire::Type),
7963         /// When we're in this state, this COption_TypeZ contains nothing
7964         None
7965 }
7966 impl COption_TypeZ {
7967         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7968                 if let Self::None = self { false } else { true }
7969         }
7970         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7971                 !self.is_some()
7972         }
7973         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7974                 if let Self::Some(v) = self { v } else { unreachable!() }
7975         }
7976 }
7977 #[no_mangle]
7978 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7979 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7980         COption_TypeZ::Some(o)
7981 }
7982 #[no_mangle]
7983 /// Constructs a new COption_TypeZ containing nothing
7984 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7985         COption_TypeZ::None
7986 }
7987 #[no_mangle]
7988 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7989 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7990 #[repr(C)]
7991 /// The contents of CResult_COption_TypeZDecodeErrorZ
7992 pub union CResult_COption_TypeZDecodeErrorZPtr {
7993         /// A pointer to the contents in the success state.
7994         /// Reading from this pointer when `result_ok` is not set is undefined.
7995         pub result: *mut crate::c_types::derived::COption_TypeZ,
7996         /// A pointer to the contents in the error state.
7997         /// Reading from this pointer when `result_ok` is set is undefined.
7998         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7999 }
8000 #[repr(C)]
8001 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8002 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8003 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8004 pub struct CResult_COption_TypeZDecodeErrorZ {
8005         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8006         /// `err` or `result` depending on the state of `result_ok`.
8007         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
8008         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8009         pub result_ok: bool,
8010 }
8011 #[no_mangle]
8012 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
8013 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
8014         CResult_COption_TypeZDecodeErrorZ {
8015                 contents: CResult_COption_TypeZDecodeErrorZPtr {
8016                         result: Box::into_raw(Box::new(o)),
8017                 },
8018                 result_ok: true,
8019         }
8020 }
8021 #[no_mangle]
8022 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
8023 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
8024         CResult_COption_TypeZDecodeErrorZ {
8025                 contents: CResult_COption_TypeZDecodeErrorZPtr {
8026                         err: Box::into_raw(Box::new(e)),
8027                 },
8028                 result_ok: false,
8029         }
8030 }
8031 /// Checks if the given object is currently in the success state
8032 #[no_mangle]
8033 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
8034         o.result_ok
8035 }
8036 #[no_mangle]
8037 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
8038 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
8039 impl Drop for CResult_COption_TypeZDecodeErrorZ {
8040         fn drop(&mut self) {
8041                 if self.result_ok {
8042                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8043                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8044                         }
8045                 } else {
8046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8048                         }
8049                 }
8050         }
8051 }
8052 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
8053         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8054                 let contents = if o.result_ok {
8055                         let result = unsafe { o.contents.result };
8056                         unsafe { o.contents.result = core::ptr::null_mut() };
8057                         CResult_COption_TypeZDecodeErrorZPtr { result }
8058                 } else {
8059                         let err = unsafe { o.contents.err };
8060                         unsafe { o.contents.err = core::ptr::null_mut(); }
8061                         CResult_COption_TypeZDecodeErrorZPtr { err }
8062                 };
8063                 Self {
8064                         contents,
8065                         result_ok: o.result_ok,
8066                 }
8067         }
8068 }
8069 #[repr(C)]
8070 /// The contents of CResult_PaymentIdPaymentErrorZ
8071 pub union CResult_PaymentIdPaymentErrorZPtr {
8072         /// A pointer to the contents in the success state.
8073         /// Reading from this pointer when `result_ok` is not set is undefined.
8074         pub result: *mut crate::c_types::ThirtyTwoBytes,
8075         /// A pointer to the contents in the error state.
8076         /// Reading from this pointer when `result_ok` is set is undefined.
8077         pub err: *mut crate::lightning_invoice::payment::PaymentError,
8078 }
8079 #[repr(C)]
8080 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8081 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8082 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8083 pub struct CResult_PaymentIdPaymentErrorZ {
8084         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8085         /// `err` or `result` depending on the state of `result_ok`.
8086         pub contents: CResult_PaymentIdPaymentErrorZPtr,
8087         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8088         pub result_ok: bool,
8089 }
8090 #[no_mangle]
8091 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8092 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8093         CResult_PaymentIdPaymentErrorZ {
8094                 contents: CResult_PaymentIdPaymentErrorZPtr {
8095                         result: Box::into_raw(Box::new(o)),
8096                 },
8097                 result_ok: true,
8098         }
8099 }
8100 #[no_mangle]
8101 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8102 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8103         CResult_PaymentIdPaymentErrorZ {
8104                 contents: CResult_PaymentIdPaymentErrorZPtr {
8105                         err: Box::into_raw(Box::new(e)),
8106                 },
8107                 result_ok: false,
8108         }
8109 }
8110 /// Checks if the given object is currently in the success state
8111 #[no_mangle]
8112 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8113         o.result_ok
8114 }
8115 #[no_mangle]
8116 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8117 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8118 impl Drop for CResult_PaymentIdPaymentErrorZ {
8119         fn drop(&mut self) {
8120                 if self.result_ok {
8121                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8122                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8123                         }
8124                 } else {
8125                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8126                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8127                         }
8128                 }
8129         }
8130 }
8131 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8132         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8133                 let contents = if o.result_ok {
8134                         let result = unsafe { o.contents.result };
8135                         unsafe { o.contents.result = core::ptr::null_mut() };
8136                         CResult_PaymentIdPaymentErrorZPtr { result }
8137                 } else {
8138                         let err = unsafe { o.contents.err };
8139                         unsafe { o.contents.err = core::ptr::null_mut(); }
8140                         CResult_PaymentIdPaymentErrorZPtr { err }
8141                 };
8142                 Self {
8143                         contents,
8144                         result_ok: o.result_ok,
8145                 }
8146         }
8147 }
8148 impl Clone for CResult_PaymentIdPaymentErrorZ {
8149         fn clone(&self) -> Self {
8150                 if self.result_ok {
8151                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8152                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8153                         } }
8154                 } else {
8155                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8156                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8157                         } }
8158                 }
8159         }
8160 }
8161 #[no_mangle]
8162 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8163 /// but with all dynamically-allocated buffers duplicated in new buffers.
8164 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8165 #[repr(C)]
8166 /// The contents of CResult_SiPrefixNoneZ
8167 pub union CResult_SiPrefixNoneZPtr {
8168         /// A pointer to the contents in the success state.
8169         /// Reading from this pointer when `result_ok` is not set is undefined.
8170         pub result: *mut crate::lightning_invoice::SiPrefix,
8171         /// Note that this value is always NULL, as there are no contents in the Err variant
8172         pub err: *mut core::ffi::c_void,
8173 }
8174 #[repr(C)]
8175 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8176 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8178 pub struct CResult_SiPrefixNoneZ {
8179         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8180         /// `err` or `result` depending on the state of `result_ok`.
8181         pub contents: CResult_SiPrefixNoneZPtr,
8182         /// Whether this CResult_SiPrefixNoneZ represents a success state.
8183         pub result_ok: bool,
8184 }
8185 #[no_mangle]
8186 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8187 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8188         CResult_SiPrefixNoneZ {
8189                 contents: CResult_SiPrefixNoneZPtr {
8190                         result: Box::into_raw(Box::new(o)),
8191                 },
8192                 result_ok: true,
8193         }
8194 }
8195 #[no_mangle]
8196 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8197 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8198         CResult_SiPrefixNoneZ {
8199                 contents: CResult_SiPrefixNoneZPtr {
8200                         err: core::ptr::null_mut(),
8201                 },
8202                 result_ok: false,
8203         }
8204 }
8205 /// Checks if the given object is currently in the success state
8206 #[no_mangle]
8207 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8208         o.result_ok
8209 }
8210 #[no_mangle]
8211 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8212 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8213 impl Drop for CResult_SiPrefixNoneZ {
8214         fn drop(&mut self) {
8215                 if self.result_ok {
8216                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8217                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8218                         }
8219                 } else {
8220                 }
8221         }
8222 }
8223 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8225                 let contents = if o.result_ok {
8226                         let result = unsafe { o.contents.result };
8227                         unsafe { o.contents.result = core::ptr::null_mut() };
8228                         CResult_SiPrefixNoneZPtr { result }
8229                 } else {
8230                         let _ = unsafe { Box::from_raw(o.contents.err) };
8231                         o.contents.err = core::ptr::null_mut();
8232                         CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8233                 };
8234                 Self {
8235                         contents,
8236                         result_ok: o.result_ok,
8237                 }
8238         }
8239 }
8240 impl Clone for CResult_SiPrefixNoneZ {
8241         fn clone(&self) -> Self {
8242                 if self.result_ok {
8243                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8244                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8245                         } }
8246                 } else {
8247                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8248                                 err: core::ptr::null_mut()
8249                         } }
8250                 }
8251         }
8252 }
8253 #[no_mangle]
8254 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8255 /// but with all dynamically-allocated buffers duplicated in new buffers.
8256 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8257 #[repr(C)]
8258 /// The contents of CResult_InvoiceNoneZ
8259 pub union CResult_InvoiceNoneZPtr {
8260         /// A pointer to the contents in the success state.
8261         /// Reading from this pointer when `result_ok` is not set is undefined.
8262         pub result: *mut crate::lightning_invoice::Invoice,
8263         /// Note that this value is always NULL, as there are no contents in the Err variant
8264         pub err: *mut core::ffi::c_void,
8265 }
8266 #[repr(C)]
8267 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8268 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8270 pub struct CResult_InvoiceNoneZ {
8271         /// The contents of this CResult_InvoiceNoneZ, accessible via either
8272         /// `err` or `result` depending on the state of `result_ok`.
8273         pub contents: CResult_InvoiceNoneZPtr,
8274         /// Whether this CResult_InvoiceNoneZ represents a success state.
8275         pub result_ok: bool,
8276 }
8277 #[no_mangle]
8278 /// Creates a new CResult_InvoiceNoneZ in the success state.
8279 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8280         CResult_InvoiceNoneZ {
8281                 contents: CResult_InvoiceNoneZPtr {
8282                         result: Box::into_raw(Box::new(o)),
8283                 },
8284                 result_ok: true,
8285         }
8286 }
8287 #[no_mangle]
8288 /// Creates a new CResult_InvoiceNoneZ in the error state.
8289 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8290         CResult_InvoiceNoneZ {
8291                 contents: CResult_InvoiceNoneZPtr {
8292                         err: core::ptr::null_mut(),
8293                 },
8294                 result_ok: false,
8295         }
8296 }
8297 /// Checks if the given object is currently in the success state
8298 #[no_mangle]
8299 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8300         o.result_ok
8301 }
8302 #[no_mangle]
8303 /// Frees any resources used by the CResult_InvoiceNoneZ.
8304 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8305 impl Drop for CResult_InvoiceNoneZ {
8306         fn drop(&mut self) {
8307                 if self.result_ok {
8308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8310                         }
8311                 } else {
8312                 }
8313         }
8314 }
8315 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8316         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8317                 let contents = if o.result_ok {
8318                         let result = unsafe { o.contents.result };
8319                         unsafe { o.contents.result = core::ptr::null_mut() };
8320                         CResult_InvoiceNoneZPtr { result }
8321                 } else {
8322                         let _ = unsafe { Box::from_raw(o.contents.err) };
8323                         o.contents.err = core::ptr::null_mut();
8324                         CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8325                 };
8326                 Self {
8327                         contents,
8328                         result_ok: o.result_ok,
8329                 }
8330         }
8331 }
8332 impl Clone for CResult_InvoiceNoneZ {
8333         fn clone(&self) -> Self {
8334                 if self.result_ok {
8335                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8336                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8337                         } }
8338                 } else {
8339                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8340                                 err: core::ptr::null_mut()
8341                         } }
8342                 }
8343         }
8344 }
8345 #[no_mangle]
8346 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8347 /// but with all dynamically-allocated buffers duplicated in new buffers.
8348 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8349 #[repr(C)]
8350 /// The contents of CResult_SignedRawInvoiceNoneZ
8351 pub union CResult_SignedRawInvoiceNoneZPtr {
8352         /// A pointer to the contents in the success state.
8353         /// Reading from this pointer when `result_ok` is not set is undefined.
8354         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8355         /// Note that this value is always NULL, as there are no contents in the Err variant
8356         pub err: *mut core::ffi::c_void,
8357 }
8358 #[repr(C)]
8359 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8360 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8362 pub struct CResult_SignedRawInvoiceNoneZ {
8363         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8364         /// `err` or `result` depending on the state of `result_ok`.
8365         pub contents: CResult_SignedRawInvoiceNoneZPtr,
8366         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8367         pub result_ok: bool,
8368 }
8369 #[no_mangle]
8370 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8371 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8372         CResult_SignedRawInvoiceNoneZ {
8373                 contents: CResult_SignedRawInvoiceNoneZPtr {
8374                         result: Box::into_raw(Box::new(o)),
8375                 },
8376                 result_ok: true,
8377         }
8378 }
8379 #[no_mangle]
8380 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8381 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8382         CResult_SignedRawInvoiceNoneZ {
8383                 contents: CResult_SignedRawInvoiceNoneZPtr {
8384                         err: core::ptr::null_mut(),
8385                 },
8386                 result_ok: false,
8387         }
8388 }
8389 /// Checks if the given object is currently in the success state
8390 #[no_mangle]
8391 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8392         o.result_ok
8393 }
8394 #[no_mangle]
8395 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8396 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8397 impl Drop for CResult_SignedRawInvoiceNoneZ {
8398         fn drop(&mut self) {
8399                 if self.result_ok {
8400                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8401                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8402                         }
8403                 } else {
8404                 }
8405         }
8406 }
8407 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8408         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8409                 let contents = if o.result_ok {
8410                         let result = unsafe { o.contents.result };
8411                         unsafe { o.contents.result = core::ptr::null_mut() };
8412                         CResult_SignedRawInvoiceNoneZPtr { result }
8413                 } else {
8414                         let _ = unsafe { Box::from_raw(o.contents.err) };
8415                         o.contents.err = core::ptr::null_mut();
8416                         CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8417                 };
8418                 Self {
8419                         contents,
8420                         result_ok: o.result_ok,
8421                 }
8422         }
8423 }
8424 impl Clone for CResult_SignedRawInvoiceNoneZ {
8425         fn clone(&self) -> Self {
8426                 if self.result_ok {
8427                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8428                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8429                         } }
8430                 } else {
8431                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8432                                 err: core::ptr::null_mut()
8433                         } }
8434                 }
8435         }
8436 }
8437 #[no_mangle]
8438 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8439 /// but with all dynamically-allocated buffers duplicated in new buffers.
8440 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8441 #[repr(C)]
8442 /// A tuple of 3 elements. See the individual fields for the types contained.
8443 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8444         /// The element at position 0
8445         pub a: crate::lightning_invoice::RawInvoice,
8446         /// The element at position 1
8447         pub b: crate::c_types::ThirtyTwoBytes,
8448         /// The element at position 2
8449         pub c: crate::lightning_invoice::InvoiceSignature,
8450 }
8451 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8452         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8453                 Self {
8454                         a: tup.0,
8455                         b: tup.1,
8456                         c: tup.2,
8457                 }
8458         }
8459 }
8460 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8461         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8462                 (self.a, self.b, self.c)
8463         }
8464 }
8465 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8466         fn clone(&self) -> Self {
8467                 Self {
8468                         a: Clone::clone(&self.a),
8469                         b: Clone::clone(&self.b),
8470                         c: Clone::clone(&self.c),
8471                 }
8472         }
8473 }
8474 #[no_mangle]
8475 /// Creates a new tuple which has the same data as `orig`
8476 /// but with all dynamically-allocated buffers duplicated in new buffers.
8477 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8478 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8479 #[no_mangle]
8480 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 {
8481         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8482 }
8483
8484 #[no_mangle]
8485 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8486 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8487 #[repr(C)]
8488 /// The contents of CResult_PayeePubKeyErrorZ
8489 pub union CResult_PayeePubKeyErrorZPtr {
8490         /// A pointer to the contents in the success state.
8491         /// Reading from this pointer when `result_ok` is not set is undefined.
8492         pub result: *mut crate::lightning_invoice::PayeePubKey,
8493         /// A pointer to the contents in the error state.
8494         /// Reading from this pointer when `result_ok` is set is undefined.
8495         pub err: *mut crate::c_types::Secp256k1Error,
8496 }
8497 #[repr(C)]
8498 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8499 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8501 pub struct CResult_PayeePubKeyErrorZ {
8502         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8503         /// `err` or `result` depending on the state of `result_ok`.
8504         pub contents: CResult_PayeePubKeyErrorZPtr,
8505         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8506         pub result_ok: bool,
8507 }
8508 #[no_mangle]
8509 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8510 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8511         CResult_PayeePubKeyErrorZ {
8512                 contents: CResult_PayeePubKeyErrorZPtr {
8513                         result: Box::into_raw(Box::new(o)),
8514                 },
8515                 result_ok: true,
8516         }
8517 }
8518 #[no_mangle]
8519 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8520 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8521         CResult_PayeePubKeyErrorZ {
8522                 contents: CResult_PayeePubKeyErrorZPtr {
8523                         err: Box::into_raw(Box::new(e)),
8524                 },
8525                 result_ok: false,
8526         }
8527 }
8528 /// Checks if the given object is currently in the success state
8529 #[no_mangle]
8530 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8531         o.result_ok
8532 }
8533 #[no_mangle]
8534 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8535 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8536 impl Drop for CResult_PayeePubKeyErrorZ {
8537         fn drop(&mut self) {
8538                 if self.result_ok {
8539                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8540                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8541                         }
8542                 } else {
8543                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8544                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8545                         }
8546                 }
8547         }
8548 }
8549 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8550         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8551                 let contents = if o.result_ok {
8552                         let result = unsafe { o.contents.result };
8553                         unsafe { o.contents.result = core::ptr::null_mut() };
8554                         CResult_PayeePubKeyErrorZPtr { result }
8555                 } else {
8556                         let err = unsafe { o.contents.err };
8557                         unsafe { o.contents.err = core::ptr::null_mut(); }
8558                         CResult_PayeePubKeyErrorZPtr { err }
8559                 };
8560                 Self {
8561                         contents,
8562                         result_ok: o.result_ok,
8563                 }
8564         }
8565 }
8566 impl Clone for CResult_PayeePubKeyErrorZ {
8567         fn clone(&self) -> Self {
8568                 if self.result_ok {
8569                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8570                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8571                         } }
8572                 } else {
8573                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8574                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8575                         } }
8576                 }
8577         }
8578 }
8579 #[no_mangle]
8580 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8581 /// but with all dynamically-allocated buffers duplicated in new buffers.
8582 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8583 #[repr(C)]
8584 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8585 /// This corresponds to std::vector in C++
8586 pub struct CVec_PrivateRouteZ {
8587         /// The elements in the array.
8588         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8589         pub data: *mut crate::lightning_invoice::PrivateRoute,
8590         /// The number of elements pointed to by `data`.
8591         pub datalen: usize
8592 }
8593 impl CVec_PrivateRouteZ {
8594         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8595                 if self.datalen == 0 { return Vec::new(); }
8596                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8597                 self.data = core::ptr::null_mut();
8598                 self.datalen = 0;
8599                 ret
8600         }
8601         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8602                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8603         }
8604 }
8605 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8606         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8607                 let datalen = v.len();
8608                 let data = Box::into_raw(v.into_boxed_slice());
8609                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8610         }
8611 }
8612 #[no_mangle]
8613 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8614 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8615 impl Drop for CVec_PrivateRouteZ {
8616         fn drop(&mut self) {
8617                 if self.datalen == 0 { return; }
8618                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8619         }
8620 }
8621 impl Clone for CVec_PrivateRouteZ {
8622         fn clone(&self) -> Self {
8623                 let mut res = Vec::new();
8624                 if self.datalen == 0 { return Self::from(res); }
8625                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8626                 Self::from(res)
8627         }
8628 }
8629 #[repr(C)]
8630 /// The contents of CResult_PositiveTimestampCreationErrorZ
8631 pub union CResult_PositiveTimestampCreationErrorZPtr {
8632         /// A pointer to the contents in the success state.
8633         /// Reading from this pointer when `result_ok` is not set is undefined.
8634         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8635         /// A pointer to the contents in the error state.
8636         /// Reading from this pointer when `result_ok` is set is undefined.
8637         pub err: *mut crate::lightning_invoice::CreationError,
8638 }
8639 #[repr(C)]
8640 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8641 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8643 pub struct CResult_PositiveTimestampCreationErrorZ {
8644         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8645         /// `err` or `result` depending on the state of `result_ok`.
8646         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8647         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8648         pub result_ok: bool,
8649 }
8650 #[no_mangle]
8651 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8652 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8653         CResult_PositiveTimestampCreationErrorZ {
8654                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8655                         result: Box::into_raw(Box::new(o)),
8656                 },
8657                 result_ok: true,
8658         }
8659 }
8660 #[no_mangle]
8661 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8662 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8663         CResult_PositiveTimestampCreationErrorZ {
8664                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8665                         err: Box::into_raw(Box::new(e)),
8666                 },
8667                 result_ok: false,
8668         }
8669 }
8670 /// Checks if the given object is currently in the success state
8671 #[no_mangle]
8672 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8673         o.result_ok
8674 }
8675 #[no_mangle]
8676 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8677 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8678 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8679         fn drop(&mut self) {
8680                 if self.result_ok {
8681                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8682                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8683                         }
8684                 } else {
8685                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8686                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8687                         }
8688                 }
8689         }
8690 }
8691 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8692         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8693                 let contents = if o.result_ok {
8694                         let result = unsafe { o.contents.result };
8695                         unsafe { o.contents.result = core::ptr::null_mut() };
8696                         CResult_PositiveTimestampCreationErrorZPtr { result }
8697                 } else {
8698                         let err = unsafe { o.contents.err };
8699                         unsafe { o.contents.err = core::ptr::null_mut(); }
8700                         CResult_PositiveTimestampCreationErrorZPtr { err }
8701                 };
8702                 Self {
8703                         contents,
8704                         result_ok: o.result_ok,
8705                 }
8706         }
8707 }
8708 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8709         fn clone(&self) -> Self {
8710                 if self.result_ok {
8711                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8712                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8713                         } }
8714                 } else {
8715                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8716                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8717                         } }
8718                 }
8719         }
8720 }
8721 #[no_mangle]
8722 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8723 /// but with all dynamically-allocated buffers duplicated in new buffers.
8724 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8725 #[repr(C)]
8726 /// The contents of CResult_NoneSemanticErrorZ
8727 pub union CResult_NoneSemanticErrorZPtr {
8728         /// Note that this value is always NULL, as there are no contents in the OK variant
8729         pub result: *mut core::ffi::c_void,
8730         /// A pointer to the contents in the error state.
8731         /// Reading from this pointer when `result_ok` is set is undefined.
8732         pub err: *mut crate::lightning_invoice::SemanticError,
8733 }
8734 #[repr(C)]
8735 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8736 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8738 pub struct CResult_NoneSemanticErrorZ {
8739         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8740         /// `err` or `result` depending on the state of `result_ok`.
8741         pub contents: CResult_NoneSemanticErrorZPtr,
8742         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8743         pub result_ok: bool,
8744 }
8745 #[no_mangle]
8746 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8747 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8748         CResult_NoneSemanticErrorZ {
8749                 contents: CResult_NoneSemanticErrorZPtr {
8750                         result: core::ptr::null_mut(),
8751                 },
8752                 result_ok: true,
8753         }
8754 }
8755 #[no_mangle]
8756 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8757 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8758         CResult_NoneSemanticErrorZ {
8759                 contents: CResult_NoneSemanticErrorZPtr {
8760                         err: Box::into_raw(Box::new(e)),
8761                 },
8762                 result_ok: false,
8763         }
8764 }
8765 /// Checks if the given object is currently in the success state
8766 #[no_mangle]
8767 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8768         o.result_ok
8769 }
8770 #[no_mangle]
8771 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8772 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8773 impl Drop for CResult_NoneSemanticErrorZ {
8774         fn drop(&mut self) {
8775                 if self.result_ok {
8776                 } else {
8777                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8778                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8779                         }
8780                 }
8781         }
8782 }
8783 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8784         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8785                 let contents = if o.result_ok {
8786                         let _ = unsafe { Box::from_raw(o.contents.result) };
8787                         o.contents.result = core::ptr::null_mut();
8788                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8789                 } else {
8790                         let err = unsafe { o.contents.err };
8791                         unsafe { o.contents.err = core::ptr::null_mut(); }
8792                         CResult_NoneSemanticErrorZPtr { err }
8793                 };
8794                 Self {
8795                         contents,
8796                         result_ok: o.result_ok,
8797                 }
8798         }
8799 }
8800 impl Clone for CResult_NoneSemanticErrorZ {
8801         fn clone(&self) -> Self {
8802                 if self.result_ok {
8803                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8804                                 result: core::ptr::null_mut()
8805                         } }
8806                 } else {
8807                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8808                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8809                         } }
8810                 }
8811         }
8812 }
8813 #[no_mangle]
8814 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8815 /// but with all dynamically-allocated buffers duplicated in new buffers.
8816 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8817 #[repr(C)]
8818 /// The contents of CResult_InvoiceSemanticErrorZ
8819 pub union CResult_InvoiceSemanticErrorZPtr {
8820         /// A pointer to the contents in the success state.
8821         /// Reading from this pointer when `result_ok` is not set is undefined.
8822         pub result: *mut crate::lightning_invoice::Invoice,
8823         /// A pointer to the contents in the error state.
8824         /// Reading from this pointer when `result_ok` is set is undefined.
8825         pub err: *mut crate::lightning_invoice::SemanticError,
8826 }
8827 #[repr(C)]
8828 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8829 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8831 pub struct CResult_InvoiceSemanticErrorZ {
8832         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8833         /// `err` or `result` depending on the state of `result_ok`.
8834         pub contents: CResult_InvoiceSemanticErrorZPtr,
8835         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8836         pub result_ok: bool,
8837 }
8838 #[no_mangle]
8839 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8840 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8841         CResult_InvoiceSemanticErrorZ {
8842                 contents: CResult_InvoiceSemanticErrorZPtr {
8843                         result: Box::into_raw(Box::new(o)),
8844                 },
8845                 result_ok: true,
8846         }
8847 }
8848 #[no_mangle]
8849 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8850 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8851         CResult_InvoiceSemanticErrorZ {
8852                 contents: CResult_InvoiceSemanticErrorZPtr {
8853                         err: Box::into_raw(Box::new(e)),
8854                 },
8855                 result_ok: false,
8856         }
8857 }
8858 /// Checks if the given object is currently in the success state
8859 #[no_mangle]
8860 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8861         o.result_ok
8862 }
8863 #[no_mangle]
8864 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8865 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8866 impl Drop for CResult_InvoiceSemanticErrorZ {
8867         fn drop(&mut self) {
8868                 if self.result_ok {
8869                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8870                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8871                         }
8872                 } else {
8873                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8874                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8875                         }
8876                 }
8877         }
8878 }
8879 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8880         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8881                 let contents = if o.result_ok {
8882                         let result = unsafe { o.contents.result };
8883                         unsafe { o.contents.result = core::ptr::null_mut() };
8884                         CResult_InvoiceSemanticErrorZPtr { result }
8885                 } else {
8886                         let err = unsafe { o.contents.err };
8887                         unsafe { o.contents.err = core::ptr::null_mut(); }
8888                         CResult_InvoiceSemanticErrorZPtr { err }
8889                 };
8890                 Self {
8891                         contents,
8892                         result_ok: o.result_ok,
8893                 }
8894         }
8895 }
8896 impl Clone for CResult_InvoiceSemanticErrorZ {
8897         fn clone(&self) -> Self {
8898                 if self.result_ok {
8899                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8900                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8901                         } }
8902                 } else {
8903                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8904                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8905                         } }
8906                 }
8907         }
8908 }
8909 #[no_mangle]
8910 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8911 /// but with all dynamically-allocated buffers duplicated in new buffers.
8912 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8913 #[repr(C)]
8914 /// The contents of CResult_DescriptionCreationErrorZ
8915 pub union CResult_DescriptionCreationErrorZPtr {
8916         /// A pointer to the contents in the success state.
8917         /// Reading from this pointer when `result_ok` is not set is undefined.
8918         pub result: *mut crate::lightning_invoice::Description,
8919         /// A pointer to the contents in the error state.
8920         /// Reading from this pointer when `result_ok` is set is undefined.
8921         pub err: *mut crate::lightning_invoice::CreationError,
8922 }
8923 #[repr(C)]
8924 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8925 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8926 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8927 pub struct CResult_DescriptionCreationErrorZ {
8928         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8929         /// `err` or `result` depending on the state of `result_ok`.
8930         pub contents: CResult_DescriptionCreationErrorZPtr,
8931         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8932         pub result_ok: bool,
8933 }
8934 #[no_mangle]
8935 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8936 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8937         CResult_DescriptionCreationErrorZ {
8938                 contents: CResult_DescriptionCreationErrorZPtr {
8939                         result: Box::into_raw(Box::new(o)),
8940                 },
8941                 result_ok: true,
8942         }
8943 }
8944 #[no_mangle]
8945 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8946 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8947         CResult_DescriptionCreationErrorZ {
8948                 contents: CResult_DescriptionCreationErrorZPtr {
8949                         err: Box::into_raw(Box::new(e)),
8950                 },
8951                 result_ok: false,
8952         }
8953 }
8954 /// Checks if the given object is currently in the success state
8955 #[no_mangle]
8956 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8957         o.result_ok
8958 }
8959 #[no_mangle]
8960 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8961 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8962 impl Drop for CResult_DescriptionCreationErrorZ {
8963         fn drop(&mut self) {
8964                 if self.result_ok {
8965                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8966                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8967                         }
8968                 } else {
8969                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8970                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8971                         }
8972                 }
8973         }
8974 }
8975 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8976         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8977                 let contents = if o.result_ok {
8978                         let result = unsafe { o.contents.result };
8979                         unsafe { o.contents.result = core::ptr::null_mut() };
8980                         CResult_DescriptionCreationErrorZPtr { result }
8981                 } else {
8982                         let err = unsafe { o.contents.err };
8983                         unsafe { o.contents.err = core::ptr::null_mut(); }
8984                         CResult_DescriptionCreationErrorZPtr { err }
8985                 };
8986                 Self {
8987                         contents,
8988                         result_ok: o.result_ok,
8989                 }
8990         }
8991 }
8992 impl Clone for CResult_DescriptionCreationErrorZ {
8993         fn clone(&self) -> Self {
8994                 if self.result_ok {
8995                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8996                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8997                         } }
8998                 } else {
8999                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
9000                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9001                         } }
9002                 }
9003         }
9004 }
9005 #[no_mangle]
9006 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9007 /// but with all dynamically-allocated buffers duplicated in new buffers.
9008 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
9009 #[repr(C)]
9010 /// The contents of CResult_PrivateRouteCreationErrorZ
9011 pub union CResult_PrivateRouteCreationErrorZPtr {
9012         /// A pointer to the contents in the success state.
9013         /// Reading from this pointer when `result_ok` is not set is undefined.
9014         pub result: *mut crate::lightning_invoice::PrivateRoute,
9015         /// A pointer to the contents in the error state.
9016         /// Reading from this pointer when `result_ok` is set is undefined.
9017         pub err: *mut crate::lightning_invoice::CreationError,
9018 }
9019 #[repr(C)]
9020 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
9021 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
9022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9023 pub struct CResult_PrivateRouteCreationErrorZ {
9024         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
9025         /// `err` or `result` depending on the state of `result_ok`.
9026         pub contents: CResult_PrivateRouteCreationErrorZPtr,
9027         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
9028         pub result_ok: bool,
9029 }
9030 #[no_mangle]
9031 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
9032 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
9033         CResult_PrivateRouteCreationErrorZ {
9034                 contents: CResult_PrivateRouteCreationErrorZPtr {
9035                         result: Box::into_raw(Box::new(o)),
9036                 },
9037                 result_ok: true,
9038         }
9039 }
9040 #[no_mangle]
9041 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
9042 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
9043         CResult_PrivateRouteCreationErrorZ {
9044                 contents: CResult_PrivateRouteCreationErrorZPtr {
9045                         err: Box::into_raw(Box::new(e)),
9046                 },
9047                 result_ok: false,
9048         }
9049 }
9050 /// Checks if the given object is currently in the success state
9051 #[no_mangle]
9052 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
9053         o.result_ok
9054 }
9055 #[no_mangle]
9056 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
9057 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
9058 impl Drop for CResult_PrivateRouteCreationErrorZ {
9059         fn drop(&mut self) {
9060                 if self.result_ok {
9061                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9062                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9063                         }
9064                 } else {
9065                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9066                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9067                         }
9068                 }
9069         }
9070 }
9071 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9072         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9073                 let contents = if o.result_ok {
9074                         let result = unsafe { o.contents.result };
9075                         unsafe { o.contents.result = core::ptr::null_mut() };
9076                         CResult_PrivateRouteCreationErrorZPtr { result }
9077                 } else {
9078                         let err = unsafe { o.contents.err };
9079                         unsafe { o.contents.err = core::ptr::null_mut(); }
9080                         CResult_PrivateRouteCreationErrorZPtr { err }
9081                 };
9082                 Self {
9083                         contents,
9084                         result_ok: o.result_ok,
9085                 }
9086         }
9087 }
9088 impl Clone for CResult_PrivateRouteCreationErrorZ {
9089         fn clone(&self) -> Self {
9090                 if self.result_ok {
9091                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9092                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9093                         } }
9094                 } else {
9095                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9096                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9097                         } }
9098                 }
9099         }
9100 }
9101 #[no_mangle]
9102 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9103 /// but with all dynamically-allocated buffers duplicated in new buffers.
9104 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9105 #[repr(C)]
9106 /// The contents of CResult_StringErrorZ
9107 pub union CResult_StringErrorZPtr {
9108         /// A pointer to the contents in the success state.
9109         /// Reading from this pointer when `result_ok` is not set is undefined.
9110         pub result: *mut crate::c_types::Str,
9111         /// A pointer to the contents in the error state.
9112         /// Reading from this pointer when `result_ok` is set is undefined.
9113         pub err: *mut crate::c_types::Secp256k1Error,
9114 }
9115 #[repr(C)]
9116 /// A CResult_StringErrorZ represents the result of a fallible operation,
9117 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9119 pub struct CResult_StringErrorZ {
9120         /// The contents of this CResult_StringErrorZ, accessible via either
9121         /// `err` or `result` depending on the state of `result_ok`.
9122         pub contents: CResult_StringErrorZPtr,
9123         /// Whether this CResult_StringErrorZ represents a success state.
9124         pub result_ok: bool,
9125 }
9126 #[no_mangle]
9127 /// Creates a new CResult_StringErrorZ in the success state.
9128 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9129         CResult_StringErrorZ {
9130                 contents: CResult_StringErrorZPtr {
9131                         result: Box::into_raw(Box::new(o)),
9132                 },
9133                 result_ok: true,
9134         }
9135 }
9136 #[no_mangle]
9137 /// Creates a new CResult_StringErrorZ in the error state.
9138 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9139         CResult_StringErrorZ {
9140                 contents: CResult_StringErrorZPtr {
9141                         err: Box::into_raw(Box::new(e)),
9142                 },
9143                 result_ok: false,
9144         }
9145 }
9146 /// Checks if the given object is currently in the success state
9147 #[no_mangle]
9148 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9149         o.result_ok
9150 }
9151 #[no_mangle]
9152 /// Frees any resources used by the CResult_StringErrorZ.
9153 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9154 impl Drop for CResult_StringErrorZ {
9155         fn drop(&mut self) {
9156                 if self.result_ok {
9157                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9158                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9159                         }
9160                 } else {
9161                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9162                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9163                         }
9164                 }
9165         }
9166 }
9167 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9168         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9169                 let contents = if o.result_ok {
9170                         let result = unsafe { o.contents.result };
9171                         unsafe { o.contents.result = core::ptr::null_mut() };
9172                         CResult_StringErrorZPtr { result }
9173                 } else {
9174                         let err = unsafe { o.contents.err };
9175                         unsafe { o.contents.err = core::ptr::null_mut(); }
9176                         CResult_StringErrorZPtr { err }
9177                 };
9178                 Self {
9179                         contents,
9180                         result_ok: o.result_ok,
9181                 }
9182         }
9183 }
9184 #[repr(C)]
9185 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9186 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9187         /// A pointer to the contents in the success state.
9188         /// Reading from this pointer when `result_ok` is not set is undefined.
9189         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9190         /// A pointer to the contents in the error state.
9191         /// Reading from this pointer when `result_ok` is set is undefined.
9192         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9193 }
9194 #[repr(C)]
9195 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9196 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9198 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9199         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9200         /// `err` or `result` depending on the state of `result_ok`.
9201         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9202         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9203         pub result_ok: bool,
9204 }
9205 #[no_mangle]
9206 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9207 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9208         CResult_ChannelMonitorUpdateDecodeErrorZ {
9209                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9210                         result: Box::into_raw(Box::new(o)),
9211                 },
9212                 result_ok: true,
9213         }
9214 }
9215 #[no_mangle]
9216 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9217 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9218         CResult_ChannelMonitorUpdateDecodeErrorZ {
9219                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9220                         err: Box::into_raw(Box::new(e)),
9221                 },
9222                 result_ok: false,
9223         }
9224 }
9225 /// Checks if the given object is currently in the success state
9226 #[no_mangle]
9227 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9228         o.result_ok
9229 }
9230 #[no_mangle]
9231 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9232 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9233 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9234         fn drop(&mut self) {
9235                 if self.result_ok {
9236                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9237                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9238                         }
9239                 } else {
9240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9242                         }
9243                 }
9244         }
9245 }
9246 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9247         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9248                 let contents = if o.result_ok {
9249                         let result = unsafe { o.contents.result };
9250                         unsafe { o.contents.result = core::ptr::null_mut() };
9251                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9252                 } else {
9253                         let err = unsafe { o.contents.err };
9254                         unsafe { o.contents.err = core::ptr::null_mut(); }
9255                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9256                 };
9257                 Self {
9258                         contents,
9259                         result_ok: o.result_ok,
9260                 }
9261         }
9262 }
9263 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9264         fn clone(&self) -> Self {
9265                 if self.result_ok {
9266                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9267                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9268                         } }
9269                 } else {
9270                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9271                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9272                         } }
9273                 }
9274         }
9275 }
9276 #[no_mangle]
9277 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9278 /// but with all dynamically-allocated buffers duplicated in new buffers.
9279 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9280 #[repr(C)]
9281 #[derive(Clone)]
9282 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9283 pub enum COption_MonitorEventZ {
9284         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9285         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9286         /// When we're in this state, this COption_MonitorEventZ contains nothing
9287         None
9288 }
9289 impl COption_MonitorEventZ {
9290         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9291                 if let Self::None = self { false } else { true }
9292         }
9293         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9294                 !self.is_some()
9295         }
9296         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9297                 if let Self::Some(v) = self { v } else { unreachable!() }
9298         }
9299 }
9300 #[no_mangle]
9301 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9302 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9303         COption_MonitorEventZ::Some(o)
9304 }
9305 #[no_mangle]
9306 /// Constructs a new COption_MonitorEventZ containing nothing
9307 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9308         COption_MonitorEventZ::None
9309 }
9310 #[no_mangle]
9311 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9312 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9313 #[no_mangle]
9314 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9315 /// but with all dynamically-allocated buffers duplicated in new buffers.
9316 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9317 #[repr(C)]
9318 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9319 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9320         /// A pointer to the contents in the success state.
9321         /// Reading from this pointer when `result_ok` is not set is undefined.
9322         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9323         /// A pointer to the contents in the error state.
9324         /// Reading from this pointer when `result_ok` is set is undefined.
9325         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9326 }
9327 #[repr(C)]
9328 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9329 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9331 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9332         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9333         /// `err` or `result` depending on the state of `result_ok`.
9334         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9335         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9336         pub result_ok: bool,
9337 }
9338 #[no_mangle]
9339 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9340 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9341         CResult_COption_MonitorEventZDecodeErrorZ {
9342                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9343                         result: Box::into_raw(Box::new(o)),
9344                 },
9345                 result_ok: true,
9346         }
9347 }
9348 #[no_mangle]
9349 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9350 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9351         CResult_COption_MonitorEventZDecodeErrorZ {
9352                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9353                         err: Box::into_raw(Box::new(e)),
9354                 },
9355                 result_ok: false,
9356         }
9357 }
9358 /// Checks if the given object is currently in the success state
9359 #[no_mangle]
9360 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9361         o.result_ok
9362 }
9363 #[no_mangle]
9364 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9365 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9366 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9367         fn drop(&mut self) {
9368                 if self.result_ok {
9369                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9370                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9371                         }
9372                 } else {
9373                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9374                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9375                         }
9376                 }
9377         }
9378 }
9379 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9380         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9381                 let contents = if o.result_ok {
9382                         let result = unsafe { o.contents.result };
9383                         unsafe { o.contents.result = core::ptr::null_mut() };
9384                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9385                 } else {
9386                         let err = unsafe { o.contents.err };
9387                         unsafe { o.contents.err = core::ptr::null_mut(); }
9388                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9389                 };
9390                 Self {
9391                         contents,
9392                         result_ok: o.result_ok,
9393                 }
9394         }
9395 }
9396 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9397         fn clone(&self) -> Self {
9398                 if self.result_ok {
9399                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9400                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9401                         } }
9402                 } else {
9403                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9404                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9405                         } }
9406                 }
9407         }
9408 }
9409 #[no_mangle]
9410 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9411 /// but with all dynamically-allocated buffers duplicated in new buffers.
9412 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9413 #[repr(C)]
9414 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9415 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9416         /// A pointer to the contents in the success state.
9417         /// Reading from this pointer when `result_ok` is not set is undefined.
9418         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9419         /// A pointer to the contents in the error state.
9420         /// Reading from this pointer when `result_ok` is set is undefined.
9421         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9422 }
9423 #[repr(C)]
9424 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9425 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9426 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9427 pub struct CResult_HTLCUpdateDecodeErrorZ {
9428         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9429         /// `err` or `result` depending on the state of `result_ok`.
9430         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9431         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9432         pub result_ok: bool,
9433 }
9434 #[no_mangle]
9435 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9436 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9437         CResult_HTLCUpdateDecodeErrorZ {
9438                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9439                         result: Box::into_raw(Box::new(o)),
9440                 },
9441                 result_ok: true,
9442         }
9443 }
9444 #[no_mangle]
9445 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9446 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9447         CResult_HTLCUpdateDecodeErrorZ {
9448                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9449                         err: Box::into_raw(Box::new(e)),
9450                 },
9451                 result_ok: false,
9452         }
9453 }
9454 /// Checks if the given object is currently in the success state
9455 #[no_mangle]
9456 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9457         o.result_ok
9458 }
9459 #[no_mangle]
9460 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9461 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9462 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9463         fn drop(&mut self) {
9464                 if self.result_ok {
9465                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9466                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9467                         }
9468                 } else {
9469                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9470                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9471                         }
9472                 }
9473         }
9474 }
9475 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9476         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9477                 let contents = if o.result_ok {
9478                         let result = unsafe { o.contents.result };
9479                         unsafe { o.contents.result = core::ptr::null_mut() };
9480                         CResult_HTLCUpdateDecodeErrorZPtr { result }
9481                 } else {
9482                         let err = unsafe { o.contents.err };
9483                         unsafe { o.contents.err = core::ptr::null_mut(); }
9484                         CResult_HTLCUpdateDecodeErrorZPtr { err }
9485                 };
9486                 Self {
9487                         contents,
9488                         result_ok: o.result_ok,
9489                 }
9490         }
9491 }
9492 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9493         fn clone(&self) -> Self {
9494                 if self.result_ok {
9495                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9496                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9497                         } }
9498                 } else {
9499                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9500                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9501                         } }
9502                 }
9503         }
9504 }
9505 #[no_mangle]
9506 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9507 /// but with all dynamically-allocated buffers duplicated in new buffers.
9508 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9509 #[repr(C)]
9510 /// A tuple of 2 elements. See the individual fields for the types contained.
9511 pub struct C2Tuple_OutPointScriptZ {
9512         /// The element at position 0
9513         pub a: crate::lightning::chain::transaction::OutPoint,
9514         /// The element at position 1
9515         pub b: crate::c_types::derived::CVec_u8Z,
9516 }
9517 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9518         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9519                 Self {
9520                         a: tup.0,
9521                         b: tup.1,
9522                 }
9523         }
9524 }
9525 impl C2Tuple_OutPointScriptZ {
9526         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9527                 (self.a, self.b)
9528         }
9529 }
9530 impl Clone for C2Tuple_OutPointScriptZ {
9531         fn clone(&self) -> Self {
9532                 Self {
9533                         a: Clone::clone(&self.a),
9534                         b: Clone::clone(&self.b),
9535                 }
9536         }
9537 }
9538 #[no_mangle]
9539 /// Creates a new tuple which has the same data as `orig`
9540 /// but with all dynamically-allocated buffers duplicated in new buffers.
9541 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9542 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9543 #[no_mangle]
9544 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9545         C2Tuple_OutPointScriptZ { a, b, }
9546 }
9547
9548 #[no_mangle]
9549 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9550 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9551 #[repr(C)]
9552 /// A tuple of 2 elements. See the individual fields for the types contained.
9553 pub struct C2Tuple_u32ScriptZ {
9554         /// The element at position 0
9555         pub a: u32,
9556         /// The element at position 1
9557         pub b: crate::c_types::derived::CVec_u8Z,
9558 }
9559 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9560         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9561                 Self {
9562                         a: tup.0,
9563                         b: tup.1,
9564                 }
9565         }
9566 }
9567 impl C2Tuple_u32ScriptZ {
9568         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9569                 (self.a, self.b)
9570         }
9571 }
9572 impl Clone for C2Tuple_u32ScriptZ {
9573         fn clone(&self) -> Self {
9574                 Self {
9575                         a: Clone::clone(&self.a),
9576                         b: Clone::clone(&self.b),
9577                 }
9578         }
9579 }
9580 #[no_mangle]
9581 /// Creates a new tuple which has the same data as `orig`
9582 /// but with all dynamically-allocated buffers duplicated in new buffers.
9583 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9584 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9585 #[no_mangle]
9586 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9587         C2Tuple_u32ScriptZ { a, b, }
9588 }
9589
9590 #[no_mangle]
9591 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9592 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9593 #[repr(C)]
9594 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9595 /// This corresponds to std::vector in C++
9596 pub struct CVec_C2Tuple_u32ScriptZZ {
9597         /// The elements in the array.
9598         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9599         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9600         /// The number of elements pointed to by `data`.
9601         pub datalen: usize
9602 }
9603 impl CVec_C2Tuple_u32ScriptZZ {
9604         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9605                 if self.datalen == 0 { return Vec::new(); }
9606                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9607                 self.data = core::ptr::null_mut();
9608                 self.datalen = 0;
9609                 ret
9610         }
9611         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9612                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9613         }
9614 }
9615 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9616         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9617                 let datalen = v.len();
9618                 let data = Box::into_raw(v.into_boxed_slice());
9619                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9620         }
9621 }
9622 #[no_mangle]
9623 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9624 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9625 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9626         fn drop(&mut self) {
9627                 if self.datalen == 0 { return; }
9628                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9629         }
9630 }
9631 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9632         fn clone(&self) -> Self {
9633                 let mut res = Vec::new();
9634                 if self.datalen == 0 { return Self::from(res); }
9635                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9636                 Self::from(res)
9637         }
9638 }
9639 #[repr(C)]
9640 /// A tuple of 2 elements. See the individual fields for the types contained.
9641 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9642         /// The element at position 0
9643         pub a: crate::c_types::ThirtyTwoBytes,
9644         /// The element at position 1
9645         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9646 }
9647 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9648         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9649                 Self {
9650                         a: tup.0,
9651                         b: tup.1,
9652                 }
9653         }
9654 }
9655 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9656         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9657                 (self.a, self.b)
9658         }
9659 }
9660 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9661         fn clone(&self) -> Self {
9662                 Self {
9663                         a: Clone::clone(&self.a),
9664                         b: Clone::clone(&self.b),
9665                 }
9666         }
9667 }
9668 #[no_mangle]
9669 /// Creates a new tuple which has the same data as `orig`
9670 /// but with all dynamically-allocated buffers duplicated in new buffers.
9671 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9672 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9673 #[no_mangle]
9674 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 {
9675         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9676 }
9677
9678 #[no_mangle]
9679 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9680 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9681 #[repr(C)]
9682 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9683 /// This corresponds to std::vector in C++
9684 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9685         /// The elements in the array.
9686         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9687         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9688         /// The number of elements pointed to by `data`.
9689         pub datalen: usize
9690 }
9691 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9692         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9693                 if self.datalen == 0 { return Vec::new(); }
9694                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9695                 self.data = core::ptr::null_mut();
9696                 self.datalen = 0;
9697                 ret
9698         }
9699         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9700                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9701         }
9702 }
9703 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9704         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9705                 let datalen = v.len();
9706                 let data = Box::into_raw(v.into_boxed_slice());
9707                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9708         }
9709 }
9710 #[no_mangle]
9711 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9712 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9713 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9714         fn drop(&mut self) {
9715                 if self.datalen == 0 { return; }
9716                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9717         }
9718 }
9719 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9720         fn clone(&self) -> Self {
9721                 let mut res = Vec::new();
9722                 if self.datalen == 0 { return Self::from(res); }
9723                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9724                 Self::from(res)
9725         }
9726 }
9727 #[repr(C)]
9728 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9729 /// This corresponds to std::vector in C++
9730 pub struct CVec_EventZ {
9731         /// The elements in the array.
9732         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9733         pub data: *mut crate::lightning::util::events::Event,
9734         /// The number of elements pointed to by `data`.
9735         pub datalen: usize
9736 }
9737 impl CVec_EventZ {
9738         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9739                 if self.datalen == 0 { return Vec::new(); }
9740                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9741                 self.data = core::ptr::null_mut();
9742                 self.datalen = 0;
9743                 ret
9744         }
9745         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9746                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9747         }
9748 }
9749 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9750         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9751                 let datalen = v.len();
9752                 let data = Box::into_raw(v.into_boxed_slice());
9753                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9754         }
9755 }
9756 #[no_mangle]
9757 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9758 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9759 impl Drop for CVec_EventZ {
9760         fn drop(&mut self) {
9761                 if self.datalen == 0 { return; }
9762                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9763         }
9764 }
9765 impl Clone for CVec_EventZ {
9766         fn clone(&self) -> Self {
9767                 let mut res = Vec::new();
9768                 if self.datalen == 0 { return Self::from(res); }
9769                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9770                 Self::from(res)
9771         }
9772 }
9773 #[repr(C)]
9774 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9775 /// This corresponds to std::vector in C++
9776 pub struct CVec_TransactionZ {
9777         /// The elements in the array.
9778         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9779         pub data: *mut crate::c_types::Transaction,
9780         /// The number of elements pointed to by `data`.
9781         pub datalen: usize
9782 }
9783 impl CVec_TransactionZ {
9784         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9785                 if self.datalen == 0 { return Vec::new(); }
9786                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9787                 self.data = core::ptr::null_mut();
9788                 self.datalen = 0;
9789                 ret
9790         }
9791         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9792                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9793         }
9794 }
9795 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9796         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9797                 let datalen = v.len();
9798                 let data = Box::into_raw(v.into_boxed_slice());
9799                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9800         }
9801 }
9802 #[no_mangle]
9803 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9804 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9805 impl Drop for CVec_TransactionZ {
9806         fn drop(&mut self) {
9807                 if self.datalen == 0 { return; }
9808                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9809         }
9810 }
9811 impl Clone for CVec_TransactionZ {
9812         fn clone(&self) -> Self {
9813                 let mut res = Vec::new();
9814                 if self.datalen == 0 { return Self::from(res); }
9815                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9816                 Self::from(res)
9817         }
9818 }
9819 #[repr(C)]
9820 /// A tuple of 2 elements. See the individual fields for the types contained.
9821 pub struct C2Tuple_u32TxOutZ {
9822         /// The element at position 0
9823         pub a: u32,
9824         /// The element at position 1
9825         pub b: crate::c_types::TxOut,
9826 }
9827 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9828         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9829                 Self {
9830                         a: tup.0,
9831                         b: tup.1,
9832                 }
9833         }
9834 }
9835 impl C2Tuple_u32TxOutZ {
9836         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9837                 (self.a, self.b)
9838         }
9839 }
9840 impl Clone for C2Tuple_u32TxOutZ {
9841         fn clone(&self) -> Self {
9842                 Self {
9843                         a: Clone::clone(&self.a),
9844                         b: Clone::clone(&self.b),
9845                 }
9846         }
9847 }
9848 #[no_mangle]
9849 /// Creates a new tuple which has the same data as `orig`
9850 /// but with all dynamically-allocated buffers duplicated in new buffers.
9851 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9852 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9853 #[no_mangle]
9854 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9855         C2Tuple_u32TxOutZ { a, b, }
9856 }
9857
9858 #[no_mangle]
9859 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9860 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9861 #[repr(C)]
9862 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9863 /// This corresponds to std::vector in C++
9864 pub struct CVec_C2Tuple_u32TxOutZZ {
9865         /// The elements in the array.
9866         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9867         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9868         /// The number of elements pointed to by `data`.
9869         pub datalen: usize
9870 }
9871 impl CVec_C2Tuple_u32TxOutZZ {
9872         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9873                 if self.datalen == 0 { return Vec::new(); }
9874                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9875                 self.data = core::ptr::null_mut();
9876                 self.datalen = 0;
9877                 ret
9878         }
9879         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9880                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9881         }
9882 }
9883 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9884         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9885                 let datalen = v.len();
9886                 let data = Box::into_raw(v.into_boxed_slice());
9887                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9888         }
9889 }
9890 #[no_mangle]
9891 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9892 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9893 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9894         fn drop(&mut self) {
9895                 if self.datalen == 0 { return; }
9896                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9897         }
9898 }
9899 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9900         fn clone(&self) -> Self {
9901                 let mut res = Vec::new();
9902                 if self.datalen == 0 { return Self::from(res); }
9903                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9904                 Self::from(res)
9905         }
9906 }
9907 #[repr(C)]
9908 /// A tuple of 2 elements. See the individual fields for the types contained.
9909 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9910         /// The element at position 0
9911         pub a: crate::c_types::ThirtyTwoBytes,
9912         /// The element at position 1
9913         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9914 }
9915 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9916         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9917                 Self {
9918                         a: tup.0,
9919                         b: tup.1,
9920                 }
9921         }
9922 }
9923 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9924         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9925                 (self.a, self.b)
9926         }
9927 }
9928 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9929         fn clone(&self) -> Self {
9930                 Self {
9931                         a: Clone::clone(&self.a),
9932                         b: Clone::clone(&self.b),
9933                 }
9934         }
9935 }
9936 #[no_mangle]
9937 /// Creates a new tuple which has the same data as `orig`
9938 /// but with all dynamically-allocated buffers duplicated in new buffers.
9939 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9940 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9941 #[no_mangle]
9942 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 {
9943         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9944 }
9945
9946 #[no_mangle]
9947 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9948 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9949 #[repr(C)]
9950 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9951 /// This corresponds to std::vector in C++
9952 pub struct CVec_TransactionOutputsZ {
9953         /// The elements in the array.
9954         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9955         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9956         /// The number of elements pointed to by `data`.
9957         pub datalen: usize
9958 }
9959 impl CVec_TransactionOutputsZ {
9960         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9961                 if self.datalen == 0 { return Vec::new(); }
9962                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9963                 self.data = core::ptr::null_mut();
9964                 self.datalen = 0;
9965                 ret
9966         }
9967         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9968                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9969         }
9970 }
9971 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9972         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9973                 let datalen = v.len();
9974                 let data = Box::into_raw(v.into_boxed_slice());
9975                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9976         }
9977 }
9978 #[no_mangle]
9979 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9980 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9981 impl Drop for CVec_TransactionOutputsZ {
9982         fn drop(&mut self) {
9983                 if self.datalen == 0 { return; }
9984                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9985         }
9986 }
9987 impl Clone for CVec_TransactionOutputsZ {
9988         fn clone(&self) -> Self {
9989                 let mut res = Vec::new();
9990                 if self.datalen == 0 { return Self::from(res); }
9991                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9992                 Self::from(res)
9993         }
9994 }
9995 #[repr(C)]
9996 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9997 /// This corresponds to std::vector in C++
9998 pub struct CVec_BalanceZ {
9999         /// The elements in the array.
10000         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10001         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
10002         /// The number of elements pointed to by `data`.
10003         pub datalen: usize
10004 }
10005 impl CVec_BalanceZ {
10006         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
10007                 if self.datalen == 0 { return Vec::new(); }
10008                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10009                 self.data = core::ptr::null_mut();
10010                 self.datalen = 0;
10011                 ret
10012         }
10013         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
10014                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10015         }
10016 }
10017 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
10018         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
10019                 let datalen = v.len();
10020                 let data = Box::into_raw(v.into_boxed_slice());
10021                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10022         }
10023 }
10024 #[no_mangle]
10025 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10026 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
10027 impl Drop for CVec_BalanceZ {
10028         fn drop(&mut self) {
10029                 if self.datalen == 0 { return; }
10030                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10031         }
10032 }
10033 impl Clone for CVec_BalanceZ {
10034         fn clone(&self) -> Self {
10035                 let mut res = Vec::new();
10036                 if self.datalen == 0 { return Self::from(res); }
10037                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10038                 Self::from(res)
10039         }
10040 }
10041 #[repr(C)]
10042 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10043 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10044         /// A pointer to the contents in the success state.
10045         /// Reading from this pointer when `result_ok` is not set is undefined.
10046         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10047         /// A pointer to the contents in the error state.
10048         /// Reading from this pointer when `result_ok` is set is undefined.
10049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10050 }
10051 #[repr(C)]
10052 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10053 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10055 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10056         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10057         /// `err` or `result` depending on the state of `result_ok`.
10058         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10059         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10060         pub result_ok: bool,
10061 }
10062 #[no_mangle]
10063 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10064 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10065         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10066                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10067                         result: Box::into_raw(Box::new(o)),
10068                 },
10069                 result_ok: true,
10070         }
10071 }
10072 #[no_mangle]
10073 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10074 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10075         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10076                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10077                         err: Box::into_raw(Box::new(e)),
10078                 },
10079                 result_ok: false,
10080         }
10081 }
10082 /// Checks if the given object is currently in the success state
10083 #[no_mangle]
10084 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10085         o.result_ok
10086 }
10087 #[no_mangle]
10088 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10089 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10090 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10091         fn drop(&mut self) {
10092                 if self.result_ok {
10093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10095                         }
10096                 } else {
10097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10099                         }
10100                 }
10101         }
10102 }
10103 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10104         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10105                 let contents = if o.result_ok {
10106                         let result = unsafe { o.contents.result };
10107                         unsafe { o.contents.result = core::ptr::null_mut() };
10108                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10109                 } else {
10110                         let err = unsafe { o.contents.err };
10111                         unsafe { o.contents.err = core::ptr::null_mut(); }
10112                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10113                 };
10114                 Self {
10115                         contents,
10116                         result_ok: o.result_ok,
10117                 }
10118         }
10119 }
10120 #[repr(C)]
10121 /// The contents of CResult_NoneLightningErrorZ
10122 pub union CResult_NoneLightningErrorZPtr {
10123         /// Note that this value is always NULL, as there are no contents in the OK variant
10124         pub result: *mut core::ffi::c_void,
10125         /// A pointer to the contents in the error state.
10126         /// Reading from this pointer when `result_ok` is set is undefined.
10127         pub err: *mut crate::lightning::ln::msgs::LightningError,
10128 }
10129 #[repr(C)]
10130 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10131 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10133 pub struct CResult_NoneLightningErrorZ {
10134         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10135         /// `err` or `result` depending on the state of `result_ok`.
10136         pub contents: CResult_NoneLightningErrorZPtr,
10137         /// Whether this CResult_NoneLightningErrorZ represents a success state.
10138         pub result_ok: bool,
10139 }
10140 #[no_mangle]
10141 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10142 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10143         CResult_NoneLightningErrorZ {
10144                 contents: CResult_NoneLightningErrorZPtr {
10145                         result: core::ptr::null_mut(),
10146                 },
10147                 result_ok: true,
10148         }
10149 }
10150 #[no_mangle]
10151 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10152 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10153         CResult_NoneLightningErrorZ {
10154                 contents: CResult_NoneLightningErrorZPtr {
10155                         err: Box::into_raw(Box::new(e)),
10156                 },
10157                 result_ok: false,
10158         }
10159 }
10160 /// Checks if the given object is currently in the success state
10161 #[no_mangle]
10162 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10163         o.result_ok
10164 }
10165 #[no_mangle]
10166 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10167 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10168 impl Drop for CResult_NoneLightningErrorZ {
10169         fn drop(&mut self) {
10170                 if self.result_ok {
10171                 } else {
10172                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10173                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10174                         }
10175                 }
10176         }
10177 }
10178 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10179         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10180                 let contents = if o.result_ok {
10181                         let _ = unsafe { Box::from_raw(o.contents.result) };
10182                         o.contents.result = core::ptr::null_mut();
10183                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10184                 } else {
10185                         let err = unsafe { o.contents.err };
10186                         unsafe { o.contents.err = core::ptr::null_mut(); }
10187                         CResult_NoneLightningErrorZPtr { err }
10188                 };
10189                 Self {
10190                         contents,
10191                         result_ok: o.result_ok,
10192                 }
10193         }
10194 }
10195 impl Clone for CResult_NoneLightningErrorZ {
10196         fn clone(&self) -> Self {
10197                 if self.result_ok {
10198                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10199                                 result: core::ptr::null_mut()
10200                         } }
10201                 } else {
10202                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10203                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10204                         } }
10205                 }
10206         }
10207 }
10208 #[no_mangle]
10209 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10210 /// but with all dynamically-allocated buffers duplicated in new buffers.
10211 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10212 #[repr(C)]
10213 /// A tuple of 2 elements. See the individual fields for the types contained.
10214 pub struct C2Tuple_PublicKeyTypeZ {
10215         /// The element at position 0
10216         pub a: crate::c_types::PublicKey,
10217         /// The element at position 1
10218         pub b: crate::lightning::ln::wire::Type,
10219 }
10220 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10221         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10222                 Self {
10223                         a: tup.0,
10224                         b: tup.1,
10225                 }
10226         }
10227 }
10228 impl C2Tuple_PublicKeyTypeZ {
10229         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10230                 (self.a, self.b)
10231         }
10232 }
10233 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10234 #[no_mangle]
10235 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10236         C2Tuple_PublicKeyTypeZ { a, b, }
10237 }
10238
10239 #[no_mangle]
10240 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10241 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10242 #[repr(C)]
10243 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10244 /// This corresponds to std::vector in C++
10245 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10246         /// The elements in the array.
10247         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10248         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10249         /// The number of elements pointed to by `data`.
10250         pub datalen: usize
10251 }
10252 impl CVec_C2Tuple_PublicKeyTypeZZ {
10253         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10254                 if self.datalen == 0 { return Vec::new(); }
10255                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10256                 self.data = core::ptr::null_mut();
10257                 self.datalen = 0;
10258                 ret
10259         }
10260         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10261                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10262         }
10263 }
10264 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10265         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10266                 let datalen = v.len();
10267                 let data = Box::into_raw(v.into_boxed_slice());
10268                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10269         }
10270 }
10271 #[no_mangle]
10272 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10273 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10274 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10275         fn drop(&mut self) {
10276                 if self.datalen == 0 { return; }
10277                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10278         }
10279 }
10280 #[repr(C)]
10281 /// The contents of CResult_boolLightningErrorZ
10282 pub union CResult_boolLightningErrorZPtr {
10283         /// A pointer to the contents in the success state.
10284         /// Reading from this pointer when `result_ok` is not set is undefined.
10285         pub result: *mut bool,
10286         /// A pointer to the contents in the error state.
10287         /// Reading from this pointer when `result_ok` is set is undefined.
10288         pub err: *mut crate::lightning::ln::msgs::LightningError,
10289 }
10290 #[repr(C)]
10291 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10292 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10293 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10294 pub struct CResult_boolLightningErrorZ {
10295         /// The contents of this CResult_boolLightningErrorZ, accessible via either
10296         /// `err` or `result` depending on the state of `result_ok`.
10297         pub contents: CResult_boolLightningErrorZPtr,
10298         /// Whether this CResult_boolLightningErrorZ represents a success state.
10299         pub result_ok: bool,
10300 }
10301 #[no_mangle]
10302 /// Creates a new CResult_boolLightningErrorZ in the success state.
10303 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10304         CResult_boolLightningErrorZ {
10305                 contents: CResult_boolLightningErrorZPtr {
10306                         result: Box::into_raw(Box::new(o)),
10307                 },
10308                 result_ok: true,
10309         }
10310 }
10311 #[no_mangle]
10312 /// Creates a new CResult_boolLightningErrorZ in the error state.
10313 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10314         CResult_boolLightningErrorZ {
10315                 contents: CResult_boolLightningErrorZPtr {
10316                         err: Box::into_raw(Box::new(e)),
10317                 },
10318                 result_ok: false,
10319         }
10320 }
10321 /// Checks if the given object is currently in the success state
10322 #[no_mangle]
10323 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10324         o.result_ok
10325 }
10326 #[no_mangle]
10327 /// Frees any resources used by the CResult_boolLightningErrorZ.
10328 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10329 impl Drop for CResult_boolLightningErrorZ {
10330         fn drop(&mut self) {
10331                 if self.result_ok {
10332                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10333                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10334                         }
10335                 } else {
10336                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10337                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10338                         }
10339                 }
10340         }
10341 }
10342 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10343         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10344                 let contents = if o.result_ok {
10345                         let result = unsafe { o.contents.result };
10346                         unsafe { o.contents.result = core::ptr::null_mut() };
10347                         CResult_boolLightningErrorZPtr { result }
10348                 } else {
10349                         let err = unsafe { o.contents.err };
10350                         unsafe { o.contents.err = core::ptr::null_mut(); }
10351                         CResult_boolLightningErrorZPtr { err }
10352                 };
10353                 Self {
10354                         contents,
10355                         result_ok: o.result_ok,
10356                 }
10357         }
10358 }
10359 impl Clone for CResult_boolLightningErrorZ {
10360         fn clone(&self) -> Self {
10361                 if self.result_ok {
10362                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10363                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10364                         } }
10365                 } else {
10366                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10367                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10368                         } }
10369                 }
10370         }
10371 }
10372 #[no_mangle]
10373 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10374 /// but with all dynamically-allocated buffers duplicated in new buffers.
10375 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10376 #[repr(C)]
10377 /// A tuple of 3 elements. See the individual fields for the types contained.
10378 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10379         /// The element at position 0
10380         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10381         /// The element at position 1
10382         pub b: crate::lightning::ln::msgs::ChannelUpdate,
10383         /// The element at position 2
10384         pub c: crate::lightning::ln::msgs::ChannelUpdate,
10385 }
10386 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10387         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10388                 Self {
10389                         a: tup.0,
10390                         b: tup.1,
10391                         c: tup.2,
10392                 }
10393         }
10394 }
10395 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10396         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10397                 (self.a, self.b, self.c)
10398         }
10399 }
10400 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10401         fn clone(&self) -> Self {
10402                 Self {
10403                         a: Clone::clone(&self.a),
10404                         b: Clone::clone(&self.b),
10405                         c: Clone::clone(&self.c),
10406                 }
10407         }
10408 }
10409 #[no_mangle]
10410 /// Creates a new tuple which has the same data as `orig`
10411 /// but with all dynamically-allocated buffers duplicated in new buffers.
10412 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10413 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10414 #[no_mangle]
10415 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 {
10416         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10417 }
10418
10419 #[no_mangle]
10420 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10421 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10422 #[repr(C)]
10423 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10424 /// This corresponds to std::vector in C++
10425 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10426         /// The elements in the array.
10427         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10428         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10429         /// The number of elements pointed to by `data`.
10430         pub datalen: usize
10431 }
10432 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10433         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10434                 if self.datalen == 0 { return Vec::new(); }
10435                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10436                 self.data = core::ptr::null_mut();
10437                 self.datalen = 0;
10438                 ret
10439         }
10440         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10441                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10442         }
10443 }
10444 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10445         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10446                 let datalen = v.len();
10447                 let data = Box::into_raw(v.into_boxed_slice());
10448                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10449         }
10450 }
10451 #[no_mangle]
10452 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10453 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10454 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10455         fn drop(&mut self) {
10456                 if self.datalen == 0 { return; }
10457                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10458         }
10459 }
10460 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10461         fn clone(&self) -> Self {
10462                 let mut res = Vec::new();
10463                 if self.datalen == 0 { return Self::from(res); }
10464                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10465                 Self::from(res)
10466         }
10467 }
10468 #[repr(C)]
10469 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10470 /// This corresponds to std::vector in C++
10471 pub struct CVec_NodeAnnouncementZ {
10472         /// The elements in the array.
10473         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10474         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10475         /// The number of elements pointed to by `data`.
10476         pub datalen: usize
10477 }
10478 impl CVec_NodeAnnouncementZ {
10479         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10480                 if self.datalen == 0 { return Vec::new(); }
10481                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10482                 self.data = core::ptr::null_mut();
10483                 self.datalen = 0;
10484                 ret
10485         }
10486         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10487                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10488         }
10489 }
10490 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10491         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10492                 let datalen = v.len();
10493                 let data = Box::into_raw(v.into_boxed_slice());
10494                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10495         }
10496 }
10497 #[no_mangle]
10498 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10499 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10500 impl Drop for CVec_NodeAnnouncementZ {
10501         fn drop(&mut self) {
10502                 if self.datalen == 0 { return; }
10503                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10504         }
10505 }
10506 impl Clone for CVec_NodeAnnouncementZ {
10507         fn clone(&self) -> Self {
10508                 let mut res = Vec::new();
10509                 if self.datalen == 0 { return Self::from(res); }
10510                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10511                 Self::from(res)
10512         }
10513 }
10514 #[repr(C)]
10515 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10516 /// This corresponds to std::vector in C++
10517 pub struct CVec_PublicKeyZ {
10518         /// The elements in the array.
10519         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10520         pub data: *mut crate::c_types::PublicKey,
10521         /// The number of elements pointed to by `data`.
10522         pub datalen: usize
10523 }
10524 impl CVec_PublicKeyZ {
10525         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10526                 if self.datalen == 0 { return Vec::new(); }
10527                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10528                 self.data = core::ptr::null_mut();
10529                 self.datalen = 0;
10530                 ret
10531         }
10532         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10533                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10534         }
10535 }
10536 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10537         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10538                 let datalen = v.len();
10539                 let data = Box::into_raw(v.into_boxed_slice());
10540                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10541         }
10542 }
10543 #[no_mangle]
10544 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10545 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10546 impl Drop for CVec_PublicKeyZ {
10547         fn drop(&mut self) {
10548                 if self.datalen == 0 { return; }
10549                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10550         }
10551 }
10552 impl Clone for CVec_PublicKeyZ {
10553         fn clone(&self) -> Self {
10554                 let mut res = Vec::new();
10555                 if self.datalen == 0 { return Self::from(res); }
10556                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10557                 Self::from(res)
10558         }
10559 }
10560 #[repr(C)]
10561 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10562 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10563         /// A pointer to the contents in the success state.
10564         /// Reading from this pointer when `result_ok` is not set is undefined.
10565         pub result: *mut crate::c_types::derived::CVec_u8Z,
10566         /// A pointer to the contents in the error state.
10567         /// Reading from this pointer when `result_ok` is set is undefined.
10568         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10569 }
10570 #[repr(C)]
10571 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10572 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10573 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10574 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10575         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10576         /// `err` or `result` depending on the state of `result_ok`.
10577         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10578         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10579         pub result_ok: bool,
10580 }
10581 #[no_mangle]
10582 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10583 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10584         CResult_CVec_u8ZPeerHandleErrorZ {
10585                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10586                         result: Box::into_raw(Box::new(o)),
10587                 },
10588                 result_ok: true,
10589         }
10590 }
10591 #[no_mangle]
10592 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10593 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10594         CResult_CVec_u8ZPeerHandleErrorZ {
10595                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10596                         err: Box::into_raw(Box::new(e)),
10597                 },
10598                 result_ok: false,
10599         }
10600 }
10601 /// Checks if the given object is currently in the success state
10602 #[no_mangle]
10603 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10604         o.result_ok
10605 }
10606 #[no_mangle]
10607 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10608 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10609 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10610         fn drop(&mut self) {
10611                 if self.result_ok {
10612                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10613                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10614                         }
10615                 } else {
10616                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10617                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10618                         }
10619                 }
10620         }
10621 }
10622 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10623         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10624                 let contents = if o.result_ok {
10625                         let result = unsafe { o.contents.result };
10626                         unsafe { o.contents.result = core::ptr::null_mut() };
10627                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10628                 } else {
10629                         let err = unsafe { o.contents.err };
10630                         unsafe { o.contents.err = core::ptr::null_mut(); }
10631                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10632                 };
10633                 Self {
10634                         contents,
10635                         result_ok: o.result_ok,
10636                 }
10637         }
10638 }
10639 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10640         fn clone(&self) -> Self {
10641                 if self.result_ok {
10642                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10643                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10644                         } }
10645                 } else {
10646                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10647                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10648                         } }
10649                 }
10650         }
10651 }
10652 #[no_mangle]
10653 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10654 /// but with all dynamically-allocated buffers duplicated in new buffers.
10655 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10656 #[repr(C)]
10657 /// The contents of CResult_NonePeerHandleErrorZ
10658 pub union CResult_NonePeerHandleErrorZPtr {
10659         /// Note that this value is always NULL, as there are no contents in the OK variant
10660         pub result: *mut core::ffi::c_void,
10661         /// A pointer to the contents in the error state.
10662         /// Reading from this pointer when `result_ok` is set is undefined.
10663         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10664 }
10665 #[repr(C)]
10666 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10667 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10669 pub struct CResult_NonePeerHandleErrorZ {
10670         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10671         /// `err` or `result` depending on the state of `result_ok`.
10672         pub contents: CResult_NonePeerHandleErrorZPtr,
10673         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10674         pub result_ok: bool,
10675 }
10676 #[no_mangle]
10677 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10678 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10679         CResult_NonePeerHandleErrorZ {
10680                 contents: CResult_NonePeerHandleErrorZPtr {
10681                         result: core::ptr::null_mut(),
10682                 },
10683                 result_ok: true,
10684         }
10685 }
10686 #[no_mangle]
10687 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10688 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10689         CResult_NonePeerHandleErrorZ {
10690                 contents: CResult_NonePeerHandleErrorZPtr {
10691                         err: Box::into_raw(Box::new(e)),
10692                 },
10693                 result_ok: false,
10694         }
10695 }
10696 /// Checks if the given object is currently in the success state
10697 #[no_mangle]
10698 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10699         o.result_ok
10700 }
10701 #[no_mangle]
10702 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10703 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10704 impl Drop for CResult_NonePeerHandleErrorZ {
10705         fn drop(&mut self) {
10706                 if self.result_ok {
10707                 } else {
10708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10710                         }
10711                 }
10712         }
10713 }
10714 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10715         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10716                 let contents = if o.result_ok {
10717                         let _ = unsafe { Box::from_raw(o.contents.result) };
10718                         o.contents.result = core::ptr::null_mut();
10719                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10720                 } else {
10721                         let err = unsafe { o.contents.err };
10722                         unsafe { o.contents.err = core::ptr::null_mut(); }
10723                         CResult_NonePeerHandleErrorZPtr { err }
10724                 };
10725                 Self {
10726                         contents,
10727                         result_ok: o.result_ok,
10728                 }
10729         }
10730 }
10731 impl Clone for CResult_NonePeerHandleErrorZ {
10732         fn clone(&self) -> Self {
10733                 if self.result_ok {
10734                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10735                                 result: core::ptr::null_mut()
10736                         } }
10737                 } else {
10738                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10739                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10740                         } }
10741                 }
10742         }
10743 }
10744 #[no_mangle]
10745 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10746 /// but with all dynamically-allocated buffers duplicated in new buffers.
10747 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10748 #[repr(C)]
10749 /// The contents of CResult_boolPeerHandleErrorZ
10750 pub union CResult_boolPeerHandleErrorZPtr {
10751         /// A pointer to the contents in the success state.
10752         /// Reading from this pointer when `result_ok` is not set is undefined.
10753         pub result: *mut bool,
10754         /// A pointer to the contents in the error state.
10755         /// Reading from this pointer when `result_ok` is set is undefined.
10756         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10757 }
10758 #[repr(C)]
10759 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10760 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10761 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10762 pub struct CResult_boolPeerHandleErrorZ {
10763         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10764         /// `err` or `result` depending on the state of `result_ok`.
10765         pub contents: CResult_boolPeerHandleErrorZPtr,
10766         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10767         pub result_ok: bool,
10768 }
10769 #[no_mangle]
10770 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10771 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10772         CResult_boolPeerHandleErrorZ {
10773                 contents: CResult_boolPeerHandleErrorZPtr {
10774                         result: Box::into_raw(Box::new(o)),
10775                 },
10776                 result_ok: true,
10777         }
10778 }
10779 #[no_mangle]
10780 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10781 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10782         CResult_boolPeerHandleErrorZ {
10783                 contents: CResult_boolPeerHandleErrorZPtr {
10784                         err: Box::into_raw(Box::new(e)),
10785                 },
10786                 result_ok: false,
10787         }
10788 }
10789 /// Checks if the given object is currently in the success state
10790 #[no_mangle]
10791 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10792         o.result_ok
10793 }
10794 #[no_mangle]
10795 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10796 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10797 impl Drop for CResult_boolPeerHandleErrorZ {
10798         fn drop(&mut self) {
10799                 if self.result_ok {
10800                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10801                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10802                         }
10803                 } else {
10804                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10805                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10806                         }
10807                 }
10808         }
10809 }
10810 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10811         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10812                 let contents = if o.result_ok {
10813                         let result = unsafe { o.contents.result };
10814                         unsafe { o.contents.result = core::ptr::null_mut() };
10815                         CResult_boolPeerHandleErrorZPtr { result }
10816                 } else {
10817                         let err = unsafe { o.contents.err };
10818                         unsafe { o.contents.err = core::ptr::null_mut(); }
10819                         CResult_boolPeerHandleErrorZPtr { err }
10820                 };
10821                 Self {
10822                         contents,
10823                         result_ok: o.result_ok,
10824                 }
10825         }
10826 }
10827 impl Clone for CResult_boolPeerHandleErrorZ {
10828         fn clone(&self) -> Self {
10829                 if self.result_ok {
10830                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10831                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10832                         } }
10833                 } else {
10834                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10835                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10836                         } }
10837                 }
10838         }
10839 }
10840 #[no_mangle]
10841 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10842 /// but with all dynamically-allocated buffers duplicated in new buffers.
10843 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10844 #[repr(C)]
10845 /// The contents of CResult_NodeIdDecodeErrorZ
10846 pub union CResult_NodeIdDecodeErrorZPtr {
10847         /// A pointer to the contents in the success state.
10848         /// Reading from this pointer when `result_ok` is not set is undefined.
10849         pub result: *mut crate::lightning::routing::network_graph::NodeId,
10850         /// A pointer to the contents in the error state.
10851         /// Reading from this pointer when `result_ok` is set is undefined.
10852         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10853 }
10854 #[repr(C)]
10855 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10856 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10857 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10858 pub struct CResult_NodeIdDecodeErrorZ {
10859         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10860         /// `err` or `result` depending on the state of `result_ok`.
10861         pub contents: CResult_NodeIdDecodeErrorZPtr,
10862         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10863         pub result_ok: bool,
10864 }
10865 #[no_mangle]
10866 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10867 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10868         CResult_NodeIdDecodeErrorZ {
10869                 contents: CResult_NodeIdDecodeErrorZPtr {
10870                         result: Box::into_raw(Box::new(o)),
10871                 },
10872                 result_ok: true,
10873         }
10874 }
10875 #[no_mangle]
10876 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10877 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10878         CResult_NodeIdDecodeErrorZ {
10879                 contents: CResult_NodeIdDecodeErrorZPtr {
10880                         err: Box::into_raw(Box::new(e)),
10881                 },
10882                 result_ok: false,
10883         }
10884 }
10885 /// Checks if the given object is currently in the success state
10886 #[no_mangle]
10887 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10888         o.result_ok
10889 }
10890 #[no_mangle]
10891 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10892 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10893 impl Drop for CResult_NodeIdDecodeErrorZ {
10894         fn drop(&mut self) {
10895                 if self.result_ok {
10896                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10897                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10898                         }
10899                 } else {
10900                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10901                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10902                         }
10903                 }
10904         }
10905 }
10906 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10907         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10908                 let contents = if o.result_ok {
10909                         let result = unsafe { o.contents.result };
10910                         unsafe { o.contents.result = core::ptr::null_mut() };
10911                         CResult_NodeIdDecodeErrorZPtr { result }
10912                 } else {
10913                         let err = unsafe { o.contents.err };
10914                         unsafe { o.contents.err = core::ptr::null_mut(); }
10915                         CResult_NodeIdDecodeErrorZPtr { err }
10916                 };
10917                 Self {
10918                         contents,
10919                         result_ok: o.result_ok,
10920                 }
10921         }
10922 }
10923 impl Clone for CResult_NodeIdDecodeErrorZ {
10924         fn clone(&self) -> Self {
10925                 if self.result_ok {
10926                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10927                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10928                         } }
10929                 } else {
10930                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10931                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10932                         } }
10933                 }
10934         }
10935 }
10936 #[no_mangle]
10937 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10938 /// but with all dynamically-allocated buffers duplicated in new buffers.
10939 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10940 #[repr(C)]
10941 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10942 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10943         /// A pointer to the contents in the success state.
10944         /// Reading from this pointer when `result_ok` is not set is undefined.
10945         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10946         /// A pointer to the contents in the error state.
10947         /// Reading from this pointer when `result_ok` is set is undefined.
10948         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10949 }
10950 #[repr(C)]
10951 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10952 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10954 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10955         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10956         /// `err` or `result` depending on the state of `result_ok`.
10957         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10958         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10959         pub result_ok: bool,
10960 }
10961 #[no_mangle]
10962 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10963 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10964         CResult_COption_NetworkUpdateZDecodeErrorZ {
10965                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10966                         result: Box::into_raw(Box::new(o)),
10967                 },
10968                 result_ok: true,
10969         }
10970 }
10971 #[no_mangle]
10972 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10973 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10974         CResult_COption_NetworkUpdateZDecodeErrorZ {
10975                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10976                         err: Box::into_raw(Box::new(e)),
10977                 },
10978                 result_ok: false,
10979         }
10980 }
10981 /// Checks if the given object is currently in the success state
10982 #[no_mangle]
10983 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10984         o.result_ok
10985 }
10986 #[no_mangle]
10987 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10988 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10989 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10990         fn drop(&mut self) {
10991                 if self.result_ok {
10992                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10993                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10994                         }
10995                 } else {
10996                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10997                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10998                         }
10999                 }
11000         }
11001 }
11002 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
11003         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11004                 let contents = if o.result_ok {
11005                         let result = unsafe { o.contents.result };
11006                         unsafe { o.contents.result = core::ptr::null_mut() };
11007                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
11008                 } else {
11009                         let err = unsafe { o.contents.err };
11010                         unsafe { o.contents.err = core::ptr::null_mut(); }
11011                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
11012                 };
11013                 Self {
11014                         contents,
11015                         result_ok: o.result_ok,
11016                 }
11017         }
11018 }
11019 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
11020         fn clone(&self) -> Self {
11021                 if self.result_ok {
11022                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11023                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
11024                         } }
11025                 } else {
11026                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11027                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11028                         } }
11029                 }
11030         }
11031 }
11032 #[no_mangle]
11033 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11034 /// but with all dynamically-allocated buffers duplicated in new buffers.
11035 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11036 #[repr(C)]
11037 /// An enum which can either contain a crate::lightning::chain::Access or not
11038 pub enum COption_AccessZ {
11039         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11040         Some(crate::lightning::chain::Access),
11041         /// When we're in this state, this COption_AccessZ contains nothing
11042         None
11043 }
11044 impl COption_AccessZ {
11045         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11046                 if let Self::None = self { false } else { true }
11047         }
11048         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11049                 !self.is_some()
11050         }
11051         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11052                 if let Self::Some(v) = self { v } else { unreachable!() }
11053         }
11054 }
11055 #[no_mangle]
11056 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11057 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11058         COption_AccessZ::Some(o)
11059 }
11060 #[no_mangle]
11061 /// Constructs a new COption_AccessZ containing nothing
11062 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11063         COption_AccessZ::None
11064 }
11065 #[no_mangle]
11066 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11067 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11068 #[repr(C)]
11069 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11070 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11071         /// A pointer to the contents in the success state.
11072         /// Reading from this pointer when `result_ok` is not set is undefined.
11073         pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11074         /// A pointer to the contents in the error state.
11075         /// Reading from this pointer when `result_ok` is set is undefined.
11076         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11077 }
11078 #[repr(C)]
11079 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11080 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11081 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11082 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11083         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11084         /// `err` or `result` depending on the state of `result_ok`.
11085         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11086         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11087         pub result_ok: bool,
11088 }
11089 #[no_mangle]
11090 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11091 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11092         CResult_ChannelUpdateInfoDecodeErrorZ {
11093                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11094                         result: Box::into_raw(Box::new(o)),
11095                 },
11096                 result_ok: true,
11097         }
11098 }
11099 #[no_mangle]
11100 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11101 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11102         CResult_ChannelUpdateInfoDecodeErrorZ {
11103                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11104                         err: Box::into_raw(Box::new(e)),
11105                 },
11106                 result_ok: false,
11107         }
11108 }
11109 /// Checks if the given object is currently in the success state
11110 #[no_mangle]
11111 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11112         o.result_ok
11113 }
11114 #[no_mangle]
11115 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11116 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11117 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11118         fn drop(&mut self) {
11119                 if self.result_ok {
11120                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11121                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11122                         }
11123                 } else {
11124                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11125                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11126                         }
11127                 }
11128         }
11129 }
11130 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11131         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11132                 let contents = if o.result_ok {
11133                         let result = unsafe { o.contents.result };
11134                         unsafe { o.contents.result = core::ptr::null_mut() };
11135                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11136                 } else {
11137                         let err = unsafe { o.contents.err };
11138                         unsafe { o.contents.err = core::ptr::null_mut(); }
11139                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11140                 };
11141                 Self {
11142                         contents,
11143                         result_ok: o.result_ok,
11144                 }
11145         }
11146 }
11147 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11148         fn clone(&self) -> Self {
11149                 if self.result_ok {
11150                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11151                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11152                         } }
11153                 } else {
11154                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11155                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11156                         } }
11157                 }
11158         }
11159 }
11160 #[no_mangle]
11161 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11162 /// but with all dynamically-allocated buffers duplicated in new buffers.
11163 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11164 #[repr(C)]
11165 /// The contents of CResult_ChannelInfoDecodeErrorZ
11166 pub union CResult_ChannelInfoDecodeErrorZPtr {
11167         /// A pointer to the contents in the success state.
11168         /// Reading from this pointer when `result_ok` is not set is undefined.
11169         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11170         /// A pointer to the contents in the error state.
11171         /// Reading from this pointer when `result_ok` is set is undefined.
11172         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11173 }
11174 #[repr(C)]
11175 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11176 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11177 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11178 pub struct CResult_ChannelInfoDecodeErrorZ {
11179         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11180         /// `err` or `result` depending on the state of `result_ok`.
11181         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11182         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11183         pub result_ok: bool,
11184 }
11185 #[no_mangle]
11186 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11187 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11188         CResult_ChannelInfoDecodeErrorZ {
11189                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11190                         result: Box::into_raw(Box::new(o)),
11191                 },
11192                 result_ok: true,
11193         }
11194 }
11195 #[no_mangle]
11196 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11197 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11198         CResult_ChannelInfoDecodeErrorZ {
11199                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11200                         err: Box::into_raw(Box::new(e)),
11201                 },
11202                 result_ok: false,
11203         }
11204 }
11205 /// Checks if the given object is currently in the success state
11206 #[no_mangle]
11207 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11208         o.result_ok
11209 }
11210 #[no_mangle]
11211 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11212 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11213 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11214         fn drop(&mut self) {
11215                 if self.result_ok {
11216                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11217                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11218                         }
11219                 } else {
11220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11222                         }
11223                 }
11224         }
11225 }
11226 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11227         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11228                 let contents = if o.result_ok {
11229                         let result = unsafe { o.contents.result };
11230                         unsafe { o.contents.result = core::ptr::null_mut() };
11231                         CResult_ChannelInfoDecodeErrorZPtr { result }
11232                 } else {
11233                         let err = unsafe { o.contents.err };
11234                         unsafe { o.contents.err = core::ptr::null_mut(); }
11235                         CResult_ChannelInfoDecodeErrorZPtr { err }
11236                 };
11237                 Self {
11238                         contents,
11239                         result_ok: o.result_ok,
11240                 }
11241         }
11242 }
11243 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11244         fn clone(&self) -> Self {
11245                 if self.result_ok {
11246                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11247                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11248                         } }
11249                 } else {
11250                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11251                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11252                         } }
11253                 }
11254         }
11255 }
11256 #[no_mangle]
11257 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11258 /// but with all dynamically-allocated buffers duplicated in new buffers.
11259 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11260 #[repr(C)]
11261 /// The contents of CResult_RoutingFeesDecodeErrorZ
11262 pub union CResult_RoutingFeesDecodeErrorZPtr {
11263         /// A pointer to the contents in the success state.
11264         /// Reading from this pointer when `result_ok` is not set is undefined.
11265         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11266         /// A pointer to the contents in the error state.
11267         /// Reading from this pointer when `result_ok` is set is undefined.
11268         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11269 }
11270 #[repr(C)]
11271 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11272 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11274 pub struct CResult_RoutingFeesDecodeErrorZ {
11275         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11276         /// `err` or `result` depending on the state of `result_ok`.
11277         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11278         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11279         pub result_ok: bool,
11280 }
11281 #[no_mangle]
11282 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11283 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11284         CResult_RoutingFeesDecodeErrorZ {
11285                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11286                         result: Box::into_raw(Box::new(o)),
11287                 },
11288                 result_ok: true,
11289         }
11290 }
11291 #[no_mangle]
11292 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11293 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11294         CResult_RoutingFeesDecodeErrorZ {
11295                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11296                         err: Box::into_raw(Box::new(e)),
11297                 },
11298                 result_ok: false,
11299         }
11300 }
11301 /// Checks if the given object is currently in the success state
11302 #[no_mangle]
11303 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11304         o.result_ok
11305 }
11306 #[no_mangle]
11307 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11308 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11309 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11310         fn drop(&mut self) {
11311                 if self.result_ok {
11312                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11313                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11314                         }
11315                 } else {
11316                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11317                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11318                         }
11319                 }
11320         }
11321 }
11322 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11323         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11324                 let contents = if o.result_ok {
11325                         let result = unsafe { o.contents.result };
11326                         unsafe { o.contents.result = core::ptr::null_mut() };
11327                         CResult_RoutingFeesDecodeErrorZPtr { result }
11328                 } else {
11329                         let err = unsafe { o.contents.err };
11330                         unsafe { o.contents.err = core::ptr::null_mut(); }
11331                         CResult_RoutingFeesDecodeErrorZPtr { err }
11332                 };
11333                 Self {
11334                         contents,
11335                         result_ok: o.result_ok,
11336                 }
11337         }
11338 }
11339 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11340         fn clone(&self) -> Self {
11341                 if self.result_ok {
11342                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11343                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11344                         } }
11345                 } else {
11346                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11347                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11348                         } }
11349                 }
11350         }
11351 }
11352 #[no_mangle]
11353 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11354 /// but with all dynamically-allocated buffers duplicated in new buffers.
11355 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11356 #[repr(C)]
11357 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11358 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11359         /// A pointer to the contents in the success state.
11360         /// Reading from this pointer when `result_ok` is not set is undefined.
11361         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11362         /// A pointer to the contents in the error state.
11363         /// Reading from this pointer when `result_ok` is set is undefined.
11364         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11365 }
11366 #[repr(C)]
11367 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11368 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11369 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11370 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11371         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11372         /// `err` or `result` depending on the state of `result_ok`.
11373         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11374         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11375         pub result_ok: bool,
11376 }
11377 #[no_mangle]
11378 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11379 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11380         CResult_NodeAnnouncementInfoDecodeErrorZ {
11381                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11382                         result: Box::into_raw(Box::new(o)),
11383                 },
11384                 result_ok: true,
11385         }
11386 }
11387 #[no_mangle]
11388 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11389 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11390         CResult_NodeAnnouncementInfoDecodeErrorZ {
11391                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11392                         err: Box::into_raw(Box::new(e)),
11393                 },
11394                 result_ok: false,
11395         }
11396 }
11397 /// Checks if the given object is currently in the success state
11398 #[no_mangle]
11399 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11400         o.result_ok
11401 }
11402 #[no_mangle]
11403 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11404 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11405 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11406         fn drop(&mut self) {
11407                 if self.result_ok {
11408                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11409                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11410                         }
11411                 } else {
11412                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11413                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11414                         }
11415                 }
11416         }
11417 }
11418 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11419         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11420                 let contents = if o.result_ok {
11421                         let result = unsafe { o.contents.result };
11422                         unsafe { o.contents.result = core::ptr::null_mut() };
11423                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11424                 } else {
11425                         let err = unsafe { o.contents.err };
11426                         unsafe { o.contents.err = core::ptr::null_mut(); }
11427                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11428                 };
11429                 Self {
11430                         contents,
11431                         result_ok: o.result_ok,
11432                 }
11433         }
11434 }
11435 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11436         fn clone(&self) -> Self {
11437                 if self.result_ok {
11438                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11439                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11440                         } }
11441                 } else {
11442                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11443                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11444                         } }
11445                 }
11446         }
11447 }
11448 #[no_mangle]
11449 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11450 /// but with all dynamically-allocated buffers duplicated in new buffers.
11451 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11452 #[repr(C)]
11453 /// A dynamically-allocated array of u64s of arbitrary size.
11454 /// This corresponds to std::vector in C++
11455 pub struct CVec_u64Z {
11456         /// The elements in the array.
11457         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11458         pub data: *mut u64,
11459         /// The number of elements pointed to by `data`.
11460         pub datalen: usize
11461 }
11462 impl CVec_u64Z {
11463         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11464                 if self.datalen == 0 { return Vec::new(); }
11465                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11466                 self.data = core::ptr::null_mut();
11467                 self.datalen = 0;
11468                 ret
11469         }
11470         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11471                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11472         }
11473 }
11474 impl From<Vec<u64>> for CVec_u64Z {
11475         fn from(v: Vec<u64>) -> Self {
11476                 let datalen = v.len();
11477                 let data = Box::into_raw(v.into_boxed_slice());
11478                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11479         }
11480 }
11481 #[no_mangle]
11482 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11483 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11484 impl Drop for CVec_u64Z {
11485         fn drop(&mut self) {
11486                 if self.datalen == 0 { return; }
11487                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11488         }
11489 }
11490 impl Clone for CVec_u64Z {
11491         fn clone(&self) -> Self {
11492                 let mut res = Vec::new();
11493                 if self.datalen == 0 { return Self::from(res); }
11494                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11495                 Self::from(res)
11496         }
11497 }
11498 #[repr(C)]
11499 /// The contents of CResult_NodeInfoDecodeErrorZ
11500 pub union CResult_NodeInfoDecodeErrorZPtr {
11501         /// A pointer to the contents in the success state.
11502         /// Reading from this pointer when `result_ok` is not set is undefined.
11503         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11504         /// A pointer to the contents in the error state.
11505         /// Reading from this pointer when `result_ok` is set is undefined.
11506         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11507 }
11508 #[repr(C)]
11509 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11510 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11512 pub struct CResult_NodeInfoDecodeErrorZ {
11513         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11514         /// `err` or `result` depending on the state of `result_ok`.
11515         pub contents: CResult_NodeInfoDecodeErrorZPtr,
11516         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11517         pub result_ok: bool,
11518 }
11519 #[no_mangle]
11520 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11521 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11522         CResult_NodeInfoDecodeErrorZ {
11523                 contents: CResult_NodeInfoDecodeErrorZPtr {
11524                         result: Box::into_raw(Box::new(o)),
11525                 },
11526                 result_ok: true,
11527         }
11528 }
11529 #[no_mangle]
11530 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11531 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11532         CResult_NodeInfoDecodeErrorZ {
11533                 contents: CResult_NodeInfoDecodeErrorZPtr {
11534                         err: Box::into_raw(Box::new(e)),
11535                 },
11536                 result_ok: false,
11537         }
11538 }
11539 /// Checks if the given object is currently in the success state
11540 #[no_mangle]
11541 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11542         o.result_ok
11543 }
11544 #[no_mangle]
11545 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11546 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11547 impl Drop for CResult_NodeInfoDecodeErrorZ {
11548         fn drop(&mut self) {
11549                 if self.result_ok {
11550                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11551                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11552                         }
11553                 } else {
11554                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11555                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11556                         }
11557                 }
11558         }
11559 }
11560 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11561         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11562                 let contents = if o.result_ok {
11563                         let result = unsafe { o.contents.result };
11564                         unsafe { o.contents.result = core::ptr::null_mut() };
11565                         CResult_NodeInfoDecodeErrorZPtr { result }
11566                 } else {
11567                         let err = unsafe { o.contents.err };
11568                         unsafe { o.contents.err = core::ptr::null_mut(); }
11569                         CResult_NodeInfoDecodeErrorZPtr { err }
11570                 };
11571                 Self {
11572                         contents,
11573                         result_ok: o.result_ok,
11574                 }
11575         }
11576 }
11577 impl Clone for CResult_NodeInfoDecodeErrorZ {
11578         fn clone(&self) -> Self {
11579                 if self.result_ok {
11580                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11581                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11582                         } }
11583                 } else {
11584                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11585                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11586                         } }
11587                 }
11588         }
11589 }
11590 #[no_mangle]
11591 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11592 /// but with all dynamically-allocated buffers duplicated in new buffers.
11593 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11594 #[repr(C)]
11595 /// The contents of CResult_NetworkGraphDecodeErrorZ
11596 pub union CResult_NetworkGraphDecodeErrorZPtr {
11597         /// A pointer to the contents in the success state.
11598         /// Reading from this pointer when `result_ok` is not set is undefined.
11599         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11600         /// A pointer to the contents in the error state.
11601         /// Reading from this pointer when `result_ok` is set is undefined.
11602         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11603 }
11604 #[repr(C)]
11605 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11606 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11608 pub struct CResult_NetworkGraphDecodeErrorZ {
11609         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11610         /// `err` or `result` depending on the state of `result_ok`.
11611         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11612         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11613         pub result_ok: bool,
11614 }
11615 #[no_mangle]
11616 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11617 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11618         CResult_NetworkGraphDecodeErrorZ {
11619                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11620                         result: Box::into_raw(Box::new(o)),
11621                 },
11622                 result_ok: true,
11623         }
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11627 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11628         CResult_NetworkGraphDecodeErrorZ {
11629                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11630                         err: Box::into_raw(Box::new(e)),
11631                 },
11632                 result_ok: false,
11633         }
11634 }
11635 /// Checks if the given object is currently in the success state
11636 #[no_mangle]
11637 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11638         o.result_ok
11639 }
11640 #[no_mangle]
11641 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11642 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11643 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11644         fn drop(&mut self) {
11645                 if self.result_ok {
11646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11648                         }
11649                 } else {
11650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11652                         }
11653                 }
11654         }
11655 }
11656 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11657         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11658                 let contents = if o.result_ok {
11659                         let result = unsafe { o.contents.result };
11660                         unsafe { o.contents.result = core::ptr::null_mut() };
11661                         CResult_NetworkGraphDecodeErrorZPtr { result }
11662                 } else {
11663                         let err = unsafe { o.contents.err };
11664                         unsafe { o.contents.err = core::ptr::null_mut(); }
11665                         CResult_NetworkGraphDecodeErrorZPtr { err }
11666                 };
11667                 Self {
11668                         contents,
11669                         result_ok: o.result_ok,
11670                 }
11671         }
11672 }
11673 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11674         fn clone(&self) -> Self {
11675                 if self.result_ok {
11676                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11677                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11678                         } }
11679                 } else {
11680                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11681                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11682                         } }
11683                 }
11684         }
11685 }
11686 #[no_mangle]
11687 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11688 /// but with all dynamically-allocated buffers duplicated in new buffers.
11689 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11690 #[repr(C)]
11691 #[derive(Clone)]
11692 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11693 pub enum COption_CVec_NetAddressZZ {
11694         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11695         Some(crate::c_types::derived::CVec_NetAddressZ),
11696         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11697         None
11698 }
11699 impl COption_CVec_NetAddressZZ {
11700         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11701                 if let Self::None = self { false } else { true }
11702         }
11703         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11704                 !self.is_some()
11705         }
11706         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11707                 if let Self::Some(v) = self { v } else { unreachable!() }
11708         }
11709 }
11710 #[no_mangle]
11711 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11712 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11713         COption_CVec_NetAddressZZ::Some(o)
11714 }
11715 #[no_mangle]
11716 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11717 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11718         COption_CVec_NetAddressZZ::None
11719 }
11720 #[no_mangle]
11721 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11722 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11723 #[no_mangle]
11724 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11725 /// but with all dynamically-allocated buffers duplicated in new buffers.
11726 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11727 #[repr(C)]
11728 /// The contents of CResult_NetAddressDecodeErrorZ
11729 pub union CResult_NetAddressDecodeErrorZPtr {
11730         /// A pointer to the contents in the success state.
11731         /// Reading from this pointer when `result_ok` is not set is undefined.
11732         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11733         /// A pointer to the contents in the error state.
11734         /// Reading from this pointer when `result_ok` is set is undefined.
11735         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11736 }
11737 #[repr(C)]
11738 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11739 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11740 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11741 pub struct CResult_NetAddressDecodeErrorZ {
11742         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11743         /// `err` or `result` depending on the state of `result_ok`.
11744         pub contents: CResult_NetAddressDecodeErrorZPtr,
11745         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11746         pub result_ok: bool,
11747 }
11748 #[no_mangle]
11749 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11750 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11751         CResult_NetAddressDecodeErrorZ {
11752                 contents: CResult_NetAddressDecodeErrorZPtr {
11753                         result: Box::into_raw(Box::new(o)),
11754                 },
11755                 result_ok: true,
11756         }
11757 }
11758 #[no_mangle]
11759 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11760 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11761         CResult_NetAddressDecodeErrorZ {
11762                 contents: CResult_NetAddressDecodeErrorZPtr {
11763                         err: Box::into_raw(Box::new(e)),
11764                 },
11765                 result_ok: false,
11766         }
11767 }
11768 /// Checks if the given object is currently in the success state
11769 #[no_mangle]
11770 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11771         o.result_ok
11772 }
11773 #[no_mangle]
11774 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11775 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11776 impl Drop for CResult_NetAddressDecodeErrorZ {
11777         fn drop(&mut self) {
11778                 if self.result_ok {
11779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11781                         }
11782                 } else {
11783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11785                         }
11786                 }
11787         }
11788 }
11789 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11790         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11791                 let contents = if o.result_ok {
11792                         let result = unsafe { o.contents.result };
11793                         unsafe { o.contents.result = core::ptr::null_mut() };
11794                         CResult_NetAddressDecodeErrorZPtr { result }
11795                 } else {
11796                         let err = unsafe { o.contents.err };
11797                         unsafe { o.contents.err = core::ptr::null_mut(); }
11798                         CResult_NetAddressDecodeErrorZPtr { err }
11799                 };
11800                 Self {
11801                         contents,
11802                         result_ok: o.result_ok,
11803                 }
11804         }
11805 }
11806 impl Clone for CResult_NetAddressDecodeErrorZ {
11807         fn clone(&self) -> Self {
11808                 if self.result_ok {
11809                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11810                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11811                         } }
11812                 } else {
11813                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11814                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11815                         } }
11816                 }
11817         }
11818 }
11819 #[no_mangle]
11820 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11821 /// but with all dynamically-allocated buffers duplicated in new buffers.
11822 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11823 #[repr(C)]
11824 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11825 /// This corresponds to std::vector in C++
11826 pub struct CVec_UpdateAddHTLCZ {
11827         /// The elements in the array.
11828         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11829         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11830         /// The number of elements pointed to by `data`.
11831         pub datalen: usize
11832 }
11833 impl CVec_UpdateAddHTLCZ {
11834         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11835                 if self.datalen == 0 { return Vec::new(); }
11836                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11837                 self.data = core::ptr::null_mut();
11838                 self.datalen = 0;
11839                 ret
11840         }
11841         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11842                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11843         }
11844 }
11845 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11846         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11847                 let datalen = v.len();
11848                 let data = Box::into_raw(v.into_boxed_slice());
11849                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11850         }
11851 }
11852 #[no_mangle]
11853 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11854 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11855 impl Drop for CVec_UpdateAddHTLCZ {
11856         fn drop(&mut self) {
11857                 if self.datalen == 0 { return; }
11858                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11859         }
11860 }
11861 impl Clone for CVec_UpdateAddHTLCZ {
11862         fn clone(&self) -> Self {
11863                 let mut res = Vec::new();
11864                 if self.datalen == 0 { return Self::from(res); }
11865                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11866                 Self::from(res)
11867         }
11868 }
11869 #[repr(C)]
11870 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11871 /// This corresponds to std::vector in C++
11872 pub struct CVec_UpdateFulfillHTLCZ {
11873         /// The elements in the array.
11874         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11875         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11876         /// The number of elements pointed to by `data`.
11877         pub datalen: usize
11878 }
11879 impl CVec_UpdateFulfillHTLCZ {
11880         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11881                 if self.datalen == 0 { return Vec::new(); }
11882                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11883                 self.data = core::ptr::null_mut();
11884                 self.datalen = 0;
11885                 ret
11886         }
11887         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11888                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11889         }
11890 }
11891 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11892         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11893                 let datalen = v.len();
11894                 let data = Box::into_raw(v.into_boxed_slice());
11895                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11896         }
11897 }
11898 #[no_mangle]
11899 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11900 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11901 impl Drop for CVec_UpdateFulfillHTLCZ {
11902         fn drop(&mut self) {
11903                 if self.datalen == 0 { return; }
11904                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11905         }
11906 }
11907 impl Clone for CVec_UpdateFulfillHTLCZ {
11908         fn clone(&self) -> Self {
11909                 let mut res = Vec::new();
11910                 if self.datalen == 0 { return Self::from(res); }
11911                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11912                 Self::from(res)
11913         }
11914 }
11915 #[repr(C)]
11916 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11917 /// This corresponds to std::vector in C++
11918 pub struct CVec_UpdateFailHTLCZ {
11919         /// The elements in the array.
11920         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11921         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11922         /// The number of elements pointed to by `data`.
11923         pub datalen: usize
11924 }
11925 impl CVec_UpdateFailHTLCZ {
11926         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11927                 if self.datalen == 0 { return Vec::new(); }
11928                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11929                 self.data = core::ptr::null_mut();
11930                 self.datalen = 0;
11931                 ret
11932         }
11933         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11934                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11935         }
11936 }
11937 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11938         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11939                 let datalen = v.len();
11940                 let data = Box::into_raw(v.into_boxed_slice());
11941                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11942         }
11943 }
11944 #[no_mangle]
11945 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11946 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11947 impl Drop for CVec_UpdateFailHTLCZ {
11948         fn drop(&mut self) {
11949                 if self.datalen == 0 { return; }
11950                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11951         }
11952 }
11953 impl Clone for CVec_UpdateFailHTLCZ {
11954         fn clone(&self) -> Self {
11955                 let mut res = Vec::new();
11956                 if self.datalen == 0 { return Self::from(res); }
11957                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11958                 Self::from(res)
11959         }
11960 }
11961 #[repr(C)]
11962 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11963 /// This corresponds to std::vector in C++
11964 pub struct CVec_UpdateFailMalformedHTLCZ {
11965         /// The elements in the array.
11966         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11967         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11968         /// The number of elements pointed to by `data`.
11969         pub datalen: usize
11970 }
11971 impl CVec_UpdateFailMalformedHTLCZ {
11972         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11973                 if self.datalen == 0 { return Vec::new(); }
11974                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11975                 self.data = core::ptr::null_mut();
11976                 self.datalen = 0;
11977                 ret
11978         }
11979         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11980                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11981         }
11982 }
11983 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11984         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11985                 let datalen = v.len();
11986                 let data = Box::into_raw(v.into_boxed_slice());
11987                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11988         }
11989 }
11990 #[no_mangle]
11991 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11992 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11993 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11994         fn drop(&mut self) {
11995                 if self.datalen == 0 { return; }
11996                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11997         }
11998 }
11999 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12000         fn clone(&self) -> Self {
12001                 let mut res = Vec::new();
12002                 if self.datalen == 0 { return Self::from(res); }
12003                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12004                 Self::from(res)
12005         }
12006 }
12007 #[repr(C)]
12008 /// The contents of CResult_AcceptChannelDecodeErrorZ
12009 pub union CResult_AcceptChannelDecodeErrorZPtr {
12010         /// A pointer to the contents in the success state.
12011         /// Reading from this pointer when `result_ok` is not set is undefined.
12012         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12013         /// A pointer to the contents in the error state.
12014         /// Reading from this pointer when `result_ok` is set is undefined.
12015         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12016 }
12017 #[repr(C)]
12018 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12019 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12021 pub struct CResult_AcceptChannelDecodeErrorZ {
12022         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12023         /// `err` or `result` depending on the state of `result_ok`.
12024         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12025         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12026         pub result_ok: bool,
12027 }
12028 #[no_mangle]
12029 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12030 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12031         CResult_AcceptChannelDecodeErrorZ {
12032                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12033                         result: Box::into_raw(Box::new(o)),
12034                 },
12035                 result_ok: true,
12036         }
12037 }
12038 #[no_mangle]
12039 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12040 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12041         CResult_AcceptChannelDecodeErrorZ {
12042                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12043                         err: Box::into_raw(Box::new(e)),
12044                 },
12045                 result_ok: false,
12046         }
12047 }
12048 /// Checks if the given object is currently in the success state
12049 #[no_mangle]
12050 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12051         o.result_ok
12052 }
12053 #[no_mangle]
12054 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12055 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12056 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12057         fn drop(&mut self) {
12058                 if self.result_ok {
12059                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12060                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12061                         }
12062                 } else {
12063                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12064                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12065                         }
12066                 }
12067         }
12068 }
12069 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12070         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12071                 let contents = if o.result_ok {
12072                         let result = unsafe { o.contents.result };
12073                         unsafe { o.contents.result = core::ptr::null_mut() };
12074                         CResult_AcceptChannelDecodeErrorZPtr { result }
12075                 } else {
12076                         let err = unsafe { o.contents.err };
12077                         unsafe { o.contents.err = core::ptr::null_mut(); }
12078                         CResult_AcceptChannelDecodeErrorZPtr { err }
12079                 };
12080                 Self {
12081                         contents,
12082                         result_ok: o.result_ok,
12083                 }
12084         }
12085 }
12086 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12087         fn clone(&self) -> Self {
12088                 if self.result_ok {
12089                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12090                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12091                         } }
12092                 } else {
12093                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12094                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12095                         } }
12096                 }
12097         }
12098 }
12099 #[no_mangle]
12100 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12101 /// but with all dynamically-allocated buffers duplicated in new buffers.
12102 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12103 #[repr(C)]
12104 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12105 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12106         /// A pointer to the contents in the success state.
12107         /// Reading from this pointer when `result_ok` is not set is undefined.
12108         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12109         /// A pointer to the contents in the error state.
12110         /// Reading from this pointer when `result_ok` is set is undefined.
12111         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12112 }
12113 #[repr(C)]
12114 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12115 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12117 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12118         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12119         /// `err` or `result` depending on the state of `result_ok`.
12120         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12121         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12122         pub result_ok: bool,
12123 }
12124 #[no_mangle]
12125 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12126 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12127         CResult_AnnouncementSignaturesDecodeErrorZ {
12128                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12129                         result: Box::into_raw(Box::new(o)),
12130                 },
12131                 result_ok: true,
12132         }
12133 }
12134 #[no_mangle]
12135 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12136 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12137         CResult_AnnouncementSignaturesDecodeErrorZ {
12138                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12139                         err: Box::into_raw(Box::new(e)),
12140                 },
12141                 result_ok: false,
12142         }
12143 }
12144 /// Checks if the given object is currently in the success state
12145 #[no_mangle]
12146 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12147         o.result_ok
12148 }
12149 #[no_mangle]
12150 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12151 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12152 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12153         fn drop(&mut self) {
12154                 if self.result_ok {
12155                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12156                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12157                         }
12158                 } else {
12159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12161                         }
12162                 }
12163         }
12164 }
12165 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12166         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12167                 let contents = if o.result_ok {
12168                         let result = unsafe { o.contents.result };
12169                         unsafe { o.contents.result = core::ptr::null_mut() };
12170                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12171                 } else {
12172                         let err = unsafe { o.contents.err };
12173                         unsafe { o.contents.err = core::ptr::null_mut(); }
12174                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12175                 };
12176                 Self {
12177                         contents,
12178                         result_ok: o.result_ok,
12179                 }
12180         }
12181 }
12182 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12183         fn clone(&self) -> Self {
12184                 if self.result_ok {
12185                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12186                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12187                         } }
12188                 } else {
12189                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12191                         } }
12192                 }
12193         }
12194 }
12195 #[no_mangle]
12196 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12197 /// but with all dynamically-allocated buffers duplicated in new buffers.
12198 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12199 #[repr(C)]
12200 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12201 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12202         /// A pointer to the contents in the success state.
12203         /// Reading from this pointer when `result_ok` is not set is undefined.
12204         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12205         /// A pointer to the contents in the error state.
12206         /// Reading from this pointer when `result_ok` is set is undefined.
12207         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12208 }
12209 #[repr(C)]
12210 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12211 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12213 pub struct CResult_ChannelReestablishDecodeErrorZ {
12214         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12215         /// `err` or `result` depending on the state of `result_ok`.
12216         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12217         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12218         pub result_ok: bool,
12219 }
12220 #[no_mangle]
12221 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12222 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12223         CResult_ChannelReestablishDecodeErrorZ {
12224                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12225                         result: Box::into_raw(Box::new(o)),
12226                 },
12227                 result_ok: true,
12228         }
12229 }
12230 #[no_mangle]
12231 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12232 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12233         CResult_ChannelReestablishDecodeErrorZ {
12234                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12235                         err: Box::into_raw(Box::new(e)),
12236                 },
12237                 result_ok: false,
12238         }
12239 }
12240 /// Checks if the given object is currently in the success state
12241 #[no_mangle]
12242 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12243         o.result_ok
12244 }
12245 #[no_mangle]
12246 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12247 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12248 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12249         fn drop(&mut self) {
12250                 if self.result_ok {
12251                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12252                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12253                         }
12254                 } else {
12255                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12256                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12257                         }
12258                 }
12259         }
12260 }
12261 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12262         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12263                 let contents = if o.result_ok {
12264                         let result = unsafe { o.contents.result };
12265                         unsafe { o.contents.result = core::ptr::null_mut() };
12266                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12267                 } else {
12268                         let err = unsafe { o.contents.err };
12269                         unsafe { o.contents.err = core::ptr::null_mut(); }
12270                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12271                 };
12272                 Self {
12273                         contents,
12274                         result_ok: o.result_ok,
12275                 }
12276         }
12277 }
12278 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12279         fn clone(&self) -> Self {
12280                 if self.result_ok {
12281                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12282                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12283                         } }
12284                 } else {
12285                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12286                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12287                         } }
12288                 }
12289         }
12290 }
12291 #[no_mangle]
12292 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12293 /// but with all dynamically-allocated buffers duplicated in new buffers.
12294 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12295 #[repr(C)]
12296 /// The contents of CResult_ClosingSignedDecodeErrorZ
12297 pub union CResult_ClosingSignedDecodeErrorZPtr {
12298         /// A pointer to the contents in the success state.
12299         /// Reading from this pointer when `result_ok` is not set is undefined.
12300         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12301         /// A pointer to the contents in the error state.
12302         /// Reading from this pointer when `result_ok` is set is undefined.
12303         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12304 }
12305 #[repr(C)]
12306 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12307 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12308 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12309 pub struct CResult_ClosingSignedDecodeErrorZ {
12310         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12311         /// `err` or `result` depending on the state of `result_ok`.
12312         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12313         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12314         pub result_ok: bool,
12315 }
12316 #[no_mangle]
12317 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12318 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12319         CResult_ClosingSignedDecodeErrorZ {
12320                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12321                         result: Box::into_raw(Box::new(o)),
12322                 },
12323                 result_ok: true,
12324         }
12325 }
12326 #[no_mangle]
12327 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12328 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12329         CResult_ClosingSignedDecodeErrorZ {
12330                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12331                         err: Box::into_raw(Box::new(e)),
12332                 },
12333                 result_ok: false,
12334         }
12335 }
12336 /// Checks if the given object is currently in the success state
12337 #[no_mangle]
12338 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12339         o.result_ok
12340 }
12341 #[no_mangle]
12342 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12343 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12344 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12345         fn drop(&mut self) {
12346                 if self.result_ok {
12347                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12348                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12349                         }
12350                 } else {
12351                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12352                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12353                         }
12354                 }
12355         }
12356 }
12357 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12358         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12359                 let contents = if o.result_ok {
12360                         let result = unsafe { o.contents.result };
12361                         unsafe { o.contents.result = core::ptr::null_mut() };
12362                         CResult_ClosingSignedDecodeErrorZPtr { result }
12363                 } else {
12364                         let err = unsafe { o.contents.err };
12365                         unsafe { o.contents.err = core::ptr::null_mut(); }
12366                         CResult_ClosingSignedDecodeErrorZPtr { err }
12367                 };
12368                 Self {
12369                         contents,
12370                         result_ok: o.result_ok,
12371                 }
12372         }
12373 }
12374 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12375         fn clone(&self) -> Self {
12376                 if self.result_ok {
12377                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12378                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12379                         } }
12380                 } else {
12381                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12382                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12383                         } }
12384                 }
12385         }
12386 }
12387 #[no_mangle]
12388 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12389 /// but with all dynamically-allocated buffers duplicated in new buffers.
12390 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12391 #[repr(C)]
12392 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12393 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12394         /// A pointer to the contents in the success state.
12395         /// Reading from this pointer when `result_ok` is not set is undefined.
12396         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12397         /// A pointer to the contents in the error state.
12398         /// Reading from this pointer when `result_ok` is set is undefined.
12399         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12400 }
12401 #[repr(C)]
12402 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12403 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12405 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12406         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12407         /// `err` or `result` depending on the state of `result_ok`.
12408         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12409         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12410         pub result_ok: bool,
12411 }
12412 #[no_mangle]
12413 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12414 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12415         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12416                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12417                         result: Box::into_raw(Box::new(o)),
12418                 },
12419                 result_ok: true,
12420         }
12421 }
12422 #[no_mangle]
12423 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12424 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12425         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12426                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12427                         err: Box::into_raw(Box::new(e)),
12428                 },
12429                 result_ok: false,
12430         }
12431 }
12432 /// Checks if the given object is currently in the success state
12433 #[no_mangle]
12434 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12435         o.result_ok
12436 }
12437 #[no_mangle]
12438 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12439 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12440 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12441         fn drop(&mut self) {
12442                 if self.result_ok {
12443                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12444                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12445                         }
12446                 } else {
12447                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12448                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12449                         }
12450                 }
12451         }
12452 }
12453 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12454         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12455                 let contents = if o.result_ok {
12456                         let result = unsafe { o.contents.result };
12457                         unsafe { o.contents.result = core::ptr::null_mut() };
12458                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12459                 } else {
12460                         let err = unsafe { o.contents.err };
12461                         unsafe { o.contents.err = core::ptr::null_mut(); }
12462                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12463                 };
12464                 Self {
12465                         contents,
12466                         result_ok: o.result_ok,
12467                 }
12468         }
12469 }
12470 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12471         fn clone(&self) -> Self {
12472                 if self.result_ok {
12473                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12474                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12475                         } }
12476                 } else {
12477                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12478                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12479                         } }
12480                 }
12481         }
12482 }
12483 #[no_mangle]
12484 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12485 /// but with all dynamically-allocated buffers duplicated in new buffers.
12486 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12487 #[repr(C)]
12488 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12489 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12490         /// A pointer to the contents in the success state.
12491         /// Reading from this pointer when `result_ok` is not set is undefined.
12492         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12493         /// A pointer to the contents in the error state.
12494         /// Reading from this pointer when `result_ok` is set is undefined.
12495         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12496 }
12497 #[repr(C)]
12498 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12499 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12500 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12501 pub struct CResult_CommitmentSignedDecodeErrorZ {
12502         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12503         /// `err` or `result` depending on the state of `result_ok`.
12504         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12505         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12506         pub result_ok: bool,
12507 }
12508 #[no_mangle]
12509 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12510 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12511         CResult_CommitmentSignedDecodeErrorZ {
12512                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12513                         result: Box::into_raw(Box::new(o)),
12514                 },
12515                 result_ok: true,
12516         }
12517 }
12518 #[no_mangle]
12519 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12520 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12521         CResult_CommitmentSignedDecodeErrorZ {
12522                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12523                         err: Box::into_raw(Box::new(e)),
12524                 },
12525                 result_ok: false,
12526         }
12527 }
12528 /// Checks if the given object is currently in the success state
12529 #[no_mangle]
12530 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12531         o.result_ok
12532 }
12533 #[no_mangle]
12534 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12535 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12536 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12537         fn drop(&mut self) {
12538                 if self.result_ok {
12539                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12540                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12541                         }
12542                 } else {
12543                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12544                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12545                         }
12546                 }
12547         }
12548 }
12549 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12550         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12551                 let contents = if o.result_ok {
12552                         let result = unsafe { o.contents.result };
12553                         unsafe { o.contents.result = core::ptr::null_mut() };
12554                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12555                 } else {
12556                         let err = unsafe { o.contents.err };
12557                         unsafe { o.contents.err = core::ptr::null_mut(); }
12558                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12559                 };
12560                 Self {
12561                         contents,
12562                         result_ok: o.result_ok,
12563                 }
12564         }
12565 }
12566 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12567         fn clone(&self) -> Self {
12568                 if self.result_ok {
12569                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12570                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12571                         } }
12572                 } else {
12573                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12574                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12575                         } }
12576                 }
12577         }
12578 }
12579 #[no_mangle]
12580 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12581 /// but with all dynamically-allocated buffers duplicated in new buffers.
12582 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12583 #[repr(C)]
12584 /// The contents of CResult_FundingCreatedDecodeErrorZ
12585 pub union CResult_FundingCreatedDecodeErrorZPtr {
12586         /// A pointer to the contents in the success state.
12587         /// Reading from this pointer when `result_ok` is not set is undefined.
12588         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12589         /// A pointer to the contents in the error state.
12590         /// Reading from this pointer when `result_ok` is set is undefined.
12591         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12592 }
12593 #[repr(C)]
12594 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12595 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12596 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12597 pub struct CResult_FundingCreatedDecodeErrorZ {
12598         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12599         /// `err` or `result` depending on the state of `result_ok`.
12600         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12601         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12602         pub result_ok: bool,
12603 }
12604 #[no_mangle]
12605 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12606 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12607         CResult_FundingCreatedDecodeErrorZ {
12608                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12609                         result: Box::into_raw(Box::new(o)),
12610                 },
12611                 result_ok: true,
12612         }
12613 }
12614 #[no_mangle]
12615 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12616 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12617         CResult_FundingCreatedDecodeErrorZ {
12618                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12619                         err: Box::into_raw(Box::new(e)),
12620                 },
12621                 result_ok: false,
12622         }
12623 }
12624 /// Checks if the given object is currently in the success state
12625 #[no_mangle]
12626 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12627         o.result_ok
12628 }
12629 #[no_mangle]
12630 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12631 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12632 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12633         fn drop(&mut self) {
12634                 if self.result_ok {
12635                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12636                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12637                         }
12638                 } else {
12639                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12640                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12641                         }
12642                 }
12643         }
12644 }
12645 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12646         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12647                 let contents = if o.result_ok {
12648                         let result = unsafe { o.contents.result };
12649                         unsafe { o.contents.result = core::ptr::null_mut() };
12650                         CResult_FundingCreatedDecodeErrorZPtr { result }
12651                 } else {
12652                         let err = unsafe { o.contents.err };
12653                         unsafe { o.contents.err = core::ptr::null_mut(); }
12654                         CResult_FundingCreatedDecodeErrorZPtr { err }
12655                 };
12656                 Self {
12657                         contents,
12658                         result_ok: o.result_ok,
12659                 }
12660         }
12661 }
12662 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12663         fn clone(&self) -> Self {
12664                 if self.result_ok {
12665                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12666                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12667                         } }
12668                 } else {
12669                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12670                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12671                         } }
12672                 }
12673         }
12674 }
12675 #[no_mangle]
12676 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12677 /// but with all dynamically-allocated buffers duplicated in new buffers.
12678 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12679 #[repr(C)]
12680 /// The contents of CResult_FundingSignedDecodeErrorZ
12681 pub union CResult_FundingSignedDecodeErrorZPtr {
12682         /// A pointer to the contents in the success state.
12683         /// Reading from this pointer when `result_ok` is not set is undefined.
12684         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12685         /// A pointer to the contents in the error state.
12686         /// Reading from this pointer when `result_ok` is set is undefined.
12687         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12688 }
12689 #[repr(C)]
12690 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12691 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12693 pub struct CResult_FundingSignedDecodeErrorZ {
12694         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12695         /// `err` or `result` depending on the state of `result_ok`.
12696         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12697         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12698         pub result_ok: bool,
12699 }
12700 #[no_mangle]
12701 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12702 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12703         CResult_FundingSignedDecodeErrorZ {
12704                 contents: CResult_FundingSignedDecodeErrorZPtr {
12705                         result: Box::into_raw(Box::new(o)),
12706                 },
12707                 result_ok: true,
12708         }
12709 }
12710 #[no_mangle]
12711 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12712 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12713         CResult_FundingSignedDecodeErrorZ {
12714                 contents: CResult_FundingSignedDecodeErrorZPtr {
12715                         err: Box::into_raw(Box::new(e)),
12716                 },
12717                 result_ok: false,
12718         }
12719 }
12720 /// Checks if the given object is currently in the success state
12721 #[no_mangle]
12722 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12723         o.result_ok
12724 }
12725 #[no_mangle]
12726 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12727 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12728 impl Drop for CResult_FundingSignedDecodeErrorZ {
12729         fn drop(&mut self) {
12730                 if self.result_ok {
12731                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12732                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12733                         }
12734                 } else {
12735                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12736                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12737                         }
12738                 }
12739         }
12740 }
12741 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12742         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12743                 let contents = if o.result_ok {
12744                         let result = unsafe { o.contents.result };
12745                         unsafe { o.contents.result = core::ptr::null_mut() };
12746                         CResult_FundingSignedDecodeErrorZPtr { result }
12747                 } else {
12748                         let err = unsafe { o.contents.err };
12749                         unsafe { o.contents.err = core::ptr::null_mut(); }
12750                         CResult_FundingSignedDecodeErrorZPtr { err }
12751                 };
12752                 Self {
12753                         contents,
12754                         result_ok: o.result_ok,
12755                 }
12756         }
12757 }
12758 impl Clone for CResult_FundingSignedDecodeErrorZ {
12759         fn clone(&self) -> Self {
12760                 if self.result_ok {
12761                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12762                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12763                         } }
12764                 } else {
12765                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12766                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12767                         } }
12768                 }
12769         }
12770 }
12771 #[no_mangle]
12772 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12773 /// but with all dynamically-allocated buffers duplicated in new buffers.
12774 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12775 #[repr(C)]
12776 /// The contents of CResult_FundingLockedDecodeErrorZ
12777 pub union CResult_FundingLockedDecodeErrorZPtr {
12778         /// A pointer to the contents in the success state.
12779         /// Reading from this pointer when `result_ok` is not set is undefined.
12780         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12781         /// A pointer to the contents in the error state.
12782         /// Reading from this pointer when `result_ok` is set is undefined.
12783         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12784 }
12785 #[repr(C)]
12786 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12787 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12788 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12789 pub struct CResult_FundingLockedDecodeErrorZ {
12790         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12791         /// `err` or `result` depending on the state of `result_ok`.
12792         pub contents: CResult_FundingLockedDecodeErrorZPtr,
12793         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12794         pub result_ok: bool,
12795 }
12796 #[no_mangle]
12797 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12798 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12799         CResult_FundingLockedDecodeErrorZ {
12800                 contents: CResult_FundingLockedDecodeErrorZPtr {
12801                         result: Box::into_raw(Box::new(o)),
12802                 },
12803                 result_ok: true,
12804         }
12805 }
12806 #[no_mangle]
12807 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12808 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12809         CResult_FundingLockedDecodeErrorZ {
12810                 contents: CResult_FundingLockedDecodeErrorZPtr {
12811                         err: Box::into_raw(Box::new(e)),
12812                 },
12813                 result_ok: false,
12814         }
12815 }
12816 /// Checks if the given object is currently in the success state
12817 #[no_mangle]
12818 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12819         o.result_ok
12820 }
12821 #[no_mangle]
12822 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12823 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12824 impl Drop for CResult_FundingLockedDecodeErrorZ {
12825         fn drop(&mut self) {
12826                 if self.result_ok {
12827                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12828                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12829                         }
12830                 } else {
12831                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12832                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12833                         }
12834                 }
12835         }
12836 }
12837 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12838         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12839                 let contents = if o.result_ok {
12840                         let result = unsafe { o.contents.result };
12841                         unsafe { o.contents.result = core::ptr::null_mut() };
12842                         CResult_FundingLockedDecodeErrorZPtr { result }
12843                 } else {
12844                         let err = unsafe { o.contents.err };
12845                         unsafe { o.contents.err = core::ptr::null_mut(); }
12846                         CResult_FundingLockedDecodeErrorZPtr { err }
12847                 };
12848                 Self {
12849                         contents,
12850                         result_ok: o.result_ok,
12851                 }
12852         }
12853 }
12854 impl Clone for CResult_FundingLockedDecodeErrorZ {
12855         fn clone(&self) -> Self {
12856                 if self.result_ok {
12857                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12858                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12859                         } }
12860                 } else {
12861                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12862                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12863                         } }
12864                 }
12865         }
12866 }
12867 #[no_mangle]
12868 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12869 /// but with all dynamically-allocated buffers duplicated in new buffers.
12870 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12871 #[repr(C)]
12872 /// The contents of CResult_InitDecodeErrorZ
12873 pub union CResult_InitDecodeErrorZPtr {
12874         /// A pointer to the contents in the success state.
12875         /// Reading from this pointer when `result_ok` is not set is undefined.
12876         pub result: *mut crate::lightning::ln::msgs::Init,
12877         /// A pointer to the contents in the error state.
12878         /// Reading from this pointer when `result_ok` is set is undefined.
12879         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12880 }
12881 #[repr(C)]
12882 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12883 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12885 pub struct CResult_InitDecodeErrorZ {
12886         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12887         /// `err` or `result` depending on the state of `result_ok`.
12888         pub contents: CResult_InitDecodeErrorZPtr,
12889         /// Whether this CResult_InitDecodeErrorZ represents a success state.
12890         pub result_ok: bool,
12891 }
12892 #[no_mangle]
12893 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12894 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12895         CResult_InitDecodeErrorZ {
12896                 contents: CResult_InitDecodeErrorZPtr {
12897                         result: Box::into_raw(Box::new(o)),
12898                 },
12899                 result_ok: true,
12900         }
12901 }
12902 #[no_mangle]
12903 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12904 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12905         CResult_InitDecodeErrorZ {
12906                 contents: CResult_InitDecodeErrorZPtr {
12907                         err: Box::into_raw(Box::new(e)),
12908                 },
12909                 result_ok: false,
12910         }
12911 }
12912 /// Checks if the given object is currently in the success state
12913 #[no_mangle]
12914 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12915         o.result_ok
12916 }
12917 #[no_mangle]
12918 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12919 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12920 impl Drop for CResult_InitDecodeErrorZ {
12921         fn drop(&mut self) {
12922                 if self.result_ok {
12923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12925                         }
12926                 } else {
12927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12929                         }
12930                 }
12931         }
12932 }
12933 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12934         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12935                 let contents = if o.result_ok {
12936                         let result = unsafe { o.contents.result };
12937                         unsafe { o.contents.result = core::ptr::null_mut() };
12938                         CResult_InitDecodeErrorZPtr { result }
12939                 } else {
12940                         let err = unsafe { o.contents.err };
12941                         unsafe { o.contents.err = core::ptr::null_mut(); }
12942                         CResult_InitDecodeErrorZPtr { err }
12943                 };
12944                 Self {
12945                         contents,
12946                         result_ok: o.result_ok,
12947                 }
12948         }
12949 }
12950 impl Clone for CResult_InitDecodeErrorZ {
12951         fn clone(&self) -> Self {
12952                 if self.result_ok {
12953                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12954                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12955                         } }
12956                 } else {
12957                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12958                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12959                         } }
12960                 }
12961         }
12962 }
12963 #[no_mangle]
12964 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12965 /// but with all dynamically-allocated buffers duplicated in new buffers.
12966 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12967 #[repr(C)]
12968 /// The contents of CResult_OpenChannelDecodeErrorZ
12969 pub union CResult_OpenChannelDecodeErrorZPtr {
12970         /// A pointer to the contents in the success state.
12971         /// Reading from this pointer when `result_ok` is not set is undefined.
12972         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12973         /// A pointer to the contents in the error state.
12974         /// Reading from this pointer when `result_ok` is set is undefined.
12975         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12976 }
12977 #[repr(C)]
12978 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12979 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12981 pub struct CResult_OpenChannelDecodeErrorZ {
12982         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12983         /// `err` or `result` depending on the state of `result_ok`.
12984         pub contents: CResult_OpenChannelDecodeErrorZPtr,
12985         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12986         pub result_ok: bool,
12987 }
12988 #[no_mangle]
12989 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12990 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12991         CResult_OpenChannelDecodeErrorZ {
12992                 contents: CResult_OpenChannelDecodeErrorZPtr {
12993                         result: Box::into_raw(Box::new(o)),
12994                 },
12995                 result_ok: true,
12996         }
12997 }
12998 #[no_mangle]
12999 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13000 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13001         CResult_OpenChannelDecodeErrorZ {
13002                 contents: CResult_OpenChannelDecodeErrorZPtr {
13003                         err: Box::into_raw(Box::new(e)),
13004                 },
13005                 result_ok: false,
13006         }
13007 }
13008 /// Checks if the given object is currently in the success state
13009 #[no_mangle]
13010 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13011         o.result_ok
13012 }
13013 #[no_mangle]
13014 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13015 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13016 impl Drop for CResult_OpenChannelDecodeErrorZ {
13017         fn drop(&mut self) {
13018                 if self.result_ok {
13019                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13020                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13021                         }
13022                 } else {
13023                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13024                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13025                         }
13026                 }
13027         }
13028 }
13029 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13030         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13031                 let contents = if o.result_ok {
13032                         let result = unsafe { o.contents.result };
13033                         unsafe { o.contents.result = core::ptr::null_mut() };
13034                         CResult_OpenChannelDecodeErrorZPtr { result }
13035                 } else {
13036                         let err = unsafe { o.contents.err };
13037                         unsafe { o.contents.err = core::ptr::null_mut(); }
13038                         CResult_OpenChannelDecodeErrorZPtr { err }
13039                 };
13040                 Self {
13041                         contents,
13042                         result_ok: o.result_ok,
13043                 }
13044         }
13045 }
13046 impl Clone for CResult_OpenChannelDecodeErrorZ {
13047         fn clone(&self) -> Self {
13048                 if self.result_ok {
13049                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13050                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13051                         } }
13052                 } else {
13053                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13054                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13055                         } }
13056                 }
13057         }
13058 }
13059 #[no_mangle]
13060 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13061 /// but with all dynamically-allocated buffers duplicated in new buffers.
13062 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13063 #[repr(C)]
13064 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13065 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13066         /// A pointer to the contents in the success state.
13067         /// Reading from this pointer when `result_ok` is not set is undefined.
13068         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13069         /// A pointer to the contents in the error state.
13070         /// Reading from this pointer when `result_ok` is set is undefined.
13071         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13072 }
13073 #[repr(C)]
13074 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13075 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13076 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13077 pub struct CResult_RevokeAndACKDecodeErrorZ {
13078         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13079         /// `err` or `result` depending on the state of `result_ok`.
13080         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13081         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13082         pub result_ok: bool,
13083 }
13084 #[no_mangle]
13085 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13086 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13087         CResult_RevokeAndACKDecodeErrorZ {
13088                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13089                         result: Box::into_raw(Box::new(o)),
13090                 },
13091                 result_ok: true,
13092         }
13093 }
13094 #[no_mangle]
13095 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13096 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13097         CResult_RevokeAndACKDecodeErrorZ {
13098                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13099                         err: Box::into_raw(Box::new(e)),
13100                 },
13101                 result_ok: false,
13102         }
13103 }
13104 /// Checks if the given object is currently in the success state
13105 #[no_mangle]
13106 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13107         o.result_ok
13108 }
13109 #[no_mangle]
13110 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13111 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13112 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13113         fn drop(&mut self) {
13114                 if self.result_ok {
13115                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13116                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13117                         }
13118                 } else {
13119                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13120                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13121                         }
13122                 }
13123         }
13124 }
13125 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13126         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13127                 let contents = if o.result_ok {
13128                         let result = unsafe { o.contents.result };
13129                         unsafe { o.contents.result = core::ptr::null_mut() };
13130                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13131                 } else {
13132                         let err = unsafe { o.contents.err };
13133                         unsafe { o.contents.err = core::ptr::null_mut(); }
13134                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13135                 };
13136                 Self {
13137                         contents,
13138                         result_ok: o.result_ok,
13139                 }
13140         }
13141 }
13142 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13143         fn clone(&self) -> Self {
13144                 if self.result_ok {
13145                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13146                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13147                         } }
13148                 } else {
13149                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13150                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13151                         } }
13152                 }
13153         }
13154 }
13155 #[no_mangle]
13156 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13157 /// but with all dynamically-allocated buffers duplicated in new buffers.
13158 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13159 #[repr(C)]
13160 /// The contents of CResult_ShutdownDecodeErrorZ
13161 pub union CResult_ShutdownDecodeErrorZPtr {
13162         /// A pointer to the contents in the success state.
13163         /// Reading from this pointer when `result_ok` is not set is undefined.
13164         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13165         /// A pointer to the contents in the error state.
13166         /// Reading from this pointer when `result_ok` is set is undefined.
13167         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13168 }
13169 #[repr(C)]
13170 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13171 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13173 pub struct CResult_ShutdownDecodeErrorZ {
13174         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13175         /// `err` or `result` depending on the state of `result_ok`.
13176         pub contents: CResult_ShutdownDecodeErrorZPtr,
13177         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13178         pub result_ok: bool,
13179 }
13180 #[no_mangle]
13181 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13182 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13183         CResult_ShutdownDecodeErrorZ {
13184                 contents: CResult_ShutdownDecodeErrorZPtr {
13185                         result: Box::into_raw(Box::new(o)),
13186                 },
13187                 result_ok: true,
13188         }
13189 }
13190 #[no_mangle]
13191 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13192 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13193         CResult_ShutdownDecodeErrorZ {
13194                 contents: CResult_ShutdownDecodeErrorZPtr {
13195                         err: Box::into_raw(Box::new(e)),
13196                 },
13197                 result_ok: false,
13198         }
13199 }
13200 /// Checks if the given object is currently in the success state
13201 #[no_mangle]
13202 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13203         o.result_ok
13204 }
13205 #[no_mangle]
13206 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13207 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13208 impl Drop for CResult_ShutdownDecodeErrorZ {
13209         fn drop(&mut self) {
13210                 if self.result_ok {
13211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13213                         }
13214                 } else {
13215                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13216                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13217                         }
13218                 }
13219         }
13220 }
13221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13222         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13223                 let contents = if o.result_ok {
13224                         let result = unsafe { o.contents.result };
13225                         unsafe { o.contents.result = core::ptr::null_mut() };
13226                         CResult_ShutdownDecodeErrorZPtr { result }
13227                 } else {
13228                         let err = unsafe { o.contents.err };
13229                         unsafe { o.contents.err = core::ptr::null_mut(); }
13230                         CResult_ShutdownDecodeErrorZPtr { err }
13231                 };
13232                 Self {
13233                         contents,
13234                         result_ok: o.result_ok,
13235                 }
13236         }
13237 }
13238 impl Clone for CResult_ShutdownDecodeErrorZ {
13239         fn clone(&self) -> Self {
13240                 if self.result_ok {
13241                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13242                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13243                         } }
13244                 } else {
13245                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13246                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13247                         } }
13248                 }
13249         }
13250 }
13251 #[no_mangle]
13252 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13253 /// but with all dynamically-allocated buffers duplicated in new buffers.
13254 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13255 #[repr(C)]
13256 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13257 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13258         /// A pointer to the contents in the success state.
13259         /// Reading from this pointer when `result_ok` is not set is undefined.
13260         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13261         /// A pointer to the contents in the error state.
13262         /// Reading from this pointer when `result_ok` is set is undefined.
13263         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13264 }
13265 #[repr(C)]
13266 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13267 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13268 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13269 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13270         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13271         /// `err` or `result` depending on the state of `result_ok`.
13272         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13273         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13274         pub result_ok: bool,
13275 }
13276 #[no_mangle]
13277 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13278 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13279         CResult_UpdateFailHTLCDecodeErrorZ {
13280                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13281                         result: Box::into_raw(Box::new(o)),
13282                 },
13283                 result_ok: true,
13284         }
13285 }
13286 #[no_mangle]
13287 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13288 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13289         CResult_UpdateFailHTLCDecodeErrorZ {
13290                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13291                         err: Box::into_raw(Box::new(e)),
13292                 },
13293                 result_ok: false,
13294         }
13295 }
13296 /// Checks if the given object is currently in the success state
13297 #[no_mangle]
13298 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13299         o.result_ok
13300 }
13301 #[no_mangle]
13302 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13303 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13304 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13305         fn drop(&mut self) {
13306                 if self.result_ok {
13307                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13308                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13309                         }
13310                 } else {
13311                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13312                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13313                         }
13314                 }
13315         }
13316 }
13317 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13318         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13319                 let contents = if o.result_ok {
13320                         let result = unsafe { o.contents.result };
13321                         unsafe { o.contents.result = core::ptr::null_mut() };
13322                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13323                 } else {
13324                         let err = unsafe { o.contents.err };
13325                         unsafe { o.contents.err = core::ptr::null_mut(); }
13326                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13327                 };
13328                 Self {
13329                         contents,
13330                         result_ok: o.result_ok,
13331                 }
13332         }
13333 }
13334 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13335         fn clone(&self) -> Self {
13336                 if self.result_ok {
13337                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13338                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13339                         } }
13340                 } else {
13341                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13342                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13343                         } }
13344                 }
13345         }
13346 }
13347 #[no_mangle]
13348 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13349 /// but with all dynamically-allocated buffers duplicated in new buffers.
13350 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13351 #[repr(C)]
13352 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13353 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13354         /// A pointer to the contents in the success state.
13355         /// Reading from this pointer when `result_ok` is not set is undefined.
13356         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13357         /// A pointer to the contents in the error state.
13358         /// Reading from this pointer when `result_ok` is set is undefined.
13359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13360 }
13361 #[repr(C)]
13362 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13363 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13365 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13366         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13367         /// `err` or `result` depending on the state of `result_ok`.
13368         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13369         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13370         pub result_ok: bool,
13371 }
13372 #[no_mangle]
13373 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13374 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13375         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13376                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13377                         result: Box::into_raw(Box::new(o)),
13378                 },
13379                 result_ok: true,
13380         }
13381 }
13382 #[no_mangle]
13383 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13384 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13385         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13386                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13387                         err: Box::into_raw(Box::new(e)),
13388                 },
13389                 result_ok: false,
13390         }
13391 }
13392 /// Checks if the given object is currently in the success state
13393 #[no_mangle]
13394 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13395         o.result_ok
13396 }
13397 #[no_mangle]
13398 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13399 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13400 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13401         fn drop(&mut self) {
13402                 if self.result_ok {
13403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13405                         }
13406                 } else {
13407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13409                         }
13410                 }
13411         }
13412 }
13413 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13415                 let contents = if o.result_ok {
13416                         let result = unsafe { o.contents.result };
13417                         unsafe { o.contents.result = core::ptr::null_mut() };
13418                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13419                 } else {
13420                         let err = unsafe { o.contents.err };
13421                         unsafe { o.contents.err = core::ptr::null_mut(); }
13422                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13423                 };
13424                 Self {
13425                         contents,
13426                         result_ok: o.result_ok,
13427                 }
13428         }
13429 }
13430 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13431         fn clone(&self) -> Self {
13432                 if self.result_ok {
13433                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13434                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13435                         } }
13436                 } else {
13437                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13439                         } }
13440                 }
13441         }
13442 }
13443 #[no_mangle]
13444 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13445 /// but with all dynamically-allocated buffers duplicated in new buffers.
13446 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13447 #[repr(C)]
13448 /// The contents of CResult_UpdateFeeDecodeErrorZ
13449 pub union CResult_UpdateFeeDecodeErrorZPtr {
13450         /// A pointer to the contents in the success state.
13451         /// Reading from this pointer when `result_ok` is not set is undefined.
13452         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13453         /// A pointer to the contents in the error state.
13454         /// Reading from this pointer when `result_ok` is set is undefined.
13455         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13456 }
13457 #[repr(C)]
13458 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13459 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13460 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13461 pub struct CResult_UpdateFeeDecodeErrorZ {
13462         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13463         /// `err` or `result` depending on the state of `result_ok`.
13464         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13465         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13466         pub result_ok: bool,
13467 }
13468 #[no_mangle]
13469 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13470 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13471         CResult_UpdateFeeDecodeErrorZ {
13472                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13473                         result: Box::into_raw(Box::new(o)),
13474                 },
13475                 result_ok: true,
13476         }
13477 }
13478 #[no_mangle]
13479 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13480 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13481         CResult_UpdateFeeDecodeErrorZ {
13482                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13483                         err: Box::into_raw(Box::new(e)),
13484                 },
13485                 result_ok: false,
13486         }
13487 }
13488 /// Checks if the given object is currently in the success state
13489 #[no_mangle]
13490 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13491         o.result_ok
13492 }
13493 #[no_mangle]
13494 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13495 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13496 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13497         fn drop(&mut self) {
13498                 if self.result_ok {
13499                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13500                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13501                         }
13502                 } else {
13503                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13504                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13505                         }
13506                 }
13507         }
13508 }
13509 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13510         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13511                 let contents = if o.result_ok {
13512                         let result = unsafe { o.contents.result };
13513                         unsafe { o.contents.result = core::ptr::null_mut() };
13514                         CResult_UpdateFeeDecodeErrorZPtr { result }
13515                 } else {
13516                         let err = unsafe { o.contents.err };
13517                         unsafe { o.contents.err = core::ptr::null_mut(); }
13518                         CResult_UpdateFeeDecodeErrorZPtr { err }
13519                 };
13520                 Self {
13521                         contents,
13522                         result_ok: o.result_ok,
13523                 }
13524         }
13525 }
13526 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13527         fn clone(&self) -> Self {
13528                 if self.result_ok {
13529                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13530                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13531                         } }
13532                 } else {
13533                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13534                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13535                         } }
13536                 }
13537         }
13538 }
13539 #[no_mangle]
13540 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13541 /// but with all dynamically-allocated buffers duplicated in new buffers.
13542 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13543 #[repr(C)]
13544 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13545 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13546         /// A pointer to the contents in the success state.
13547         /// Reading from this pointer when `result_ok` is not set is undefined.
13548         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13549         /// A pointer to the contents in the error state.
13550         /// Reading from this pointer when `result_ok` is set is undefined.
13551         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13552 }
13553 #[repr(C)]
13554 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13555 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13557 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13558         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13559         /// `err` or `result` depending on the state of `result_ok`.
13560         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13561         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13562         pub result_ok: bool,
13563 }
13564 #[no_mangle]
13565 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13566 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13567         CResult_UpdateFulfillHTLCDecodeErrorZ {
13568                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13569                         result: Box::into_raw(Box::new(o)),
13570                 },
13571                 result_ok: true,
13572         }
13573 }
13574 #[no_mangle]
13575 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13576 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13577         CResult_UpdateFulfillHTLCDecodeErrorZ {
13578                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13579                         err: Box::into_raw(Box::new(e)),
13580                 },
13581                 result_ok: false,
13582         }
13583 }
13584 /// Checks if the given object is currently in the success state
13585 #[no_mangle]
13586 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13587         o.result_ok
13588 }
13589 #[no_mangle]
13590 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13591 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13592 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13593         fn drop(&mut self) {
13594                 if self.result_ok {
13595                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13596                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13597                         }
13598                 } else {
13599                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13600                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13601                         }
13602                 }
13603         }
13604 }
13605 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13606         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13607                 let contents = if o.result_ok {
13608                         let result = unsafe { o.contents.result };
13609                         unsafe { o.contents.result = core::ptr::null_mut() };
13610                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13611                 } else {
13612                         let err = unsafe { o.contents.err };
13613                         unsafe { o.contents.err = core::ptr::null_mut(); }
13614                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13615                 };
13616                 Self {
13617                         contents,
13618                         result_ok: o.result_ok,
13619                 }
13620         }
13621 }
13622 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13623         fn clone(&self) -> Self {
13624                 if self.result_ok {
13625                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13626                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13627                         } }
13628                 } else {
13629                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13630                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13631                         } }
13632                 }
13633         }
13634 }
13635 #[no_mangle]
13636 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13637 /// but with all dynamically-allocated buffers duplicated in new buffers.
13638 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13639 #[repr(C)]
13640 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13641 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13642         /// A pointer to the contents in the success state.
13643         /// Reading from this pointer when `result_ok` is not set is undefined.
13644         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13645         /// A pointer to the contents in the error state.
13646         /// Reading from this pointer when `result_ok` is set is undefined.
13647         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13648 }
13649 #[repr(C)]
13650 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13651 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13652 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13653 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13654         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13655         /// `err` or `result` depending on the state of `result_ok`.
13656         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13657         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13658         pub result_ok: bool,
13659 }
13660 #[no_mangle]
13661 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13662 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13663         CResult_UpdateAddHTLCDecodeErrorZ {
13664                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13665                         result: Box::into_raw(Box::new(o)),
13666                 },
13667                 result_ok: true,
13668         }
13669 }
13670 #[no_mangle]
13671 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13672 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13673         CResult_UpdateAddHTLCDecodeErrorZ {
13674                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13675                         err: Box::into_raw(Box::new(e)),
13676                 },
13677                 result_ok: false,
13678         }
13679 }
13680 /// Checks if the given object is currently in the success state
13681 #[no_mangle]
13682 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13683         o.result_ok
13684 }
13685 #[no_mangle]
13686 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13687 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13688 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13689         fn drop(&mut self) {
13690                 if self.result_ok {
13691                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13692                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13693                         }
13694                 } else {
13695                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13696                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13697                         }
13698                 }
13699         }
13700 }
13701 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13702         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13703                 let contents = if o.result_ok {
13704                         let result = unsafe { o.contents.result };
13705                         unsafe { o.contents.result = core::ptr::null_mut() };
13706                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13707                 } else {
13708                         let err = unsafe { o.contents.err };
13709                         unsafe { o.contents.err = core::ptr::null_mut(); }
13710                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13711                 };
13712                 Self {
13713                         contents,
13714                         result_ok: o.result_ok,
13715                 }
13716         }
13717 }
13718 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13719         fn clone(&self) -> Self {
13720                 if self.result_ok {
13721                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13722                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13723                         } }
13724                 } else {
13725                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13726                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13727                         } }
13728                 }
13729         }
13730 }
13731 #[no_mangle]
13732 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13733 /// but with all dynamically-allocated buffers duplicated in new buffers.
13734 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13735 #[repr(C)]
13736 /// The contents of CResult_PingDecodeErrorZ
13737 pub union CResult_PingDecodeErrorZPtr {
13738         /// A pointer to the contents in the success state.
13739         /// Reading from this pointer when `result_ok` is not set is undefined.
13740         pub result: *mut crate::lightning::ln::msgs::Ping,
13741         /// A pointer to the contents in the error state.
13742         /// Reading from this pointer when `result_ok` is set is undefined.
13743         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13744 }
13745 #[repr(C)]
13746 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13747 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13749 pub struct CResult_PingDecodeErrorZ {
13750         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13751         /// `err` or `result` depending on the state of `result_ok`.
13752         pub contents: CResult_PingDecodeErrorZPtr,
13753         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13754         pub result_ok: bool,
13755 }
13756 #[no_mangle]
13757 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13758 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13759         CResult_PingDecodeErrorZ {
13760                 contents: CResult_PingDecodeErrorZPtr {
13761                         result: Box::into_raw(Box::new(o)),
13762                 },
13763                 result_ok: true,
13764         }
13765 }
13766 #[no_mangle]
13767 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13768 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13769         CResult_PingDecodeErrorZ {
13770                 contents: CResult_PingDecodeErrorZPtr {
13771                         err: Box::into_raw(Box::new(e)),
13772                 },
13773                 result_ok: false,
13774         }
13775 }
13776 /// Checks if the given object is currently in the success state
13777 #[no_mangle]
13778 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13779         o.result_ok
13780 }
13781 #[no_mangle]
13782 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13783 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13784 impl Drop for CResult_PingDecodeErrorZ {
13785         fn drop(&mut self) {
13786                 if self.result_ok {
13787                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13788                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13789                         }
13790                 } else {
13791                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13792                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13793                         }
13794                 }
13795         }
13796 }
13797 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13798         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13799                 let contents = if o.result_ok {
13800                         let result = unsafe { o.contents.result };
13801                         unsafe { o.contents.result = core::ptr::null_mut() };
13802                         CResult_PingDecodeErrorZPtr { result }
13803                 } else {
13804                         let err = unsafe { o.contents.err };
13805                         unsafe { o.contents.err = core::ptr::null_mut(); }
13806                         CResult_PingDecodeErrorZPtr { err }
13807                 };
13808                 Self {
13809                         contents,
13810                         result_ok: o.result_ok,
13811                 }
13812         }
13813 }
13814 impl Clone for CResult_PingDecodeErrorZ {
13815         fn clone(&self) -> Self {
13816                 if self.result_ok {
13817                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13818                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13819                         } }
13820                 } else {
13821                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13822                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13823                         } }
13824                 }
13825         }
13826 }
13827 #[no_mangle]
13828 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13829 /// but with all dynamically-allocated buffers duplicated in new buffers.
13830 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13831 #[repr(C)]
13832 /// The contents of CResult_PongDecodeErrorZ
13833 pub union CResult_PongDecodeErrorZPtr {
13834         /// A pointer to the contents in the success state.
13835         /// Reading from this pointer when `result_ok` is not set is undefined.
13836         pub result: *mut crate::lightning::ln::msgs::Pong,
13837         /// A pointer to the contents in the error state.
13838         /// Reading from this pointer when `result_ok` is set is undefined.
13839         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13840 }
13841 #[repr(C)]
13842 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13843 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13844 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13845 pub struct CResult_PongDecodeErrorZ {
13846         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13847         /// `err` or `result` depending on the state of `result_ok`.
13848         pub contents: CResult_PongDecodeErrorZPtr,
13849         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13850         pub result_ok: bool,
13851 }
13852 #[no_mangle]
13853 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13854 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13855         CResult_PongDecodeErrorZ {
13856                 contents: CResult_PongDecodeErrorZPtr {
13857                         result: Box::into_raw(Box::new(o)),
13858                 },
13859                 result_ok: true,
13860         }
13861 }
13862 #[no_mangle]
13863 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13864 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13865         CResult_PongDecodeErrorZ {
13866                 contents: CResult_PongDecodeErrorZPtr {
13867                         err: Box::into_raw(Box::new(e)),
13868                 },
13869                 result_ok: false,
13870         }
13871 }
13872 /// Checks if the given object is currently in the success state
13873 #[no_mangle]
13874 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13875         o.result_ok
13876 }
13877 #[no_mangle]
13878 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13879 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13880 impl Drop for CResult_PongDecodeErrorZ {
13881         fn drop(&mut self) {
13882                 if self.result_ok {
13883                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13884                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13885                         }
13886                 } else {
13887                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13888                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13889                         }
13890                 }
13891         }
13892 }
13893 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13894         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13895                 let contents = if o.result_ok {
13896                         let result = unsafe { o.contents.result };
13897                         unsafe { o.contents.result = core::ptr::null_mut() };
13898                         CResult_PongDecodeErrorZPtr { result }
13899                 } else {
13900                         let err = unsafe { o.contents.err };
13901                         unsafe { o.contents.err = core::ptr::null_mut(); }
13902                         CResult_PongDecodeErrorZPtr { err }
13903                 };
13904                 Self {
13905                         contents,
13906                         result_ok: o.result_ok,
13907                 }
13908         }
13909 }
13910 impl Clone for CResult_PongDecodeErrorZ {
13911         fn clone(&self) -> Self {
13912                 if self.result_ok {
13913                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13914                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13915                         } }
13916                 } else {
13917                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13918                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13919                         } }
13920                 }
13921         }
13922 }
13923 #[no_mangle]
13924 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13925 /// but with all dynamically-allocated buffers duplicated in new buffers.
13926 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13927 #[repr(C)]
13928 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13929 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13930         /// A pointer to the contents in the success state.
13931         /// Reading from this pointer when `result_ok` is not set is undefined.
13932         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13933         /// A pointer to the contents in the error state.
13934         /// Reading from this pointer when `result_ok` is set is undefined.
13935         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13936 }
13937 #[repr(C)]
13938 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13939 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13940 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13941 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13942         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13943         /// `err` or `result` depending on the state of `result_ok`.
13944         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13945         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13946         pub result_ok: bool,
13947 }
13948 #[no_mangle]
13949 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13950 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13951         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13952                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13953                         result: Box::into_raw(Box::new(o)),
13954                 },
13955                 result_ok: true,
13956         }
13957 }
13958 #[no_mangle]
13959 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13960 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13961         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13962                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13963                         err: Box::into_raw(Box::new(e)),
13964                 },
13965                 result_ok: false,
13966         }
13967 }
13968 /// Checks if the given object is currently in the success state
13969 #[no_mangle]
13970 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13971         o.result_ok
13972 }
13973 #[no_mangle]
13974 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13975 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13976 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13977         fn drop(&mut self) {
13978                 if self.result_ok {
13979                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13980                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13981                         }
13982                 } else {
13983                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13984                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13985                         }
13986                 }
13987         }
13988 }
13989 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13990         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13991                 let contents = if o.result_ok {
13992                         let result = unsafe { o.contents.result };
13993                         unsafe { o.contents.result = core::ptr::null_mut() };
13994                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13995                 } else {
13996                         let err = unsafe { o.contents.err };
13997                         unsafe { o.contents.err = core::ptr::null_mut(); }
13998                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13999                 };
14000                 Self {
14001                         contents,
14002                         result_ok: o.result_ok,
14003                 }
14004         }
14005 }
14006 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14007         fn clone(&self) -> Self {
14008                 if self.result_ok {
14009                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14010                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14011                         } }
14012                 } else {
14013                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14014                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14015                         } }
14016                 }
14017         }
14018 }
14019 #[no_mangle]
14020 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14021 /// but with all dynamically-allocated buffers duplicated in new buffers.
14022 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14023 #[repr(C)]
14024 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14025 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14026         /// A pointer to the contents in the success state.
14027         /// Reading from this pointer when `result_ok` is not set is undefined.
14028         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14029         /// A pointer to the contents in the error state.
14030         /// Reading from this pointer when `result_ok` is set is undefined.
14031         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14032 }
14033 #[repr(C)]
14034 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14035 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14037 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14038         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14039         /// `err` or `result` depending on the state of `result_ok`.
14040         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14041         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14042         pub result_ok: bool,
14043 }
14044 #[no_mangle]
14045 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14046 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14047         CResult_ChannelAnnouncementDecodeErrorZ {
14048                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14049                         result: Box::into_raw(Box::new(o)),
14050                 },
14051                 result_ok: true,
14052         }
14053 }
14054 #[no_mangle]
14055 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14056 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14057         CResult_ChannelAnnouncementDecodeErrorZ {
14058                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14059                         err: Box::into_raw(Box::new(e)),
14060                 },
14061                 result_ok: false,
14062         }
14063 }
14064 /// Checks if the given object is currently in the success state
14065 #[no_mangle]
14066 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14067         o.result_ok
14068 }
14069 #[no_mangle]
14070 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14071 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14072 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14073         fn drop(&mut self) {
14074                 if self.result_ok {
14075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14077                         }
14078                 } else {
14079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14081                         }
14082                 }
14083         }
14084 }
14085 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14087                 let contents = if o.result_ok {
14088                         let result = unsafe { o.contents.result };
14089                         unsafe { o.contents.result = core::ptr::null_mut() };
14090                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14091                 } else {
14092                         let err = unsafe { o.contents.err };
14093                         unsafe { o.contents.err = core::ptr::null_mut(); }
14094                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14095                 };
14096                 Self {
14097                         contents,
14098                         result_ok: o.result_ok,
14099                 }
14100         }
14101 }
14102 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14103         fn clone(&self) -> Self {
14104                 if self.result_ok {
14105                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14106                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14107                         } }
14108                 } else {
14109                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14110                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14111                         } }
14112                 }
14113         }
14114 }
14115 #[no_mangle]
14116 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14117 /// but with all dynamically-allocated buffers duplicated in new buffers.
14118 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14119 #[repr(C)]
14120 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14121 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14122         /// A pointer to the contents in the success state.
14123         /// Reading from this pointer when `result_ok` is not set is undefined.
14124         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14125         /// A pointer to the contents in the error state.
14126         /// Reading from this pointer when `result_ok` is set is undefined.
14127         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14128 }
14129 #[repr(C)]
14130 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14131 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14133 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14134         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14135         /// `err` or `result` depending on the state of `result_ok`.
14136         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14137         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14138         pub result_ok: bool,
14139 }
14140 #[no_mangle]
14141 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14142 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14143         CResult_UnsignedChannelUpdateDecodeErrorZ {
14144                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14145                         result: Box::into_raw(Box::new(o)),
14146                 },
14147                 result_ok: true,
14148         }
14149 }
14150 #[no_mangle]
14151 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14152 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14153         CResult_UnsignedChannelUpdateDecodeErrorZ {
14154                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14155                         err: Box::into_raw(Box::new(e)),
14156                 },
14157                 result_ok: false,
14158         }
14159 }
14160 /// Checks if the given object is currently in the success state
14161 #[no_mangle]
14162 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14163         o.result_ok
14164 }
14165 #[no_mangle]
14166 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14167 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14168 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14169         fn drop(&mut self) {
14170                 if self.result_ok {
14171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14173                         }
14174                 } else {
14175                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14176                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14177                         }
14178                 }
14179         }
14180 }
14181 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14182         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14183                 let contents = if o.result_ok {
14184                         let result = unsafe { o.contents.result };
14185                         unsafe { o.contents.result = core::ptr::null_mut() };
14186                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14187                 } else {
14188                         let err = unsafe { o.contents.err };
14189                         unsafe { o.contents.err = core::ptr::null_mut(); }
14190                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14191                 };
14192                 Self {
14193                         contents,
14194                         result_ok: o.result_ok,
14195                 }
14196         }
14197 }
14198 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14199         fn clone(&self) -> Self {
14200                 if self.result_ok {
14201                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14202                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14203                         } }
14204                 } else {
14205                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14206                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14207                         } }
14208                 }
14209         }
14210 }
14211 #[no_mangle]
14212 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14213 /// but with all dynamically-allocated buffers duplicated in new buffers.
14214 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14215 #[repr(C)]
14216 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14217 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14218         /// A pointer to the contents in the success state.
14219         /// Reading from this pointer when `result_ok` is not set is undefined.
14220         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14221         /// A pointer to the contents in the error state.
14222         /// Reading from this pointer when `result_ok` is set is undefined.
14223         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14224 }
14225 #[repr(C)]
14226 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14227 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14228 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14229 pub struct CResult_ChannelUpdateDecodeErrorZ {
14230         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14231         /// `err` or `result` depending on the state of `result_ok`.
14232         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14233         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14234         pub result_ok: bool,
14235 }
14236 #[no_mangle]
14237 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14238 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14239         CResult_ChannelUpdateDecodeErrorZ {
14240                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14241                         result: Box::into_raw(Box::new(o)),
14242                 },
14243                 result_ok: true,
14244         }
14245 }
14246 #[no_mangle]
14247 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14248 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14249         CResult_ChannelUpdateDecodeErrorZ {
14250                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14251                         err: Box::into_raw(Box::new(e)),
14252                 },
14253                 result_ok: false,
14254         }
14255 }
14256 /// Checks if the given object is currently in the success state
14257 #[no_mangle]
14258 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14259         o.result_ok
14260 }
14261 #[no_mangle]
14262 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14263 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14264 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14265         fn drop(&mut self) {
14266                 if self.result_ok {
14267                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14268                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14269                         }
14270                 } else {
14271                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14272                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14273                         }
14274                 }
14275         }
14276 }
14277 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14278         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14279                 let contents = if o.result_ok {
14280                         let result = unsafe { o.contents.result };
14281                         unsafe { o.contents.result = core::ptr::null_mut() };
14282                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14283                 } else {
14284                         let err = unsafe { o.contents.err };
14285                         unsafe { o.contents.err = core::ptr::null_mut(); }
14286                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14287                 };
14288                 Self {
14289                         contents,
14290                         result_ok: o.result_ok,
14291                 }
14292         }
14293 }
14294 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14295         fn clone(&self) -> Self {
14296                 if self.result_ok {
14297                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14298                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14299                         } }
14300                 } else {
14301                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14302                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14303                         } }
14304                 }
14305         }
14306 }
14307 #[no_mangle]
14308 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14309 /// but with all dynamically-allocated buffers duplicated in new buffers.
14310 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14311 #[repr(C)]
14312 /// The contents of CResult_ErrorMessageDecodeErrorZ
14313 pub union CResult_ErrorMessageDecodeErrorZPtr {
14314         /// A pointer to the contents in the success state.
14315         /// Reading from this pointer when `result_ok` is not set is undefined.
14316         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14317         /// A pointer to the contents in the error state.
14318         /// Reading from this pointer when `result_ok` is set is undefined.
14319         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14320 }
14321 #[repr(C)]
14322 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14323 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14324 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14325 pub struct CResult_ErrorMessageDecodeErrorZ {
14326         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14327         /// `err` or `result` depending on the state of `result_ok`.
14328         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14329         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14330         pub result_ok: bool,
14331 }
14332 #[no_mangle]
14333 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14334 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14335         CResult_ErrorMessageDecodeErrorZ {
14336                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14337                         result: Box::into_raw(Box::new(o)),
14338                 },
14339                 result_ok: true,
14340         }
14341 }
14342 #[no_mangle]
14343 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14344 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14345         CResult_ErrorMessageDecodeErrorZ {
14346                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14347                         err: Box::into_raw(Box::new(e)),
14348                 },
14349                 result_ok: false,
14350         }
14351 }
14352 /// Checks if the given object is currently in the success state
14353 #[no_mangle]
14354 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14355         o.result_ok
14356 }
14357 #[no_mangle]
14358 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14359 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14360 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14361         fn drop(&mut self) {
14362                 if self.result_ok {
14363                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14364                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14365                         }
14366                 } else {
14367                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14368                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14369                         }
14370                 }
14371         }
14372 }
14373 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14374         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14375                 let contents = if o.result_ok {
14376                         let result = unsafe { o.contents.result };
14377                         unsafe { o.contents.result = core::ptr::null_mut() };
14378                         CResult_ErrorMessageDecodeErrorZPtr { result }
14379                 } else {
14380                         let err = unsafe { o.contents.err };
14381                         unsafe { o.contents.err = core::ptr::null_mut(); }
14382                         CResult_ErrorMessageDecodeErrorZPtr { err }
14383                 };
14384                 Self {
14385                         contents,
14386                         result_ok: o.result_ok,
14387                 }
14388         }
14389 }
14390 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14391         fn clone(&self) -> Self {
14392                 if self.result_ok {
14393                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14394                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14395                         } }
14396                 } else {
14397                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14398                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14399                         } }
14400                 }
14401         }
14402 }
14403 #[no_mangle]
14404 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14405 /// but with all dynamically-allocated buffers duplicated in new buffers.
14406 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14407 #[repr(C)]
14408 /// The contents of CResult_WarningMessageDecodeErrorZ
14409 pub union CResult_WarningMessageDecodeErrorZPtr {
14410         /// A pointer to the contents in the success state.
14411         /// Reading from this pointer when `result_ok` is not set is undefined.
14412         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14413         /// A pointer to the contents in the error state.
14414         /// Reading from this pointer when `result_ok` is set is undefined.
14415         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14416 }
14417 #[repr(C)]
14418 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14419 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14420 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14421 pub struct CResult_WarningMessageDecodeErrorZ {
14422         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14423         /// `err` or `result` depending on the state of `result_ok`.
14424         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14425         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14426         pub result_ok: bool,
14427 }
14428 #[no_mangle]
14429 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14430 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14431         CResult_WarningMessageDecodeErrorZ {
14432                 contents: CResult_WarningMessageDecodeErrorZPtr {
14433                         result: Box::into_raw(Box::new(o)),
14434                 },
14435                 result_ok: true,
14436         }
14437 }
14438 #[no_mangle]
14439 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14440 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14441         CResult_WarningMessageDecodeErrorZ {
14442                 contents: CResult_WarningMessageDecodeErrorZPtr {
14443                         err: Box::into_raw(Box::new(e)),
14444                 },
14445                 result_ok: false,
14446         }
14447 }
14448 /// Checks if the given object is currently in the success state
14449 #[no_mangle]
14450 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14451         o.result_ok
14452 }
14453 #[no_mangle]
14454 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14455 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14456 impl Drop for CResult_WarningMessageDecodeErrorZ {
14457         fn drop(&mut self) {
14458                 if self.result_ok {
14459                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14460                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14461                         }
14462                 } else {
14463                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14464                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14465                         }
14466                 }
14467         }
14468 }
14469 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14470         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14471                 let contents = if o.result_ok {
14472                         let result = unsafe { o.contents.result };
14473                         unsafe { o.contents.result = core::ptr::null_mut() };
14474                         CResult_WarningMessageDecodeErrorZPtr { result }
14475                 } else {
14476                         let err = unsafe { o.contents.err };
14477                         unsafe { o.contents.err = core::ptr::null_mut(); }
14478                         CResult_WarningMessageDecodeErrorZPtr { err }
14479                 };
14480                 Self {
14481                         contents,
14482                         result_ok: o.result_ok,
14483                 }
14484         }
14485 }
14486 impl Clone for CResult_WarningMessageDecodeErrorZ {
14487         fn clone(&self) -> Self {
14488                 if self.result_ok {
14489                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14490                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14491                         } }
14492                 } else {
14493                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14494                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14495                         } }
14496                 }
14497         }
14498 }
14499 #[no_mangle]
14500 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14501 /// but with all dynamically-allocated buffers duplicated in new buffers.
14502 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14503 #[repr(C)]
14504 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14505 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14506         /// A pointer to the contents in the success state.
14507         /// Reading from this pointer when `result_ok` is not set is undefined.
14508         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14509         /// A pointer to the contents in the error state.
14510         /// Reading from this pointer when `result_ok` is set is undefined.
14511         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14512 }
14513 #[repr(C)]
14514 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14515 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14517 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14518         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14519         /// `err` or `result` depending on the state of `result_ok`.
14520         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14521         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14522         pub result_ok: bool,
14523 }
14524 #[no_mangle]
14525 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14526 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14527         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14528                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14529                         result: Box::into_raw(Box::new(o)),
14530                 },
14531                 result_ok: true,
14532         }
14533 }
14534 #[no_mangle]
14535 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14536 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14537         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14538                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14539                         err: Box::into_raw(Box::new(e)),
14540                 },
14541                 result_ok: false,
14542         }
14543 }
14544 /// Checks if the given object is currently in the success state
14545 #[no_mangle]
14546 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14547         o.result_ok
14548 }
14549 #[no_mangle]
14550 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14551 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14552 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14553         fn drop(&mut self) {
14554                 if self.result_ok {
14555                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14556                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14557                         }
14558                 } else {
14559                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14560                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14561                         }
14562                 }
14563         }
14564 }
14565 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14566         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14567                 let contents = if o.result_ok {
14568                         let result = unsafe { o.contents.result };
14569                         unsafe { o.contents.result = core::ptr::null_mut() };
14570                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14571                 } else {
14572                         let err = unsafe { o.contents.err };
14573                         unsafe { o.contents.err = core::ptr::null_mut(); }
14574                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14575                 };
14576                 Self {
14577                         contents,
14578                         result_ok: o.result_ok,
14579                 }
14580         }
14581 }
14582 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14583         fn clone(&self) -> Self {
14584                 if self.result_ok {
14585                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14586                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14587                         } }
14588                 } else {
14589                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14590                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14591                         } }
14592                 }
14593         }
14594 }
14595 #[no_mangle]
14596 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14597 /// but with all dynamically-allocated buffers duplicated in new buffers.
14598 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14599 #[repr(C)]
14600 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14601 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14602         /// A pointer to the contents in the success state.
14603         /// Reading from this pointer when `result_ok` is not set is undefined.
14604         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14605         /// A pointer to the contents in the error state.
14606         /// Reading from this pointer when `result_ok` is set is undefined.
14607         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14608 }
14609 #[repr(C)]
14610 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14611 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14613 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14614         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14615         /// `err` or `result` depending on the state of `result_ok`.
14616         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14617         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14618         pub result_ok: bool,
14619 }
14620 #[no_mangle]
14621 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14622 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14623         CResult_NodeAnnouncementDecodeErrorZ {
14624                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14625                         result: Box::into_raw(Box::new(o)),
14626                 },
14627                 result_ok: true,
14628         }
14629 }
14630 #[no_mangle]
14631 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14632 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14633         CResult_NodeAnnouncementDecodeErrorZ {
14634                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14635                         err: Box::into_raw(Box::new(e)),
14636                 },
14637                 result_ok: false,
14638         }
14639 }
14640 /// Checks if the given object is currently in the success state
14641 #[no_mangle]
14642 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14643         o.result_ok
14644 }
14645 #[no_mangle]
14646 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14647 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14648 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14649         fn drop(&mut self) {
14650                 if self.result_ok {
14651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14653                         }
14654                 } else {
14655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14657                         }
14658                 }
14659         }
14660 }
14661 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14663                 let contents = if o.result_ok {
14664                         let result = unsafe { o.contents.result };
14665                         unsafe { o.contents.result = core::ptr::null_mut() };
14666                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14667                 } else {
14668                         let err = unsafe { o.contents.err };
14669                         unsafe { o.contents.err = core::ptr::null_mut(); }
14670                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14671                 };
14672                 Self {
14673                         contents,
14674                         result_ok: o.result_ok,
14675                 }
14676         }
14677 }
14678 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14679         fn clone(&self) -> Self {
14680                 if self.result_ok {
14681                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14682                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14683                         } }
14684                 } else {
14685                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14686                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14687                         } }
14688                 }
14689         }
14690 }
14691 #[no_mangle]
14692 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14693 /// but with all dynamically-allocated buffers duplicated in new buffers.
14694 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14695 #[repr(C)]
14696 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14697 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14698         /// A pointer to the contents in the success state.
14699         /// Reading from this pointer when `result_ok` is not set is undefined.
14700         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14701         /// A pointer to the contents in the error state.
14702         /// Reading from this pointer when `result_ok` is set is undefined.
14703         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14704 }
14705 #[repr(C)]
14706 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14707 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14709 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14710         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14711         /// `err` or `result` depending on the state of `result_ok`.
14712         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14713         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14714         pub result_ok: bool,
14715 }
14716 #[no_mangle]
14717 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14718 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14719         CResult_QueryShortChannelIdsDecodeErrorZ {
14720                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14721                         result: Box::into_raw(Box::new(o)),
14722                 },
14723                 result_ok: true,
14724         }
14725 }
14726 #[no_mangle]
14727 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14728 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14729         CResult_QueryShortChannelIdsDecodeErrorZ {
14730                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14731                         err: Box::into_raw(Box::new(e)),
14732                 },
14733                 result_ok: false,
14734         }
14735 }
14736 /// Checks if the given object is currently in the success state
14737 #[no_mangle]
14738 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14739         o.result_ok
14740 }
14741 #[no_mangle]
14742 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14743 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14744 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14745         fn drop(&mut self) {
14746                 if self.result_ok {
14747                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14748                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14749                         }
14750                 } else {
14751                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14752                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14753                         }
14754                 }
14755         }
14756 }
14757 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14758         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14759                 let contents = if o.result_ok {
14760                         let result = unsafe { o.contents.result };
14761                         unsafe { o.contents.result = core::ptr::null_mut() };
14762                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14763                 } else {
14764                         let err = unsafe { o.contents.err };
14765                         unsafe { o.contents.err = core::ptr::null_mut(); }
14766                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14767                 };
14768                 Self {
14769                         contents,
14770                         result_ok: o.result_ok,
14771                 }
14772         }
14773 }
14774 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14775         fn clone(&self) -> Self {
14776                 if self.result_ok {
14777                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14778                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14779                         } }
14780                 } else {
14781                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14782                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14783                         } }
14784                 }
14785         }
14786 }
14787 #[no_mangle]
14788 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14789 /// but with all dynamically-allocated buffers duplicated in new buffers.
14790 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14791 #[repr(C)]
14792 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14793 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14794         /// A pointer to the contents in the success state.
14795         /// Reading from this pointer when `result_ok` is not set is undefined.
14796         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14797         /// A pointer to the contents in the error state.
14798         /// Reading from this pointer when `result_ok` is set is undefined.
14799         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14800 }
14801 #[repr(C)]
14802 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14803 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14804 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14805 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14806         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14807         /// `err` or `result` depending on the state of `result_ok`.
14808         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14809         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14810         pub result_ok: bool,
14811 }
14812 #[no_mangle]
14813 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14814 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14815         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14816                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14817                         result: Box::into_raw(Box::new(o)),
14818                 },
14819                 result_ok: true,
14820         }
14821 }
14822 #[no_mangle]
14823 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14824 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14825         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14826                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14827                         err: Box::into_raw(Box::new(e)),
14828                 },
14829                 result_ok: false,
14830         }
14831 }
14832 /// Checks if the given object is currently in the success state
14833 #[no_mangle]
14834 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14835         o.result_ok
14836 }
14837 #[no_mangle]
14838 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14839 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14840 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14841         fn drop(&mut self) {
14842                 if self.result_ok {
14843                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14844                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14845                         }
14846                 } else {
14847                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14848                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14849                         }
14850                 }
14851         }
14852 }
14853 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14854         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14855                 let contents = if o.result_ok {
14856                         let result = unsafe { o.contents.result };
14857                         unsafe { o.contents.result = core::ptr::null_mut() };
14858                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14859                 } else {
14860                         let err = unsafe { o.contents.err };
14861                         unsafe { o.contents.err = core::ptr::null_mut(); }
14862                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14863                 };
14864                 Self {
14865                         contents,
14866                         result_ok: o.result_ok,
14867                 }
14868         }
14869 }
14870 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14871         fn clone(&self) -> Self {
14872                 if self.result_ok {
14873                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14874                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14875                         } }
14876                 } else {
14877                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14878                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14879                         } }
14880                 }
14881         }
14882 }
14883 #[no_mangle]
14884 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14885 /// but with all dynamically-allocated buffers duplicated in new buffers.
14886 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14887 #[repr(C)]
14888 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14889 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14890         /// A pointer to the contents in the success state.
14891         /// Reading from this pointer when `result_ok` is not set is undefined.
14892         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14893         /// A pointer to the contents in the error state.
14894         /// Reading from this pointer when `result_ok` is set is undefined.
14895         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14896 }
14897 #[repr(C)]
14898 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14899 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14900 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14901 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14902         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14903         /// `err` or `result` depending on the state of `result_ok`.
14904         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14905         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14906         pub result_ok: bool,
14907 }
14908 #[no_mangle]
14909 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14910 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14911         CResult_QueryChannelRangeDecodeErrorZ {
14912                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14913                         result: Box::into_raw(Box::new(o)),
14914                 },
14915                 result_ok: true,
14916         }
14917 }
14918 #[no_mangle]
14919 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14920 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14921         CResult_QueryChannelRangeDecodeErrorZ {
14922                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14923                         err: Box::into_raw(Box::new(e)),
14924                 },
14925                 result_ok: false,
14926         }
14927 }
14928 /// Checks if the given object is currently in the success state
14929 #[no_mangle]
14930 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14931         o.result_ok
14932 }
14933 #[no_mangle]
14934 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14935 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14936 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14937         fn drop(&mut self) {
14938                 if self.result_ok {
14939                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14940                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14941                         }
14942                 } else {
14943                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14944                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14945                         }
14946                 }
14947         }
14948 }
14949 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14950         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14951                 let contents = if o.result_ok {
14952                         let result = unsafe { o.contents.result };
14953                         unsafe { o.contents.result = core::ptr::null_mut() };
14954                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
14955                 } else {
14956                         let err = unsafe { o.contents.err };
14957                         unsafe { o.contents.err = core::ptr::null_mut(); }
14958                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
14959                 };
14960                 Self {
14961                         contents,
14962                         result_ok: o.result_ok,
14963                 }
14964         }
14965 }
14966 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14967         fn clone(&self) -> Self {
14968                 if self.result_ok {
14969                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14970                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14971                         } }
14972                 } else {
14973                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14974                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14975                         } }
14976                 }
14977         }
14978 }
14979 #[no_mangle]
14980 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14981 /// but with all dynamically-allocated buffers duplicated in new buffers.
14982 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14983 #[repr(C)]
14984 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14985 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14986         /// A pointer to the contents in the success state.
14987         /// Reading from this pointer when `result_ok` is not set is undefined.
14988         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14989         /// A pointer to the contents in the error state.
14990         /// Reading from this pointer when `result_ok` is set is undefined.
14991         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14992 }
14993 #[repr(C)]
14994 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14995 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14996 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14997 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14998         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14999         /// `err` or `result` depending on the state of `result_ok`.
15000         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15001         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15002         pub result_ok: bool,
15003 }
15004 #[no_mangle]
15005 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15006 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15007         CResult_ReplyChannelRangeDecodeErrorZ {
15008                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15009                         result: Box::into_raw(Box::new(o)),
15010                 },
15011                 result_ok: true,
15012         }
15013 }
15014 #[no_mangle]
15015 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15016 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15017         CResult_ReplyChannelRangeDecodeErrorZ {
15018                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15019                         err: Box::into_raw(Box::new(e)),
15020                 },
15021                 result_ok: false,
15022         }
15023 }
15024 /// Checks if the given object is currently in the success state
15025 #[no_mangle]
15026 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15027         o.result_ok
15028 }
15029 #[no_mangle]
15030 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15031 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15032 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15033         fn drop(&mut self) {
15034                 if self.result_ok {
15035                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15036                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15037                         }
15038                 } else {
15039                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15040                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15041                         }
15042                 }
15043         }
15044 }
15045 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15046         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15047                 let contents = if o.result_ok {
15048                         let result = unsafe { o.contents.result };
15049                         unsafe { o.contents.result = core::ptr::null_mut() };
15050                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15051                 } else {
15052                         let err = unsafe { o.contents.err };
15053                         unsafe { o.contents.err = core::ptr::null_mut(); }
15054                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15055                 };
15056                 Self {
15057                         contents,
15058                         result_ok: o.result_ok,
15059                 }
15060         }
15061 }
15062 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15063         fn clone(&self) -> Self {
15064                 if self.result_ok {
15065                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15066                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15067                         } }
15068                 } else {
15069                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15070                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15071                         } }
15072                 }
15073         }
15074 }
15075 #[no_mangle]
15076 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15077 /// but with all dynamically-allocated buffers duplicated in new buffers.
15078 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15079 #[repr(C)]
15080 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15081 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15082         /// A pointer to the contents in the success state.
15083         /// Reading from this pointer when `result_ok` is not set is undefined.
15084         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15085         /// A pointer to the contents in the error state.
15086         /// Reading from this pointer when `result_ok` is set is undefined.
15087         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15088 }
15089 #[repr(C)]
15090 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15091 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15093 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15094         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15095         /// `err` or `result` depending on the state of `result_ok`.
15096         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15097         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15098         pub result_ok: bool,
15099 }
15100 #[no_mangle]
15101 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15102 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15103         CResult_GossipTimestampFilterDecodeErrorZ {
15104                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15105                         result: Box::into_raw(Box::new(o)),
15106                 },
15107                 result_ok: true,
15108         }
15109 }
15110 #[no_mangle]
15111 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15112 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15113         CResult_GossipTimestampFilterDecodeErrorZ {
15114                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15115                         err: Box::into_raw(Box::new(e)),
15116                 },
15117                 result_ok: false,
15118         }
15119 }
15120 /// Checks if the given object is currently in the success state
15121 #[no_mangle]
15122 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15123         o.result_ok
15124 }
15125 #[no_mangle]
15126 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15127 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15128 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15129         fn drop(&mut self) {
15130                 if self.result_ok {
15131                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15132                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15133                         }
15134                 } else {
15135                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15136                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15137                         }
15138                 }
15139         }
15140 }
15141 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15142         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15143                 let contents = if o.result_ok {
15144                         let result = unsafe { o.contents.result };
15145                         unsafe { o.contents.result = core::ptr::null_mut() };
15146                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15147                 } else {
15148                         let err = unsafe { o.contents.err };
15149                         unsafe { o.contents.err = core::ptr::null_mut(); }
15150                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15151                 };
15152                 Self {
15153                         contents,
15154                         result_ok: o.result_ok,
15155                 }
15156         }
15157 }
15158 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15159         fn clone(&self) -> Self {
15160                 if self.result_ok {
15161                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15162                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15163                         } }
15164                 } else {
15165                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15166                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15167                         } }
15168                 }
15169         }
15170 }
15171 #[no_mangle]
15172 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15173 /// but with all dynamically-allocated buffers duplicated in new buffers.
15174 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15175 #[repr(C)]
15176 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15177 /// This corresponds to std::vector in C++
15178 pub struct CVec_PhantomRouteHintsZ {
15179         /// The elements in the array.
15180         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15181         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15182         /// The number of elements pointed to by `data`.
15183         pub datalen: usize
15184 }
15185 impl CVec_PhantomRouteHintsZ {
15186         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15187                 if self.datalen == 0 { return Vec::new(); }
15188                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15189                 self.data = core::ptr::null_mut();
15190                 self.datalen = 0;
15191                 ret
15192         }
15193         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15194                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15195         }
15196 }
15197 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15198         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15199                 let datalen = v.len();
15200                 let data = Box::into_raw(v.into_boxed_slice());
15201                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15202         }
15203 }
15204 #[no_mangle]
15205 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15206 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15207 impl Drop for CVec_PhantomRouteHintsZ {
15208         fn drop(&mut self) {
15209                 if self.datalen == 0 { return; }
15210                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15211         }
15212 }
15213 #[repr(C)]
15214 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15215 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15216         /// A pointer to the contents in the success state.
15217         /// Reading from this pointer when `result_ok` is not set is undefined.
15218         pub result: *mut crate::lightning_invoice::Invoice,
15219         /// A pointer to the contents in the error state.
15220         /// Reading from this pointer when `result_ok` is set is undefined.
15221         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15222 }
15223 #[repr(C)]
15224 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15225 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15227 pub struct CResult_InvoiceSignOrCreationErrorZ {
15228         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15229         /// `err` or `result` depending on the state of `result_ok`.
15230         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15231         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15232         pub result_ok: bool,
15233 }
15234 #[no_mangle]
15235 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15236 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15237         CResult_InvoiceSignOrCreationErrorZ {
15238                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15239                         result: Box::into_raw(Box::new(o)),
15240                 },
15241                 result_ok: true,
15242         }
15243 }
15244 #[no_mangle]
15245 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15246 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15247         CResult_InvoiceSignOrCreationErrorZ {
15248                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15249                         err: Box::into_raw(Box::new(e)),
15250                 },
15251                 result_ok: false,
15252         }
15253 }
15254 /// Checks if the given object is currently in the success state
15255 #[no_mangle]
15256 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15257         o.result_ok
15258 }
15259 #[no_mangle]
15260 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15261 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15262 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15263         fn drop(&mut self) {
15264                 if self.result_ok {
15265                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15266                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15267                         }
15268                 } else {
15269                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15270                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15271                         }
15272                 }
15273         }
15274 }
15275 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15276         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15277                 let contents = if o.result_ok {
15278                         let result = unsafe { o.contents.result };
15279                         unsafe { o.contents.result = core::ptr::null_mut() };
15280                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15281                 } else {
15282                         let err = unsafe { o.contents.err };
15283                         unsafe { o.contents.err = core::ptr::null_mut(); }
15284                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15285                 };
15286                 Self {
15287                         contents,
15288                         result_ok: o.result_ok,
15289                 }
15290         }
15291 }
15292 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15293         fn clone(&self) -> Self {
15294                 if self.result_ok {
15295                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15296                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15297                         } }
15298                 } else {
15299                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15300                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15301                         } }
15302                 }
15303         }
15304 }
15305 #[no_mangle]
15306 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15307 /// but with all dynamically-allocated buffers duplicated in new buffers.
15308 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15309 #[repr(C)]
15310 /// An enum which can either contain a crate::lightning::chain::Filter or not
15311 pub enum COption_FilterZ {
15312         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15313         Some(crate::lightning::chain::Filter),
15314         /// When we're in this state, this COption_FilterZ contains nothing
15315         None
15316 }
15317 impl COption_FilterZ {
15318         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15319                 if let Self::None = self { false } else { true }
15320         }
15321         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15322                 !self.is_some()
15323         }
15324         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15325                 if let Self::Some(v) = self { v } else { unreachable!() }
15326         }
15327 }
15328 #[no_mangle]
15329 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15330 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15331         COption_FilterZ::Some(o)
15332 }
15333 #[no_mangle]
15334 /// Constructs a new COption_FilterZ containing nothing
15335 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15336         COption_FilterZ::None
15337 }
15338 #[no_mangle]
15339 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15340 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15341 #[repr(C)]
15342 /// The contents of CResult_LockedChannelMonitorNoneZ
15343 pub union CResult_LockedChannelMonitorNoneZPtr {
15344         /// A pointer to the contents in the success state.
15345         /// Reading from this pointer when `result_ok` is not set is undefined.
15346         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15347         /// Note that this value is always NULL, as there are no contents in the Err variant
15348         pub err: *mut core::ffi::c_void,
15349 }
15350 #[repr(C)]
15351 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15352 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15354 pub struct CResult_LockedChannelMonitorNoneZ {
15355         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15356         /// `err` or `result` depending on the state of `result_ok`.
15357         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15358         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15359         pub result_ok: bool,
15360 }
15361 #[no_mangle]
15362 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15363 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15364         CResult_LockedChannelMonitorNoneZ {
15365                 contents: CResult_LockedChannelMonitorNoneZPtr {
15366                         result: Box::into_raw(Box::new(o)),
15367                 },
15368                 result_ok: true,
15369         }
15370 }
15371 #[no_mangle]
15372 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15373 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15374         CResult_LockedChannelMonitorNoneZ {
15375                 contents: CResult_LockedChannelMonitorNoneZPtr {
15376                         err: core::ptr::null_mut(),
15377                 },
15378                 result_ok: false,
15379         }
15380 }
15381 /// Checks if the given object is currently in the success state
15382 #[no_mangle]
15383 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15384         o.result_ok
15385 }
15386 #[no_mangle]
15387 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15388 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15389 impl Drop for CResult_LockedChannelMonitorNoneZ {
15390         fn drop(&mut self) {
15391                 if self.result_ok {
15392                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15393                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15394                         }
15395                 } else {
15396                 }
15397         }
15398 }
15399 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15400         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15401                 let contents = if o.result_ok {
15402                         let result = unsafe { o.contents.result };
15403                         unsafe { o.contents.result = core::ptr::null_mut() };
15404                         CResult_LockedChannelMonitorNoneZPtr { result }
15405                 } else {
15406                         let _ = unsafe { Box::from_raw(o.contents.err) };
15407                         o.contents.err = core::ptr::null_mut();
15408                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15409                 };
15410                 Self {
15411                         contents,
15412                         result_ok: o.result_ok,
15413                 }
15414         }
15415 }
15416 #[repr(C)]
15417 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15418 /// This corresponds to std::vector in C++
15419 pub struct CVec_OutPointZ {
15420         /// The elements in the array.
15421         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15422         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15423         /// The number of elements pointed to by `data`.
15424         pub datalen: usize
15425 }
15426 impl CVec_OutPointZ {
15427         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15428                 if self.datalen == 0 { return Vec::new(); }
15429                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15430                 self.data = core::ptr::null_mut();
15431                 self.datalen = 0;
15432                 ret
15433         }
15434         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15435                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15436         }
15437 }
15438 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15439         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15440                 let datalen = v.len();
15441                 let data = Box::into_raw(v.into_boxed_slice());
15442                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15443         }
15444 }
15445 #[no_mangle]
15446 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15447 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15448 impl Drop for CVec_OutPointZ {
15449         fn drop(&mut self) {
15450                 if self.datalen == 0 { return; }
15451                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15452         }
15453 }
15454 impl Clone for CVec_OutPointZ {
15455         fn clone(&self) -> Self {
15456                 let mut res = Vec::new();
15457                 if self.datalen == 0 { return Self::from(res); }
15458                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15459                 Self::from(res)
15460         }
15461 }