Update auto-generated bindings
[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 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2829 /// This corresponds to std::vector in C++
2830 pub struct CVec_PublicKeyZ {
2831         /// The elements in the array.
2832         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2833         pub data: *mut crate::c_types::PublicKey,
2834         /// The number of elements pointed to by `data`.
2835         pub datalen: usize
2836 }
2837 impl CVec_PublicKeyZ {
2838         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2839                 if self.datalen == 0 { return Vec::new(); }
2840                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2841                 self.data = core::ptr::null_mut();
2842                 self.datalen = 0;
2843                 ret
2844         }
2845         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2846                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2847         }
2848 }
2849 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2850         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2851                 let datalen = v.len();
2852                 let data = Box::into_raw(v.into_boxed_slice());
2853                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2854         }
2855 }
2856 #[no_mangle]
2857 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2858 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2859 impl Drop for CVec_PublicKeyZ {
2860         fn drop(&mut self) {
2861                 if self.datalen == 0 { return; }
2862                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2863         }
2864 }
2865 impl Clone for CVec_PublicKeyZ {
2866         fn clone(&self) -> Self {
2867                 let mut res = Vec::new();
2868                 if self.datalen == 0 { return Self::from(res); }
2869                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2870                 Self::from(res)
2871         }
2872 }
2873 #[repr(C)]
2874 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2875 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2876         /// A pointer to the contents in the success state.
2877         /// Reading from this pointer when `result_ok` is not set is undefined.
2878         pub result: *mut crate::lightning::util::events::PaymentPurpose,
2879         /// A pointer to the contents in the error state.
2880         /// Reading from this pointer when `result_ok` is set is undefined.
2881         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2882 }
2883 #[repr(C)]
2884 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2885 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2887 pub struct CResult_PaymentPurposeDecodeErrorZ {
2888         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2889         /// `err` or `result` depending on the state of `result_ok`.
2890         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2891         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2892         pub result_ok: bool,
2893 }
2894 #[no_mangle]
2895 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2896 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2897         CResult_PaymentPurposeDecodeErrorZ {
2898                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2899                         result: Box::into_raw(Box::new(o)),
2900                 },
2901                 result_ok: true,
2902         }
2903 }
2904 #[no_mangle]
2905 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2906 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2907         CResult_PaymentPurposeDecodeErrorZ {
2908                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2909                         err: Box::into_raw(Box::new(e)),
2910                 },
2911                 result_ok: false,
2912         }
2913 }
2914 /// Checks if the given object is currently in the success state
2915 #[no_mangle]
2916 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2917         o.result_ok
2918 }
2919 #[no_mangle]
2920 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2921 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2922 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2923         fn drop(&mut self) {
2924                 if self.result_ok {
2925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2927                         }
2928                 } else {
2929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2931                         }
2932                 }
2933         }
2934 }
2935 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2936         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2937                 let contents = if o.result_ok {
2938                         let result = unsafe { o.contents.result };
2939                         unsafe { o.contents.result = core::ptr::null_mut() };
2940                         CResult_PaymentPurposeDecodeErrorZPtr { result }
2941                 } else {
2942                         let err = unsafe { o.contents.err };
2943                         unsafe { o.contents.err = core::ptr::null_mut(); }
2944                         CResult_PaymentPurposeDecodeErrorZPtr { err }
2945                 };
2946                 Self {
2947                         contents,
2948                         result_ok: o.result_ok,
2949                 }
2950         }
2951 }
2952 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2953         fn clone(&self) -> Self {
2954                 if self.result_ok {
2955                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2956                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
2957                         } }
2958                 } else {
2959                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2961                         } }
2962                 }
2963         }
2964 }
2965 #[no_mangle]
2966 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
2967 /// but with all dynamically-allocated buffers duplicated in new buffers.
2968 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
2969 #[repr(C)]
2970 #[derive(Clone)]
2971 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2972 pub enum COption_ClosureReasonZ {
2973         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2974         Some(crate::lightning::util::events::ClosureReason),
2975         /// When we're in this state, this COption_ClosureReasonZ contains nothing
2976         None
2977 }
2978 impl COption_ClosureReasonZ {
2979         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2980                 if let Self::None = self { false } else { true }
2981         }
2982         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2983                 !self.is_some()
2984         }
2985         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
2986                 if let Self::Some(v) = self { v } else { unreachable!() }
2987         }
2988 }
2989 #[no_mangle]
2990 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
2991 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
2992         COption_ClosureReasonZ::Some(o)
2993 }
2994 #[no_mangle]
2995 /// Constructs a new COption_ClosureReasonZ containing nothing
2996 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
2997         COption_ClosureReasonZ::None
2998 }
2999 #[no_mangle]
3000 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3001 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3002 #[no_mangle]
3003 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3004 /// but with all dynamically-allocated buffers duplicated in new buffers.
3005 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3006 #[repr(C)]
3007 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3008 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3009         /// A pointer to the contents in the success state.
3010         /// Reading from this pointer when `result_ok` is not set is undefined.
3011         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3012         /// A pointer to the contents in the error state.
3013         /// Reading from this pointer when `result_ok` is set is undefined.
3014         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3015 }
3016 #[repr(C)]
3017 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3018 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3020 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3021         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3022         /// `err` or `result` depending on the state of `result_ok`.
3023         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3024         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3025         pub result_ok: bool,
3026 }
3027 #[no_mangle]
3028 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3029 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3030         CResult_COption_ClosureReasonZDecodeErrorZ {
3031                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3032                         result: Box::into_raw(Box::new(o)),
3033                 },
3034                 result_ok: true,
3035         }
3036 }
3037 #[no_mangle]
3038 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3039 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3040         CResult_COption_ClosureReasonZDecodeErrorZ {
3041                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3042                         err: Box::into_raw(Box::new(e)),
3043                 },
3044                 result_ok: false,
3045         }
3046 }
3047 /// Checks if the given object is currently in the success state
3048 #[no_mangle]
3049 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3050         o.result_ok
3051 }
3052 #[no_mangle]
3053 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3054 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3055 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3056         fn drop(&mut self) {
3057                 if self.result_ok {
3058                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3059                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3060                         }
3061                 } else {
3062                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3063                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3064                         }
3065                 }
3066         }
3067 }
3068 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3069         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3070                 let contents = if o.result_ok {
3071                         let result = unsafe { o.contents.result };
3072                         unsafe { o.contents.result = core::ptr::null_mut() };
3073                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3074                 } else {
3075                         let err = unsafe { o.contents.err };
3076                         unsafe { o.contents.err = core::ptr::null_mut(); }
3077                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3078                 };
3079                 Self {
3080                         contents,
3081                         result_ok: o.result_ok,
3082                 }
3083         }
3084 }
3085 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3086         fn clone(&self) -> Self {
3087                 if self.result_ok {
3088                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3089                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3090                         } }
3091                 } else {
3092                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3093                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3094                         } }
3095                 }
3096         }
3097 }
3098 #[no_mangle]
3099 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3100 /// but with all dynamically-allocated buffers duplicated in new buffers.
3101 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3102 #[repr(C)]
3103 #[derive(Clone)]
3104 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3105 pub enum COption_NetworkUpdateZ {
3106         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3107         Some(crate::lightning::routing::gossip::NetworkUpdate),
3108         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3109         None
3110 }
3111 impl COption_NetworkUpdateZ {
3112         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3113                 if let Self::None = self { false } else { true }
3114         }
3115         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3116                 !self.is_some()
3117         }
3118         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3119                 if let Self::Some(v) = self { v } else { unreachable!() }
3120         }
3121 }
3122 #[no_mangle]
3123 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3124 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3125         COption_NetworkUpdateZ::Some(o)
3126 }
3127 #[no_mangle]
3128 /// Constructs a new COption_NetworkUpdateZ containing nothing
3129 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3130         COption_NetworkUpdateZ::None
3131 }
3132 #[no_mangle]
3133 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3134 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3135 #[no_mangle]
3136 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3137 /// but with all dynamically-allocated buffers duplicated in new buffers.
3138 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3139 #[repr(C)]
3140 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3141 /// This corresponds to std::vector in C++
3142 pub struct CVec_SpendableOutputDescriptorZ {
3143         /// The elements in the array.
3144         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3145         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3146         /// The number of elements pointed to by `data`.
3147         pub datalen: usize
3148 }
3149 impl CVec_SpendableOutputDescriptorZ {
3150         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3151                 if self.datalen == 0 { return Vec::new(); }
3152                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3153                 self.data = core::ptr::null_mut();
3154                 self.datalen = 0;
3155                 ret
3156         }
3157         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3158                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3159         }
3160 }
3161 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3162         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3163                 let datalen = v.len();
3164                 let data = Box::into_raw(v.into_boxed_slice());
3165                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3166         }
3167 }
3168 #[no_mangle]
3169 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3170 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3171 impl Drop for CVec_SpendableOutputDescriptorZ {
3172         fn drop(&mut self) {
3173                 if self.datalen == 0 { return; }
3174                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3175         }
3176 }
3177 impl Clone for CVec_SpendableOutputDescriptorZ {
3178         fn clone(&self) -> Self {
3179                 let mut res = Vec::new();
3180                 if self.datalen == 0 { return Self::from(res); }
3181                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3182                 Self::from(res)
3183         }
3184 }
3185 #[repr(C)]
3186 #[derive(Clone)]
3187 /// An enum which can either contain a crate::lightning::util::events::Event or not
3188 pub enum COption_EventZ {
3189         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3190         Some(crate::lightning::util::events::Event),
3191         /// When we're in this state, this COption_EventZ contains nothing
3192         None
3193 }
3194 impl COption_EventZ {
3195         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3196                 if let Self::None = self { false } else { true }
3197         }
3198         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3199                 !self.is_some()
3200         }
3201         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3202                 if let Self::Some(v) = self { v } else { unreachable!() }
3203         }
3204 }
3205 #[no_mangle]
3206 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3207 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3208         COption_EventZ::Some(o)
3209 }
3210 #[no_mangle]
3211 /// Constructs a new COption_EventZ containing nothing
3212 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3213         COption_EventZ::None
3214 }
3215 #[no_mangle]
3216 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3217 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3218 #[no_mangle]
3219 /// Creates a new COption_EventZ which has the same data as `orig`
3220 /// but with all dynamically-allocated buffers duplicated in new buffers.
3221 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3222 #[repr(C)]
3223 /// The contents of CResult_COption_EventZDecodeErrorZ
3224 pub union CResult_COption_EventZDecodeErrorZPtr {
3225         /// A pointer to the contents in the success state.
3226         /// Reading from this pointer when `result_ok` is not set is undefined.
3227         pub result: *mut crate::c_types::derived::COption_EventZ,
3228         /// A pointer to the contents in the error state.
3229         /// Reading from this pointer when `result_ok` is set is undefined.
3230         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3231 }
3232 #[repr(C)]
3233 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3234 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3236 pub struct CResult_COption_EventZDecodeErrorZ {
3237         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3238         /// `err` or `result` depending on the state of `result_ok`.
3239         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3240         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3241         pub result_ok: bool,
3242 }
3243 #[no_mangle]
3244 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3245 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3246         CResult_COption_EventZDecodeErrorZ {
3247                 contents: CResult_COption_EventZDecodeErrorZPtr {
3248                         result: Box::into_raw(Box::new(o)),
3249                 },
3250                 result_ok: true,
3251         }
3252 }
3253 #[no_mangle]
3254 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3255 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3256         CResult_COption_EventZDecodeErrorZ {
3257                 contents: CResult_COption_EventZDecodeErrorZPtr {
3258                         err: Box::into_raw(Box::new(e)),
3259                 },
3260                 result_ok: false,
3261         }
3262 }
3263 /// Checks if the given object is currently in the success state
3264 #[no_mangle]
3265 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3266         o.result_ok
3267 }
3268 #[no_mangle]
3269 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3270 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3271 impl Drop for CResult_COption_EventZDecodeErrorZ {
3272         fn drop(&mut self) {
3273                 if self.result_ok {
3274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3276                         }
3277                 } else {
3278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3280                         }
3281                 }
3282         }
3283 }
3284 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3285         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3286                 let contents = if o.result_ok {
3287                         let result = unsafe { o.contents.result };
3288                         unsafe { o.contents.result = core::ptr::null_mut() };
3289                         CResult_COption_EventZDecodeErrorZPtr { result }
3290                 } else {
3291                         let err = unsafe { o.contents.err };
3292                         unsafe { o.contents.err = core::ptr::null_mut(); }
3293                         CResult_COption_EventZDecodeErrorZPtr { err }
3294                 };
3295                 Self {
3296                         contents,
3297                         result_ok: o.result_ok,
3298                 }
3299         }
3300 }
3301 impl Clone for CResult_COption_EventZDecodeErrorZ {
3302         fn clone(&self) -> Self {
3303                 if self.result_ok {
3304                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3305                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3306                         } }
3307                 } else {
3308                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3309                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3310                         } }
3311                 }
3312         }
3313 }
3314 #[no_mangle]
3315 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3316 /// but with all dynamically-allocated buffers duplicated in new buffers.
3317 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3318 #[repr(C)]
3319 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3320 /// This corresponds to std::vector in C++
3321 pub struct CVec_MessageSendEventZ {
3322         /// The elements in the array.
3323         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3324         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3325         /// The number of elements pointed to by `data`.
3326         pub datalen: usize
3327 }
3328 impl CVec_MessageSendEventZ {
3329         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3330                 if self.datalen == 0 { return Vec::new(); }
3331                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3332                 self.data = core::ptr::null_mut();
3333                 self.datalen = 0;
3334                 ret
3335         }
3336         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3337                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3338         }
3339 }
3340 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3341         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3342                 let datalen = v.len();
3343                 let data = Box::into_raw(v.into_boxed_slice());
3344                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3345         }
3346 }
3347 #[no_mangle]
3348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3349 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3350 impl Drop for CVec_MessageSendEventZ {
3351         fn drop(&mut self) {
3352                 if self.datalen == 0 { return; }
3353                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3354         }
3355 }
3356 impl Clone for CVec_MessageSendEventZ {
3357         fn clone(&self) -> Self {
3358                 let mut res = Vec::new();
3359                 if self.datalen == 0 { return Self::from(res); }
3360                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3361                 Self::from(res)
3362         }
3363 }
3364 #[repr(C)]
3365 /// The contents of CResult_TxOutAccessErrorZ
3366 pub union CResult_TxOutAccessErrorZPtr {
3367         /// A pointer to the contents in the success state.
3368         /// Reading from this pointer when `result_ok` is not set is undefined.
3369         pub result: *mut crate::c_types::TxOut,
3370         /// A pointer to the contents in the error state.
3371         /// Reading from this pointer when `result_ok` is set is undefined.
3372         pub err: *mut crate::lightning::chain::AccessError,
3373 }
3374 #[repr(C)]
3375 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3376 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3378 pub struct CResult_TxOutAccessErrorZ {
3379         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3380         /// `err` or `result` depending on the state of `result_ok`.
3381         pub contents: CResult_TxOutAccessErrorZPtr,
3382         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3383         pub result_ok: bool,
3384 }
3385 #[no_mangle]
3386 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3387 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3388         CResult_TxOutAccessErrorZ {
3389                 contents: CResult_TxOutAccessErrorZPtr {
3390                         result: Box::into_raw(Box::new(o)),
3391                 },
3392                 result_ok: true,
3393         }
3394 }
3395 #[no_mangle]
3396 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3397 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3398         CResult_TxOutAccessErrorZ {
3399                 contents: CResult_TxOutAccessErrorZPtr {
3400                         err: Box::into_raw(Box::new(e)),
3401                 },
3402                 result_ok: false,
3403         }
3404 }
3405 /// Checks if the given object is currently in the success state
3406 #[no_mangle]
3407 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3408         o.result_ok
3409 }
3410 #[no_mangle]
3411 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3412 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3413 impl Drop for CResult_TxOutAccessErrorZ {
3414         fn drop(&mut self) {
3415                 if self.result_ok {
3416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3418                         }
3419                 } else {
3420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3422                         }
3423                 }
3424         }
3425 }
3426 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3427         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3428                 let contents = if o.result_ok {
3429                         let result = unsafe { o.contents.result };
3430                         unsafe { o.contents.result = core::ptr::null_mut() };
3431                         CResult_TxOutAccessErrorZPtr { result }
3432                 } else {
3433                         let err = unsafe { o.contents.err };
3434                         unsafe { o.contents.err = core::ptr::null_mut(); }
3435                         CResult_TxOutAccessErrorZPtr { err }
3436                 };
3437                 Self {
3438                         contents,
3439                         result_ok: o.result_ok,
3440                 }
3441         }
3442 }
3443 impl Clone for CResult_TxOutAccessErrorZ {
3444         fn clone(&self) -> Self {
3445                 if self.result_ok {
3446                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3447                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3448                         } }
3449                 } else {
3450                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3451                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3452                         } }
3453                 }
3454         }
3455 }
3456 #[no_mangle]
3457 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3458 /// but with all dynamically-allocated buffers duplicated in new buffers.
3459 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3460 #[repr(C)]
3461 /// A tuple of 2 elements. See the individual fields for the types contained.
3462 pub struct C2Tuple_usizeTransactionZ {
3463         /// The element at position 0
3464         pub a: usize,
3465         /// The element at position 1
3466         pub b: crate::c_types::Transaction,
3467 }
3468 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3469         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3470                 Self {
3471                         a: tup.0,
3472                         b: tup.1,
3473                 }
3474         }
3475 }
3476 impl C2Tuple_usizeTransactionZ {
3477         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3478                 (self.a, self.b)
3479         }
3480 }
3481 impl Clone for C2Tuple_usizeTransactionZ {
3482         fn clone(&self) -> Self {
3483                 Self {
3484                         a: Clone::clone(&self.a),
3485                         b: Clone::clone(&self.b),
3486                 }
3487         }
3488 }
3489 #[no_mangle]
3490 /// Creates a new tuple which has the same data as `orig`
3491 /// but with all dynamically-allocated buffers duplicated in new buffers.
3492 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3493 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3494 #[no_mangle]
3495 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3496         C2Tuple_usizeTransactionZ { a, b, }
3497 }
3498
3499 #[no_mangle]
3500 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3501 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3502 #[repr(C)]
3503 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3504 /// This corresponds to std::vector in C++
3505 pub struct CVec_C2Tuple_usizeTransactionZZ {
3506         /// The elements in the array.
3507         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3508         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3509         /// The number of elements pointed to by `data`.
3510         pub datalen: usize
3511 }
3512 impl CVec_C2Tuple_usizeTransactionZZ {
3513         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3514                 if self.datalen == 0 { return Vec::new(); }
3515                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3516                 self.data = core::ptr::null_mut();
3517                 self.datalen = 0;
3518                 ret
3519         }
3520         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3521                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3522         }
3523 }
3524 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3525         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3526                 let datalen = v.len();
3527                 let data = Box::into_raw(v.into_boxed_slice());
3528                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3529         }
3530 }
3531 #[no_mangle]
3532 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3533 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3534 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3535         fn drop(&mut self) {
3536                 if self.datalen == 0 { return; }
3537                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3538         }
3539 }
3540 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3541         fn clone(&self) -> Self {
3542                 let mut res = Vec::new();
3543                 if self.datalen == 0 { return Self::from(res); }
3544                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3545                 Self::from(res)
3546         }
3547 }
3548 #[repr(C)]
3549 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3550 /// This corresponds to std::vector in C++
3551 pub struct CVec_TxidZ {
3552         /// The elements in the array.
3553         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3554         pub data: *mut crate::c_types::ThirtyTwoBytes,
3555         /// The number of elements pointed to by `data`.
3556         pub datalen: usize
3557 }
3558 impl CVec_TxidZ {
3559         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3560                 if self.datalen == 0 { return Vec::new(); }
3561                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3562                 self.data = core::ptr::null_mut();
3563                 self.datalen = 0;
3564                 ret
3565         }
3566         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3567                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3568         }
3569 }
3570 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3571         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3572                 let datalen = v.len();
3573                 let data = Box::into_raw(v.into_boxed_slice());
3574                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3579 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3580 impl Drop for CVec_TxidZ {
3581         fn drop(&mut self) {
3582                 if self.datalen == 0 { return; }
3583                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3584         }
3585 }
3586 impl Clone for CVec_TxidZ {
3587         fn clone(&self) -> Self {
3588                 let mut res = Vec::new();
3589                 if self.datalen == 0 { return Self::from(res); }
3590                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3591                 Self::from(res)
3592         }
3593 }
3594 #[repr(C)]
3595 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3596 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3597         /// Note that this value is always NULL, as there are no contents in the OK variant
3598         pub result: *mut core::ffi::c_void,
3599         /// A pointer to the contents in the error state.
3600         /// Reading from this pointer when `result_ok` is set is undefined.
3601         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3602 }
3603 #[repr(C)]
3604 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3605 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3607 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3608         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3609         /// `err` or `result` depending on the state of `result_ok`.
3610         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3611         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3612         pub result_ok: bool,
3613 }
3614 #[no_mangle]
3615 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3616 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3617         CResult_NoneChannelMonitorUpdateErrZ {
3618                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3619                         result: core::ptr::null_mut(),
3620                 },
3621                 result_ok: true,
3622         }
3623 }
3624 #[no_mangle]
3625 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3626 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3627         CResult_NoneChannelMonitorUpdateErrZ {
3628                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3629                         err: Box::into_raw(Box::new(e)),
3630                 },
3631                 result_ok: false,
3632         }
3633 }
3634 /// Checks if the given object is currently in the success state
3635 #[no_mangle]
3636 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3637         o.result_ok
3638 }
3639 #[no_mangle]
3640 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3641 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3642 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3643         fn drop(&mut self) {
3644                 if self.result_ok {
3645                 } else {
3646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3648                         }
3649                 }
3650         }
3651 }
3652 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3653         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3654                 let contents = if o.result_ok {
3655                         let _ = unsafe { Box::from_raw(o.contents.result) };
3656                         o.contents.result = core::ptr::null_mut();
3657                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3658                 } else {
3659                         let err = unsafe { o.contents.err };
3660                         unsafe { o.contents.err = core::ptr::null_mut(); }
3661                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3662                 };
3663                 Self {
3664                         contents,
3665                         result_ok: o.result_ok,
3666                 }
3667         }
3668 }
3669 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3670         fn clone(&self) -> Self {
3671                 if self.result_ok {
3672                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3673                                 result: core::ptr::null_mut()
3674                         } }
3675                 } else {
3676                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3677                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3678                         } }
3679                 }
3680         }
3681 }
3682 #[no_mangle]
3683 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3684 /// but with all dynamically-allocated buffers duplicated in new buffers.
3685 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3686 #[repr(C)]
3687 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3688 /// This corresponds to std::vector in C++
3689 pub struct CVec_MonitorEventZ {
3690         /// The elements in the array.
3691         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3692         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3693         /// The number of elements pointed to by `data`.
3694         pub datalen: usize
3695 }
3696 impl CVec_MonitorEventZ {
3697         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3698                 if self.datalen == 0 { return Vec::new(); }
3699                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3700                 self.data = core::ptr::null_mut();
3701                 self.datalen = 0;
3702                 ret
3703         }
3704         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3705                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3706         }
3707 }
3708 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3709         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3710                 let datalen = v.len();
3711                 let data = Box::into_raw(v.into_boxed_slice());
3712                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3713         }
3714 }
3715 #[no_mangle]
3716 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3717 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3718 impl Drop for CVec_MonitorEventZ {
3719         fn drop(&mut self) {
3720                 if self.datalen == 0 { return; }
3721                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3722         }
3723 }
3724 impl Clone for CVec_MonitorEventZ {
3725         fn clone(&self) -> Self {
3726                 let mut res = Vec::new();
3727                 if self.datalen == 0 { return Self::from(res); }
3728                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3729                 Self::from(res)
3730         }
3731 }
3732 #[repr(C)]
3733 /// A tuple of 2 elements. See the individual fields for the types contained.
3734 pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
3735         /// The element at position 0
3736         pub a: crate::lightning::chain::transaction::OutPoint,
3737         /// The element at position 1
3738         pub b: crate::c_types::derived::CVec_MonitorEventZ,
3739 }
3740 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
3741         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
3742                 Self {
3743                         a: tup.0,
3744                         b: tup.1,
3745                 }
3746         }
3747 }
3748 impl C2Tuple_OutPointCVec_MonitorEventZZ {
3749         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
3750                 (self.a, self.b)
3751         }
3752 }
3753 impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
3754         fn clone(&self) -> Self {
3755                 Self {
3756                         a: Clone::clone(&self.a),
3757                         b: Clone::clone(&self.b),
3758                 }
3759         }
3760 }
3761 #[no_mangle]
3762 /// Creates a new tuple which has the same data as `orig`
3763 /// but with all dynamically-allocated buffers duplicated in new buffers.
3764 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
3765 /// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
3766 #[no_mangle]
3767 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
3768         C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
3769 }
3770
3771 #[no_mangle]
3772 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
3773 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
3774 #[repr(C)]
3775 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
3776 /// This corresponds to std::vector in C++
3777 pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3778         /// The elements in the array.
3779         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3780         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ,
3781         /// The number of elements pointed to by `data`.
3782         pub datalen: usize
3783 }
3784 impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3785         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
3786                 if self.datalen == 0 { return Vec::new(); }
3787                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3788                 self.data = core::ptr::null_mut();
3789                 self.datalen = 0;
3790                 ret
3791         }
3792         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ] {
3793                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3794         }
3795 }
3796 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3797         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> Self {
3798                 let datalen = v.len();
3799                 let data = Box::into_raw(v.into_boxed_slice());
3800                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3801         }
3802 }
3803 #[no_mangle]
3804 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3805 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
3806 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3807         fn drop(&mut self) {
3808                 if self.datalen == 0 { return; }
3809                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3810         }
3811 }
3812 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3813         fn clone(&self) -> Self {
3814                 let mut res = Vec::new();
3815                 if self.datalen == 0 { return Self::from(res); }
3816                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3817                 Self::from(res)
3818         }
3819 }
3820 #[repr(C)]
3821 #[derive(Clone)]
3822 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3823 pub enum COption_C2Tuple_usizeTransactionZZ {
3824         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3825         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3826         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3827         None
3828 }
3829 impl COption_C2Tuple_usizeTransactionZZ {
3830         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3831                 if let Self::None = self { false } else { true }
3832         }
3833         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3834                 !self.is_some()
3835         }
3836         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3837                 if let Self::Some(v) = self { v } else { unreachable!() }
3838         }
3839 }
3840 #[no_mangle]
3841 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3842 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3843         COption_C2Tuple_usizeTransactionZZ::Some(o)
3844 }
3845 #[no_mangle]
3846 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3847 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3848         COption_C2Tuple_usizeTransactionZZ::None
3849 }
3850 #[no_mangle]
3851 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3852 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3853 #[no_mangle]
3854 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3855 /// but with all dynamically-allocated buffers duplicated in new buffers.
3856 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3857 #[repr(C)]
3858 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3859 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3860         /// A pointer to the contents in the success state.
3861         /// Reading from this pointer when `result_ok` is not set is undefined.
3862         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3863         /// A pointer to the contents in the error state.
3864         /// Reading from this pointer when `result_ok` is set is undefined.
3865         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3866 }
3867 #[repr(C)]
3868 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3869 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3871 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3872         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3873         /// `err` or `result` depending on the state of `result_ok`.
3874         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3875         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3876         pub result_ok: bool,
3877 }
3878 #[no_mangle]
3879 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3880 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3881         CResult_FixedPenaltyScorerDecodeErrorZ {
3882                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3883                         result: Box::into_raw(Box::new(o)),
3884                 },
3885                 result_ok: true,
3886         }
3887 }
3888 #[no_mangle]
3889 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3890 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3891         CResult_FixedPenaltyScorerDecodeErrorZ {
3892                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3893                         err: Box::into_raw(Box::new(e)),
3894                 },
3895                 result_ok: false,
3896         }
3897 }
3898 /// Checks if the given object is currently in the success state
3899 #[no_mangle]
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3901         o.result_ok
3902 }
3903 #[no_mangle]
3904 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3905 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3906 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3907         fn drop(&mut self) {
3908                 if self.result_ok {
3909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3911                         }
3912                 } else {
3913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3915                         }
3916                 }
3917         }
3918 }
3919 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3921                 let contents = if o.result_ok {
3922                         let result = unsafe { o.contents.result };
3923                         unsafe { o.contents.result = core::ptr::null_mut() };
3924                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3925                 } else {
3926                         let err = unsafe { o.contents.err };
3927                         unsafe { o.contents.err = core::ptr::null_mut(); }
3928                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3929                 };
3930                 Self {
3931                         contents,
3932                         result_ok: o.result_ok,
3933                 }
3934         }
3935 }
3936 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3937         fn clone(&self) -> Self {
3938                 if self.result_ok {
3939                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3940                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3941                         } }
3942                 } else {
3943                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3944                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3945                         } }
3946                 }
3947         }
3948 }
3949 #[no_mangle]
3950 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3951 /// but with all dynamically-allocated buffers duplicated in new buffers.
3952 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3953 #[repr(C)]
3954 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3955 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3956         /// A pointer to the contents in the success state.
3957         /// Reading from this pointer when `result_ok` is not set is undefined.
3958         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3959         /// A pointer to the contents in the error state.
3960         /// Reading from this pointer when `result_ok` is set is undefined.
3961         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3962 }
3963 #[repr(C)]
3964 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3965 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3967 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3968         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3969         /// `err` or `result` depending on the state of `result_ok`.
3970         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3971         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3972         pub result_ok: bool,
3973 }
3974 #[no_mangle]
3975 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3976 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3977         CResult_ProbabilisticScorerDecodeErrorZ {
3978                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3979                         result: Box::into_raw(Box::new(o)),
3980                 },
3981                 result_ok: true,
3982         }
3983 }
3984 #[no_mangle]
3985 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3986 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3987         CResult_ProbabilisticScorerDecodeErrorZ {
3988                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3989                         err: Box::into_raw(Box::new(e)),
3990                 },
3991                 result_ok: false,
3992         }
3993 }
3994 /// Checks if the given object is currently in the success state
3995 #[no_mangle]
3996 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
3997         o.result_ok
3998 }
3999 #[no_mangle]
4000 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4001 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4002 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4003         fn drop(&mut self) {
4004                 if self.result_ok {
4005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4007                         }
4008                 } else {
4009                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4010                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4011                         }
4012                 }
4013         }
4014 }
4015 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4016         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4017                 let contents = if o.result_ok {
4018                         let result = unsafe { o.contents.result };
4019                         unsafe { o.contents.result = core::ptr::null_mut() };
4020                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4021                 } else {
4022                         let err = unsafe { o.contents.err };
4023                         unsafe { o.contents.err = core::ptr::null_mut(); }
4024                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4025                 };
4026                 Self {
4027                         contents,
4028                         result_ok: o.result_ok,
4029                 }
4030         }
4031 }
4032 #[repr(C)]
4033 /// The contents of CResult_InitFeaturesDecodeErrorZ
4034 pub union CResult_InitFeaturesDecodeErrorZPtr {
4035         /// A pointer to the contents in the success state.
4036         /// Reading from this pointer when `result_ok` is not set is undefined.
4037         pub result: *mut crate::lightning::ln::features::InitFeatures,
4038         /// A pointer to the contents in the error state.
4039         /// Reading from this pointer when `result_ok` is set is undefined.
4040         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4041 }
4042 #[repr(C)]
4043 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4044 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4045 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4046 pub struct CResult_InitFeaturesDecodeErrorZ {
4047         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4048         /// `err` or `result` depending on the state of `result_ok`.
4049         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4050         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4051         pub result_ok: bool,
4052 }
4053 #[no_mangle]
4054 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4055 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4056         CResult_InitFeaturesDecodeErrorZ {
4057                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4058                         result: Box::into_raw(Box::new(o)),
4059                 },
4060                 result_ok: true,
4061         }
4062 }
4063 #[no_mangle]
4064 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4065 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4066         CResult_InitFeaturesDecodeErrorZ {
4067                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4068                         err: Box::into_raw(Box::new(e)),
4069                 },
4070                 result_ok: false,
4071         }
4072 }
4073 /// Checks if the given object is currently in the success state
4074 #[no_mangle]
4075 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4076         o.result_ok
4077 }
4078 #[no_mangle]
4079 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4080 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4081 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4082         fn drop(&mut self) {
4083                 if self.result_ok {
4084                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4085                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4086                         }
4087                 } else {
4088                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4089                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4090                         }
4091                 }
4092         }
4093 }
4094 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4095         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4096                 let contents = if o.result_ok {
4097                         let result = unsafe { o.contents.result };
4098                         unsafe { o.contents.result = core::ptr::null_mut() };
4099                         CResult_InitFeaturesDecodeErrorZPtr { result }
4100                 } else {
4101                         let err = unsafe { o.contents.err };
4102                         unsafe { o.contents.err = core::ptr::null_mut(); }
4103                         CResult_InitFeaturesDecodeErrorZPtr { err }
4104                 };
4105                 Self {
4106                         contents,
4107                         result_ok: o.result_ok,
4108                 }
4109         }
4110 }
4111 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4112         fn clone(&self) -> Self {
4113                 if self.result_ok {
4114                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4115                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4116                         } }
4117                 } else {
4118                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4119                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4120                         } }
4121                 }
4122         }
4123 }
4124 #[no_mangle]
4125 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4126 /// but with all dynamically-allocated buffers duplicated in new buffers.
4127 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4128 #[repr(C)]
4129 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4130 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4131         /// A pointer to the contents in the success state.
4132         /// Reading from this pointer when `result_ok` is not set is undefined.
4133         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4134         /// A pointer to the contents in the error state.
4135         /// Reading from this pointer when `result_ok` is set is undefined.
4136         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4137 }
4138 #[repr(C)]
4139 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4140 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4142 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4143         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4144         /// `err` or `result` depending on the state of `result_ok`.
4145         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4146         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4147         pub result_ok: bool,
4148 }
4149 #[no_mangle]
4150 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4151 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4152         CResult_ChannelFeaturesDecodeErrorZ {
4153                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4154                         result: Box::into_raw(Box::new(o)),
4155                 },
4156                 result_ok: true,
4157         }
4158 }
4159 #[no_mangle]
4160 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4161 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4162         CResult_ChannelFeaturesDecodeErrorZ {
4163                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4164                         err: Box::into_raw(Box::new(e)),
4165                 },
4166                 result_ok: false,
4167         }
4168 }
4169 /// Checks if the given object is currently in the success state
4170 #[no_mangle]
4171 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4172         o.result_ok
4173 }
4174 #[no_mangle]
4175 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4176 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4177 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4178         fn drop(&mut self) {
4179                 if self.result_ok {
4180                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4181                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4182                         }
4183                 } else {
4184                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4185                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4186                         }
4187                 }
4188         }
4189 }
4190 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4191         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4192                 let contents = if o.result_ok {
4193                         let result = unsafe { o.contents.result };
4194                         unsafe { o.contents.result = core::ptr::null_mut() };
4195                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4196                 } else {
4197                         let err = unsafe { o.contents.err };
4198                         unsafe { o.contents.err = core::ptr::null_mut(); }
4199                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4200                 };
4201                 Self {
4202                         contents,
4203                         result_ok: o.result_ok,
4204                 }
4205         }
4206 }
4207 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4208         fn clone(&self) -> Self {
4209                 if self.result_ok {
4210                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4211                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4212                         } }
4213                 } else {
4214                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4215                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4216                         } }
4217                 }
4218         }
4219 }
4220 #[no_mangle]
4221 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4222 /// but with all dynamically-allocated buffers duplicated in new buffers.
4223 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4224 #[repr(C)]
4225 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4226 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4227         /// A pointer to the contents in the success state.
4228         /// Reading from this pointer when `result_ok` is not set is undefined.
4229         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4230         /// A pointer to the contents in the error state.
4231         /// Reading from this pointer when `result_ok` is set is undefined.
4232         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4233 }
4234 #[repr(C)]
4235 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4236 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4238 pub struct CResult_NodeFeaturesDecodeErrorZ {
4239         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4240         /// `err` or `result` depending on the state of `result_ok`.
4241         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4242         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4243         pub result_ok: bool,
4244 }
4245 #[no_mangle]
4246 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4247 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4248         CResult_NodeFeaturesDecodeErrorZ {
4249                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4250                         result: Box::into_raw(Box::new(o)),
4251                 },
4252                 result_ok: true,
4253         }
4254 }
4255 #[no_mangle]
4256 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4257 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4258         CResult_NodeFeaturesDecodeErrorZ {
4259                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4260                         err: Box::into_raw(Box::new(e)),
4261                 },
4262                 result_ok: false,
4263         }
4264 }
4265 /// Checks if the given object is currently in the success state
4266 #[no_mangle]
4267 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4268         o.result_ok
4269 }
4270 #[no_mangle]
4271 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4272 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4273 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4274         fn drop(&mut self) {
4275                 if self.result_ok {
4276                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4277                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4278                         }
4279                 } else {
4280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4282                         }
4283                 }
4284         }
4285 }
4286 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4287         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4288                 let contents = if o.result_ok {
4289                         let result = unsafe { o.contents.result };
4290                         unsafe { o.contents.result = core::ptr::null_mut() };
4291                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4292                 } else {
4293                         let err = unsafe { o.contents.err };
4294                         unsafe { o.contents.err = core::ptr::null_mut(); }
4295                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4296                 };
4297                 Self {
4298                         contents,
4299                         result_ok: o.result_ok,
4300                 }
4301         }
4302 }
4303 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4304         fn clone(&self) -> Self {
4305                 if self.result_ok {
4306                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4307                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4308                         } }
4309                 } else {
4310                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4311                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4312                         } }
4313                 }
4314         }
4315 }
4316 #[no_mangle]
4317 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4318 /// but with all dynamically-allocated buffers duplicated in new buffers.
4319 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4320 #[repr(C)]
4321 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4322 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4323         /// A pointer to the contents in the success state.
4324         /// Reading from this pointer when `result_ok` is not set is undefined.
4325         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4326         /// A pointer to the contents in the error state.
4327         /// Reading from this pointer when `result_ok` is set is undefined.
4328         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4329 }
4330 #[repr(C)]
4331 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4332 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4333 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4334 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4335         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4336         /// `err` or `result` depending on the state of `result_ok`.
4337         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4338         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4339         pub result_ok: bool,
4340 }
4341 #[no_mangle]
4342 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4343 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4344         CResult_InvoiceFeaturesDecodeErrorZ {
4345                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4346                         result: Box::into_raw(Box::new(o)),
4347                 },
4348                 result_ok: true,
4349         }
4350 }
4351 #[no_mangle]
4352 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4353 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4354         CResult_InvoiceFeaturesDecodeErrorZ {
4355                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4356                         err: Box::into_raw(Box::new(e)),
4357                 },
4358                 result_ok: false,
4359         }
4360 }
4361 /// Checks if the given object is currently in the success state
4362 #[no_mangle]
4363 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4364         o.result_ok
4365 }
4366 #[no_mangle]
4367 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4368 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4369 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4370         fn drop(&mut self) {
4371                 if self.result_ok {
4372                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4373                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4374                         }
4375                 } else {
4376                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4377                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4378                         }
4379                 }
4380         }
4381 }
4382 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4383         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4384                 let contents = if o.result_ok {
4385                         let result = unsafe { o.contents.result };
4386                         unsafe { o.contents.result = core::ptr::null_mut() };
4387                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4388                 } else {
4389                         let err = unsafe { o.contents.err };
4390                         unsafe { o.contents.err = core::ptr::null_mut(); }
4391                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4392                 };
4393                 Self {
4394                         contents,
4395                         result_ok: o.result_ok,
4396                 }
4397         }
4398 }
4399 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4400         fn clone(&self) -> Self {
4401                 if self.result_ok {
4402                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4403                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4404                         } }
4405                 } else {
4406                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4407                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4408                         } }
4409                 }
4410         }
4411 }
4412 #[no_mangle]
4413 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4414 /// but with all dynamically-allocated buffers duplicated in new buffers.
4415 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4416 #[repr(C)]
4417 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4418 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4419         /// A pointer to the contents in the success state.
4420         /// Reading from this pointer when `result_ok` is not set is undefined.
4421         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4422         /// A pointer to the contents in the error state.
4423         /// Reading from this pointer when `result_ok` is set is undefined.
4424         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4425 }
4426 #[repr(C)]
4427 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4428 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4429 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4430 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4431         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4432         /// `err` or `result` depending on the state of `result_ok`.
4433         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4434         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4435         pub result_ok: bool,
4436 }
4437 #[no_mangle]
4438 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4439 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4440         CResult_ChannelTypeFeaturesDecodeErrorZ {
4441                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4442                         result: Box::into_raw(Box::new(o)),
4443                 },
4444                 result_ok: true,
4445         }
4446 }
4447 #[no_mangle]
4448 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4449 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4450         CResult_ChannelTypeFeaturesDecodeErrorZ {
4451                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4452                         err: Box::into_raw(Box::new(e)),
4453                 },
4454                 result_ok: false,
4455         }
4456 }
4457 /// Checks if the given object is currently in the success state
4458 #[no_mangle]
4459 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4460         o.result_ok
4461 }
4462 #[no_mangle]
4463 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4464 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4465 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4466         fn drop(&mut self) {
4467                 if self.result_ok {
4468                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4469                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4470                         }
4471                 } else {
4472                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4473                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4474                         }
4475                 }
4476         }
4477 }
4478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4480                 let contents = if o.result_ok {
4481                         let result = unsafe { o.contents.result };
4482                         unsafe { o.contents.result = core::ptr::null_mut() };
4483                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4484                 } else {
4485                         let err = unsafe { o.contents.err };
4486                         unsafe { o.contents.err = core::ptr::null_mut(); }
4487                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4488                 };
4489                 Self {
4490                         contents,
4491                         result_ok: o.result_ok,
4492                 }
4493         }
4494 }
4495 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4496         fn clone(&self) -> Self {
4497                 if self.result_ok {
4498                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4499                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4500                         } }
4501                 } else {
4502                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4503                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4504                         } }
4505                 }
4506         }
4507 }
4508 #[no_mangle]
4509 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4510 /// but with all dynamically-allocated buffers duplicated in new buffers.
4511 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4512 #[repr(C)]
4513 /// The contents of CResult_NodeIdDecodeErrorZ
4514 pub union CResult_NodeIdDecodeErrorZPtr {
4515         /// A pointer to the contents in the success state.
4516         /// Reading from this pointer when `result_ok` is not set is undefined.
4517         pub result: *mut crate::lightning::routing::gossip::NodeId,
4518         /// A pointer to the contents in the error state.
4519         /// Reading from this pointer when `result_ok` is set is undefined.
4520         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4521 }
4522 #[repr(C)]
4523 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4524 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4526 pub struct CResult_NodeIdDecodeErrorZ {
4527         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4528         /// `err` or `result` depending on the state of `result_ok`.
4529         pub contents: CResult_NodeIdDecodeErrorZPtr,
4530         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4531         pub result_ok: bool,
4532 }
4533 #[no_mangle]
4534 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4535 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4536         CResult_NodeIdDecodeErrorZ {
4537                 contents: CResult_NodeIdDecodeErrorZPtr {
4538                         result: Box::into_raw(Box::new(o)),
4539                 },
4540                 result_ok: true,
4541         }
4542 }
4543 #[no_mangle]
4544 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4545 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4546         CResult_NodeIdDecodeErrorZ {
4547                 contents: CResult_NodeIdDecodeErrorZPtr {
4548                         err: Box::into_raw(Box::new(e)),
4549                 },
4550                 result_ok: false,
4551         }
4552 }
4553 /// Checks if the given object is currently in the success state
4554 #[no_mangle]
4555 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4556         o.result_ok
4557 }
4558 #[no_mangle]
4559 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4560 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4561 impl Drop for CResult_NodeIdDecodeErrorZ {
4562         fn drop(&mut self) {
4563                 if self.result_ok {
4564                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4565                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4566                         }
4567                 } else {
4568                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4569                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4570                         }
4571                 }
4572         }
4573 }
4574 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4575         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4576                 let contents = if o.result_ok {
4577                         let result = unsafe { o.contents.result };
4578                         unsafe { o.contents.result = core::ptr::null_mut() };
4579                         CResult_NodeIdDecodeErrorZPtr { result }
4580                 } else {
4581                         let err = unsafe { o.contents.err };
4582                         unsafe { o.contents.err = core::ptr::null_mut(); }
4583                         CResult_NodeIdDecodeErrorZPtr { err }
4584                 };
4585                 Self {
4586                         contents,
4587                         result_ok: o.result_ok,
4588                 }
4589         }
4590 }
4591 impl Clone for CResult_NodeIdDecodeErrorZ {
4592         fn clone(&self) -> Self {
4593                 if self.result_ok {
4594                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4595                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4596                         } }
4597                 } else {
4598                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4599                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4600                         } }
4601                 }
4602         }
4603 }
4604 #[no_mangle]
4605 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4606 /// but with all dynamically-allocated buffers duplicated in new buffers.
4607 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4608 #[repr(C)]
4609 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4610 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4611         /// A pointer to the contents in the success state.
4612         /// Reading from this pointer when `result_ok` is not set is undefined.
4613         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4614         /// A pointer to the contents in the error state.
4615         /// Reading from this pointer when `result_ok` is set is undefined.
4616         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4617 }
4618 #[repr(C)]
4619 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4620 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4622 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4623         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4624         /// `err` or `result` depending on the state of `result_ok`.
4625         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4626         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4627         pub result_ok: bool,
4628 }
4629 #[no_mangle]
4630 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4631 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4632         CResult_COption_NetworkUpdateZDecodeErrorZ {
4633                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4634                         result: Box::into_raw(Box::new(o)),
4635                 },
4636                 result_ok: true,
4637         }
4638 }
4639 #[no_mangle]
4640 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4641 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4642         CResult_COption_NetworkUpdateZDecodeErrorZ {
4643                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4644                         err: Box::into_raw(Box::new(e)),
4645                 },
4646                 result_ok: false,
4647         }
4648 }
4649 /// Checks if the given object is currently in the success state
4650 #[no_mangle]
4651 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4652         o.result_ok
4653 }
4654 #[no_mangle]
4655 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4656 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4657 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4658         fn drop(&mut self) {
4659                 if self.result_ok {
4660                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4661                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4662                         }
4663                 } else {
4664                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4665                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4666                         }
4667                 }
4668         }
4669 }
4670 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4671         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4672                 let contents = if o.result_ok {
4673                         let result = unsafe { o.contents.result };
4674                         unsafe { o.contents.result = core::ptr::null_mut() };
4675                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4676                 } else {
4677                         let err = unsafe { o.contents.err };
4678                         unsafe { o.contents.err = core::ptr::null_mut(); }
4679                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4680                 };
4681                 Self {
4682                         contents,
4683                         result_ok: o.result_ok,
4684                 }
4685         }
4686 }
4687 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4688         fn clone(&self) -> Self {
4689                 if self.result_ok {
4690                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4691                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
4692                         } }
4693                 } else {
4694                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4695                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4696                         } }
4697                 }
4698         }
4699 }
4700 #[no_mangle]
4701 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
4702 /// but with all dynamically-allocated buffers duplicated in new buffers.
4703 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
4704 #[repr(C)]
4705 /// An enum which can either contain a crate::lightning::chain::Access or not
4706 pub enum COption_AccessZ {
4707         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4708         Some(crate::lightning::chain::Access),
4709         /// When we're in this state, this COption_AccessZ contains nothing
4710         None
4711 }
4712 impl COption_AccessZ {
4713         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4714                 if let Self::None = self { false } else { true }
4715         }
4716         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4717                 !self.is_some()
4718         }
4719         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
4720                 if let Self::Some(v) = self { v } else { unreachable!() }
4721         }
4722 }
4723 #[no_mangle]
4724 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
4725 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
4726         COption_AccessZ::Some(o)
4727 }
4728 #[no_mangle]
4729 /// Constructs a new COption_AccessZ containing nothing
4730 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
4731         COption_AccessZ::None
4732 }
4733 #[no_mangle]
4734 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
4735 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
4736 #[repr(C)]
4737 /// The contents of CResult_boolLightningErrorZ
4738 pub union CResult_boolLightningErrorZPtr {
4739         /// A pointer to the contents in the success state.
4740         /// Reading from this pointer when `result_ok` is not set is undefined.
4741         pub result: *mut bool,
4742         /// A pointer to the contents in the error state.
4743         /// Reading from this pointer when `result_ok` is set is undefined.
4744         pub err: *mut crate::lightning::ln::msgs::LightningError,
4745 }
4746 #[repr(C)]
4747 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4748 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4750 pub struct CResult_boolLightningErrorZ {
4751         /// The contents of this CResult_boolLightningErrorZ, accessible via either
4752         /// `err` or `result` depending on the state of `result_ok`.
4753         pub contents: CResult_boolLightningErrorZPtr,
4754         /// Whether this CResult_boolLightningErrorZ represents a success state.
4755         pub result_ok: bool,
4756 }
4757 #[no_mangle]
4758 /// Creates a new CResult_boolLightningErrorZ in the success state.
4759 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4760         CResult_boolLightningErrorZ {
4761                 contents: CResult_boolLightningErrorZPtr {
4762                         result: Box::into_raw(Box::new(o)),
4763                 },
4764                 result_ok: true,
4765         }
4766 }
4767 #[no_mangle]
4768 /// Creates a new CResult_boolLightningErrorZ in the error state.
4769 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4770         CResult_boolLightningErrorZ {
4771                 contents: CResult_boolLightningErrorZPtr {
4772                         err: Box::into_raw(Box::new(e)),
4773                 },
4774                 result_ok: false,
4775         }
4776 }
4777 /// Checks if the given object is currently in the success state
4778 #[no_mangle]
4779 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
4780         o.result_ok
4781 }
4782 #[no_mangle]
4783 /// Frees any resources used by the CResult_boolLightningErrorZ.
4784 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4785 impl Drop for CResult_boolLightningErrorZ {
4786         fn drop(&mut self) {
4787                 if self.result_ok {
4788                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4789                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4790                         }
4791                 } else {
4792                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4793                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4794                         }
4795                 }
4796         }
4797 }
4798 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4799         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4800                 let contents = if o.result_ok {
4801                         let result = unsafe { o.contents.result };
4802                         unsafe { o.contents.result = core::ptr::null_mut() };
4803                         CResult_boolLightningErrorZPtr { result }
4804                 } else {
4805                         let err = unsafe { o.contents.err };
4806                         unsafe { o.contents.err = core::ptr::null_mut(); }
4807                         CResult_boolLightningErrorZPtr { err }
4808                 };
4809                 Self {
4810                         contents,
4811                         result_ok: o.result_ok,
4812                 }
4813         }
4814 }
4815 impl Clone for CResult_boolLightningErrorZ {
4816         fn clone(&self) -> Self {
4817                 if self.result_ok {
4818                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4819                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4820                         } }
4821                 } else {
4822                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4823                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4824                         } }
4825                 }
4826         }
4827 }
4828 #[no_mangle]
4829 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4830 /// but with all dynamically-allocated buffers duplicated in new buffers.
4831 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
4832 #[repr(C)]
4833 /// A tuple of 3 elements. See the individual fields for the types contained.
4834 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4835         /// The element at position 0
4836         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4837         /// The element at position 1
4838         pub b: crate::lightning::ln::msgs::ChannelUpdate,
4839         /// The element at position 2
4840         pub c: crate::lightning::ln::msgs::ChannelUpdate,
4841 }
4842 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4843         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4844                 Self {
4845                         a: tup.0,
4846                         b: tup.1,
4847                         c: tup.2,
4848                 }
4849         }
4850 }
4851 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4852         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4853                 (self.a, self.b, self.c)
4854         }
4855 }
4856 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4857         fn clone(&self) -> Self {
4858                 Self {
4859                         a: Clone::clone(&self.a),
4860                         b: Clone::clone(&self.b),
4861                         c: Clone::clone(&self.c),
4862                 }
4863         }
4864 }
4865 #[no_mangle]
4866 /// Creates a new tuple which has the same data as `orig`
4867 /// but with all dynamically-allocated buffers duplicated in new buffers.
4868 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
4869 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4870 #[no_mangle]
4871 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 {
4872         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4873 }
4874
4875 #[no_mangle]
4876 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4877 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4878 #[repr(C)]
4879 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4880 /// This corresponds to std::vector in C++
4881 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4882         /// The elements in the array.
4883         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4884         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4885         /// The number of elements pointed to by `data`.
4886         pub datalen: usize
4887 }
4888 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4889         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4890                 if self.datalen == 0 { return Vec::new(); }
4891                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4892                 self.data = core::ptr::null_mut();
4893                 self.datalen = 0;
4894                 ret
4895         }
4896         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4897                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4898         }
4899 }
4900 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4901         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4902                 let datalen = v.len();
4903                 let data = Box::into_raw(v.into_boxed_slice());
4904                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4905         }
4906 }
4907 #[no_mangle]
4908 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4909 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4910 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4911         fn drop(&mut self) {
4912                 if self.datalen == 0 { return; }
4913                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4914         }
4915 }
4916 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4917         fn clone(&self) -> Self {
4918                 let mut res = Vec::new();
4919                 if self.datalen == 0 { return Self::from(res); }
4920                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4921                 Self::from(res)
4922         }
4923 }
4924 #[repr(C)]
4925 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4926 /// This corresponds to std::vector in C++
4927 pub struct CVec_NodeAnnouncementZ {
4928         /// The elements in the array.
4929         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4930         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4931         /// The number of elements pointed to by `data`.
4932         pub datalen: usize
4933 }
4934 impl CVec_NodeAnnouncementZ {
4935         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4936                 if self.datalen == 0 { return Vec::new(); }
4937                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4938                 self.data = core::ptr::null_mut();
4939                 self.datalen = 0;
4940                 ret
4941         }
4942         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4943                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4944         }
4945 }
4946 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4947         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4948                 let datalen = v.len();
4949                 let data = Box::into_raw(v.into_boxed_slice());
4950                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4951         }
4952 }
4953 #[no_mangle]
4954 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4955 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4956 impl Drop for CVec_NodeAnnouncementZ {
4957         fn drop(&mut self) {
4958                 if self.datalen == 0 { return; }
4959                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4960         }
4961 }
4962 impl Clone for CVec_NodeAnnouncementZ {
4963         fn clone(&self) -> Self {
4964                 let mut res = Vec::new();
4965                 if self.datalen == 0 { return Self::from(res); }
4966                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4967                 Self::from(res)
4968         }
4969 }
4970 #[repr(C)]
4971 /// The contents of CResult_NoneLightningErrorZ
4972 pub union CResult_NoneLightningErrorZPtr {
4973         /// Note that this value is always NULL, as there are no contents in the OK variant
4974         pub result: *mut core::ffi::c_void,
4975         /// A pointer to the contents in the error state.
4976         /// Reading from this pointer when `result_ok` is set is undefined.
4977         pub err: *mut crate::lightning::ln::msgs::LightningError,
4978 }
4979 #[repr(C)]
4980 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
4981 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
4982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4983 pub struct CResult_NoneLightningErrorZ {
4984         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
4985         /// `err` or `result` depending on the state of `result_ok`.
4986         pub contents: CResult_NoneLightningErrorZPtr,
4987         /// Whether this CResult_NoneLightningErrorZ represents a success state.
4988         pub result_ok: bool,
4989 }
4990 #[no_mangle]
4991 /// Creates a new CResult_NoneLightningErrorZ in the success state.
4992 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
4993         CResult_NoneLightningErrorZ {
4994                 contents: CResult_NoneLightningErrorZPtr {
4995                         result: core::ptr::null_mut(),
4996                 },
4997                 result_ok: true,
4998         }
4999 }
5000 #[no_mangle]
5001 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5002 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5003         CResult_NoneLightningErrorZ {
5004                 contents: CResult_NoneLightningErrorZPtr {
5005                         err: Box::into_raw(Box::new(e)),
5006                 },
5007                 result_ok: false,
5008         }
5009 }
5010 /// Checks if the given object is currently in the success state
5011 #[no_mangle]
5012 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5013         o.result_ok
5014 }
5015 #[no_mangle]
5016 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5017 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5018 impl Drop for CResult_NoneLightningErrorZ {
5019         fn drop(&mut self) {
5020                 if self.result_ok {
5021                 } else {
5022                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5023                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5024                         }
5025                 }
5026         }
5027 }
5028 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5029         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5030                 let contents = if o.result_ok {
5031                         let _ = unsafe { Box::from_raw(o.contents.result) };
5032                         o.contents.result = core::ptr::null_mut();
5033                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5034                 } else {
5035                         let err = unsafe { o.contents.err };
5036                         unsafe { o.contents.err = core::ptr::null_mut(); }
5037                         CResult_NoneLightningErrorZPtr { err }
5038                 };
5039                 Self {
5040                         contents,
5041                         result_ok: o.result_ok,
5042                 }
5043         }
5044 }
5045 impl Clone for CResult_NoneLightningErrorZ {
5046         fn clone(&self) -> Self {
5047                 if self.result_ok {
5048                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5049                                 result: core::ptr::null_mut()
5050                         } }
5051                 } else {
5052                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5053                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5054                         } }
5055                 }
5056         }
5057 }
5058 #[no_mangle]
5059 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5060 /// but with all dynamically-allocated buffers duplicated in new buffers.
5061 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5062 #[repr(C)]
5063 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5064 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5065         /// A pointer to the contents in the success state.
5066         /// Reading from this pointer when `result_ok` is not set is undefined.
5067         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5068         /// A pointer to the contents in the error state.
5069         /// Reading from this pointer when `result_ok` is set is undefined.
5070         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5071 }
5072 #[repr(C)]
5073 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5074 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5076 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5077         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5078         /// `err` or `result` depending on the state of `result_ok`.
5079         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5080         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5081         pub result_ok: bool,
5082 }
5083 #[no_mangle]
5084 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5085 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5086         CResult_ChannelUpdateInfoDecodeErrorZ {
5087                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5088                         result: Box::into_raw(Box::new(o)),
5089                 },
5090                 result_ok: true,
5091         }
5092 }
5093 #[no_mangle]
5094 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5095 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5096         CResult_ChannelUpdateInfoDecodeErrorZ {
5097                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5098                         err: Box::into_raw(Box::new(e)),
5099                 },
5100                 result_ok: false,
5101         }
5102 }
5103 /// Checks if the given object is currently in the success state
5104 #[no_mangle]
5105 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5106         o.result_ok
5107 }
5108 #[no_mangle]
5109 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5110 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5111 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5112         fn drop(&mut self) {
5113                 if self.result_ok {
5114                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5115                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5116                         }
5117                 } else {
5118                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5119                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5120                         }
5121                 }
5122         }
5123 }
5124 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5125         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> 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_ChannelUpdateInfoDecodeErrorZPtr { result }
5130                 } else {
5131                         let err = unsafe { o.contents.err };
5132                         unsafe { o.contents.err = core::ptr::null_mut(); }
5133                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5134                 };
5135                 Self {
5136                         contents,
5137                         result_ok: o.result_ok,
5138                 }
5139         }
5140 }
5141 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5142         fn clone(&self) -> Self {
5143                 if self.result_ok {
5144                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5145                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5146                         } }
5147                 } else {
5148                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5149                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5150                         } }
5151                 }
5152         }
5153 }
5154 #[no_mangle]
5155 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5158 #[repr(C)]
5159 /// The contents of CResult_ChannelInfoDecodeErrorZ
5160 pub union CResult_ChannelInfoDecodeErrorZPtr {
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::lightning::routing::gossip::ChannelInfo,
5164         /// A pointer to the contents in the error state.
5165         /// Reading from this pointer when `result_ok` is set is undefined.
5166         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5167 }
5168 #[repr(C)]
5169 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_ChannelInfoDecodeErrorZ {
5173         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5174         /// `err` or `result` depending on the state of `result_ok`.
5175         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5176         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5177         pub result_ok: bool,
5178 }
5179 #[no_mangle]
5180 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5181 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5182         CResult_ChannelInfoDecodeErrorZ {
5183                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5184                         result: Box::into_raw(Box::new(o)),
5185                 },
5186                 result_ok: true,
5187         }
5188 }
5189 #[no_mangle]
5190 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5191 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5192         CResult_ChannelInfoDecodeErrorZ {
5193                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5194                         err: Box::into_raw(Box::new(e)),
5195                 },
5196                 result_ok: false,
5197         }
5198 }
5199 /// Checks if the given object is currently in the success state
5200 #[no_mangle]
5201 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5202         o.result_ok
5203 }
5204 #[no_mangle]
5205 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5206 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5207 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5208         fn drop(&mut self) {
5209                 if self.result_ok {
5210                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5211                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5212                         }
5213                 } else {
5214                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5215                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5216                         }
5217                 }
5218         }
5219 }
5220 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5221         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5222                 let contents = if o.result_ok {
5223                         let result = unsafe { o.contents.result };
5224                         unsafe { o.contents.result = core::ptr::null_mut() };
5225                         CResult_ChannelInfoDecodeErrorZPtr { result }
5226                 } else {
5227                         let err = unsafe { o.contents.err };
5228                         unsafe { o.contents.err = core::ptr::null_mut(); }
5229                         CResult_ChannelInfoDecodeErrorZPtr { err }
5230                 };
5231                 Self {
5232                         contents,
5233                         result_ok: o.result_ok,
5234                 }
5235         }
5236 }
5237 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5238         fn clone(&self) -> Self {
5239                 if self.result_ok {
5240                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5241                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5242                         } }
5243                 } else {
5244                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5245                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5246                         } }
5247                 }
5248         }
5249 }
5250 #[no_mangle]
5251 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5254 #[repr(C)]
5255 /// The contents of CResult_RoutingFeesDecodeErrorZ
5256 pub union CResult_RoutingFeesDecodeErrorZPtr {
5257         /// A pointer to the contents in the success state.
5258         /// Reading from this pointer when `result_ok` is not set is undefined.
5259         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5260         /// A pointer to the contents in the error state.
5261         /// Reading from this pointer when `result_ok` is set is undefined.
5262         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5263 }
5264 #[repr(C)]
5265 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5266 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5268 pub struct CResult_RoutingFeesDecodeErrorZ {
5269         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5270         /// `err` or `result` depending on the state of `result_ok`.
5271         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5272         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5273         pub result_ok: bool,
5274 }
5275 #[no_mangle]
5276 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5277 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5278         CResult_RoutingFeesDecodeErrorZ {
5279                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5280                         result: Box::into_raw(Box::new(o)),
5281                 },
5282                 result_ok: true,
5283         }
5284 }
5285 #[no_mangle]
5286 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5287 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5288         CResult_RoutingFeesDecodeErrorZ {
5289                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5290                         err: Box::into_raw(Box::new(e)),
5291                 },
5292                 result_ok: false,
5293         }
5294 }
5295 /// Checks if the given object is currently in the success state
5296 #[no_mangle]
5297 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5298         o.result_ok
5299 }
5300 #[no_mangle]
5301 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5302 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5303 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5304         fn drop(&mut self) {
5305                 if self.result_ok {
5306                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5307                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5308                         }
5309                 } else {
5310                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5311                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5312                         }
5313                 }
5314         }
5315 }
5316 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5317         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5318                 let contents = if o.result_ok {
5319                         let result = unsafe { o.contents.result };
5320                         unsafe { o.contents.result = core::ptr::null_mut() };
5321                         CResult_RoutingFeesDecodeErrorZPtr { result }
5322                 } else {
5323                         let err = unsafe { o.contents.err };
5324                         unsafe { o.contents.err = core::ptr::null_mut(); }
5325                         CResult_RoutingFeesDecodeErrorZPtr { err }
5326                 };
5327                 Self {
5328                         contents,
5329                         result_ok: o.result_ok,
5330                 }
5331         }
5332 }
5333 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5334         fn clone(&self) -> Self {
5335                 if self.result_ok {
5336                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5337                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5338                         } }
5339                 } else {
5340                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5341                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5342                         } }
5343                 }
5344         }
5345 }
5346 #[no_mangle]
5347 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5348 /// but with all dynamically-allocated buffers duplicated in new buffers.
5349 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5350 #[repr(C)]
5351 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5352 /// This corresponds to std::vector in C++
5353 pub struct CVec_NetAddressZ {
5354         /// The elements in the array.
5355         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5356         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5357         /// The number of elements pointed to by `data`.
5358         pub datalen: usize
5359 }
5360 impl CVec_NetAddressZ {
5361         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5362                 if self.datalen == 0 { return Vec::new(); }
5363                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5364                 self.data = core::ptr::null_mut();
5365                 self.datalen = 0;
5366                 ret
5367         }
5368         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5369                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5370         }
5371 }
5372 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5373         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5374                 let datalen = v.len();
5375                 let data = Box::into_raw(v.into_boxed_slice());
5376                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5377         }
5378 }
5379 #[no_mangle]
5380 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5381 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5382 impl Drop for CVec_NetAddressZ {
5383         fn drop(&mut self) {
5384                 if self.datalen == 0 { return; }
5385                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5386         }
5387 }
5388 impl Clone for CVec_NetAddressZ {
5389         fn clone(&self) -> Self {
5390                 let mut res = Vec::new();
5391                 if self.datalen == 0 { return Self::from(res); }
5392                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5393                 Self::from(res)
5394         }
5395 }
5396 #[repr(C)]
5397 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5398 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5399         /// A pointer to the contents in the success state.
5400         /// Reading from this pointer when `result_ok` is not set is undefined.
5401         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5402         /// A pointer to the contents in the error state.
5403         /// Reading from this pointer when `result_ok` is set is undefined.
5404         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5405 }
5406 #[repr(C)]
5407 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5408 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5410 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5411         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5412         /// `err` or `result` depending on the state of `result_ok`.
5413         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5414         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5415         pub result_ok: bool,
5416 }
5417 #[no_mangle]
5418 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5419 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5420         CResult_NodeAnnouncementInfoDecodeErrorZ {
5421                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5422                         result: Box::into_raw(Box::new(o)),
5423                 },
5424                 result_ok: true,
5425         }
5426 }
5427 #[no_mangle]
5428 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5429 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5430         CResult_NodeAnnouncementInfoDecodeErrorZ {
5431                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5432                         err: Box::into_raw(Box::new(e)),
5433                 },
5434                 result_ok: false,
5435         }
5436 }
5437 /// Checks if the given object is currently in the success state
5438 #[no_mangle]
5439 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5440         o.result_ok
5441 }
5442 #[no_mangle]
5443 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5444 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5445 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5446         fn drop(&mut self) {
5447                 if self.result_ok {
5448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5450                         }
5451                 } else {
5452                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5453                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5454                         }
5455                 }
5456         }
5457 }
5458 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5459         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5460                 let contents = if o.result_ok {
5461                         let result = unsafe { o.contents.result };
5462                         unsafe { o.contents.result = core::ptr::null_mut() };
5463                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5464                 } else {
5465                         let err = unsafe { o.contents.err };
5466                         unsafe { o.contents.err = core::ptr::null_mut(); }
5467                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5468                 };
5469                 Self {
5470                         contents,
5471                         result_ok: o.result_ok,
5472                 }
5473         }
5474 }
5475 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5476         fn clone(&self) -> Self {
5477                 if self.result_ok {
5478                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5479                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5480                         } }
5481                 } else {
5482                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5483                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5484                         } }
5485                 }
5486         }
5487 }
5488 #[no_mangle]
5489 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5490 /// but with all dynamically-allocated buffers duplicated in new buffers.
5491 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5492 #[repr(C)]
5493 /// A dynamically-allocated array of u64s of arbitrary size.
5494 /// This corresponds to std::vector in C++
5495 pub struct CVec_u64Z {
5496         /// The elements in the array.
5497         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5498         pub data: *mut u64,
5499         /// The number of elements pointed to by `data`.
5500         pub datalen: usize
5501 }
5502 impl CVec_u64Z {
5503         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5504                 if self.datalen == 0 { return Vec::new(); }
5505                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5506                 self.data = core::ptr::null_mut();
5507                 self.datalen = 0;
5508                 ret
5509         }
5510         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5511                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5512         }
5513 }
5514 impl From<Vec<u64>> for CVec_u64Z {
5515         fn from(v: Vec<u64>) -> Self {
5516                 let datalen = v.len();
5517                 let data = Box::into_raw(v.into_boxed_slice());
5518                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5519         }
5520 }
5521 #[no_mangle]
5522 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5523 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5524 impl Drop for CVec_u64Z {
5525         fn drop(&mut self) {
5526                 if self.datalen == 0 { return; }
5527                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5528         }
5529 }
5530 impl Clone for CVec_u64Z {
5531         fn clone(&self) -> Self {
5532                 let mut res = Vec::new();
5533                 if self.datalen == 0 { return Self::from(res); }
5534                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5535                 Self::from(res)
5536         }
5537 }
5538 #[repr(C)]
5539 /// The contents of CResult_NodeInfoDecodeErrorZ
5540 pub union CResult_NodeInfoDecodeErrorZPtr {
5541         /// A pointer to the contents in the success state.
5542         /// Reading from this pointer when `result_ok` is not set is undefined.
5543         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5544         /// A pointer to the contents in the error state.
5545         /// Reading from this pointer when `result_ok` is set is undefined.
5546         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5547 }
5548 #[repr(C)]
5549 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5550 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5552 pub struct CResult_NodeInfoDecodeErrorZ {
5553         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5554         /// `err` or `result` depending on the state of `result_ok`.
5555         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5556         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5557         pub result_ok: bool,
5558 }
5559 #[no_mangle]
5560 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5561 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5562         CResult_NodeInfoDecodeErrorZ {
5563                 contents: CResult_NodeInfoDecodeErrorZPtr {
5564                         result: Box::into_raw(Box::new(o)),
5565                 },
5566                 result_ok: true,
5567         }
5568 }
5569 #[no_mangle]
5570 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5571 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5572         CResult_NodeInfoDecodeErrorZ {
5573                 contents: CResult_NodeInfoDecodeErrorZPtr {
5574                         err: Box::into_raw(Box::new(e)),
5575                 },
5576                 result_ok: false,
5577         }
5578 }
5579 /// Checks if the given object is currently in the success state
5580 #[no_mangle]
5581 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5582         o.result_ok
5583 }
5584 #[no_mangle]
5585 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5586 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5587 impl Drop for CResult_NodeInfoDecodeErrorZ {
5588         fn drop(&mut self) {
5589                 if self.result_ok {
5590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5592                         }
5593                 } else {
5594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5596                         }
5597                 }
5598         }
5599 }
5600 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5602                 let contents = if o.result_ok {
5603                         let result = unsafe { o.contents.result };
5604                         unsafe { o.contents.result = core::ptr::null_mut() };
5605                         CResult_NodeInfoDecodeErrorZPtr { result }
5606                 } else {
5607                         let err = unsafe { o.contents.err };
5608                         unsafe { o.contents.err = core::ptr::null_mut(); }
5609                         CResult_NodeInfoDecodeErrorZPtr { err }
5610                 };
5611                 Self {
5612                         contents,
5613                         result_ok: o.result_ok,
5614                 }
5615         }
5616 }
5617 impl Clone for CResult_NodeInfoDecodeErrorZ {
5618         fn clone(&self) -> Self {
5619                 if self.result_ok {
5620                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5621                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5622                         } }
5623                 } else {
5624                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5625                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5626                         } }
5627                 }
5628         }
5629 }
5630 #[no_mangle]
5631 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5632 /// but with all dynamically-allocated buffers duplicated in new buffers.
5633 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5634 #[repr(C)]
5635 /// The contents of CResult_NetworkGraphDecodeErrorZ
5636 pub union CResult_NetworkGraphDecodeErrorZPtr {
5637         /// A pointer to the contents in the success state.
5638         /// Reading from this pointer when `result_ok` is not set is undefined.
5639         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5640         /// A pointer to the contents in the error state.
5641         /// Reading from this pointer when `result_ok` is set is undefined.
5642         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5643 }
5644 #[repr(C)]
5645 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5646 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5648 pub struct CResult_NetworkGraphDecodeErrorZ {
5649         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5650         /// `err` or `result` depending on the state of `result_ok`.
5651         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5652         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5653         pub result_ok: bool,
5654 }
5655 #[no_mangle]
5656 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5657 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5658         CResult_NetworkGraphDecodeErrorZ {
5659                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5660                         result: Box::into_raw(Box::new(o)),
5661                 },
5662                 result_ok: true,
5663         }
5664 }
5665 #[no_mangle]
5666 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5667 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5668         CResult_NetworkGraphDecodeErrorZ {
5669                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5670                         err: Box::into_raw(Box::new(e)),
5671                 },
5672                 result_ok: false,
5673         }
5674 }
5675 /// Checks if the given object is currently in the success state
5676 #[no_mangle]
5677 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
5678         o.result_ok
5679 }
5680 #[no_mangle]
5681 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5682 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5683 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5684         fn drop(&mut self) {
5685                 if self.result_ok {
5686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5688                         }
5689                 } else {
5690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5692                         }
5693                 }
5694         }
5695 }
5696 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5698                 let contents = if o.result_ok {
5699                         let result = unsafe { o.contents.result };
5700                         unsafe { o.contents.result = core::ptr::null_mut() };
5701                         CResult_NetworkGraphDecodeErrorZPtr { result }
5702                 } else {
5703                         let err = unsafe { o.contents.err };
5704                         unsafe { o.contents.err = core::ptr::null_mut(); }
5705                         CResult_NetworkGraphDecodeErrorZPtr { err }
5706                 };
5707                 Self {
5708                         contents,
5709                         result_ok: o.result_ok,
5710                 }
5711         }
5712 }
5713 #[repr(C)]
5714 #[derive(Clone)]
5715 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5716 pub enum COption_CVec_NetAddressZZ {
5717         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5718         Some(crate::c_types::derived::CVec_NetAddressZ),
5719         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5720         None
5721 }
5722 impl COption_CVec_NetAddressZZ {
5723         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5724                 if let Self::None = self { false } else { true }
5725         }
5726         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5727                 !self.is_some()
5728         }
5729         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
5730                 if let Self::Some(v) = self { v } else { unreachable!() }
5731         }
5732 }
5733 #[no_mangle]
5734 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
5735 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
5736         COption_CVec_NetAddressZZ::Some(o)
5737 }
5738 #[no_mangle]
5739 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
5740 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
5741         COption_CVec_NetAddressZZ::None
5742 }
5743 #[no_mangle]
5744 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
5745 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
5746 #[no_mangle]
5747 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
5748 /// but with all dynamically-allocated buffers duplicated in new buffers.
5749 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
5750 #[repr(C)]
5751 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5752 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5753         /// A pointer to the contents in the success state.
5754         /// Reading from this pointer when `result_ok` is not set is undefined.
5755         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
5756         /// A pointer to the contents in the error state.
5757         /// Reading from this pointer when `result_ok` is set is undefined.
5758         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5759 }
5760 #[repr(C)]
5761 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5762 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5764 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5765         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5766         /// `err` or `result` depending on the state of `result_ok`.
5767         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
5768         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5769         pub result_ok: bool,
5770 }
5771 #[no_mangle]
5772 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
5773 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5774         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5775                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5776                         result: Box::into_raw(Box::new(o)),
5777                 },
5778                 result_ok: true,
5779         }
5780 }
5781 #[no_mangle]
5782 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
5783 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5784         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5785                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5786                         err: Box::into_raw(Box::new(e)),
5787                 },
5788                 result_ok: false,
5789         }
5790 }
5791 /// Checks if the given object is currently in the success state
5792 #[no_mangle]
5793 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
5794         o.result_ok
5795 }
5796 #[no_mangle]
5797 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
5798 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
5799 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5800         fn drop(&mut self) {
5801                 if self.result_ok {
5802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5804                         }
5805                 } else {
5806                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5807                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5808                         }
5809                 }
5810         }
5811 }
5812 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5813         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5814                 let contents = if o.result_ok {
5815                         let result = unsafe { o.contents.result };
5816                         unsafe { o.contents.result = core::ptr::null_mut() };
5817                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
5818                 } else {
5819                         let err = unsafe { o.contents.err };
5820                         unsafe { o.contents.err = core::ptr::null_mut(); }
5821                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
5822                 };
5823                 Self {
5824                         contents,
5825                         result_ok: o.result_ok,
5826                 }
5827         }
5828 }
5829 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5830         fn clone(&self) -> Self {
5831                 if self.result_ok {
5832                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5833                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5834                         } }
5835                 } else {
5836                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5837                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5838                         } }
5839                 }
5840         }
5841 }
5842 #[no_mangle]
5843 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5844 /// but with all dynamically-allocated buffers duplicated in new buffers.
5845 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5846 #[repr(C)]
5847 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5848 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5849         /// A pointer to the contents in the success state.
5850         /// Reading from this pointer when `result_ok` is not set is undefined.
5851         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
5852         /// A pointer to the contents in the error state.
5853         /// Reading from this pointer when `result_ok` is set is undefined.
5854         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5855 }
5856 #[repr(C)]
5857 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5858 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5860 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5861         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5862         /// `err` or `result` depending on the state of `result_ok`.
5863         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
5864         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5865         pub result_ok: bool,
5866 }
5867 #[no_mangle]
5868 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
5869 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5870         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5871                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5872                         result: Box::into_raw(Box::new(o)),
5873                 },
5874                 result_ok: true,
5875         }
5876 }
5877 #[no_mangle]
5878 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
5879 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5880         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5881                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5882                         err: Box::into_raw(Box::new(e)),
5883                 },
5884                 result_ok: false,
5885         }
5886 }
5887 /// Checks if the given object is currently in the success state
5888 #[no_mangle]
5889 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
5890         o.result_ok
5891 }
5892 #[no_mangle]
5893 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
5894 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
5895 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5896         fn drop(&mut self) {
5897                 if self.result_ok {
5898                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5899                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5900                         }
5901                 } else {
5902                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5903                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5904                         }
5905                 }
5906         }
5907 }
5908 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5910                 let contents = if o.result_ok {
5911                         let result = unsafe { o.contents.result };
5912                         unsafe { o.contents.result = core::ptr::null_mut() };
5913                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
5914                 } else {
5915                         let err = unsafe { o.contents.err };
5916                         unsafe { o.contents.err = core::ptr::null_mut(); }
5917                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
5918                 };
5919                 Self {
5920                         contents,
5921                         result_ok: o.result_ok,
5922                 }
5923         }
5924 }
5925 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5926         fn clone(&self) -> Self {
5927                 if self.result_ok {
5928                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5929                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5930                         } }
5931                 } else {
5932                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5933                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5934                         } }
5935                 }
5936         }
5937 }
5938 #[no_mangle]
5939 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5940 /// but with all dynamically-allocated buffers duplicated in new buffers.
5941 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5942 #[repr(C)]
5943 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5944 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5945         /// A pointer to the contents in the success state.
5946         /// Reading from this pointer when `result_ok` is not set is undefined.
5947         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5948         /// A pointer to the contents in the error state.
5949         /// Reading from this pointer when `result_ok` is set is undefined.
5950         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5951 }
5952 #[repr(C)]
5953 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5954 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5956 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
5957         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5958         /// `err` or `result` depending on the state of `result_ok`.
5959         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
5960         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5961         pub result_ok: bool,
5962 }
5963 #[no_mangle]
5964 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
5965 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
5966         CResult_SpendableOutputDescriptorDecodeErrorZ {
5967                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5968                         result: Box::into_raw(Box::new(o)),
5969                 },
5970                 result_ok: true,
5971         }
5972 }
5973 #[no_mangle]
5974 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
5975 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
5976         CResult_SpendableOutputDescriptorDecodeErrorZ {
5977                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5978                         err: Box::into_raw(Box::new(e)),
5979                 },
5980                 result_ok: false,
5981         }
5982 }
5983 /// Checks if the given object is currently in the success state
5984 #[no_mangle]
5985 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
5986         o.result_ok
5987 }
5988 #[no_mangle]
5989 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
5990 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
5991 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
5992         fn drop(&mut self) {
5993                 if self.result_ok {
5994                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5995                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5996                         }
5997                 } else {
5998                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5999                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6000                         }
6001                 }
6002         }
6003 }
6004 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6005         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6006                 let contents = if o.result_ok {
6007                         let result = unsafe { o.contents.result };
6008                         unsafe { o.contents.result = core::ptr::null_mut() };
6009                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6010                 } else {
6011                         let err = unsafe { o.contents.err };
6012                         unsafe { o.contents.err = core::ptr::null_mut(); }
6013                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6014                 };
6015                 Self {
6016                         contents,
6017                         result_ok: o.result_ok,
6018                 }
6019         }
6020 }
6021 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6022         fn clone(&self) -> Self {
6023                 if self.result_ok {
6024                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6025                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6026                         } }
6027                 } else {
6028                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6029                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6030                         } }
6031                 }
6032         }
6033 }
6034 #[no_mangle]
6035 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6036 /// but with all dynamically-allocated buffers duplicated in new buffers.
6037 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6038 #[repr(C)]
6039 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6040 /// This corresponds to std::vector in C++
6041 pub struct CVec_PaymentPreimageZ {
6042         /// The elements in the array.
6043         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6044         pub data: *mut crate::c_types::ThirtyTwoBytes,
6045         /// The number of elements pointed to by `data`.
6046         pub datalen: usize
6047 }
6048 impl CVec_PaymentPreimageZ {
6049         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6050                 if self.datalen == 0 { return Vec::new(); }
6051                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6052                 self.data = core::ptr::null_mut();
6053                 self.datalen = 0;
6054                 ret
6055         }
6056         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6057                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6058         }
6059 }
6060 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6061         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6062                 let datalen = v.len();
6063                 let data = Box::into_raw(v.into_boxed_slice());
6064                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6065         }
6066 }
6067 #[no_mangle]
6068 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6069 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6070 impl Drop for CVec_PaymentPreimageZ {
6071         fn drop(&mut self) {
6072                 if self.datalen == 0 { return; }
6073                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6074         }
6075 }
6076 impl Clone for CVec_PaymentPreimageZ {
6077         fn clone(&self) -> Self {
6078                 let mut res = Vec::new();
6079                 if self.datalen == 0 { return Self::from(res); }
6080                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6081                 Self::from(res)
6082         }
6083 }
6084 #[repr(C)]
6085 /// A tuple of 2 elements. See the individual fields for the types contained.
6086 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6087         /// The element at position 0
6088         pub a: crate::c_types::Signature,
6089         /// The element at position 1
6090         pub b: crate::c_types::derived::CVec_SignatureZ,
6091 }
6092 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6093         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6094                 Self {
6095                         a: tup.0,
6096                         b: tup.1,
6097                 }
6098         }
6099 }
6100 impl C2Tuple_SignatureCVec_SignatureZZ {
6101         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6102                 (self.a, self.b)
6103         }
6104 }
6105 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6106         fn clone(&self) -> Self {
6107                 Self {
6108                         a: Clone::clone(&self.a),
6109                         b: Clone::clone(&self.b),
6110                 }
6111         }
6112 }
6113 #[no_mangle]
6114 /// Creates a new tuple which has the same data as `orig`
6115 /// but with all dynamically-allocated buffers duplicated in new buffers.
6116 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6117 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6118 #[no_mangle]
6119 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6120         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6121 }
6122
6123 #[no_mangle]
6124 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6125 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6126 #[repr(C)]
6127 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6128 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6129         /// A pointer to the contents in the success state.
6130         /// Reading from this pointer when `result_ok` is not set is undefined.
6131         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6132         /// Note that this value is always NULL, as there are no contents in the Err variant
6133         pub err: *mut core::ffi::c_void,
6134 }
6135 #[repr(C)]
6136 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6137 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6139 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6140         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6141         /// `err` or `result` depending on the state of `result_ok`.
6142         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6143         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6144         pub result_ok: bool,
6145 }
6146 #[no_mangle]
6147 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6148 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6149         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6150                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6151                         result: Box::into_raw(Box::new(o)),
6152                 },
6153                 result_ok: true,
6154         }
6155 }
6156 #[no_mangle]
6157 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6158 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6159         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6160                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6161                         err: core::ptr::null_mut(),
6162                 },
6163                 result_ok: false,
6164         }
6165 }
6166 /// Checks if the given object is currently in the success state
6167 #[no_mangle]
6168 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6169         o.result_ok
6170 }
6171 #[no_mangle]
6172 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6173 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6174 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6175         fn drop(&mut self) {
6176                 if self.result_ok {
6177                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6178                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6179                         }
6180                 } else {
6181                 }
6182         }
6183 }
6184 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6185         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6186                 let contents = if o.result_ok {
6187                         let result = unsafe { o.contents.result };
6188                         unsafe { o.contents.result = core::ptr::null_mut() };
6189                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6190                 } else {
6191                         let _ = unsafe { Box::from_raw(o.contents.err) };
6192                         o.contents.err = core::ptr::null_mut();
6193                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6194                 };
6195                 Self {
6196                         contents,
6197                         result_ok: o.result_ok,
6198                 }
6199         }
6200 }
6201 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6202         fn clone(&self) -> Self {
6203                 if self.result_ok {
6204                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6205                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6206                         } }
6207                 } else {
6208                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6209                                 err: core::ptr::null_mut()
6210                         } }
6211                 }
6212         }
6213 }
6214 #[no_mangle]
6215 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6216 /// but with all dynamically-allocated buffers duplicated in new buffers.
6217 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6218 #[repr(C)]
6219 /// The contents of CResult_SignatureNoneZ
6220 pub union CResult_SignatureNoneZPtr {
6221         /// A pointer to the contents in the success state.
6222         /// Reading from this pointer when `result_ok` is not set is undefined.
6223         pub result: *mut crate::c_types::Signature,
6224         /// Note that this value is always NULL, as there are no contents in the Err variant
6225         pub err: *mut core::ffi::c_void,
6226 }
6227 #[repr(C)]
6228 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6229 /// containing a crate::c_types::Signature on success and a () on failure.
6230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6231 pub struct CResult_SignatureNoneZ {
6232         /// The contents of this CResult_SignatureNoneZ, accessible via either
6233         /// `err` or `result` depending on the state of `result_ok`.
6234         pub contents: CResult_SignatureNoneZPtr,
6235         /// Whether this CResult_SignatureNoneZ represents a success state.
6236         pub result_ok: bool,
6237 }
6238 #[no_mangle]
6239 /// Creates a new CResult_SignatureNoneZ in the success state.
6240 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6241         CResult_SignatureNoneZ {
6242                 contents: CResult_SignatureNoneZPtr {
6243                         result: Box::into_raw(Box::new(o)),
6244                 },
6245                 result_ok: true,
6246         }
6247 }
6248 #[no_mangle]
6249 /// Creates a new CResult_SignatureNoneZ in the error state.
6250 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6251         CResult_SignatureNoneZ {
6252                 contents: CResult_SignatureNoneZPtr {
6253                         err: core::ptr::null_mut(),
6254                 },
6255                 result_ok: false,
6256         }
6257 }
6258 /// Checks if the given object is currently in the success state
6259 #[no_mangle]
6260 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6261         o.result_ok
6262 }
6263 #[no_mangle]
6264 /// Frees any resources used by the CResult_SignatureNoneZ.
6265 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6266 impl Drop for CResult_SignatureNoneZ {
6267         fn drop(&mut self) {
6268                 if self.result_ok {
6269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6271                         }
6272                 } else {
6273                 }
6274         }
6275 }
6276 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6277         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6278                 let contents = if o.result_ok {
6279                         let result = unsafe { o.contents.result };
6280                         unsafe { o.contents.result = core::ptr::null_mut() };
6281                         CResult_SignatureNoneZPtr { result }
6282                 } else {
6283                         let _ = unsafe { Box::from_raw(o.contents.err) };
6284                         o.contents.err = core::ptr::null_mut();
6285                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6286                 };
6287                 Self {
6288                         contents,
6289                         result_ok: o.result_ok,
6290                 }
6291         }
6292 }
6293 impl Clone for CResult_SignatureNoneZ {
6294         fn clone(&self) -> Self {
6295                 if self.result_ok {
6296                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6297                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6298                         } }
6299                 } else {
6300                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6301                                 err: core::ptr::null_mut()
6302                         } }
6303                 }
6304         }
6305 }
6306 #[no_mangle]
6307 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6308 /// but with all dynamically-allocated buffers duplicated in new buffers.
6309 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6310 #[repr(C)]
6311 /// A tuple of 2 elements. See the individual fields for the types contained.
6312 pub struct C2Tuple_SignatureSignatureZ {
6313         /// The element at position 0
6314         pub a: crate::c_types::Signature,
6315         /// The element at position 1
6316         pub b: crate::c_types::Signature,
6317 }
6318 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6319         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6320                 Self {
6321                         a: tup.0,
6322                         b: tup.1,
6323                 }
6324         }
6325 }
6326 impl C2Tuple_SignatureSignatureZ {
6327         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6328                 (self.a, self.b)
6329         }
6330 }
6331 impl Clone for C2Tuple_SignatureSignatureZ {
6332         fn clone(&self) -> Self {
6333                 Self {
6334                         a: Clone::clone(&self.a),
6335                         b: Clone::clone(&self.b),
6336                 }
6337         }
6338 }
6339 #[no_mangle]
6340 /// Creates a new tuple which has the same data as `orig`
6341 /// but with all dynamically-allocated buffers duplicated in new buffers.
6342 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6343 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6344 #[no_mangle]
6345 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6346         C2Tuple_SignatureSignatureZ { a, b, }
6347 }
6348
6349 #[no_mangle]
6350 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6351 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6352 #[repr(C)]
6353 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6354 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6355         /// A pointer to the contents in the success state.
6356         /// Reading from this pointer when `result_ok` is not set is undefined.
6357         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6358         /// Note that this value is always NULL, as there are no contents in the Err variant
6359         pub err: *mut core::ffi::c_void,
6360 }
6361 #[repr(C)]
6362 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6363 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6365 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6366         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6367         /// `err` or `result` depending on the state of `result_ok`.
6368         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6369         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6370         pub result_ok: bool,
6371 }
6372 #[no_mangle]
6373 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6374 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6375         CResult_C2Tuple_SignatureSignatureZNoneZ {
6376                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6377                         result: Box::into_raw(Box::new(o)),
6378                 },
6379                 result_ok: true,
6380         }
6381 }
6382 #[no_mangle]
6383 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6384 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6385         CResult_C2Tuple_SignatureSignatureZNoneZ {
6386                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6387                         err: core::ptr::null_mut(),
6388                 },
6389                 result_ok: false,
6390         }
6391 }
6392 /// Checks if the given object is currently in the success state
6393 #[no_mangle]
6394 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6395         o.result_ok
6396 }
6397 #[no_mangle]
6398 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6399 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6400 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6401         fn drop(&mut self) {
6402                 if self.result_ok {
6403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6405                         }
6406                 } else {
6407                 }
6408         }
6409 }
6410 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6411         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6412                 let contents = if o.result_ok {
6413                         let result = unsafe { o.contents.result };
6414                         unsafe { o.contents.result = core::ptr::null_mut() };
6415                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6416                 } else {
6417                         let _ = unsafe { Box::from_raw(o.contents.err) };
6418                         o.contents.err = core::ptr::null_mut();
6419                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6420                 };
6421                 Self {
6422                         contents,
6423                         result_ok: o.result_ok,
6424                 }
6425         }
6426 }
6427 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6428         fn clone(&self) -> Self {
6429                 if self.result_ok {
6430                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6431                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6432                         } }
6433                 } else {
6434                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6435                                 err: core::ptr::null_mut()
6436                         } }
6437                 }
6438         }
6439 }
6440 #[no_mangle]
6441 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6442 /// but with all dynamically-allocated buffers duplicated in new buffers.
6443 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6444 #[repr(C)]
6445 /// The contents of CResult_SecretKeyNoneZ
6446 pub union CResult_SecretKeyNoneZPtr {
6447         /// A pointer to the contents in the success state.
6448         /// Reading from this pointer when `result_ok` is not set is undefined.
6449         pub result: *mut crate::c_types::SecretKey,
6450         /// Note that this value is always NULL, as there are no contents in the Err variant
6451         pub err: *mut core::ffi::c_void,
6452 }
6453 #[repr(C)]
6454 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6455 /// containing a crate::c_types::SecretKey on success and a () on failure.
6456 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6457 pub struct CResult_SecretKeyNoneZ {
6458         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6459         /// `err` or `result` depending on the state of `result_ok`.
6460         pub contents: CResult_SecretKeyNoneZPtr,
6461         /// Whether this CResult_SecretKeyNoneZ represents a success state.
6462         pub result_ok: bool,
6463 }
6464 #[no_mangle]
6465 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6466 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6467         CResult_SecretKeyNoneZ {
6468                 contents: CResult_SecretKeyNoneZPtr {
6469                         result: Box::into_raw(Box::new(o)),
6470                 },
6471                 result_ok: true,
6472         }
6473 }
6474 #[no_mangle]
6475 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6476 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6477         CResult_SecretKeyNoneZ {
6478                 contents: CResult_SecretKeyNoneZPtr {
6479                         err: core::ptr::null_mut(),
6480                 },
6481                 result_ok: false,
6482         }
6483 }
6484 /// Checks if the given object is currently in the success state
6485 #[no_mangle]
6486 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6487         o.result_ok
6488 }
6489 #[no_mangle]
6490 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6491 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6492 impl Drop for CResult_SecretKeyNoneZ {
6493         fn drop(&mut self) {
6494                 if self.result_ok {
6495                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6496                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6497                         }
6498                 } else {
6499                 }
6500         }
6501 }
6502 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6503         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6504                 let contents = if o.result_ok {
6505                         let result = unsafe { o.contents.result };
6506                         unsafe { o.contents.result = core::ptr::null_mut() };
6507                         CResult_SecretKeyNoneZPtr { result }
6508                 } else {
6509                         let _ = unsafe { Box::from_raw(o.contents.err) };
6510                         o.contents.err = core::ptr::null_mut();
6511                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6512                 };
6513                 Self {
6514                         contents,
6515                         result_ok: o.result_ok,
6516                 }
6517         }
6518 }
6519 impl Clone for CResult_SecretKeyNoneZ {
6520         fn clone(&self) -> Self {
6521                 if self.result_ok {
6522                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6523                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6524                         } }
6525                 } else {
6526                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6527                                 err: core::ptr::null_mut()
6528                         } }
6529                 }
6530         }
6531 }
6532 #[no_mangle]
6533 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6534 /// but with all dynamically-allocated buffers duplicated in new buffers.
6535 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6536 #[repr(C)]
6537 /// The contents of CResult_SignDecodeErrorZ
6538 pub union CResult_SignDecodeErrorZPtr {
6539         /// A pointer to the contents in the success state.
6540         /// Reading from this pointer when `result_ok` is not set is undefined.
6541         pub result: *mut crate::lightning::chain::keysinterface::Sign,
6542         /// A pointer to the contents in the error state.
6543         /// Reading from this pointer when `result_ok` is set is undefined.
6544         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6545 }
6546 #[repr(C)]
6547 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6548 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6550 pub struct CResult_SignDecodeErrorZ {
6551         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6552         /// `err` or `result` depending on the state of `result_ok`.
6553         pub contents: CResult_SignDecodeErrorZPtr,
6554         /// Whether this CResult_SignDecodeErrorZ represents a success state.
6555         pub result_ok: bool,
6556 }
6557 #[no_mangle]
6558 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6559 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6560         CResult_SignDecodeErrorZ {
6561                 contents: CResult_SignDecodeErrorZPtr {
6562                         result: Box::into_raw(Box::new(o)),
6563                 },
6564                 result_ok: true,
6565         }
6566 }
6567 #[no_mangle]
6568 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6569 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6570         CResult_SignDecodeErrorZ {
6571                 contents: CResult_SignDecodeErrorZPtr {
6572                         err: Box::into_raw(Box::new(e)),
6573                 },
6574                 result_ok: false,
6575         }
6576 }
6577 /// Checks if the given object is currently in the success state
6578 #[no_mangle]
6579 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6580         o.result_ok
6581 }
6582 #[no_mangle]
6583 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6584 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6585 impl Drop for CResult_SignDecodeErrorZ {
6586         fn drop(&mut self) {
6587                 if self.result_ok {
6588                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6589                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6590                         }
6591                 } else {
6592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6594                         }
6595                 }
6596         }
6597 }
6598 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6599         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6600                 let contents = if o.result_ok {
6601                         let result = unsafe { o.contents.result };
6602                         unsafe { o.contents.result = core::ptr::null_mut() };
6603                         CResult_SignDecodeErrorZPtr { result }
6604                 } else {
6605                         let err = unsafe { o.contents.err };
6606                         unsafe { o.contents.err = core::ptr::null_mut(); }
6607                         CResult_SignDecodeErrorZPtr { err }
6608                 };
6609                 Self {
6610                         contents,
6611                         result_ok: o.result_ok,
6612                 }
6613         }
6614 }
6615 impl Clone for CResult_SignDecodeErrorZ {
6616         fn clone(&self) -> Self {
6617                 if self.result_ok {
6618                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6619                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6620                         } }
6621                 } else {
6622                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6623                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6624                         } }
6625                 }
6626         }
6627 }
6628 #[no_mangle]
6629 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6630 /// but with all dynamically-allocated buffers duplicated in new buffers.
6631 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6632 #[repr(C)]
6633 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6634 /// This corresponds to std::vector in C++
6635 pub struct CVec_u5Z {
6636         /// The elements in the array.
6637         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6638         pub data: *mut crate::c_types::u5,
6639         /// The number of elements pointed to by `data`.
6640         pub datalen: usize
6641 }
6642 impl CVec_u5Z {
6643         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
6644                 if self.datalen == 0 { return Vec::new(); }
6645                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6646                 self.data = core::ptr::null_mut();
6647                 self.datalen = 0;
6648                 ret
6649         }
6650         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
6651                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6652         }
6653 }
6654 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
6655         fn from(v: Vec<crate::c_types::u5>) -> Self {
6656                 let datalen = v.len();
6657                 let data = Box::into_raw(v.into_boxed_slice());
6658                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6659         }
6660 }
6661 #[no_mangle]
6662 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6663 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
6664 impl Drop for CVec_u5Z {
6665         fn drop(&mut self) {
6666                 if self.datalen == 0 { return; }
6667                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6668         }
6669 }
6670 impl Clone for CVec_u5Z {
6671         fn clone(&self) -> Self {
6672                 let mut res = Vec::new();
6673                 if self.datalen == 0 { return Self::from(res); }
6674                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6675                 Self::from(res)
6676         }
6677 }
6678 #[repr(C)]
6679 /// The contents of CResult_RecoverableSignatureNoneZ
6680 pub union CResult_RecoverableSignatureNoneZPtr {
6681         /// A pointer to the contents in the success state.
6682         /// Reading from this pointer when `result_ok` is not set is undefined.
6683         pub result: *mut crate::c_types::RecoverableSignature,
6684         /// Note that this value is always NULL, as there are no contents in the Err variant
6685         pub err: *mut core::ffi::c_void,
6686 }
6687 #[repr(C)]
6688 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6689 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
6690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6691 pub struct CResult_RecoverableSignatureNoneZ {
6692         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6693         /// `err` or `result` depending on the state of `result_ok`.
6694         pub contents: CResult_RecoverableSignatureNoneZPtr,
6695         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6696         pub result_ok: bool,
6697 }
6698 #[no_mangle]
6699 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
6700 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
6701         CResult_RecoverableSignatureNoneZ {
6702                 contents: CResult_RecoverableSignatureNoneZPtr {
6703                         result: Box::into_raw(Box::new(o)),
6704                 },
6705                 result_ok: true,
6706         }
6707 }
6708 #[no_mangle]
6709 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
6710 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
6711         CResult_RecoverableSignatureNoneZ {
6712                 contents: CResult_RecoverableSignatureNoneZPtr {
6713                         err: core::ptr::null_mut(),
6714                 },
6715                 result_ok: false,
6716         }
6717 }
6718 /// Checks if the given object is currently in the success state
6719 #[no_mangle]
6720 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
6721         o.result_ok
6722 }
6723 #[no_mangle]
6724 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
6725 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
6726 impl Drop for CResult_RecoverableSignatureNoneZ {
6727         fn drop(&mut self) {
6728                 if self.result_ok {
6729                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6730                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6731                         }
6732                 } else {
6733                 }
6734         }
6735 }
6736 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
6737         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
6738                 let contents = if o.result_ok {
6739                         let result = unsafe { o.contents.result };
6740                         unsafe { o.contents.result = core::ptr::null_mut() };
6741                         CResult_RecoverableSignatureNoneZPtr { result }
6742                 } else {
6743                         let _ = unsafe { Box::from_raw(o.contents.err) };
6744                         o.contents.err = core::ptr::null_mut();
6745                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
6746                 };
6747                 Self {
6748                         contents,
6749                         result_ok: o.result_ok,
6750                 }
6751         }
6752 }
6753 impl Clone for CResult_RecoverableSignatureNoneZ {
6754         fn clone(&self) -> Self {
6755                 if self.result_ok {
6756                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
6757                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
6758                         } }
6759                 } else {
6760                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
6761                                 err: core::ptr::null_mut()
6762                         } }
6763                 }
6764         }
6765 }
6766 #[no_mangle]
6767 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
6768 /// but with all dynamically-allocated buffers duplicated in new buffers.
6769 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
6770 #[repr(C)]
6771 /// A dynamically-allocated array of u8s of arbitrary size.
6772 /// This corresponds to std::vector in C++
6773 pub struct CVec_u8Z {
6774         /// The elements in the array.
6775         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6776         pub data: *mut u8,
6777         /// The number of elements pointed to by `data`.
6778         pub datalen: usize
6779 }
6780 impl CVec_u8Z {
6781         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
6782                 if self.datalen == 0 { return Vec::new(); }
6783                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6784                 self.data = core::ptr::null_mut();
6785                 self.datalen = 0;
6786                 ret
6787         }
6788         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
6789                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6790         }
6791 }
6792 impl From<Vec<u8>> for CVec_u8Z {
6793         fn from(v: Vec<u8>) -> Self {
6794                 let datalen = v.len();
6795                 let data = Box::into_raw(v.into_boxed_slice());
6796                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6797         }
6798 }
6799 #[no_mangle]
6800 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6801 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
6802 impl Drop for CVec_u8Z {
6803         fn drop(&mut self) {
6804                 if self.datalen == 0 { return; }
6805                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6806         }
6807 }
6808 impl Clone for CVec_u8Z {
6809         fn clone(&self) -> Self {
6810                 let mut res = Vec::new();
6811                 if self.datalen == 0 { return Self::from(res); }
6812                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6813                 Self::from(res)
6814         }
6815 }
6816 #[repr(C)]
6817 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6818 /// This corresponds to std::vector in C++
6819 pub struct CVec_CVec_u8ZZ {
6820         /// The elements in the array.
6821         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6822         pub data: *mut crate::c_types::derived::CVec_u8Z,
6823         /// The number of elements pointed to by `data`.
6824         pub datalen: usize
6825 }
6826 impl CVec_CVec_u8ZZ {
6827         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
6828                 if self.datalen == 0 { return Vec::new(); }
6829                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6830                 self.data = core::ptr::null_mut();
6831                 self.datalen = 0;
6832                 ret
6833         }
6834         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
6835                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6836         }
6837 }
6838 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
6839         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
6840                 let datalen = v.len();
6841                 let data = Box::into_raw(v.into_boxed_slice());
6842                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6843         }
6844 }
6845 #[no_mangle]
6846 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6847 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
6848 impl Drop for CVec_CVec_u8ZZ {
6849         fn drop(&mut self) {
6850                 if self.datalen == 0 { return; }
6851                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6852         }
6853 }
6854 impl Clone for CVec_CVec_u8ZZ {
6855         fn clone(&self) -> Self {
6856                 let mut res = Vec::new();
6857                 if self.datalen == 0 { return Self::from(res); }
6858                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6859                 Self::from(res)
6860         }
6861 }
6862 #[repr(C)]
6863 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
6864 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
6865         /// A pointer to the contents in the success state.
6866         /// Reading from this pointer when `result_ok` is not set is undefined.
6867         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
6868         /// Note that this value is always NULL, as there are no contents in the Err variant
6869         pub err: *mut core::ffi::c_void,
6870 }
6871 #[repr(C)]
6872 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6873 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6875 pub struct CResult_CVec_CVec_u8ZZNoneZ {
6876         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6877         /// `err` or `result` depending on the state of `result_ok`.
6878         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
6879         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6880         pub result_ok: bool,
6881 }
6882 #[no_mangle]
6883 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
6884 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
6885         CResult_CVec_CVec_u8ZZNoneZ {
6886                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6887                         result: Box::into_raw(Box::new(o)),
6888                 },
6889                 result_ok: true,
6890         }
6891 }
6892 #[no_mangle]
6893 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
6894 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
6895         CResult_CVec_CVec_u8ZZNoneZ {
6896                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6897                         err: core::ptr::null_mut(),
6898                 },
6899                 result_ok: false,
6900         }
6901 }
6902 /// Checks if the given object is currently in the success state
6903 #[no_mangle]
6904 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
6905         o.result_ok
6906 }
6907 #[no_mangle]
6908 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
6909 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
6910 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
6911         fn drop(&mut self) {
6912                 if self.result_ok {
6913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6915                         }
6916                 } else {
6917                 }
6918         }
6919 }
6920 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
6921         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
6922                 let contents = if o.result_ok {
6923                         let result = unsafe { o.contents.result };
6924                         unsafe { o.contents.result = core::ptr::null_mut() };
6925                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
6926                 } else {
6927                         let _ = unsafe { Box::from_raw(o.contents.err) };
6928                         o.contents.err = core::ptr::null_mut();
6929                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
6930                 };
6931                 Self {
6932                         contents,
6933                         result_ok: o.result_ok,
6934                 }
6935         }
6936 }
6937 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
6938         fn clone(&self) -> Self {
6939                 if self.result_ok {
6940                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6941                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
6942                         } }
6943                 } else {
6944                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6945                                 err: core::ptr::null_mut()
6946                         } }
6947                 }
6948         }
6949 }
6950 #[no_mangle]
6951 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
6954 #[repr(C)]
6955 /// The contents of CResult_InMemorySignerDecodeErrorZ
6956 pub union CResult_InMemorySignerDecodeErrorZPtr {
6957         /// A pointer to the contents in the success state.
6958         /// Reading from this pointer when `result_ok` is not set is undefined.
6959         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
6960         /// A pointer to the contents in the error state.
6961         /// Reading from this pointer when `result_ok` is set is undefined.
6962         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6963 }
6964 #[repr(C)]
6965 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6966 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6968 pub struct CResult_InMemorySignerDecodeErrorZ {
6969         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6970         /// `err` or `result` depending on the state of `result_ok`.
6971         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
6972         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6973         pub result_ok: bool,
6974 }
6975 #[no_mangle]
6976 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
6977 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
6978         CResult_InMemorySignerDecodeErrorZ {
6979                 contents: CResult_InMemorySignerDecodeErrorZPtr {
6980                         result: Box::into_raw(Box::new(o)),
6981                 },
6982                 result_ok: true,
6983         }
6984 }
6985 #[no_mangle]
6986 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
6987 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
6988         CResult_InMemorySignerDecodeErrorZ {
6989                 contents: CResult_InMemorySignerDecodeErrorZPtr {
6990                         err: Box::into_raw(Box::new(e)),
6991                 },
6992                 result_ok: false,
6993         }
6994 }
6995 /// Checks if the given object is currently in the success state
6996 #[no_mangle]
6997 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
6998         o.result_ok
6999 }
7000 #[no_mangle]
7001 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7002 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7003 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7004         fn drop(&mut self) {
7005                 if self.result_ok {
7006                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7007                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7008                         }
7009                 } else {
7010                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7011                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7012                         }
7013                 }
7014         }
7015 }
7016 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7017         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7018                 let contents = if o.result_ok {
7019                         let result = unsafe { o.contents.result };
7020                         unsafe { o.contents.result = core::ptr::null_mut() };
7021                         CResult_InMemorySignerDecodeErrorZPtr { result }
7022                 } else {
7023                         let err = unsafe { o.contents.err };
7024                         unsafe { o.contents.err = core::ptr::null_mut(); }
7025                         CResult_InMemorySignerDecodeErrorZPtr { err }
7026                 };
7027                 Self {
7028                         contents,
7029                         result_ok: o.result_ok,
7030                 }
7031         }
7032 }
7033 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7034         fn clone(&self) -> Self {
7035                 if self.result_ok {
7036                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7037                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7038                         } }
7039                 } else {
7040                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7041                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7042                         } }
7043                 }
7044         }
7045 }
7046 #[no_mangle]
7047 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7048 /// but with all dynamically-allocated buffers duplicated in new buffers.
7049 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7050 #[repr(C)]
7051 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7052 /// This corresponds to std::vector in C++
7053 pub struct CVec_TxOutZ {
7054         /// The elements in the array.
7055         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7056         pub data: *mut crate::c_types::TxOut,
7057         /// The number of elements pointed to by `data`.
7058         pub datalen: usize
7059 }
7060 impl CVec_TxOutZ {
7061         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7062                 if self.datalen == 0 { return Vec::new(); }
7063                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7064                 self.data = core::ptr::null_mut();
7065                 self.datalen = 0;
7066                 ret
7067         }
7068         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7069                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7070         }
7071 }
7072 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7073         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7074                 let datalen = v.len();
7075                 let data = Box::into_raw(v.into_boxed_slice());
7076                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7077         }
7078 }
7079 #[no_mangle]
7080 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7081 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7082 impl Drop for CVec_TxOutZ {
7083         fn drop(&mut self) {
7084                 if self.datalen == 0 { return; }
7085                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7086         }
7087 }
7088 impl Clone for CVec_TxOutZ {
7089         fn clone(&self) -> Self {
7090                 let mut res = Vec::new();
7091                 if self.datalen == 0 { return Self::from(res); }
7092                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7093                 Self::from(res)
7094         }
7095 }
7096 #[repr(C)]
7097 /// The contents of CResult_TransactionNoneZ
7098 pub union CResult_TransactionNoneZPtr {
7099         /// A pointer to the contents in the success state.
7100         /// Reading from this pointer when `result_ok` is not set is undefined.
7101         pub result: *mut crate::c_types::Transaction,
7102         /// Note that this value is always NULL, as there are no contents in the Err variant
7103         pub err: *mut core::ffi::c_void,
7104 }
7105 #[repr(C)]
7106 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7107 /// containing a crate::c_types::Transaction on success and a () on failure.
7108 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7109 pub struct CResult_TransactionNoneZ {
7110         /// The contents of this CResult_TransactionNoneZ, accessible via either
7111         /// `err` or `result` depending on the state of `result_ok`.
7112         pub contents: CResult_TransactionNoneZPtr,
7113         /// Whether this CResult_TransactionNoneZ represents a success state.
7114         pub result_ok: bool,
7115 }
7116 #[no_mangle]
7117 /// Creates a new CResult_TransactionNoneZ in the success state.
7118 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7119         CResult_TransactionNoneZ {
7120                 contents: CResult_TransactionNoneZPtr {
7121                         result: Box::into_raw(Box::new(o)),
7122                 },
7123                 result_ok: true,
7124         }
7125 }
7126 #[no_mangle]
7127 /// Creates a new CResult_TransactionNoneZ in the error state.
7128 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7129         CResult_TransactionNoneZ {
7130                 contents: CResult_TransactionNoneZPtr {
7131                         err: core::ptr::null_mut(),
7132                 },
7133                 result_ok: false,
7134         }
7135 }
7136 /// Checks if the given object is currently in the success state
7137 #[no_mangle]
7138 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7139         o.result_ok
7140 }
7141 #[no_mangle]
7142 /// Frees any resources used by the CResult_TransactionNoneZ.
7143 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7144 impl Drop for CResult_TransactionNoneZ {
7145         fn drop(&mut self) {
7146                 if self.result_ok {
7147                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7148                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7149                         }
7150                 } else {
7151                 }
7152         }
7153 }
7154 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7155         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7156                 let contents = if o.result_ok {
7157                         let result = unsafe { o.contents.result };
7158                         unsafe { o.contents.result = core::ptr::null_mut() };
7159                         CResult_TransactionNoneZPtr { result }
7160                 } else {
7161                         let _ = unsafe { Box::from_raw(o.contents.err) };
7162                         o.contents.err = core::ptr::null_mut();
7163                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7164                 };
7165                 Self {
7166                         contents,
7167                         result_ok: o.result_ok,
7168                 }
7169         }
7170 }
7171 impl Clone for CResult_TransactionNoneZ {
7172         fn clone(&self) -> Self {
7173                 if self.result_ok {
7174                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7175                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7176                         } }
7177                 } else {
7178                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7179                                 err: core::ptr::null_mut()
7180                         } }
7181                 }
7182         }
7183 }
7184 #[no_mangle]
7185 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7186 /// but with all dynamically-allocated buffers duplicated in new buffers.
7187 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7188 #[repr(C)]
7189 /// A tuple of 2 elements. See the individual fields for the types contained.
7190 pub struct C2Tuple_BlockHashChannelMonitorZ {
7191         /// The element at position 0
7192         pub a: crate::c_types::ThirtyTwoBytes,
7193         /// The element at position 1
7194         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7195 }
7196 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7197         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7198                 Self {
7199                         a: tup.0,
7200                         b: tup.1,
7201                 }
7202         }
7203 }
7204 impl C2Tuple_BlockHashChannelMonitorZ {
7205         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7206                 (self.a, self.b)
7207         }
7208 }
7209 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7210 #[no_mangle]
7211 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7212         C2Tuple_BlockHashChannelMonitorZ { a, b, }
7213 }
7214
7215 #[no_mangle]
7216 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7217 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7218 #[repr(C)]
7219 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7220 /// This corresponds to std::vector in C++
7221 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7222         /// The elements in the array.
7223         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7224         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7225         /// The number of elements pointed to by `data`.
7226         pub datalen: usize
7227 }
7228 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7229         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7230                 if self.datalen == 0 { return Vec::new(); }
7231                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7232                 self.data = core::ptr::null_mut();
7233                 self.datalen = 0;
7234                 ret
7235         }
7236         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7237                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7238         }
7239 }
7240 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7241         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7242                 let datalen = v.len();
7243                 let data = Box::into_raw(v.into_boxed_slice());
7244                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7245         }
7246 }
7247 #[no_mangle]
7248 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7249 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7250 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7251         fn drop(&mut self) {
7252                 if self.datalen == 0 { return; }
7253                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7254         }
7255 }
7256 #[repr(C)]
7257 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7258 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7259         /// A pointer to the contents in the success state.
7260         /// Reading from this pointer when `result_ok` is not set is undefined.
7261         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7262         /// A pointer to the contents in the error state.
7263         /// Reading from this pointer when `result_ok` is set is undefined.
7264         pub err: *mut crate::c_types::IOError,
7265 }
7266 #[repr(C)]
7267 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7268 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7270 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7271         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7272         /// `err` or `result` depending on the state of `result_ok`.
7273         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7274         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7275         pub result_ok: bool,
7276 }
7277 #[no_mangle]
7278 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7279 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7280         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7281                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7282                         result: Box::into_raw(Box::new(o)),
7283                 },
7284                 result_ok: true,
7285         }
7286 }
7287 #[no_mangle]
7288 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7289 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7290         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7291                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7292                         err: Box::into_raw(Box::new(e)),
7293                 },
7294                 result_ok: false,
7295         }
7296 }
7297 /// Checks if the given object is currently in the success state
7298 #[no_mangle]
7299 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7300         o.result_ok
7301 }
7302 #[no_mangle]
7303 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7304 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7305 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7306         fn drop(&mut self) {
7307                 if self.result_ok {
7308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7310                         }
7311                 } else {
7312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7314                         }
7315                 }
7316         }
7317 }
7318 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7319         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7320                 let contents = if o.result_ok {
7321                         let result = unsafe { o.contents.result };
7322                         unsafe { o.contents.result = core::ptr::null_mut() };
7323                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7324                 } else {
7325                         let err = unsafe { o.contents.err };
7326                         unsafe { o.contents.err = core::ptr::null_mut(); }
7327                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7328                 };
7329                 Self {
7330                         contents,
7331                         result_ok: o.result_ok,
7332                 }
7333         }
7334 }
7335 #[repr(C)]
7336 #[derive(Clone)]
7337 /// An enum which can either contain a u16 or not
7338 pub enum COption_u16Z {
7339         /// When we're in this state, this COption_u16Z contains a u16
7340         Some(u16),
7341         /// When we're in this state, this COption_u16Z contains nothing
7342         None
7343 }
7344 impl COption_u16Z {
7345         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7346                 if let Self::None = self { false } else { true }
7347         }
7348         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7349                 !self.is_some()
7350         }
7351         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7352                 if let Self::Some(v) = self { v } else { unreachable!() }
7353         }
7354 }
7355 #[no_mangle]
7356 /// Constructs a new COption_u16Z containing a u16
7357 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7358         COption_u16Z::Some(o)
7359 }
7360 #[no_mangle]
7361 /// Constructs a new COption_u16Z containing nothing
7362 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7363         COption_u16Z::None
7364 }
7365 #[no_mangle]
7366 /// Frees any resources associated with the u16, if we are in the Some state
7367 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7368 #[no_mangle]
7369 /// Creates a new COption_u16Z which has the same data as `orig`
7370 /// but with all dynamically-allocated buffers duplicated in new buffers.
7371 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7372 #[repr(C)]
7373 /// The contents of CResult_NoneAPIErrorZ
7374 pub union CResult_NoneAPIErrorZPtr {
7375         /// Note that this value is always NULL, as there are no contents in the OK variant
7376         pub result: *mut core::ffi::c_void,
7377         /// A pointer to the contents in the error state.
7378         /// Reading from this pointer when `result_ok` is set is undefined.
7379         pub err: *mut crate::lightning::util::errors::APIError,
7380 }
7381 #[repr(C)]
7382 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7383 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7384 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7385 pub struct CResult_NoneAPIErrorZ {
7386         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7387         /// `err` or `result` depending on the state of `result_ok`.
7388         pub contents: CResult_NoneAPIErrorZPtr,
7389         /// Whether this CResult_NoneAPIErrorZ represents a success state.
7390         pub result_ok: bool,
7391 }
7392 #[no_mangle]
7393 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7394 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7395         CResult_NoneAPIErrorZ {
7396                 contents: CResult_NoneAPIErrorZPtr {
7397                         result: core::ptr::null_mut(),
7398                 },
7399                 result_ok: true,
7400         }
7401 }
7402 #[no_mangle]
7403 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7404 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7405         CResult_NoneAPIErrorZ {
7406                 contents: CResult_NoneAPIErrorZPtr {
7407                         err: Box::into_raw(Box::new(e)),
7408                 },
7409                 result_ok: false,
7410         }
7411 }
7412 /// Checks if the given object is currently in the success state
7413 #[no_mangle]
7414 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7415         o.result_ok
7416 }
7417 #[no_mangle]
7418 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7419 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7420 impl Drop for CResult_NoneAPIErrorZ {
7421         fn drop(&mut self) {
7422                 if self.result_ok {
7423                 } else {
7424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7426                         }
7427                 }
7428         }
7429 }
7430 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7431         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7432                 let contents = if o.result_ok {
7433                         let _ = unsafe { Box::from_raw(o.contents.result) };
7434                         o.contents.result = core::ptr::null_mut();
7435                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7436                 } else {
7437                         let err = unsafe { o.contents.err };
7438                         unsafe { o.contents.err = core::ptr::null_mut(); }
7439                         CResult_NoneAPIErrorZPtr { err }
7440                 };
7441                 Self {
7442                         contents,
7443                         result_ok: o.result_ok,
7444                 }
7445         }
7446 }
7447 impl Clone for CResult_NoneAPIErrorZ {
7448         fn clone(&self) -> Self {
7449                 if self.result_ok {
7450                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7451                                 result: core::ptr::null_mut()
7452                         } }
7453                 } else {
7454                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7455                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7456                         } }
7457                 }
7458         }
7459 }
7460 #[no_mangle]
7461 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7462 /// but with all dynamically-allocated buffers duplicated in new buffers.
7463 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7464 #[repr(C)]
7465 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7466 /// This corresponds to std::vector in C++
7467 pub struct CVec_CResult_NoneAPIErrorZZ {
7468         /// The elements in the array.
7469         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7470         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7471         /// The number of elements pointed to by `data`.
7472         pub datalen: usize
7473 }
7474 impl CVec_CResult_NoneAPIErrorZZ {
7475         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7476                 if self.datalen == 0 { return Vec::new(); }
7477                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7478                 self.data = core::ptr::null_mut();
7479                 self.datalen = 0;
7480                 ret
7481         }
7482         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7483                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7484         }
7485 }
7486 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7487         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7488                 let datalen = v.len();
7489                 let data = Box::into_raw(v.into_boxed_slice());
7490                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7491         }
7492 }
7493 #[no_mangle]
7494 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7495 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7496 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7497         fn drop(&mut self) {
7498                 if self.datalen == 0 { return; }
7499                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7500         }
7501 }
7502 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7503         fn clone(&self) -> Self {
7504                 let mut res = Vec::new();
7505                 if self.datalen == 0 { return Self::from(res); }
7506                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7507                 Self::from(res)
7508         }
7509 }
7510 #[repr(C)]
7511 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7512 /// This corresponds to std::vector in C++
7513 pub struct CVec_APIErrorZ {
7514         /// The elements in the array.
7515         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7516         pub data: *mut crate::lightning::util::errors::APIError,
7517         /// The number of elements pointed to by `data`.
7518         pub datalen: usize
7519 }
7520 impl CVec_APIErrorZ {
7521         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7522                 if self.datalen == 0 { return Vec::new(); }
7523                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7524                 self.data = core::ptr::null_mut();
7525                 self.datalen = 0;
7526                 ret
7527         }
7528         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7529                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7530         }
7531 }
7532 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7533         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7534                 let datalen = v.len();
7535                 let data = Box::into_raw(v.into_boxed_slice());
7536                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7537         }
7538 }
7539 #[no_mangle]
7540 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7541 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7542 impl Drop for CVec_APIErrorZ {
7543         fn drop(&mut self) {
7544                 if self.datalen == 0 { return; }
7545                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7546         }
7547 }
7548 impl Clone for CVec_APIErrorZ {
7549         fn clone(&self) -> Self {
7550                 let mut res = Vec::new();
7551                 if self.datalen == 0 { return Self::from(res); }
7552                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7553                 Self::from(res)
7554         }
7555 }
7556 #[repr(C)]
7557 /// The contents of CResult__u832APIErrorZ
7558 pub union CResult__u832APIErrorZPtr {
7559         /// A pointer to the contents in the success state.
7560         /// Reading from this pointer when `result_ok` is not set is undefined.
7561         pub result: *mut crate::c_types::ThirtyTwoBytes,
7562         /// A pointer to the contents in the error state.
7563         /// Reading from this pointer when `result_ok` is set is undefined.
7564         pub err: *mut crate::lightning::util::errors::APIError,
7565 }
7566 #[repr(C)]
7567 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7568 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7570 pub struct CResult__u832APIErrorZ {
7571         /// The contents of this CResult__u832APIErrorZ, accessible via either
7572         /// `err` or `result` depending on the state of `result_ok`.
7573         pub contents: CResult__u832APIErrorZPtr,
7574         /// Whether this CResult__u832APIErrorZ represents a success state.
7575         pub result_ok: bool,
7576 }
7577 #[no_mangle]
7578 /// Creates a new CResult__u832APIErrorZ in the success state.
7579 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7580         CResult__u832APIErrorZ {
7581                 contents: CResult__u832APIErrorZPtr {
7582                         result: Box::into_raw(Box::new(o)),
7583                 },
7584                 result_ok: true,
7585         }
7586 }
7587 #[no_mangle]
7588 /// Creates a new CResult__u832APIErrorZ in the error state.
7589 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7590         CResult__u832APIErrorZ {
7591                 contents: CResult__u832APIErrorZPtr {
7592                         err: Box::into_raw(Box::new(e)),
7593                 },
7594                 result_ok: false,
7595         }
7596 }
7597 /// Checks if the given object is currently in the success state
7598 #[no_mangle]
7599 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7600         o.result_ok
7601 }
7602 #[no_mangle]
7603 /// Frees any resources used by the CResult__u832APIErrorZ.
7604 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7605 impl Drop for CResult__u832APIErrorZ {
7606         fn drop(&mut self) {
7607                 if self.result_ok {
7608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7610                         }
7611                 } else {
7612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7614                         }
7615                 }
7616         }
7617 }
7618 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7619         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7620                 let contents = if o.result_ok {
7621                         let result = unsafe { o.contents.result };
7622                         unsafe { o.contents.result = core::ptr::null_mut() };
7623                         CResult__u832APIErrorZPtr { result }
7624                 } else {
7625                         let err = unsafe { o.contents.err };
7626                         unsafe { o.contents.err = core::ptr::null_mut(); }
7627                         CResult__u832APIErrorZPtr { err }
7628                 };
7629                 Self {
7630                         contents,
7631                         result_ok: o.result_ok,
7632                 }
7633         }
7634 }
7635 impl Clone for CResult__u832APIErrorZ {
7636         fn clone(&self) -> Self {
7637                 if self.result_ok {
7638                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7639                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7640                         } }
7641                 } else {
7642                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7643                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7644                         } }
7645                 }
7646         }
7647 }
7648 #[no_mangle]
7649 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7650 /// but with all dynamically-allocated buffers duplicated in new buffers.
7651 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7652 #[repr(C)]
7653 /// The contents of CResult_PaymentIdPaymentSendFailureZ
7654 pub union CResult_PaymentIdPaymentSendFailureZPtr {
7655         /// A pointer to the contents in the success state.
7656         /// Reading from this pointer when `result_ok` is not set is undefined.
7657         pub result: *mut crate::c_types::ThirtyTwoBytes,
7658         /// A pointer to the contents in the error state.
7659         /// Reading from this pointer when `result_ok` is set is undefined.
7660         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7661 }
7662 #[repr(C)]
7663 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7664 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7665 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7666 pub struct CResult_PaymentIdPaymentSendFailureZ {
7667         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7668         /// `err` or `result` depending on the state of `result_ok`.
7669         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
7670         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7671         pub result_ok: bool,
7672 }
7673 #[no_mangle]
7674 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
7675 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
7676         CResult_PaymentIdPaymentSendFailureZ {
7677                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7678                         result: Box::into_raw(Box::new(o)),
7679                 },
7680                 result_ok: true,
7681         }
7682 }
7683 #[no_mangle]
7684 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
7685 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
7686         CResult_PaymentIdPaymentSendFailureZ {
7687                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7688                         err: Box::into_raw(Box::new(e)),
7689                 },
7690                 result_ok: false,
7691         }
7692 }
7693 /// Checks if the given object is currently in the success state
7694 #[no_mangle]
7695 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
7696         o.result_ok
7697 }
7698 #[no_mangle]
7699 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
7700 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
7701 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
7702         fn drop(&mut self) {
7703                 if self.result_ok {
7704                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7705                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7706                         }
7707                 } else {
7708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7710                         }
7711                 }
7712         }
7713 }
7714 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
7715         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7716                 let contents = if o.result_ok {
7717                         let result = unsafe { o.contents.result };
7718                         unsafe { o.contents.result = core::ptr::null_mut() };
7719                         CResult_PaymentIdPaymentSendFailureZPtr { result }
7720                 } else {
7721                         let err = unsafe { o.contents.err };
7722                         unsafe { o.contents.err = core::ptr::null_mut(); }
7723                         CResult_PaymentIdPaymentSendFailureZPtr { err }
7724                 };
7725                 Self {
7726                         contents,
7727                         result_ok: o.result_ok,
7728                 }
7729         }
7730 }
7731 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
7732         fn clone(&self) -> Self {
7733                 if self.result_ok {
7734                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7735                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7736                         } }
7737                 } else {
7738                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7739                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7740                         } }
7741                 }
7742         }
7743 }
7744 #[no_mangle]
7745 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
7746 /// but with all dynamically-allocated buffers duplicated in new buffers.
7747 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
7748 #[repr(C)]
7749 /// The contents of CResult_NonePaymentSendFailureZ
7750 pub union CResult_NonePaymentSendFailureZPtr {
7751         /// Note that this value is always NULL, as there are no contents in the OK variant
7752         pub result: *mut core::ffi::c_void,
7753         /// A pointer to the contents in the error state.
7754         /// Reading from this pointer when `result_ok` is set is undefined.
7755         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7756 }
7757 #[repr(C)]
7758 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7759 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7761 pub struct CResult_NonePaymentSendFailureZ {
7762         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7763         /// `err` or `result` depending on the state of `result_ok`.
7764         pub contents: CResult_NonePaymentSendFailureZPtr,
7765         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7766         pub result_ok: bool,
7767 }
7768 #[no_mangle]
7769 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7770 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7771         CResult_NonePaymentSendFailureZ {
7772                 contents: CResult_NonePaymentSendFailureZPtr {
7773                         result: core::ptr::null_mut(),
7774                 },
7775                 result_ok: true,
7776         }
7777 }
7778 #[no_mangle]
7779 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
7780 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
7781         CResult_NonePaymentSendFailureZ {
7782                 contents: CResult_NonePaymentSendFailureZPtr {
7783                         err: Box::into_raw(Box::new(e)),
7784                 },
7785                 result_ok: false,
7786         }
7787 }
7788 /// Checks if the given object is currently in the success state
7789 #[no_mangle]
7790 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
7791         o.result_ok
7792 }
7793 #[no_mangle]
7794 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
7795 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
7796 impl Drop for CResult_NonePaymentSendFailureZ {
7797         fn drop(&mut self) {
7798                 if self.result_ok {
7799                 } else {
7800                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7801                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7802                         }
7803                 }
7804         }
7805 }
7806 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
7807         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7808                 let contents = if o.result_ok {
7809                         let _ = unsafe { Box::from_raw(o.contents.result) };
7810                         o.contents.result = core::ptr::null_mut();
7811                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
7812                 } else {
7813                         let err = unsafe { o.contents.err };
7814                         unsafe { o.contents.err = core::ptr::null_mut(); }
7815                         CResult_NonePaymentSendFailureZPtr { err }
7816                 };
7817                 Self {
7818                         contents,
7819                         result_ok: o.result_ok,
7820                 }
7821         }
7822 }
7823 impl Clone for CResult_NonePaymentSendFailureZ {
7824         fn clone(&self) -> Self {
7825                 if self.result_ok {
7826                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
7827                                 result: core::ptr::null_mut()
7828                         } }
7829                 } else {
7830                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
7831                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7832                         } }
7833                 }
7834         }
7835 }
7836 #[no_mangle]
7837 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
7838 /// but with all dynamically-allocated buffers duplicated in new buffers.
7839 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
7840 #[repr(C)]
7841 /// A tuple of 2 elements. See the individual fields for the types contained.
7842 pub struct C2Tuple_PaymentHashPaymentIdZ {
7843         /// The element at position 0
7844         pub a: crate::c_types::ThirtyTwoBytes,
7845         /// The element at position 1
7846         pub b: crate::c_types::ThirtyTwoBytes,
7847 }
7848 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
7849         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
7850                 Self {
7851                         a: tup.0,
7852                         b: tup.1,
7853                 }
7854         }
7855 }
7856 impl C2Tuple_PaymentHashPaymentIdZ {
7857         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
7858                 (self.a, self.b)
7859         }
7860 }
7861 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
7862         fn clone(&self) -> Self {
7863                 Self {
7864                         a: Clone::clone(&self.a),
7865                         b: Clone::clone(&self.b),
7866                 }
7867         }
7868 }
7869 #[no_mangle]
7870 /// Creates a new tuple which has the same data as `orig`
7871 /// but with all dynamically-allocated buffers duplicated in new buffers.
7872 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
7873 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
7874 #[no_mangle]
7875 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
7876         C2Tuple_PaymentHashPaymentIdZ { a, b, }
7877 }
7878
7879 #[no_mangle]
7880 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
7881 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
7882 #[repr(C)]
7883 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7884 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7885         /// A pointer to the contents in the success state.
7886         /// Reading from this pointer when `result_ok` is not set is undefined.
7887         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
7888         /// A pointer to the contents in the error state.
7889         /// Reading from this pointer when `result_ok` is set is undefined.
7890         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7891 }
7892 #[repr(C)]
7893 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7894 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7896 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7897         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7898         /// `err` or `result` depending on the state of `result_ok`.
7899         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
7900         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7901         pub result_ok: bool,
7902 }
7903 #[no_mangle]
7904 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
7905 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7906         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7907                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7908                         result: Box::into_raw(Box::new(o)),
7909                 },
7910                 result_ok: true,
7911         }
7912 }
7913 #[no_mangle]
7914 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
7915 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7916         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7917                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7918                         err: Box::into_raw(Box::new(e)),
7919                 },
7920                 result_ok: false,
7921         }
7922 }
7923 /// Checks if the given object is currently in the success state
7924 #[no_mangle]
7925 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
7926         o.result_ok
7927 }
7928 #[no_mangle]
7929 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
7930 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
7931 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7932         fn drop(&mut self) {
7933                 if self.result_ok {
7934                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7935                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7936                         }
7937                 } else {
7938                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7939                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7940                         }
7941                 }
7942         }
7943 }
7944 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7945         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7946                 let contents = if o.result_ok {
7947                         let result = unsafe { o.contents.result };
7948                         unsafe { o.contents.result = core::ptr::null_mut() };
7949                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
7950                 } else {
7951                         let err = unsafe { o.contents.err };
7952                         unsafe { o.contents.err = core::ptr::null_mut(); }
7953                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
7954                 };
7955                 Self {
7956                         contents,
7957                         result_ok: o.result_ok,
7958                 }
7959         }
7960 }
7961 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7962         fn clone(&self) -> Self {
7963                 if self.result_ok {
7964                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7965                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
7966                         } }
7967                 } else {
7968                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7969                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7970                         } }
7971                 }
7972         }
7973 }
7974 #[no_mangle]
7975 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
7976 /// but with all dynamically-allocated buffers duplicated in new buffers.
7977 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
7978 #[repr(C)]
7979 /// A tuple of 2 elements. See the individual fields for the types contained.
7980 pub struct C2Tuple_PaymentHashPaymentSecretZ {
7981         /// The element at position 0
7982         pub a: crate::c_types::ThirtyTwoBytes,
7983         /// The element at position 1
7984         pub b: crate::c_types::ThirtyTwoBytes,
7985 }
7986 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
7987         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
7988                 Self {
7989                         a: tup.0,
7990                         b: tup.1,
7991                 }
7992         }
7993 }
7994 impl C2Tuple_PaymentHashPaymentSecretZ {
7995         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
7996                 (self.a, self.b)
7997         }
7998 }
7999 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8000         fn clone(&self) -> Self {
8001                 Self {
8002                         a: Clone::clone(&self.a),
8003                         b: Clone::clone(&self.b),
8004                 }
8005         }
8006 }
8007 #[no_mangle]
8008 /// Creates a new tuple which has the same data as `orig`
8009 /// but with all dynamically-allocated buffers duplicated in new buffers.
8010 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8011 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8012 #[no_mangle]
8013 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8014         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8015 }
8016
8017 #[no_mangle]
8018 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8019 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8020 #[repr(C)]
8021 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8022 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8023         /// A pointer to the contents in the success state.
8024         /// Reading from this pointer when `result_ok` is not set is undefined.
8025         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8026         /// Note that this value is always NULL, as there are no contents in the Err variant
8027         pub err: *mut core::ffi::c_void,
8028 }
8029 #[repr(C)]
8030 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8031 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8033 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8034         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8035         /// `err` or `result` depending on the state of `result_ok`.
8036         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8037         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8038         pub result_ok: bool,
8039 }
8040 #[no_mangle]
8041 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8042 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8043         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8044                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8045                         result: Box::into_raw(Box::new(o)),
8046                 },
8047                 result_ok: true,
8048         }
8049 }
8050 #[no_mangle]
8051 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8052 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8053         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8054                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8055                         err: core::ptr::null_mut(),
8056                 },
8057                 result_ok: false,
8058         }
8059 }
8060 /// Checks if the given object is currently in the success state
8061 #[no_mangle]
8062 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8063         o.result_ok
8064 }
8065 #[no_mangle]
8066 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8067 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8068 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8069         fn drop(&mut self) {
8070                 if self.result_ok {
8071                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8072                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8073                         }
8074                 } else {
8075                 }
8076         }
8077 }
8078 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8079         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8080                 let contents = if o.result_ok {
8081                         let result = unsafe { o.contents.result };
8082                         unsafe { o.contents.result = core::ptr::null_mut() };
8083                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8084                 } else {
8085                         let _ = unsafe { Box::from_raw(o.contents.err) };
8086                         o.contents.err = core::ptr::null_mut();
8087                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8088                 };
8089                 Self {
8090                         contents,
8091                         result_ok: o.result_ok,
8092                 }
8093         }
8094 }
8095 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8096         fn clone(&self) -> Self {
8097                 if self.result_ok {
8098                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8099                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8100                         } }
8101                 } else {
8102                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8103                                 err: core::ptr::null_mut()
8104                         } }
8105                 }
8106         }
8107 }
8108 #[no_mangle]
8109 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8110 /// but with all dynamically-allocated buffers duplicated in new buffers.
8111 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8112 #[repr(C)]
8113 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8114 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8115         /// A pointer to the contents in the success state.
8116         /// Reading from this pointer when `result_ok` is not set is undefined.
8117         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8118         /// A pointer to the contents in the error state.
8119         /// Reading from this pointer when `result_ok` is set is undefined.
8120         pub err: *mut crate::lightning::util::errors::APIError,
8121 }
8122 #[repr(C)]
8123 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8124 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8126 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8127         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8128         /// `err` or `result` depending on the state of `result_ok`.
8129         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8130         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8131         pub result_ok: bool,
8132 }
8133 #[no_mangle]
8134 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8135 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8136         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8137                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8138                         result: Box::into_raw(Box::new(o)),
8139                 },
8140                 result_ok: true,
8141         }
8142 }
8143 #[no_mangle]
8144 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8145 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8146         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8147                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8148                         err: Box::into_raw(Box::new(e)),
8149                 },
8150                 result_ok: false,
8151         }
8152 }
8153 /// Checks if the given object is currently in the success state
8154 #[no_mangle]
8155 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8156         o.result_ok
8157 }
8158 #[no_mangle]
8159 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8160 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8161 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8162         fn drop(&mut self) {
8163                 if self.result_ok {
8164                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8165                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8166                         }
8167                 } else {
8168                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8169                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8170                         }
8171                 }
8172         }
8173 }
8174 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8175         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8176                 let contents = if o.result_ok {
8177                         let result = unsafe { o.contents.result };
8178                         unsafe { o.contents.result = core::ptr::null_mut() };
8179                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8180                 } else {
8181                         let err = unsafe { o.contents.err };
8182                         unsafe { o.contents.err = core::ptr::null_mut(); }
8183                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8184                 };
8185                 Self {
8186                         contents,
8187                         result_ok: o.result_ok,
8188                 }
8189         }
8190 }
8191 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8192         fn clone(&self) -> Self {
8193                 if self.result_ok {
8194                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8195                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8196                         } }
8197                 } else {
8198                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8199                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8200                         } }
8201                 }
8202         }
8203 }
8204 #[no_mangle]
8205 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8206 /// but with all dynamically-allocated buffers duplicated in new buffers.
8207 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8208 #[repr(C)]
8209 /// The contents of CResult_PaymentSecretNoneZ
8210 pub union CResult_PaymentSecretNoneZPtr {
8211         /// A pointer to the contents in the success state.
8212         /// Reading from this pointer when `result_ok` is not set is undefined.
8213         pub result: *mut crate::c_types::ThirtyTwoBytes,
8214         /// Note that this value is always NULL, as there are no contents in the Err variant
8215         pub err: *mut core::ffi::c_void,
8216 }
8217 #[repr(C)]
8218 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8219 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8220 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8221 pub struct CResult_PaymentSecretNoneZ {
8222         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8223         /// `err` or `result` depending on the state of `result_ok`.
8224         pub contents: CResult_PaymentSecretNoneZPtr,
8225         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8226         pub result_ok: bool,
8227 }
8228 #[no_mangle]
8229 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8230 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8231         CResult_PaymentSecretNoneZ {
8232                 contents: CResult_PaymentSecretNoneZPtr {
8233                         result: Box::into_raw(Box::new(o)),
8234                 },
8235                 result_ok: true,
8236         }
8237 }
8238 #[no_mangle]
8239 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8240 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8241         CResult_PaymentSecretNoneZ {
8242                 contents: CResult_PaymentSecretNoneZPtr {
8243                         err: core::ptr::null_mut(),
8244                 },
8245                 result_ok: false,
8246         }
8247 }
8248 /// Checks if the given object is currently in the success state
8249 #[no_mangle]
8250 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8251         o.result_ok
8252 }
8253 #[no_mangle]
8254 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8255 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8256 impl Drop for CResult_PaymentSecretNoneZ {
8257         fn drop(&mut self) {
8258                 if self.result_ok {
8259                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8260                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8261                         }
8262                 } else {
8263                 }
8264         }
8265 }
8266 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8267         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8268                 let contents = if o.result_ok {
8269                         let result = unsafe { o.contents.result };
8270                         unsafe { o.contents.result = core::ptr::null_mut() };
8271                         CResult_PaymentSecretNoneZPtr { result }
8272                 } else {
8273                         let _ = unsafe { Box::from_raw(o.contents.err) };
8274                         o.contents.err = core::ptr::null_mut();
8275                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8276                 };
8277                 Self {
8278                         contents,
8279                         result_ok: o.result_ok,
8280                 }
8281         }
8282 }
8283 impl Clone for CResult_PaymentSecretNoneZ {
8284         fn clone(&self) -> Self {
8285                 if self.result_ok {
8286                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8287                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8288                         } }
8289                 } else {
8290                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8291                                 err: core::ptr::null_mut()
8292                         } }
8293                 }
8294         }
8295 }
8296 #[no_mangle]
8297 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8298 /// but with all dynamically-allocated buffers duplicated in new buffers.
8299 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8300 #[repr(C)]
8301 /// The contents of CResult_PaymentSecretAPIErrorZ
8302 pub union CResult_PaymentSecretAPIErrorZPtr {
8303         /// A pointer to the contents in the success state.
8304         /// Reading from this pointer when `result_ok` is not set is undefined.
8305         pub result: *mut crate::c_types::ThirtyTwoBytes,
8306         /// A pointer to the contents in the error state.
8307         /// Reading from this pointer when `result_ok` is set is undefined.
8308         pub err: *mut crate::lightning::util::errors::APIError,
8309 }
8310 #[repr(C)]
8311 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8312 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8314 pub struct CResult_PaymentSecretAPIErrorZ {
8315         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8316         /// `err` or `result` depending on the state of `result_ok`.
8317         pub contents: CResult_PaymentSecretAPIErrorZPtr,
8318         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8319         pub result_ok: bool,
8320 }
8321 #[no_mangle]
8322 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8323 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8324         CResult_PaymentSecretAPIErrorZ {
8325                 contents: CResult_PaymentSecretAPIErrorZPtr {
8326                         result: Box::into_raw(Box::new(o)),
8327                 },
8328                 result_ok: true,
8329         }
8330 }
8331 #[no_mangle]
8332 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8333 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8334         CResult_PaymentSecretAPIErrorZ {
8335                 contents: CResult_PaymentSecretAPIErrorZPtr {
8336                         err: Box::into_raw(Box::new(e)),
8337                 },
8338                 result_ok: false,
8339         }
8340 }
8341 /// Checks if the given object is currently in the success state
8342 #[no_mangle]
8343 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8344         o.result_ok
8345 }
8346 #[no_mangle]
8347 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8348 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8349 impl Drop for CResult_PaymentSecretAPIErrorZ {
8350         fn drop(&mut self) {
8351                 if self.result_ok {
8352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8354                         }
8355                 } else {
8356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8358                         }
8359                 }
8360         }
8361 }
8362 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8363         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8364                 let contents = if o.result_ok {
8365                         let result = unsafe { o.contents.result };
8366                         unsafe { o.contents.result = core::ptr::null_mut() };
8367                         CResult_PaymentSecretAPIErrorZPtr { result }
8368                 } else {
8369                         let err = unsafe { o.contents.err };
8370                         unsafe { o.contents.err = core::ptr::null_mut(); }
8371                         CResult_PaymentSecretAPIErrorZPtr { err }
8372                 };
8373                 Self {
8374                         contents,
8375                         result_ok: o.result_ok,
8376                 }
8377         }
8378 }
8379 impl Clone for CResult_PaymentSecretAPIErrorZ {
8380         fn clone(&self) -> Self {
8381                 if self.result_ok {
8382                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8383                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8384                         } }
8385                 } else {
8386                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8387                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8388                         } }
8389                 }
8390         }
8391 }
8392 #[no_mangle]
8393 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8394 /// but with all dynamically-allocated buffers duplicated in new buffers.
8395 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8396 #[repr(C)]
8397 /// The contents of CResult_PaymentPreimageAPIErrorZ
8398 pub union CResult_PaymentPreimageAPIErrorZPtr {
8399         /// A pointer to the contents in the success state.
8400         /// Reading from this pointer when `result_ok` is not set is undefined.
8401         pub result: *mut crate::c_types::ThirtyTwoBytes,
8402         /// A pointer to the contents in the error state.
8403         /// Reading from this pointer when `result_ok` is set is undefined.
8404         pub err: *mut crate::lightning::util::errors::APIError,
8405 }
8406 #[repr(C)]
8407 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8408 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8410 pub struct CResult_PaymentPreimageAPIErrorZ {
8411         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8412         /// `err` or `result` depending on the state of `result_ok`.
8413         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8414         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8415         pub result_ok: bool,
8416 }
8417 #[no_mangle]
8418 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8419 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8420         CResult_PaymentPreimageAPIErrorZ {
8421                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8422                         result: Box::into_raw(Box::new(o)),
8423                 },
8424                 result_ok: true,
8425         }
8426 }
8427 #[no_mangle]
8428 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8429 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8430         CResult_PaymentPreimageAPIErrorZ {
8431                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8432                         err: Box::into_raw(Box::new(e)),
8433                 },
8434                 result_ok: false,
8435         }
8436 }
8437 /// Checks if the given object is currently in the success state
8438 #[no_mangle]
8439 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8440         o.result_ok
8441 }
8442 #[no_mangle]
8443 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8444 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8445 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8446         fn drop(&mut self) {
8447                 if self.result_ok {
8448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8450                         }
8451                 } else {
8452                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8453                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8454                         }
8455                 }
8456         }
8457 }
8458 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8459         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8460                 let contents = if o.result_ok {
8461                         let result = unsafe { o.contents.result };
8462                         unsafe { o.contents.result = core::ptr::null_mut() };
8463                         CResult_PaymentPreimageAPIErrorZPtr { result }
8464                 } else {
8465                         let err = unsafe { o.contents.err };
8466                         unsafe { o.contents.err = core::ptr::null_mut(); }
8467                         CResult_PaymentPreimageAPIErrorZPtr { err }
8468                 };
8469                 Self {
8470                         contents,
8471                         result_ok: o.result_ok,
8472                 }
8473         }
8474 }
8475 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8476         fn clone(&self) -> Self {
8477                 if self.result_ok {
8478                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8479                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8480                         } }
8481                 } else {
8482                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8483                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8484                         } }
8485                 }
8486         }
8487 }
8488 #[no_mangle]
8489 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8490 /// but with all dynamically-allocated buffers duplicated in new buffers.
8491 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8492 #[repr(C)]
8493 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8494 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8495         /// A pointer to the contents in the success state.
8496         /// Reading from this pointer when `result_ok` is not set is undefined.
8497         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8498         /// A pointer to the contents in the error state.
8499         /// Reading from this pointer when `result_ok` is set is undefined.
8500         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8501 }
8502 #[repr(C)]
8503 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8504 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8505 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8506 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8507         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8508         /// `err` or `result` depending on the state of `result_ok`.
8509         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8510         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8511         pub result_ok: bool,
8512 }
8513 #[no_mangle]
8514 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8515 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8516         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8517                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8518                         result: Box::into_raw(Box::new(o)),
8519                 },
8520                 result_ok: true,
8521         }
8522 }
8523 #[no_mangle]
8524 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8525 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8526         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8527                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8528                         err: Box::into_raw(Box::new(e)),
8529                 },
8530                 result_ok: false,
8531         }
8532 }
8533 /// Checks if the given object is currently in the success state
8534 #[no_mangle]
8535 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8536         o.result_ok
8537 }
8538 #[no_mangle]
8539 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8540 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8541 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8542         fn drop(&mut self) {
8543                 if self.result_ok {
8544                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8545                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8546                         }
8547                 } else {
8548                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8549                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8550                         }
8551                 }
8552         }
8553 }
8554 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8555         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8556                 let contents = if o.result_ok {
8557                         let result = unsafe { o.contents.result };
8558                         unsafe { o.contents.result = core::ptr::null_mut() };
8559                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8560                 } else {
8561                         let err = unsafe { o.contents.err };
8562                         unsafe { o.contents.err = core::ptr::null_mut(); }
8563                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8564                 };
8565                 Self {
8566                         contents,
8567                         result_ok: o.result_ok,
8568                 }
8569         }
8570 }
8571 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8572         fn clone(&self) -> Self {
8573                 if self.result_ok {
8574                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8575                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8576                         } }
8577                 } else {
8578                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8579                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8580                         } }
8581                 }
8582         }
8583 }
8584 #[no_mangle]
8585 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8586 /// but with all dynamically-allocated buffers duplicated in new buffers.
8587 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8588 #[repr(C)]
8589 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8590 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8591         /// A pointer to the contents in the success state.
8592         /// Reading from this pointer when `result_ok` is not set is undefined.
8593         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8594         /// A pointer to the contents in the error state.
8595         /// Reading from this pointer when `result_ok` is set is undefined.
8596         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8597 }
8598 #[repr(C)]
8599 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8600 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8602 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8603         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8604         /// `err` or `result` depending on the state of `result_ok`.
8605         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8606         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8607         pub result_ok: bool,
8608 }
8609 #[no_mangle]
8610 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8611 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8612         CResult_ChannelCounterpartyDecodeErrorZ {
8613                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8614                         result: Box::into_raw(Box::new(o)),
8615                 },
8616                 result_ok: true,
8617         }
8618 }
8619 #[no_mangle]
8620 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8621 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8622         CResult_ChannelCounterpartyDecodeErrorZ {
8623                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8624                         err: Box::into_raw(Box::new(e)),
8625                 },
8626                 result_ok: false,
8627         }
8628 }
8629 /// Checks if the given object is currently in the success state
8630 #[no_mangle]
8631 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8632         o.result_ok
8633 }
8634 #[no_mangle]
8635 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8636 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8637 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8638         fn drop(&mut self) {
8639                 if self.result_ok {
8640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8642                         }
8643                 } else {
8644                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8645                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8646                         }
8647                 }
8648         }
8649 }
8650 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8651         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8652                 let contents = if o.result_ok {
8653                         let result = unsafe { o.contents.result };
8654                         unsafe { o.contents.result = core::ptr::null_mut() };
8655                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8656                 } else {
8657                         let err = unsafe { o.contents.err };
8658                         unsafe { o.contents.err = core::ptr::null_mut(); }
8659                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8660                 };
8661                 Self {
8662                         contents,
8663                         result_ok: o.result_ok,
8664                 }
8665         }
8666 }
8667 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8668         fn clone(&self) -> Self {
8669                 if self.result_ok {
8670                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8671                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8672                         } }
8673                 } else {
8674                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8675                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8676                         } }
8677                 }
8678         }
8679 }
8680 #[no_mangle]
8681 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8682 /// but with all dynamically-allocated buffers duplicated in new buffers.
8683 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8684 #[repr(C)]
8685 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8686 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8687         /// A pointer to the contents in the success state.
8688         /// Reading from this pointer when `result_ok` is not set is undefined.
8689         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
8690         /// A pointer to the contents in the error state.
8691         /// Reading from this pointer when `result_ok` is set is undefined.
8692         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8693 }
8694 #[repr(C)]
8695 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8696 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8698 pub struct CResult_ChannelDetailsDecodeErrorZ {
8699         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8700         /// `err` or `result` depending on the state of `result_ok`.
8701         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
8702         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8703         pub result_ok: bool,
8704 }
8705 #[no_mangle]
8706 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
8707 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
8708         CResult_ChannelDetailsDecodeErrorZ {
8709                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8710                         result: Box::into_raw(Box::new(o)),
8711                 },
8712                 result_ok: true,
8713         }
8714 }
8715 #[no_mangle]
8716 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
8717 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
8718         CResult_ChannelDetailsDecodeErrorZ {
8719                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8720                         err: Box::into_raw(Box::new(e)),
8721                 },
8722                 result_ok: false,
8723         }
8724 }
8725 /// Checks if the given object is currently in the success state
8726 #[no_mangle]
8727 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
8728         o.result_ok
8729 }
8730 #[no_mangle]
8731 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
8732 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
8733 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
8734         fn drop(&mut self) {
8735                 if self.result_ok {
8736                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8737                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8738                         }
8739                 } else {
8740                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8741                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8742                         }
8743                 }
8744         }
8745 }
8746 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
8747         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
8748                 let contents = if o.result_ok {
8749                         let result = unsafe { o.contents.result };
8750                         unsafe { o.contents.result = core::ptr::null_mut() };
8751                         CResult_ChannelDetailsDecodeErrorZPtr { result }
8752                 } else {
8753                         let err = unsafe { o.contents.err };
8754                         unsafe { o.contents.err = core::ptr::null_mut(); }
8755                         CResult_ChannelDetailsDecodeErrorZPtr { err }
8756                 };
8757                 Self {
8758                         contents,
8759                         result_ok: o.result_ok,
8760                 }
8761         }
8762 }
8763 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
8764         fn clone(&self) -> Self {
8765                 if self.result_ok {
8766                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8767                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
8768                         } }
8769                 } else {
8770                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8771                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8772                         } }
8773                 }
8774         }
8775 }
8776 #[no_mangle]
8777 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
8778 /// but with all dynamically-allocated buffers duplicated in new buffers.
8779 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
8780 #[repr(C)]
8781 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
8782 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
8783         /// A pointer to the contents in the success state.
8784         /// Reading from this pointer when `result_ok` is not set is undefined.
8785         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
8786         /// A pointer to the contents in the error state.
8787         /// Reading from this pointer when `result_ok` is set is undefined.
8788         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8789 }
8790 #[repr(C)]
8791 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8792 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8794 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
8795         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8796         /// `err` or `result` depending on the state of `result_ok`.
8797         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
8798         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8799         pub result_ok: bool,
8800 }
8801 #[no_mangle]
8802 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
8803 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
8804         CResult_PhantomRouteHintsDecodeErrorZ {
8805                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8806                         result: Box::into_raw(Box::new(o)),
8807                 },
8808                 result_ok: true,
8809         }
8810 }
8811 #[no_mangle]
8812 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
8813 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
8814         CResult_PhantomRouteHintsDecodeErrorZ {
8815                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8816                         err: Box::into_raw(Box::new(e)),
8817                 },
8818                 result_ok: false,
8819         }
8820 }
8821 /// Checks if the given object is currently in the success state
8822 #[no_mangle]
8823 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
8824         o.result_ok
8825 }
8826 #[no_mangle]
8827 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
8828 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
8829 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
8830         fn drop(&mut self) {
8831                 if self.result_ok {
8832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8834                         }
8835                 } else {
8836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8838                         }
8839                 }
8840         }
8841 }
8842 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
8843         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
8844                 let contents = if o.result_ok {
8845                         let result = unsafe { o.contents.result };
8846                         unsafe { o.contents.result = core::ptr::null_mut() };
8847                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
8848                 } else {
8849                         let err = unsafe { o.contents.err };
8850                         unsafe { o.contents.err = core::ptr::null_mut(); }
8851                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
8852                 };
8853                 Self {
8854                         contents,
8855                         result_ok: o.result_ok,
8856                 }
8857         }
8858 }
8859 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
8860         fn clone(&self) -> Self {
8861                 if self.result_ok {
8862                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8863                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
8864                         } }
8865                 } else {
8866                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8867                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8868                         } }
8869                 }
8870         }
8871 }
8872 #[no_mangle]
8873 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
8874 /// but with all dynamically-allocated buffers duplicated in new buffers.
8875 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
8876 #[repr(C)]
8877 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8878 /// This corresponds to std::vector in C++
8879 pub struct CVec_ChannelMonitorZ {
8880         /// The elements in the array.
8881         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8882         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
8883         /// The number of elements pointed to by `data`.
8884         pub datalen: usize
8885 }
8886 impl CVec_ChannelMonitorZ {
8887         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
8888                 if self.datalen == 0 { return Vec::new(); }
8889                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8890                 self.data = core::ptr::null_mut();
8891                 self.datalen = 0;
8892                 ret
8893         }
8894         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
8895                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8896         }
8897 }
8898 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
8899         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
8900                 let datalen = v.len();
8901                 let data = Box::into_raw(v.into_boxed_slice());
8902                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8903         }
8904 }
8905 #[no_mangle]
8906 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8907 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
8908 impl Drop for CVec_ChannelMonitorZ {
8909         fn drop(&mut self) {
8910                 if self.datalen == 0 { return; }
8911                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8912         }
8913 }
8914 #[repr(C)]
8915 /// A tuple of 2 elements. See the individual fields for the types contained.
8916 pub struct C2Tuple_BlockHashChannelManagerZ {
8917         /// The element at position 0
8918         pub a: crate::c_types::ThirtyTwoBytes,
8919         /// The element at position 1
8920         pub b: crate::lightning::ln::channelmanager::ChannelManager,
8921 }
8922 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
8923         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
8924                 Self {
8925                         a: tup.0,
8926                         b: tup.1,
8927                 }
8928         }
8929 }
8930 impl C2Tuple_BlockHashChannelManagerZ {
8931         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
8932                 (self.a, self.b)
8933         }
8934 }
8935 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
8936 #[no_mangle]
8937 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
8938         C2Tuple_BlockHashChannelManagerZ { a, b, }
8939 }
8940
8941 #[no_mangle]
8942 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
8943 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
8944 #[repr(C)]
8945 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8946 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8947         /// A pointer to the contents in the success state.
8948         /// Reading from this pointer when `result_ok` is not set is undefined.
8949         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
8950         /// A pointer to the contents in the error state.
8951         /// Reading from this pointer when `result_ok` is set is undefined.
8952         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8953 }
8954 #[repr(C)]
8955 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8956 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8957 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8958 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8959         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8960         /// `err` or `result` depending on the state of `result_ok`.
8961         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
8962         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8963         pub result_ok: bool,
8964 }
8965 #[no_mangle]
8966 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
8967 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8968         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8969                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8970                         result: Box::into_raw(Box::new(o)),
8971                 },
8972                 result_ok: true,
8973         }
8974 }
8975 #[no_mangle]
8976 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
8977 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8978         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8979                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8980                         err: Box::into_raw(Box::new(e)),
8981                 },
8982                 result_ok: false,
8983         }
8984 }
8985 /// Checks if the given object is currently in the success state
8986 #[no_mangle]
8987 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
8988         o.result_ok
8989 }
8990 #[no_mangle]
8991 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
8992 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
8993 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8994         fn drop(&mut self) {
8995                 if self.result_ok {
8996                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8997                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8998                         }
8999                 } else {
9000                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9001                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9002                         }
9003                 }
9004         }
9005 }
9006 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9007         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9008                 let contents = if o.result_ok {
9009                         let result = unsafe { o.contents.result };
9010                         unsafe { o.contents.result = core::ptr::null_mut() };
9011                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9012                 } else {
9013                         let err = unsafe { o.contents.err };
9014                         unsafe { o.contents.err = core::ptr::null_mut(); }
9015                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9016                 };
9017                 Self {
9018                         contents,
9019                         result_ok: o.result_ok,
9020                 }
9021         }
9022 }
9023 #[repr(C)]
9024 /// The contents of CResult_ChannelConfigDecodeErrorZ
9025 pub union CResult_ChannelConfigDecodeErrorZPtr {
9026         /// A pointer to the contents in the success state.
9027         /// Reading from this pointer when `result_ok` is not set is undefined.
9028         pub result: *mut crate::lightning::util::config::ChannelConfig,
9029         /// A pointer to the contents in the error state.
9030         /// Reading from this pointer when `result_ok` is set is undefined.
9031         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9032 }
9033 #[repr(C)]
9034 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9035 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9037 pub struct CResult_ChannelConfigDecodeErrorZ {
9038         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9039         /// `err` or `result` depending on the state of `result_ok`.
9040         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9041         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9042         pub result_ok: bool,
9043 }
9044 #[no_mangle]
9045 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9046 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9047         CResult_ChannelConfigDecodeErrorZ {
9048                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9049                         result: Box::into_raw(Box::new(o)),
9050                 },
9051                 result_ok: true,
9052         }
9053 }
9054 #[no_mangle]
9055 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9056 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9057         CResult_ChannelConfigDecodeErrorZ {
9058                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9059                         err: Box::into_raw(Box::new(e)),
9060                 },
9061                 result_ok: false,
9062         }
9063 }
9064 /// Checks if the given object is currently in the success state
9065 #[no_mangle]
9066 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9067         o.result_ok
9068 }
9069 #[no_mangle]
9070 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9071 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9072 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9073         fn drop(&mut self) {
9074                 if self.result_ok {
9075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9077                         }
9078                 } else {
9079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9081                         }
9082                 }
9083         }
9084 }
9085 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9087                 let contents = if o.result_ok {
9088                         let result = unsafe { o.contents.result };
9089                         unsafe { o.contents.result = core::ptr::null_mut() };
9090                         CResult_ChannelConfigDecodeErrorZPtr { result }
9091                 } else {
9092                         let err = unsafe { o.contents.err };
9093                         unsafe { o.contents.err = core::ptr::null_mut(); }
9094                         CResult_ChannelConfigDecodeErrorZPtr { err }
9095                 };
9096                 Self {
9097                         contents,
9098                         result_ok: o.result_ok,
9099                 }
9100         }
9101 }
9102 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9103         fn clone(&self) -> Self {
9104                 if self.result_ok {
9105                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9106                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9107                         } }
9108                 } else {
9109                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9110                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9111                         } }
9112                 }
9113         }
9114 }
9115 #[no_mangle]
9116 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9117 /// but with all dynamically-allocated buffers duplicated in new buffers.
9118 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9119 #[repr(C)]
9120 /// The contents of CResult_OutPointDecodeErrorZ
9121 pub union CResult_OutPointDecodeErrorZPtr {
9122         /// A pointer to the contents in the success state.
9123         /// Reading from this pointer when `result_ok` is not set is undefined.
9124         pub result: *mut crate::lightning::chain::transaction::OutPoint,
9125         /// A pointer to the contents in the error state.
9126         /// Reading from this pointer when `result_ok` is set is undefined.
9127         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9128 }
9129 #[repr(C)]
9130 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9131 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9132 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9133 pub struct CResult_OutPointDecodeErrorZ {
9134         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9135         /// `err` or `result` depending on the state of `result_ok`.
9136         pub contents: CResult_OutPointDecodeErrorZPtr,
9137         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9138         pub result_ok: bool,
9139 }
9140 #[no_mangle]
9141 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9142 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9143         CResult_OutPointDecodeErrorZ {
9144                 contents: CResult_OutPointDecodeErrorZPtr {
9145                         result: Box::into_raw(Box::new(o)),
9146                 },
9147                 result_ok: true,
9148         }
9149 }
9150 #[no_mangle]
9151 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9152 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9153         CResult_OutPointDecodeErrorZ {
9154                 contents: CResult_OutPointDecodeErrorZPtr {
9155                         err: Box::into_raw(Box::new(e)),
9156                 },
9157                 result_ok: false,
9158         }
9159 }
9160 /// Checks if the given object is currently in the success state
9161 #[no_mangle]
9162 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9163         o.result_ok
9164 }
9165 #[no_mangle]
9166 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9167 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9168 impl Drop for CResult_OutPointDecodeErrorZ {
9169         fn drop(&mut self) {
9170                 if self.result_ok {
9171                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9172                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9173                         }
9174                 } else {
9175                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9176                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9177                         }
9178                 }
9179         }
9180 }
9181 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9182         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9183                 let contents = if o.result_ok {
9184                         let result = unsafe { o.contents.result };
9185                         unsafe { o.contents.result = core::ptr::null_mut() };
9186                         CResult_OutPointDecodeErrorZPtr { result }
9187                 } else {
9188                         let err = unsafe { o.contents.err };
9189                         unsafe { o.contents.err = core::ptr::null_mut(); }
9190                         CResult_OutPointDecodeErrorZPtr { err }
9191                 };
9192                 Self {
9193                         contents,
9194                         result_ok: o.result_ok,
9195                 }
9196         }
9197 }
9198 impl Clone for CResult_OutPointDecodeErrorZ {
9199         fn clone(&self) -> Self {
9200                 if self.result_ok {
9201                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9202                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9203                         } }
9204                 } else {
9205                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9206                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9207                         } }
9208                 }
9209         }
9210 }
9211 #[no_mangle]
9212 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9213 /// but with all dynamically-allocated buffers duplicated in new buffers.
9214 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9215 #[repr(C)]
9216 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9217 pub enum COption_TypeZ {
9218         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9219         Some(crate::lightning::ln::wire::Type),
9220         /// When we're in this state, this COption_TypeZ contains nothing
9221         None
9222 }
9223 impl COption_TypeZ {
9224         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9225                 if let Self::None = self { false } else { true }
9226         }
9227         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9228                 !self.is_some()
9229         }
9230         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9231                 if let Self::Some(v) = self { v } else { unreachable!() }
9232         }
9233 }
9234 #[no_mangle]
9235 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9236 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9237         COption_TypeZ::Some(o)
9238 }
9239 #[no_mangle]
9240 /// Constructs a new COption_TypeZ containing nothing
9241 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9242         COption_TypeZ::None
9243 }
9244 #[no_mangle]
9245 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9246 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9247 #[repr(C)]
9248 /// The contents of CResult_COption_TypeZDecodeErrorZ
9249 pub union CResult_COption_TypeZDecodeErrorZPtr {
9250         /// A pointer to the contents in the success state.
9251         /// Reading from this pointer when `result_ok` is not set is undefined.
9252         pub result: *mut crate::c_types::derived::COption_TypeZ,
9253         /// A pointer to the contents in the error state.
9254         /// Reading from this pointer when `result_ok` is set is undefined.
9255         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9256 }
9257 #[repr(C)]
9258 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9259 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9260 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9261 pub struct CResult_COption_TypeZDecodeErrorZ {
9262         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9263         /// `err` or `result` depending on the state of `result_ok`.
9264         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9265         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9266         pub result_ok: bool,
9267 }
9268 #[no_mangle]
9269 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9270 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9271         CResult_COption_TypeZDecodeErrorZ {
9272                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9273                         result: Box::into_raw(Box::new(o)),
9274                 },
9275                 result_ok: true,
9276         }
9277 }
9278 #[no_mangle]
9279 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9280 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9281         CResult_COption_TypeZDecodeErrorZ {
9282                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9283                         err: Box::into_raw(Box::new(e)),
9284                 },
9285                 result_ok: false,
9286         }
9287 }
9288 /// Checks if the given object is currently in the success state
9289 #[no_mangle]
9290 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9291         o.result_ok
9292 }
9293 #[no_mangle]
9294 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9295 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9296 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9297         fn drop(&mut self) {
9298                 if self.result_ok {
9299                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9300                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9301                         }
9302                 } else {
9303                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9304                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9305                         }
9306                 }
9307         }
9308 }
9309 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9310         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9311                 let contents = if o.result_ok {
9312                         let result = unsafe { o.contents.result };
9313                         unsafe { o.contents.result = core::ptr::null_mut() };
9314                         CResult_COption_TypeZDecodeErrorZPtr { result }
9315                 } else {
9316                         let err = unsafe { o.contents.err };
9317                         unsafe { o.contents.err = core::ptr::null_mut(); }
9318                         CResult_COption_TypeZDecodeErrorZPtr { err }
9319                 };
9320                 Self {
9321                         contents,
9322                         result_ok: o.result_ok,
9323                 }
9324         }
9325 }
9326 #[repr(C)]
9327 /// The contents of CResult_PaymentIdPaymentErrorZ
9328 pub union CResult_PaymentIdPaymentErrorZPtr {
9329         /// A pointer to the contents in the success state.
9330         /// Reading from this pointer when `result_ok` is not set is undefined.
9331         pub result: *mut crate::c_types::ThirtyTwoBytes,
9332         /// A pointer to the contents in the error state.
9333         /// Reading from this pointer when `result_ok` is set is undefined.
9334         pub err: *mut crate::lightning_invoice::payment::PaymentError,
9335 }
9336 #[repr(C)]
9337 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9338 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9340 pub struct CResult_PaymentIdPaymentErrorZ {
9341         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9342         /// `err` or `result` depending on the state of `result_ok`.
9343         pub contents: CResult_PaymentIdPaymentErrorZPtr,
9344         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9345         pub result_ok: bool,
9346 }
9347 #[no_mangle]
9348 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9349 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9350         CResult_PaymentIdPaymentErrorZ {
9351                 contents: CResult_PaymentIdPaymentErrorZPtr {
9352                         result: Box::into_raw(Box::new(o)),
9353                 },
9354                 result_ok: true,
9355         }
9356 }
9357 #[no_mangle]
9358 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9359 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9360         CResult_PaymentIdPaymentErrorZ {
9361                 contents: CResult_PaymentIdPaymentErrorZPtr {
9362                         err: Box::into_raw(Box::new(e)),
9363                 },
9364                 result_ok: false,
9365         }
9366 }
9367 /// Checks if the given object is currently in the success state
9368 #[no_mangle]
9369 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9370         o.result_ok
9371 }
9372 #[no_mangle]
9373 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9374 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9375 impl Drop for CResult_PaymentIdPaymentErrorZ {
9376         fn drop(&mut self) {
9377                 if self.result_ok {
9378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9380                         }
9381                 } else {
9382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9384                         }
9385                 }
9386         }
9387 }
9388 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9389         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9390                 let contents = if o.result_ok {
9391                         let result = unsafe { o.contents.result };
9392                         unsafe { o.contents.result = core::ptr::null_mut() };
9393                         CResult_PaymentIdPaymentErrorZPtr { result }
9394                 } else {
9395                         let err = unsafe { o.contents.err };
9396                         unsafe { o.contents.err = core::ptr::null_mut(); }
9397                         CResult_PaymentIdPaymentErrorZPtr { err }
9398                 };
9399                 Self {
9400                         contents,
9401                         result_ok: o.result_ok,
9402                 }
9403         }
9404 }
9405 impl Clone for CResult_PaymentIdPaymentErrorZ {
9406         fn clone(&self) -> Self {
9407                 if self.result_ok {
9408                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9409                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9410                         } }
9411                 } else {
9412                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9413                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9414                         } }
9415                 }
9416         }
9417 }
9418 #[no_mangle]
9419 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9420 /// but with all dynamically-allocated buffers duplicated in new buffers.
9421 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9422 #[repr(C)]
9423 /// The contents of CResult_SiPrefixParseErrorZ
9424 pub union CResult_SiPrefixParseErrorZPtr {
9425         /// A pointer to the contents in the success state.
9426         /// Reading from this pointer when `result_ok` is not set is undefined.
9427         pub result: *mut crate::lightning_invoice::SiPrefix,
9428         /// A pointer to the contents in the error state.
9429         /// Reading from this pointer when `result_ok` is set is undefined.
9430         pub err: *mut crate::lightning_invoice::ParseError,
9431 }
9432 #[repr(C)]
9433 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9434 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9436 pub struct CResult_SiPrefixParseErrorZ {
9437         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9438         /// `err` or `result` depending on the state of `result_ok`.
9439         pub contents: CResult_SiPrefixParseErrorZPtr,
9440         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9441         pub result_ok: bool,
9442 }
9443 #[no_mangle]
9444 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9445 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9446         CResult_SiPrefixParseErrorZ {
9447                 contents: CResult_SiPrefixParseErrorZPtr {
9448                         result: Box::into_raw(Box::new(o)),
9449                 },
9450                 result_ok: true,
9451         }
9452 }
9453 #[no_mangle]
9454 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9455 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9456         CResult_SiPrefixParseErrorZ {
9457                 contents: CResult_SiPrefixParseErrorZPtr {
9458                         err: Box::into_raw(Box::new(e)),
9459                 },
9460                 result_ok: false,
9461         }
9462 }
9463 /// Checks if the given object is currently in the success state
9464 #[no_mangle]
9465 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9466         o.result_ok
9467 }
9468 #[no_mangle]
9469 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9470 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9471 impl Drop for CResult_SiPrefixParseErrorZ {
9472         fn drop(&mut self) {
9473                 if self.result_ok {
9474                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9475                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9476                         }
9477                 } else {
9478                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9479                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9480                         }
9481                 }
9482         }
9483 }
9484 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9485         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9486                 let contents = if o.result_ok {
9487                         let result = unsafe { o.contents.result };
9488                         unsafe { o.contents.result = core::ptr::null_mut() };
9489                         CResult_SiPrefixParseErrorZPtr { result }
9490                 } else {
9491                         let err = unsafe { o.contents.err };
9492                         unsafe { o.contents.err = core::ptr::null_mut(); }
9493                         CResult_SiPrefixParseErrorZPtr { err }
9494                 };
9495                 Self {
9496                         contents,
9497                         result_ok: o.result_ok,
9498                 }
9499         }
9500 }
9501 impl Clone for CResult_SiPrefixParseErrorZ {
9502         fn clone(&self) -> Self {
9503                 if self.result_ok {
9504                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9505                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9506                         } }
9507                 } else {
9508                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9509                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9510                         } }
9511                 }
9512         }
9513 }
9514 #[no_mangle]
9515 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9516 /// but with all dynamically-allocated buffers duplicated in new buffers.
9517 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9518 #[repr(C)]
9519 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9520 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9521         /// A pointer to the contents in the success state.
9522         /// Reading from this pointer when `result_ok` is not set is undefined.
9523         pub result: *mut crate::lightning_invoice::Invoice,
9524         /// A pointer to the contents in the error state.
9525         /// Reading from this pointer when `result_ok` is set is undefined.
9526         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9527 }
9528 #[repr(C)]
9529 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9530 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9532 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9533         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9534         /// `err` or `result` depending on the state of `result_ok`.
9535         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9536         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9537         pub result_ok: bool,
9538 }
9539 #[no_mangle]
9540 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9541 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9542         CResult_InvoiceParseOrSemanticErrorZ {
9543                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9544                         result: Box::into_raw(Box::new(o)),
9545                 },
9546                 result_ok: true,
9547         }
9548 }
9549 #[no_mangle]
9550 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9551 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9552         CResult_InvoiceParseOrSemanticErrorZ {
9553                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9554                         err: Box::into_raw(Box::new(e)),
9555                 },
9556                 result_ok: false,
9557         }
9558 }
9559 /// Checks if the given object is currently in the success state
9560 #[no_mangle]
9561 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9562         o.result_ok
9563 }
9564 #[no_mangle]
9565 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9566 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9567 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9568         fn drop(&mut self) {
9569                 if self.result_ok {
9570                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9571                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9572                         }
9573                 } else {
9574                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9575                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9576                         }
9577                 }
9578         }
9579 }
9580 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9581         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9582                 let contents = if o.result_ok {
9583                         let result = unsafe { o.contents.result };
9584                         unsafe { o.contents.result = core::ptr::null_mut() };
9585                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
9586                 } else {
9587                         let err = unsafe { o.contents.err };
9588                         unsafe { o.contents.err = core::ptr::null_mut(); }
9589                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
9590                 };
9591                 Self {
9592                         contents,
9593                         result_ok: o.result_ok,
9594                 }
9595         }
9596 }
9597 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
9598         fn clone(&self) -> Self {
9599                 if self.result_ok {
9600                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9601                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9602                         } }
9603                 } else {
9604                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9605                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
9606                         } }
9607                 }
9608         }
9609 }
9610 #[no_mangle]
9611 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
9612 /// but with all dynamically-allocated buffers duplicated in new buffers.
9613 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
9614 #[repr(C)]
9615 /// The contents of CResult_SignedRawInvoiceParseErrorZ
9616 pub union CResult_SignedRawInvoiceParseErrorZPtr {
9617         /// A pointer to the contents in the success state.
9618         /// Reading from this pointer when `result_ok` is not set is undefined.
9619         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
9620         /// A pointer to the contents in the error state.
9621         /// Reading from this pointer when `result_ok` is set is undefined.
9622         pub err: *mut crate::lightning_invoice::ParseError,
9623 }
9624 #[repr(C)]
9625 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
9626 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
9627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9628 pub struct CResult_SignedRawInvoiceParseErrorZ {
9629         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
9630         /// `err` or `result` depending on the state of `result_ok`.
9631         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
9632         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
9633         pub result_ok: bool,
9634 }
9635 #[no_mangle]
9636 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
9637 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
9638         CResult_SignedRawInvoiceParseErrorZ {
9639                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9640                         result: Box::into_raw(Box::new(o)),
9641                 },
9642                 result_ok: true,
9643         }
9644 }
9645 #[no_mangle]
9646 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
9647 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
9648         CResult_SignedRawInvoiceParseErrorZ {
9649                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9650                         err: Box::into_raw(Box::new(e)),
9651                 },
9652                 result_ok: false,
9653         }
9654 }
9655 /// Checks if the given object is currently in the success state
9656 #[no_mangle]
9657 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
9658         o.result_ok
9659 }
9660 #[no_mangle]
9661 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
9662 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
9663 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
9664         fn drop(&mut self) {
9665                 if self.result_ok {
9666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9668                         }
9669                 } else {
9670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9672                         }
9673                 }
9674         }
9675 }
9676 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
9677         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
9678                 let contents = if o.result_ok {
9679                         let result = unsafe { o.contents.result };
9680                         unsafe { o.contents.result = core::ptr::null_mut() };
9681                         CResult_SignedRawInvoiceParseErrorZPtr { result }
9682                 } else {
9683                         let err = unsafe { o.contents.err };
9684                         unsafe { o.contents.err = core::ptr::null_mut(); }
9685                         CResult_SignedRawInvoiceParseErrorZPtr { err }
9686                 };
9687                 Self {
9688                         contents,
9689                         result_ok: o.result_ok,
9690                 }
9691         }
9692 }
9693 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
9694         fn clone(&self) -> Self {
9695                 if self.result_ok {
9696                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9697                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
9698                         } }
9699                 } else {
9700                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9701                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9702                         } }
9703                 }
9704         }
9705 }
9706 #[no_mangle]
9707 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
9708 /// but with all dynamically-allocated buffers duplicated in new buffers.
9709 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
9710 #[repr(C)]
9711 /// A tuple of 3 elements. See the individual fields for the types contained.
9712 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9713         /// The element at position 0
9714         pub a: crate::lightning_invoice::RawInvoice,
9715         /// The element at position 1
9716         pub b: crate::c_types::ThirtyTwoBytes,
9717         /// The element at position 2
9718         pub c: crate::lightning_invoice::InvoiceSignature,
9719 }
9720 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9721         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
9722                 Self {
9723                         a: tup.0,
9724                         b: tup.1,
9725                         c: tup.2,
9726                 }
9727         }
9728 }
9729 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9730         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
9731                 (self.a, self.b, self.c)
9732         }
9733 }
9734 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9735         fn clone(&self) -> Self {
9736                 Self {
9737                         a: Clone::clone(&self.a),
9738                         b: Clone::clone(&self.b),
9739                         c: Clone::clone(&self.c),
9740                 }
9741         }
9742 }
9743 #[no_mangle]
9744 /// Creates a new tuple which has the same data as `orig`
9745 /// but with all dynamically-allocated buffers duplicated in new buffers.
9746 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
9747 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9748 #[no_mangle]
9749 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 {
9750         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
9751 }
9752
9753 #[no_mangle]
9754 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9755 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
9756 #[repr(C)]
9757 /// The contents of CResult_PayeePubKeyErrorZ
9758 pub union CResult_PayeePubKeyErrorZPtr {
9759         /// A pointer to the contents in the success state.
9760         /// Reading from this pointer when `result_ok` is not set is undefined.
9761         pub result: *mut crate::lightning_invoice::PayeePubKey,
9762         /// A pointer to the contents in the error state.
9763         /// Reading from this pointer when `result_ok` is set is undefined.
9764         pub err: *mut crate::c_types::Secp256k1Error,
9765 }
9766 #[repr(C)]
9767 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
9768 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
9769 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9770 pub struct CResult_PayeePubKeyErrorZ {
9771         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
9772         /// `err` or `result` depending on the state of `result_ok`.
9773         pub contents: CResult_PayeePubKeyErrorZPtr,
9774         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
9775         pub result_ok: bool,
9776 }
9777 #[no_mangle]
9778 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
9779 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
9780         CResult_PayeePubKeyErrorZ {
9781                 contents: CResult_PayeePubKeyErrorZPtr {
9782                         result: Box::into_raw(Box::new(o)),
9783                 },
9784                 result_ok: true,
9785         }
9786 }
9787 #[no_mangle]
9788 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
9789 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
9790         CResult_PayeePubKeyErrorZ {
9791                 contents: CResult_PayeePubKeyErrorZPtr {
9792                         err: Box::into_raw(Box::new(e)),
9793                 },
9794                 result_ok: false,
9795         }
9796 }
9797 /// Checks if the given object is currently in the success state
9798 #[no_mangle]
9799 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
9800         o.result_ok
9801 }
9802 #[no_mangle]
9803 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
9804 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
9805 impl Drop for CResult_PayeePubKeyErrorZ {
9806         fn drop(&mut self) {
9807                 if self.result_ok {
9808                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9809                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9810                         }
9811                 } else {
9812                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9813                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9814                         }
9815                 }
9816         }
9817 }
9818 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
9819         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
9820                 let contents = if o.result_ok {
9821                         let result = unsafe { o.contents.result };
9822                         unsafe { o.contents.result = core::ptr::null_mut() };
9823                         CResult_PayeePubKeyErrorZPtr { result }
9824                 } else {
9825                         let err = unsafe { o.contents.err };
9826                         unsafe { o.contents.err = core::ptr::null_mut(); }
9827                         CResult_PayeePubKeyErrorZPtr { err }
9828                 };
9829                 Self {
9830                         contents,
9831                         result_ok: o.result_ok,
9832                 }
9833         }
9834 }
9835 impl Clone for CResult_PayeePubKeyErrorZ {
9836         fn clone(&self) -> Self {
9837                 if self.result_ok {
9838                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
9839                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
9840                         } }
9841                 } else {
9842                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
9843                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
9844                         } }
9845                 }
9846         }
9847 }
9848 #[no_mangle]
9849 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
9850 /// but with all dynamically-allocated buffers duplicated in new buffers.
9851 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
9852 #[repr(C)]
9853 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
9854 /// This corresponds to std::vector in C++
9855 pub struct CVec_PrivateRouteZ {
9856         /// The elements in the array.
9857         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9858         pub data: *mut crate::lightning_invoice::PrivateRoute,
9859         /// The number of elements pointed to by `data`.
9860         pub datalen: usize
9861 }
9862 impl CVec_PrivateRouteZ {
9863         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
9864                 if self.datalen == 0 { return Vec::new(); }
9865                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9866                 self.data = core::ptr::null_mut();
9867                 self.datalen = 0;
9868                 ret
9869         }
9870         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
9871                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9872         }
9873 }
9874 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
9875         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
9876                 let datalen = v.len();
9877                 let data = Box::into_raw(v.into_boxed_slice());
9878                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9879         }
9880 }
9881 #[no_mangle]
9882 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9883 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
9884 impl Drop for CVec_PrivateRouteZ {
9885         fn drop(&mut self) {
9886                 if self.datalen == 0 { return; }
9887                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9888         }
9889 }
9890 impl Clone for CVec_PrivateRouteZ {
9891         fn clone(&self) -> Self {
9892                 let mut res = Vec::new();
9893                 if self.datalen == 0 { return Self::from(res); }
9894                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9895                 Self::from(res)
9896         }
9897 }
9898 #[repr(C)]
9899 /// The contents of CResult_PositiveTimestampCreationErrorZ
9900 pub union CResult_PositiveTimestampCreationErrorZPtr {
9901         /// A pointer to the contents in the success state.
9902         /// Reading from this pointer when `result_ok` is not set is undefined.
9903         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
9904         /// A pointer to the contents in the error state.
9905         /// Reading from this pointer when `result_ok` is set is undefined.
9906         pub err: *mut crate::lightning_invoice::CreationError,
9907 }
9908 #[repr(C)]
9909 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
9910 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
9911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9912 pub struct CResult_PositiveTimestampCreationErrorZ {
9913         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
9914         /// `err` or `result` depending on the state of `result_ok`.
9915         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
9916         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
9917         pub result_ok: bool,
9918 }
9919 #[no_mangle]
9920 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9921 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
9922         CResult_PositiveTimestampCreationErrorZ {
9923                 contents: CResult_PositiveTimestampCreationErrorZPtr {
9924                         result: Box::into_raw(Box::new(o)),
9925                 },
9926                 result_ok: true,
9927         }
9928 }
9929 #[no_mangle]
9930 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9931 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
9932         CResult_PositiveTimestampCreationErrorZ {
9933                 contents: CResult_PositiveTimestampCreationErrorZPtr {
9934                         err: Box::into_raw(Box::new(e)),
9935                 },
9936                 result_ok: false,
9937         }
9938 }
9939 /// Checks if the given object is currently in the success state
9940 #[no_mangle]
9941 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
9942         o.result_ok
9943 }
9944 #[no_mangle]
9945 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9946 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
9947 impl Drop for CResult_PositiveTimestampCreationErrorZ {
9948         fn drop(&mut self) {
9949                 if self.result_ok {
9950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9952                         }
9953                 } else {
9954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9956                         }
9957                 }
9958         }
9959 }
9960 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
9961         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
9962                 let contents = if o.result_ok {
9963                         let result = unsafe { o.contents.result };
9964                         unsafe { o.contents.result = core::ptr::null_mut() };
9965                         CResult_PositiveTimestampCreationErrorZPtr { result }
9966                 } else {
9967                         let err = unsafe { o.contents.err };
9968                         unsafe { o.contents.err = core::ptr::null_mut(); }
9969                         CResult_PositiveTimestampCreationErrorZPtr { err }
9970                 };
9971                 Self {
9972                         contents,
9973                         result_ok: o.result_ok,
9974                 }
9975         }
9976 }
9977 impl Clone for CResult_PositiveTimestampCreationErrorZ {
9978         fn clone(&self) -> Self {
9979                 if self.result_ok {
9980                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
9981                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
9982                         } }
9983                 } else {
9984                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
9985                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9986                         } }
9987                 }
9988         }
9989 }
9990 #[no_mangle]
9991 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
9992 /// but with all dynamically-allocated buffers duplicated in new buffers.
9993 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
9994 #[repr(C)]
9995 /// The contents of CResult_NoneSemanticErrorZ
9996 pub union CResult_NoneSemanticErrorZPtr {
9997         /// Note that this value is always NULL, as there are no contents in the OK variant
9998         pub result: *mut core::ffi::c_void,
9999         /// A pointer to the contents in the error state.
10000         /// Reading from this pointer when `result_ok` is set is undefined.
10001         pub err: *mut crate::lightning_invoice::SemanticError,
10002 }
10003 #[repr(C)]
10004 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10005 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10007 pub struct CResult_NoneSemanticErrorZ {
10008         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10009         /// `err` or `result` depending on the state of `result_ok`.
10010         pub contents: CResult_NoneSemanticErrorZPtr,
10011         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10012         pub result_ok: bool,
10013 }
10014 #[no_mangle]
10015 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10016 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10017         CResult_NoneSemanticErrorZ {
10018                 contents: CResult_NoneSemanticErrorZPtr {
10019                         result: core::ptr::null_mut(),
10020                 },
10021                 result_ok: true,
10022         }
10023 }
10024 #[no_mangle]
10025 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10026 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10027         CResult_NoneSemanticErrorZ {
10028                 contents: CResult_NoneSemanticErrorZPtr {
10029                         err: Box::into_raw(Box::new(e)),
10030                 },
10031                 result_ok: false,
10032         }
10033 }
10034 /// Checks if the given object is currently in the success state
10035 #[no_mangle]
10036 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10037         o.result_ok
10038 }
10039 #[no_mangle]
10040 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10041 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10042 impl Drop for CResult_NoneSemanticErrorZ {
10043         fn drop(&mut self) {
10044                 if self.result_ok {
10045                 } else {
10046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10048                         }
10049                 }
10050         }
10051 }
10052 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10053         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10054                 let contents = if o.result_ok {
10055                         let _ = unsafe { Box::from_raw(o.contents.result) };
10056                         o.contents.result = core::ptr::null_mut();
10057                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10058                 } else {
10059                         let err = unsafe { o.contents.err };
10060                         unsafe { o.contents.err = core::ptr::null_mut(); }
10061                         CResult_NoneSemanticErrorZPtr { err }
10062                 };
10063                 Self {
10064                         contents,
10065                         result_ok: o.result_ok,
10066                 }
10067         }
10068 }
10069 impl Clone for CResult_NoneSemanticErrorZ {
10070         fn clone(&self) -> Self {
10071                 if self.result_ok {
10072                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10073                                 result: core::ptr::null_mut()
10074                         } }
10075                 } else {
10076                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10077                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10078                         } }
10079                 }
10080         }
10081 }
10082 #[no_mangle]
10083 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10084 /// but with all dynamically-allocated buffers duplicated in new buffers.
10085 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10086 #[repr(C)]
10087 /// The contents of CResult_InvoiceSemanticErrorZ
10088 pub union CResult_InvoiceSemanticErrorZPtr {
10089         /// A pointer to the contents in the success state.
10090         /// Reading from this pointer when `result_ok` is not set is undefined.
10091         pub result: *mut crate::lightning_invoice::Invoice,
10092         /// A pointer to the contents in the error state.
10093         /// Reading from this pointer when `result_ok` is set is undefined.
10094         pub err: *mut crate::lightning_invoice::SemanticError,
10095 }
10096 #[repr(C)]
10097 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10098 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10099 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10100 pub struct CResult_InvoiceSemanticErrorZ {
10101         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10102         /// `err` or `result` depending on the state of `result_ok`.
10103         pub contents: CResult_InvoiceSemanticErrorZPtr,
10104         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10105         pub result_ok: bool,
10106 }
10107 #[no_mangle]
10108 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10109 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10110         CResult_InvoiceSemanticErrorZ {
10111                 contents: CResult_InvoiceSemanticErrorZPtr {
10112                         result: Box::into_raw(Box::new(o)),
10113                 },
10114                 result_ok: true,
10115         }
10116 }
10117 #[no_mangle]
10118 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10119 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10120         CResult_InvoiceSemanticErrorZ {
10121                 contents: CResult_InvoiceSemanticErrorZPtr {
10122                         err: Box::into_raw(Box::new(e)),
10123                 },
10124                 result_ok: false,
10125         }
10126 }
10127 /// Checks if the given object is currently in the success state
10128 #[no_mangle]
10129 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10130         o.result_ok
10131 }
10132 #[no_mangle]
10133 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10134 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10135 impl Drop for CResult_InvoiceSemanticErrorZ {
10136         fn drop(&mut self) {
10137                 if self.result_ok {
10138                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10139                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10140                         }
10141                 } else {
10142                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10143                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10144                         }
10145                 }
10146         }
10147 }
10148 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10149         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10150                 let contents = if o.result_ok {
10151                         let result = unsafe { o.contents.result };
10152                         unsafe { o.contents.result = core::ptr::null_mut() };
10153                         CResult_InvoiceSemanticErrorZPtr { result }
10154                 } else {
10155                         let err = unsafe { o.contents.err };
10156                         unsafe { o.contents.err = core::ptr::null_mut(); }
10157                         CResult_InvoiceSemanticErrorZPtr { err }
10158                 };
10159                 Self {
10160                         contents,
10161                         result_ok: o.result_ok,
10162                 }
10163         }
10164 }
10165 impl Clone for CResult_InvoiceSemanticErrorZ {
10166         fn clone(&self) -> Self {
10167                 if self.result_ok {
10168                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10169                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10170                         } }
10171                 } else {
10172                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10173                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10174                         } }
10175                 }
10176         }
10177 }
10178 #[no_mangle]
10179 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10180 /// but with all dynamically-allocated buffers duplicated in new buffers.
10181 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10182 #[repr(C)]
10183 /// The contents of CResult_DescriptionCreationErrorZ
10184 pub union CResult_DescriptionCreationErrorZPtr {
10185         /// A pointer to the contents in the success state.
10186         /// Reading from this pointer when `result_ok` is not set is undefined.
10187         pub result: *mut crate::lightning_invoice::Description,
10188         /// A pointer to the contents in the error state.
10189         /// Reading from this pointer when `result_ok` is set is undefined.
10190         pub err: *mut crate::lightning_invoice::CreationError,
10191 }
10192 #[repr(C)]
10193 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10194 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10195 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10196 pub struct CResult_DescriptionCreationErrorZ {
10197         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10198         /// `err` or `result` depending on the state of `result_ok`.
10199         pub contents: CResult_DescriptionCreationErrorZPtr,
10200         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10201         pub result_ok: bool,
10202 }
10203 #[no_mangle]
10204 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10205 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10206         CResult_DescriptionCreationErrorZ {
10207                 contents: CResult_DescriptionCreationErrorZPtr {
10208                         result: Box::into_raw(Box::new(o)),
10209                 },
10210                 result_ok: true,
10211         }
10212 }
10213 #[no_mangle]
10214 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10215 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10216         CResult_DescriptionCreationErrorZ {
10217                 contents: CResult_DescriptionCreationErrorZPtr {
10218                         err: Box::into_raw(Box::new(e)),
10219                 },
10220                 result_ok: false,
10221         }
10222 }
10223 /// Checks if the given object is currently in the success state
10224 #[no_mangle]
10225 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10226         o.result_ok
10227 }
10228 #[no_mangle]
10229 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10230 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10231 impl Drop for CResult_DescriptionCreationErrorZ {
10232         fn drop(&mut self) {
10233                 if self.result_ok {
10234                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10235                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10236                         }
10237                 } else {
10238                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10239                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10240                         }
10241                 }
10242         }
10243 }
10244 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10245         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10246                 let contents = if o.result_ok {
10247                         let result = unsafe { o.contents.result };
10248                         unsafe { o.contents.result = core::ptr::null_mut() };
10249                         CResult_DescriptionCreationErrorZPtr { result }
10250                 } else {
10251                         let err = unsafe { o.contents.err };
10252                         unsafe { o.contents.err = core::ptr::null_mut(); }
10253                         CResult_DescriptionCreationErrorZPtr { err }
10254                 };
10255                 Self {
10256                         contents,
10257                         result_ok: o.result_ok,
10258                 }
10259         }
10260 }
10261 impl Clone for CResult_DescriptionCreationErrorZ {
10262         fn clone(&self) -> Self {
10263                 if self.result_ok {
10264                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10265                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10266                         } }
10267                 } else {
10268                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10269                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10270                         } }
10271                 }
10272         }
10273 }
10274 #[no_mangle]
10275 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10276 /// but with all dynamically-allocated buffers duplicated in new buffers.
10277 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10278 #[repr(C)]
10279 /// The contents of CResult_PrivateRouteCreationErrorZ
10280 pub union CResult_PrivateRouteCreationErrorZPtr {
10281         /// A pointer to the contents in the success state.
10282         /// Reading from this pointer when `result_ok` is not set is undefined.
10283         pub result: *mut crate::lightning_invoice::PrivateRoute,
10284         /// A pointer to the contents in the error state.
10285         /// Reading from this pointer when `result_ok` is set is undefined.
10286         pub err: *mut crate::lightning_invoice::CreationError,
10287 }
10288 #[repr(C)]
10289 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10290 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10292 pub struct CResult_PrivateRouteCreationErrorZ {
10293         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10294         /// `err` or `result` depending on the state of `result_ok`.
10295         pub contents: CResult_PrivateRouteCreationErrorZPtr,
10296         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10297         pub result_ok: bool,
10298 }
10299 #[no_mangle]
10300 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10301 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10302         CResult_PrivateRouteCreationErrorZ {
10303                 contents: CResult_PrivateRouteCreationErrorZPtr {
10304                         result: Box::into_raw(Box::new(o)),
10305                 },
10306                 result_ok: true,
10307         }
10308 }
10309 #[no_mangle]
10310 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10311 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10312         CResult_PrivateRouteCreationErrorZ {
10313                 contents: CResult_PrivateRouteCreationErrorZPtr {
10314                         err: Box::into_raw(Box::new(e)),
10315                 },
10316                 result_ok: false,
10317         }
10318 }
10319 /// Checks if the given object is currently in the success state
10320 #[no_mangle]
10321 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10322         o.result_ok
10323 }
10324 #[no_mangle]
10325 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10326 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10327 impl Drop for CResult_PrivateRouteCreationErrorZ {
10328         fn drop(&mut self) {
10329                 if self.result_ok {
10330                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10331                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10332                         }
10333                 } else {
10334                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10335                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10336                         }
10337                 }
10338         }
10339 }
10340 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10341         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10342                 let contents = if o.result_ok {
10343                         let result = unsafe { o.contents.result };
10344                         unsafe { o.contents.result = core::ptr::null_mut() };
10345                         CResult_PrivateRouteCreationErrorZPtr { result }
10346                 } else {
10347                         let err = unsafe { o.contents.err };
10348                         unsafe { o.contents.err = core::ptr::null_mut(); }
10349                         CResult_PrivateRouteCreationErrorZPtr { err }
10350                 };
10351                 Self {
10352                         contents,
10353                         result_ok: o.result_ok,
10354                 }
10355         }
10356 }
10357 impl Clone for CResult_PrivateRouteCreationErrorZ {
10358         fn clone(&self) -> Self {
10359                 if self.result_ok {
10360                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10361                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10362                         } }
10363                 } else {
10364                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10365                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10366                         } }
10367                 }
10368         }
10369 }
10370 #[no_mangle]
10371 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10372 /// but with all dynamically-allocated buffers duplicated in new buffers.
10373 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10374 #[repr(C)]
10375 /// The contents of CResult_StringErrorZ
10376 pub union CResult_StringErrorZPtr {
10377         /// A pointer to the contents in the success state.
10378         /// Reading from this pointer when `result_ok` is not set is undefined.
10379         pub result: *mut crate::c_types::Str,
10380         /// A pointer to the contents in the error state.
10381         /// Reading from this pointer when `result_ok` is set is undefined.
10382         pub err: *mut crate::c_types::Secp256k1Error,
10383 }
10384 #[repr(C)]
10385 /// A CResult_StringErrorZ represents the result of a fallible operation,
10386 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10387 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10388 pub struct CResult_StringErrorZ {
10389         /// The contents of this CResult_StringErrorZ, accessible via either
10390         /// `err` or `result` depending on the state of `result_ok`.
10391         pub contents: CResult_StringErrorZPtr,
10392         /// Whether this CResult_StringErrorZ represents a success state.
10393         pub result_ok: bool,
10394 }
10395 #[no_mangle]
10396 /// Creates a new CResult_StringErrorZ in the success state.
10397 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10398         CResult_StringErrorZ {
10399                 contents: CResult_StringErrorZPtr {
10400                         result: Box::into_raw(Box::new(o)),
10401                 },
10402                 result_ok: true,
10403         }
10404 }
10405 #[no_mangle]
10406 /// Creates a new CResult_StringErrorZ in the error state.
10407 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10408         CResult_StringErrorZ {
10409                 contents: CResult_StringErrorZPtr {
10410                         err: Box::into_raw(Box::new(e)),
10411                 },
10412                 result_ok: false,
10413         }
10414 }
10415 /// Checks if the given object is currently in the success state
10416 #[no_mangle]
10417 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10418         o.result_ok
10419 }
10420 #[no_mangle]
10421 /// Frees any resources used by the CResult_StringErrorZ.
10422 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10423 impl Drop for CResult_StringErrorZ {
10424         fn drop(&mut self) {
10425                 if self.result_ok {
10426                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10427                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10428                         }
10429                 } else {
10430                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10431                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10432                         }
10433                 }
10434         }
10435 }
10436 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10437         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10438                 let contents = if o.result_ok {
10439                         let result = unsafe { o.contents.result };
10440                         unsafe { o.contents.result = core::ptr::null_mut() };
10441                         CResult_StringErrorZPtr { result }
10442                 } else {
10443                         let err = unsafe { o.contents.err };
10444                         unsafe { o.contents.err = core::ptr::null_mut(); }
10445                         CResult_StringErrorZPtr { err }
10446                 };
10447                 Self {
10448                         contents,
10449                         result_ok: o.result_ok,
10450                 }
10451         }
10452 }
10453 impl Clone for CResult_StringErrorZ {
10454         fn clone(&self) -> Self {
10455                 if self.result_ok {
10456                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
10457                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10458                         } }
10459                 } else {
10460                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
10461                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10462                         } }
10463                 }
10464         }
10465 }
10466 #[no_mangle]
10467 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10468 /// but with all dynamically-allocated buffers duplicated in new buffers.
10469 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10470 #[repr(C)]
10471 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10472 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10473         /// A pointer to the contents in the success state.
10474         /// Reading from this pointer when `result_ok` is not set is undefined.
10475         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10476         /// A pointer to the contents in the error state.
10477         /// Reading from this pointer when `result_ok` is set is undefined.
10478         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10479 }
10480 #[repr(C)]
10481 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10482 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10483 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10484 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10485         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10486         /// `err` or `result` depending on the state of `result_ok`.
10487         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10488         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10489         pub result_ok: bool,
10490 }
10491 #[no_mangle]
10492 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10493 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10494         CResult_ChannelMonitorUpdateDecodeErrorZ {
10495                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10496                         result: Box::into_raw(Box::new(o)),
10497                 },
10498                 result_ok: true,
10499         }
10500 }
10501 #[no_mangle]
10502 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10503 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10504         CResult_ChannelMonitorUpdateDecodeErrorZ {
10505                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10506                         err: Box::into_raw(Box::new(e)),
10507                 },
10508                 result_ok: false,
10509         }
10510 }
10511 /// Checks if the given object is currently in the success state
10512 #[no_mangle]
10513 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10514         o.result_ok
10515 }
10516 #[no_mangle]
10517 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10518 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10519 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10520         fn drop(&mut self) {
10521                 if self.result_ok {
10522                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10523                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10524                         }
10525                 } else {
10526                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10527                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10528                         }
10529                 }
10530         }
10531 }
10532 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10533         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10534                 let contents = if o.result_ok {
10535                         let result = unsafe { o.contents.result };
10536                         unsafe { o.contents.result = core::ptr::null_mut() };
10537                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10538                 } else {
10539                         let err = unsafe { o.contents.err };
10540                         unsafe { o.contents.err = core::ptr::null_mut(); }
10541                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10542                 };
10543                 Self {
10544                         contents,
10545                         result_ok: o.result_ok,
10546                 }
10547         }
10548 }
10549 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10550         fn clone(&self) -> Self {
10551                 if self.result_ok {
10552                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10553                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10554                         } }
10555                 } else {
10556                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10557                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10558                         } }
10559                 }
10560         }
10561 }
10562 #[no_mangle]
10563 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10564 /// but with all dynamically-allocated buffers duplicated in new buffers.
10565 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10566 #[repr(C)]
10567 #[derive(Clone)]
10568 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10569 pub enum COption_MonitorEventZ {
10570         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10571         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10572         /// When we're in this state, this COption_MonitorEventZ contains nothing
10573         None
10574 }
10575 impl COption_MonitorEventZ {
10576         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10577                 if let Self::None = self { false } else { true }
10578         }
10579         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10580                 !self.is_some()
10581         }
10582         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10583                 if let Self::Some(v) = self { v } else { unreachable!() }
10584         }
10585 }
10586 #[no_mangle]
10587 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10588 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10589         COption_MonitorEventZ::Some(o)
10590 }
10591 #[no_mangle]
10592 /// Constructs a new COption_MonitorEventZ containing nothing
10593 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10594         COption_MonitorEventZ::None
10595 }
10596 #[no_mangle]
10597 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10598 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10599 #[no_mangle]
10600 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10601 /// but with all dynamically-allocated buffers duplicated in new buffers.
10602 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10603 #[repr(C)]
10604 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10605 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10606         /// A pointer to the contents in the success state.
10607         /// Reading from this pointer when `result_ok` is not set is undefined.
10608         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10609         /// A pointer to the contents in the error state.
10610         /// Reading from this pointer when `result_ok` is set is undefined.
10611         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10612 }
10613 #[repr(C)]
10614 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10615 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10617 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10618         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10619         /// `err` or `result` depending on the state of `result_ok`.
10620         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10621         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10622         pub result_ok: bool,
10623 }
10624 #[no_mangle]
10625 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10626 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10627         CResult_COption_MonitorEventZDecodeErrorZ {
10628                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10629                         result: Box::into_raw(Box::new(o)),
10630                 },
10631                 result_ok: true,
10632         }
10633 }
10634 #[no_mangle]
10635 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10636 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10637         CResult_COption_MonitorEventZDecodeErrorZ {
10638                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10639                         err: Box::into_raw(Box::new(e)),
10640                 },
10641                 result_ok: false,
10642         }
10643 }
10644 /// Checks if the given object is currently in the success state
10645 #[no_mangle]
10646 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10647         o.result_ok
10648 }
10649 #[no_mangle]
10650 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10651 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10652 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10653         fn drop(&mut self) {
10654                 if self.result_ok {
10655                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10656                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10657                         }
10658                 } else {
10659                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10660                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10661                         }
10662                 }
10663         }
10664 }
10665 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10666         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10667                 let contents = if o.result_ok {
10668                         let result = unsafe { o.contents.result };
10669                         unsafe { o.contents.result = core::ptr::null_mut() };
10670                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10671                 } else {
10672                         let err = unsafe { o.contents.err };
10673                         unsafe { o.contents.err = core::ptr::null_mut(); }
10674                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10675                 };
10676                 Self {
10677                         contents,
10678                         result_ok: o.result_ok,
10679                 }
10680         }
10681 }
10682 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10683         fn clone(&self) -> Self {
10684                 if self.result_ok {
10685                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10686                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10687                         } }
10688                 } else {
10689                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10690                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10691                         } }
10692                 }
10693         }
10694 }
10695 #[no_mangle]
10696 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10697 /// but with all dynamically-allocated buffers duplicated in new buffers.
10698 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10699 #[repr(C)]
10700 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10701 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10702         /// A pointer to the contents in the success state.
10703         /// Reading from this pointer when `result_ok` is not set is undefined.
10704         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10705         /// A pointer to the contents in the error state.
10706         /// Reading from this pointer when `result_ok` is set is undefined.
10707         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10708 }
10709 #[repr(C)]
10710 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10711 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10713 pub struct CResult_HTLCUpdateDecodeErrorZ {
10714         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10715         /// `err` or `result` depending on the state of `result_ok`.
10716         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10717         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10718         pub result_ok: bool,
10719 }
10720 #[no_mangle]
10721 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10722 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10723         CResult_HTLCUpdateDecodeErrorZ {
10724                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10725                         result: Box::into_raw(Box::new(o)),
10726                 },
10727                 result_ok: true,
10728         }
10729 }
10730 #[no_mangle]
10731 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10732 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10733         CResult_HTLCUpdateDecodeErrorZ {
10734                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10735                         err: Box::into_raw(Box::new(e)),
10736                 },
10737                 result_ok: false,
10738         }
10739 }
10740 /// Checks if the given object is currently in the success state
10741 #[no_mangle]
10742 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10743         o.result_ok
10744 }
10745 #[no_mangle]
10746 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10747 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10748 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10749         fn drop(&mut self) {
10750                 if self.result_ok {
10751                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10752                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10753                         }
10754                 } else {
10755                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10756                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10757                         }
10758                 }
10759         }
10760 }
10761 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10762         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10763                 let contents = if o.result_ok {
10764                         let result = unsafe { o.contents.result };
10765                         unsafe { o.contents.result = core::ptr::null_mut() };
10766                         CResult_HTLCUpdateDecodeErrorZPtr { result }
10767                 } else {
10768                         let err = unsafe { o.contents.err };
10769                         unsafe { o.contents.err = core::ptr::null_mut(); }
10770                         CResult_HTLCUpdateDecodeErrorZPtr { err }
10771                 };
10772                 Self {
10773                         contents,
10774                         result_ok: o.result_ok,
10775                 }
10776         }
10777 }
10778 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10779         fn clone(&self) -> Self {
10780                 if self.result_ok {
10781                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10782                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10783                         } }
10784                 } else {
10785                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10786                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10787                         } }
10788                 }
10789         }
10790 }
10791 #[no_mangle]
10792 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10793 /// but with all dynamically-allocated buffers duplicated in new buffers.
10794 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10795 #[repr(C)]
10796 /// A tuple of 2 elements. See the individual fields for the types contained.
10797 pub struct C2Tuple_OutPointScriptZ {
10798         /// The element at position 0
10799         pub a: crate::lightning::chain::transaction::OutPoint,
10800         /// The element at position 1
10801         pub b: crate::c_types::derived::CVec_u8Z,
10802 }
10803 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10804         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10805                 Self {
10806                         a: tup.0,
10807                         b: tup.1,
10808                 }
10809         }
10810 }
10811 impl C2Tuple_OutPointScriptZ {
10812         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10813                 (self.a, self.b)
10814         }
10815 }
10816 impl Clone for C2Tuple_OutPointScriptZ {
10817         fn clone(&self) -> Self {
10818                 Self {
10819                         a: Clone::clone(&self.a),
10820                         b: Clone::clone(&self.b),
10821                 }
10822         }
10823 }
10824 #[no_mangle]
10825 /// Creates a new tuple which has the same data as `orig`
10826 /// but with all dynamically-allocated buffers duplicated in new buffers.
10827 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10828 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10829 #[no_mangle]
10830 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10831         C2Tuple_OutPointScriptZ { a, b, }
10832 }
10833
10834 #[no_mangle]
10835 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10836 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10837 #[repr(C)]
10838 /// A tuple of 2 elements. See the individual fields for the types contained.
10839 pub struct C2Tuple_u32ScriptZ {
10840         /// The element at position 0
10841         pub a: u32,
10842         /// The element at position 1
10843         pub b: crate::c_types::derived::CVec_u8Z,
10844 }
10845 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10846         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10847                 Self {
10848                         a: tup.0,
10849                         b: tup.1,
10850                 }
10851         }
10852 }
10853 impl C2Tuple_u32ScriptZ {
10854         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10855                 (self.a, self.b)
10856         }
10857 }
10858 impl Clone for C2Tuple_u32ScriptZ {
10859         fn clone(&self) -> Self {
10860                 Self {
10861                         a: Clone::clone(&self.a),
10862                         b: Clone::clone(&self.b),
10863                 }
10864         }
10865 }
10866 #[no_mangle]
10867 /// Creates a new tuple which has the same data as `orig`
10868 /// but with all dynamically-allocated buffers duplicated in new buffers.
10869 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10870 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10871 #[no_mangle]
10872 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10873         C2Tuple_u32ScriptZ { a, b, }
10874 }
10875
10876 #[no_mangle]
10877 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10878 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10879 #[repr(C)]
10880 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10881 /// This corresponds to std::vector in C++
10882 pub struct CVec_C2Tuple_u32ScriptZZ {
10883         /// The elements in the array.
10884         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10885         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10886         /// The number of elements pointed to by `data`.
10887         pub datalen: usize
10888 }
10889 impl CVec_C2Tuple_u32ScriptZZ {
10890         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10891                 if self.datalen == 0 { return Vec::new(); }
10892                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10893                 self.data = core::ptr::null_mut();
10894                 self.datalen = 0;
10895                 ret
10896         }
10897         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10898                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10899         }
10900 }
10901 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10902         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10903                 let datalen = v.len();
10904                 let data = Box::into_raw(v.into_boxed_slice());
10905                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10906         }
10907 }
10908 #[no_mangle]
10909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10910 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10911 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10912         fn drop(&mut self) {
10913                 if self.datalen == 0 { return; }
10914                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10915         }
10916 }
10917 impl Clone for CVec_C2Tuple_u32ScriptZZ {
10918         fn clone(&self) -> Self {
10919                 let mut res = Vec::new();
10920                 if self.datalen == 0 { return Self::from(res); }
10921                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10922                 Self::from(res)
10923         }
10924 }
10925 #[repr(C)]
10926 /// A tuple of 2 elements. See the individual fields for the types contained.
10927 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10928         /// The element at position 0
10929         pub a: crate::c_types::ThirtyTwoBytes,
10930         /// The element at position 1
10931         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
10932 }
10933 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10934         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
10935                 Self {
10936                         a: tup.0,
10937                         b: tup.1,
10938                 }
10939         }
10940 }
10941 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10942         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
10943                 (self.a, self.b)
10944         }
10945 }
10946 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10947         fn clone(&self) -> Self {
10948                 Self {
10949                         a: Clone::clone(&self.a),
10950                         b: Clone::clone(&self.b),
10951                 }
10952         }
10953 }
10954 #[no_mangle]
10955 /// Creates a new tuple which has the same data as `orig`
10956 /// but with all dynamically-allocated buffers duplicated in new buffers.
10957 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
10958 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10959 #[no_mangle]
10960 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 {
10961         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
10962 }
10963
10964 #[no_mangle]
10965 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10966 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
10967 #[repr(C)]
10968 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
10969 /// This corresponds to std::vector in C++
10970 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10971         /// The elements in the array.
10972         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10973         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
10974         /// The number of elements pointed to by `data`.
10975         pub datalen: usize
10976 }
10977 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10978         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
10979                 if self.datalen == 0 { return Vec::new(); }
10980                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10981                 self.data = core::ptr::null_mut();
10982                 self.datalen = 0;
10983                 ret
10984         }
10985         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
10986                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10987         }
10988 }
10989 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
10990         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
10991                 let datalen = v.len();
10992                 let data = Box::into_raw(v.into_boxed_slice());
10993                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10994         }
10995 }
10996 #[no_mangle]
10997 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10998 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
10999 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11000         fn drop(&mut self) {
11001                 if self.datalen == 0 { return; }
11002                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11003         }
11004 }
11005 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11006         fn clone(&self) -> Self {
11007                 let mut res = Vec::new();
11008                 if self.datalen == 0 { return Self::from(res); }
11009                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11010                 Self::from(res)
11011         }
11012 }
11013 #[repr(C)]
11014 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11015 /// This corresponds to std::vector in C++
11016 pub struct CVec_EventZ {
11017         /// The elements in the array.
11018         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11019         pub data: *mut crate::lightning::util::events::Event,
11020         /// The number of elements pointed to by `data`.
11021         pub datalen: usize
11022 }
11023 impl CVec_EventZ {
11024         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11025                 if self.datalen == 0 { return Vec::new(); }
11026                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11027                 self.data = core::ptr::null_mut();
11028                 self.datalen = 0;
11029                 ret
11030         }
11031         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11032                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11033         }
11034 }
11035 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11036         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11037                 let datalen = v.len();
11038                 let data = Box::into_raw(v.into_boxed_slice());
11039                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11040         }
11041 }
11042 #[no_mangle]
11043 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11044 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11045 impl Drop for CVec_EventZ {
11046         fn drop(&mut self) {
11047                 if self.datalen == 0 { return; }
11048                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11049         }
11050 }
11051 impl Clone for CVec_EventZ {
11052         fn clone(&self) -> Self {
11053                 let mut res = Vec::new();
11054                 if self.datalen == 0 { return Self::from(res); }
11055                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11056                 Self::from(res)
11057         }
11058 }
11059 #[repr(C)]
11060 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11061 /// This corresponds to std::vector in C++
11062 pub struct CVec_TransactionZ {
11063         /// The elements in the array.
11064         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11065         pub data: *mut crate::c_types::Transaction,
11066         /// The number of elements pointed to by `data`.
11067         pub datalen: usize
11068 }
11069 impl CVec_TransactionZ {
11070         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11071                 if self.datalen == 0 { return Vec::new(); }
11072                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11073                 self.data = core::ptr::null_mut();
11074                 self.datalen = 0;
11075                 ret
11076         }
11077         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11078                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11079         }
11080 }
11081 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11082         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11083                 let datalen = v.len();
11084                 let data = Box::into_raw(v.into_boxed_slice());
11085                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11086         }
11087 }
11088 #[no_mangle]
11089 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11090 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11091 impl Drop for CVec_TransactionZ {
11092         fn drop(&mut self) {
11093                 if self.datalen == 0 { return; }
11094                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11095         }
11096 }
11097 impl Clone for CVec_TransactionZ {
11098         fn clone(&self) -> Self {
11099                 let mut res = Vec::new();
11100                 if self.datalen == 0 { return Self::from(res); }
11101                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11102                 Self::from(res)
11103         }
11104 }
11105 #[repr(C)]
11106 /// A tuple of 2 elements. See the individual fields for the types contained.
11107 pub struct C2Tuple_u32TxOutZ {
11108         /// The element at position 0
11109         pub a: u32,
11110         /// The element at position 1
11111         pub b: crate::c_types::TxOut,
11112 }
11113 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11114         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11115                 Self {
11116                         a: tup.0,
11117                         b: tup.1,
11118                 }
11119         }
11120 }
11121 impl C2Tuple_u32TxOutZ {
11122         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11123                 (self.a, self.b)
11124         }
11125 }
11126 impl Clone for C2Tuple_u32TxOutZ {
11127         fn clone(&self) -> Self {
11128                 Self {
11129                         a: Clone::clone(&self.a),
11130                         b: Clone::clone(&self.b),
11131                 }
11132         }
11133 }
11134 #[no_mangle]
11135 /// Creates a new tuple which has the same data as `orig`
11136 /// but with all dynamically-allocated buffers duplicated in new buffers.
11137 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11138 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11139 #[no_mangle]
11140 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11141         C2Tuple_u32TxOutZ { a, b, }
11142 }
11143
11144 #[no_mangle]
11145 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11146 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11147 #[repr(C)]
11148 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11149 /// This corresponds to std::vector in C++
11150 pub struct CVec_C2Tuple_u32TxOutZZ {
11151         /// The elements in the array.
11152         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11153         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11154         /// The number of elements pointed to by `data`.
11155         pub datalen: usize
11156 }
11157 impl CVec_C2Tuple_u32TxOutZZ {
11158         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11159                 if self.datalen == 0 { return Vec::new(); }
11160                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11161                 self.data = core::ptr::null_mut();
11162                 self.datalen = 0;
11163                 ret
11164         }
11165         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11166                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11167         }
11168 }
11169 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11170         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11171                 let datalen = v.len();
11172                 let data = Box::into_raw(v.into_boxed_slice());
11173                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11174         }
11175 }
11176 #[no_mangle]
11177 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11178 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11179 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11180         fn drop(&mut self) {
11181                 if self.datalen == 0 { return; }
11182                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11183         }
11184 }
11185 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11186         fn clone(&self) -> Self {
11187                 let mut res = Vec::new();
11188                 if self.datalen == 0 { return Self::from(res); }
11189                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11190                 Self::from(res)
11191         }
11192 }
11193 #[repr(C)]
11194 /// A tuple of 2 elements. See the individual fields for the types contained.
11195 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11196         /// The element at position 0
11197         pub a: crate::c_types::ThirtyTwoBytes,
11198         /// The element at position 1
11199         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11200 }
11201 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11202         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11203                 Self {
11204                         a: tup.0,
11205                         b: tup.1,
11206                 }
11207         }
11208 }
11209 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11210         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11211                 (self.a, self.b)
11212         }
11213 }
11214 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11215         fn clone(&self) -> Self {
11216                 Self {
11217                         a: Clone::clone(&self.a),
11218                         b: Clone::clone(&self.b),
11219                 }
11220         }
11221 }
11222 #[no_mangle]
11223 /// Creates a new tuple which has the same data as `orig`
11224 /// but with all dynamically-allocated buffers duplicated in new buffers.
11225 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11226 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11227 #[no_mangle]
11228 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 {
11229         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11230 }
11231
11232 #[no_mangle]
11233 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11234 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11235 #[repr(C)]
11236 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11237 /// This corresponds to std::vector in C++
11238 pub struct CVec_TransactionOutputsZ {
11239         /// The elements in the array.
11240         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11241         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11242         /// The number of elements pointed to by `data`.
11243         pub datalen: usize
11244 }
11245 impl CVec_TransactionOutputsZ {
11246         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11247                 if self.datalen == 0 { return Vec::new(); }
11248                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11249                 self.data = core::ptr::null_mut();
11250                 self.datalen = 0;
11251                 ret
11252         }
11253         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11254                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11255         }
11256 }
11257 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11258         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11259                 let datalen = v.len();
11260                 let data = Box::into_raw(v.into_boxed_slice());
11261                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11262         }
11263 }
11264 #[no_mangle]
11265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11266 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11267 impl Drop for CVec_TransactionOutputsZ {
11268         fn drop(&mut self) {
11269                 if self.datalen == 0 { return; }
11270                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11271         }
11272 }
11273 impl Clone for CVec_TransactionOutputsZ {
11274         fn clone(&self) -> Self {
11275                 let mut res = Vec::new();
11276                 if self.datalen == 0 { return Self::from(res); }
11277                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11278                 Self::from(res)
11279         }
11280 }
11281 #[repr(C)]
11282 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11283 /// This corresponds to std::vector in C++
11284 pub struct CVec_BalanceZ {
11285         /// The elements in the array.
11286         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11287         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11288         /// The number of elements pointed to by `data`.
11289         pub datalen: usize
11290 }
11291 impl CVec_BalanceZ {
11292         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11293                 if self.datalen == 0 { return Vec::new(); }
11294                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11295                 self.data = core::ptr::null_mut();
11296                 self.datalen = 0;
11297                 ret
11298         }
11299         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11300                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11301         }
11302 }
11303 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11304         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11305                 let datalen = v.len();
11306                 let data = Box::into_raw(v.into_boxed_slice());
11307                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11308         }
11309 }
11310 #[no_mangle]
11311 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11312 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11313 impl Drop for CVec_BalanceZ {
11314         fn drop(&mut self) {
11315                 if self.datalen == 0 { return; }
11316                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11317         }
11318 }
11319 impl Clone for CVec_BalanceZ {
11320         fn clone(&self) -> Self {
11321                 let mut res = Vec::new();
11322                 if self.datalen == 0 { return Self::from(res); }
11323                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11324                 Self::from(res)
11325         }
11326 }
11327 #[repr(C)]
11328 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11329 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11330         /// A pointer to the contents in the success state.
11331         /// Reading from this pointer when `result_ok` is not set is undefined.
11332         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11333         /// A pointer to the contents in the error state.
11334         /// Reading from this pointer when `result_ok` is set is undefined.
11335         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11336 }
11337 #[repr(C)]
11338 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11339 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11340 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11341 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11342         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11343         /// `err` or `result` depending on the state of `result_ok`.
11344         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11345         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11346         pub result_ok: bool,
11347 }
11348 #[no_mangle]
11349 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11350 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11351         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11352                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11353                         result: Box::into_raw(Box::new(o)),
11354                 },
11355                 result_ok: true,
11356         }
11357 }
11358 #[no_mangle]
11359 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11360 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11361         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11362                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11363                         err: Box::into_raw(Box::new(e)),
11364                 },
11365                 result_ok: false,
11366         }
11367 }
11368 /// Checks if the given object is currently in the success state
11369 #[no_mangle]
11370 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11371         o.result_ok
11372 }
11373 #[no_mangle]
11374 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11375 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11376 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11377         fn drop(&mut self) {
11378                 if self.result_ok {
11379                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11380                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11381                         }
11382                 } else {
11383                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11384                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11385                         }
11386                 }
11387         }
11388 }
11389 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11390         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11391                 let contents = if o.result_ok {
11392                         let result = unsafe { o.contents.result };
11393                         unsafe { o.contents.result = core::ptr::null_mut() };
11394                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11395                 } else {
11396                         let err = unsafe { o.contents.err };
11397                         unsafe { o.contents.err = core::ptr::null_mut(); }
11398                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11399                 };
11400                 Self {
11401                         contents,
11402                         result_ok: o.result_ok,
11403                 }
11404         }
11405 }
11406 #[repr(C)]
11407 /// A tuple of 2 elements. See the individual fields for the types contained.
11408 pub struct C2Tuple_PublicKeyTypeZ {
11409         /// The element at position 0
11410         pub a: crate::c_types::PublicKey,
11411         /// The element at position 1
11412         pub b: crate::lightning::ln::wire::Type,
11413 }
11414 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11415         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11416                 Self {
11417                         a: tup.0,
11418                         b: tup.1,
11419                 }
11420         }
11421 }
11422 impl C2Tuple_PublicKeyTypeZ {
11423         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11424                 (self.a, self.b)
11425         }
11426 }
11427 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11428 #[no_mangle]
11429 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11430         C2Tuple_PublicKeyTypeZ { a, b, }
11431 }
11432
11433 #[no_mangle]
11434 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11435 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11436 #[repr(C)]
11437 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11438 /// This corresponds to std::vector in C++
11439 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11440         /// The elements in the array.
11441         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11442         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11443         /// The number of elements pointed to by `data`.
11444         pub datalen: usize
11445 }
11446 impl CVec_C2Tuple_PublicKeyTypeZZ {
11447         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11448                 if self.datalen == 0 { return Vec::new(); }
11449                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11450                 self.data = core::ptr::null_mut();
11451                 self.datalen = 0;
11452                 ret
11453         }
11454         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11455                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11456         }
11457 }
11458 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11459         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11460                 let datalen = v.len();
11461                 let data = Box::into_raw(v.into_boxed_slice());
11462                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11463         }
11464 }
11465 #[no_mangle]
11466 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11467 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11468 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11469         fn drop(&mut self) {
11470                 if self.datalen == 0 { return; }
11471                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11472         }
11473 }
11474 #[repr(C)]
11475 #[derive(Clone)]
11476 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11477 pub enum COption_NetAddressZ {
11478         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11479         Some(crate::lightning::ln::msgs::NetAddress),
11480         /// When we're in this state, this COption_NetAddressZ contains nothing
11481         None
11482 }
11483 impl COption_NetAddressZ {
11484         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11485                 if let Self::None = self { false } else { true }
11486         }
11487         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11488                 !self.is_some()
11489         }
11490         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11491                 if let Self::Some(v) = self { v } else { unreachable!() }
11492         }
11493 }
11494 #[no_mangle]
11495 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11496 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11497         COption_NetAddressZ::Some(o)
11498 }
11499 #[no_mangle]
11500 /// Constructs a new COption_NetAddressZ containing nothing
11501 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11502         COption_NetAddressZ::None
11503 }
11504 #[no_mangle]
11505 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11506 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11507 #[no_mangle]
11508 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11509 /// but with all dynamically-allocated buffers duplicated in new buffers.
11510 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11511 #[repr(C)]
11512 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11513 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11514         /// A pointer to the contents in the success state.
11515         /// Reading from this pointer when `result_ok` is not set is undefined.
11516         pub result: *mut crate::c_types::derived::CVec_u8Z,
11517         /// A pointer to the contents in the error state.
11518         /// Reading from this pointer when `result_ok` is set is undefined.
11519         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11520 }
11521 #[repr(C)]
11522 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11523 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11525 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11526         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11527         /// `err` or `result` depending on the state of `result_ok`.
11528         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11529         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11530         pub result_ok: bool,
11531 }
11532 #[no_mangle]
11533 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11534 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11535         CResult_CVec_u8ZPeerHandleErrorZ {
11536                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11537                         result: Box::into_raw(Box::new(o)),
11538                 },
11539                 result_ok: true,
11540         }
11541 }
11542 #[no_mangle]
11543 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11544 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11545         CResult_CVec_u8ZPeerHandleErrorZ {
11546                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11547                         err: Box::into_raw(Box::new(e)),
11548                 },
11549                 result_ok: false,
11550         }
11551 }
11552 /// Checks if the given object is currently in the success state
11553 #[no_mangle]
11554 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11555         o.result_ok
11556 }
11557 #[no_mangle]
11558 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11559 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11560 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11561         fn drop(&mut self) {
11562                 if self.result_ok {
11563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11565                         }
11566                 } else {
11567                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11568                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11569                         }
11570                 }
11571         }
11572 }
11573 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11574         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11575                 let contents = if o.result_ok {
11576                         let result = unsafe { o.contents.result };
11577                         unsafe { o.contents.result = core::ptr::null_mut() };
11578                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11579                 } else {
11580                         let err = unsafe { o.contents.err };
11581                         unsafe { o.contents.err = core::ptr::null_mut(); }
11582                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11583                 };
11584                 Self {
11585                         contents,
11586                         result_ok: o.result_ok,
11587                 }
11588         }
11589 }
11590 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11591         fn clone(&self) -> Self {
11592                 if self.result_ok {
11593                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11594                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11595                         } }
11596                 } else {
11597                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11598                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11599                         } }
11600                 }
11601         }
11602 }
11603 #[no_mangle]
11604 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11605 /// but with all dynamically-allocated buffers duplicated in new buffers.
11606 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11607 #[repr(C)]
11608 /// The contents of CResult_NonePeerHandleErrorZ
11609 pub union CResult_NonePeerHandleErrorZPtr {
11610         /// Note that this value is always NULL, as there are no contents in the OK variant
11611         pub result: *mut core::ffi::c_void,
11612         /// A pointer to the contents in the error state.
11613         /// Reading from this pointer when `result_ok` is set is undefined.
11614         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11615 }
11616 #[repr(C)]
11617 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11618 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11620 pub struct CResult_NonePeerHandleErrorZ {
11621         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11622         /// `err` or `result` depending on the state of `result_ok`.
11623         pub contents: CResult_NonePeerHandleErrorZPtr,
11624         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11625         pub result_ok: bool,
11626 }
11627 #[no_mangle]
11628 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11629 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11630         CResult_NonePeerHandleErrorZ {
11631                 contents: CResult_NonePeerHandleErrorZPtr {
11632                         result: core::ptr::null_mut(),
11633                 },
11634                 result_ok: true,
11635         }
11636 }
11637 #[no_mangle]
11638 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11639 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11640         CResult_NonePeerHandleErrorZ {
11641                 contents: CResult_NonePeerHandleErrorZPtr {
11642                         err: Box::into_raw(Box::new(e)),
11643                 },
11644                 result_ok: false,
11645         }
11646 }
11647 /// Checks if the given object is currently in the success state
11648 #[no_mangle]
11649 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11650         o.result_ok
11651 }
11652 #[no_mangle]
11653 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11654 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11655 impl Drop for CResult_NonePeerHandleErrorZ {
11656         fn drop(&mut self) {
11657                 if self.result_ok {
11658                 } else {
11659                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11660                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11661                         }
11662                 }
11663         }
11664 }
11665 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11666         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11667                 let contents = if o.result_ok {
11668                         let _ = unsafe { Box::from_raw(o.contents.result) };
11669                         o.contents.result = core::ptr::null_mut();
11670                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11671                 } else {
11672                         let err = unsafe { o.contents.err };
11673                         unsafe { o.contents.err = core::ptr::null_mut(); }
11674                         CResult_NonePeerHandleErrorZPtr { err }
11675                 };
11676                 Self {
11677                         contents,
11678                         result_ok: o.result_ok,
11679                 }
11680         }
11681 }
11682 impl Clone for CResult_NonePeerHandleErrorZ {
11683         fn clone(&self) -> Self {
11684                 if self.result_ok {
11685                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11686                                 result: core::ptr::null_mut()
11687                         } }
11688                 } else {
11689                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11690                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11691                         } }
11692                 }
11693         }
11694 }
11695 #[no_mangle]
11696 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11697 /// but with all dynamically-allocated buffers duplicated in new buffers.
11698 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11699 #[repr(C)]
11700 /// The contents of CResult_boolPeerHandleErrorZ
11701 pub union CResult_boolPeerHandleErrorZPtr {
11702         /// A pointer to the contents in the success state.
11703         /// Reading from this pointer when `result_ok` is not set is undefined.
11704         pub result: *mut bool,
11705         /// A pointer to the contents in the error state.
11706         /// Reading from this pointer when `result_ok` is set is undefined.
11707         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11708 }
11709 #[repr(C)]
11710 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11711 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11713 pub struct CResult_boolPeerHandleErrorZ {
11714         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11715         /// `err` or `result` depending on the state of `result_ok`.
11716         pub contents: CResult_boolPeerHandleErrorZPtr,
11717         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11718         pub result_ok: bool,
11719 }
11720 #[no_mangle]
11721 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11722 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11723         CResult_boolPeerHandleErrorZ {
11724                 contents: CResult_boolPeerHandleErrorZPtr {
11725                         result: Box::into_raw(Box::new(o)),
11726                 },
11727                 result_ok: true,
11728         }
11729 }
11730 #[no_mangle]
11731 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11732 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11733         CResult_boolPeerHandleErrorZ {
11734                 contents: CResult_boolPeerHandleErrorZPtr {
11735                         err: Box::into_raw(Box::new(e)),
11736                 },
11737                 result_ok: false,
11738         }
11739 }
11740 /// Checks if the given object is currently in the success state
11741 #[no_mangle]
11742 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11743         o.result_ok
11744 }
11745 #[no_mangle]
11746 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11747 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11748 impl Drop for CResult_boolPeerHandleErrorZ {
11749         fn drop(&mut self) {
11750                 if self.result_ok {
11751                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11752                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11753                         }
11754                 } else {
11755                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11756                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11757                         }
11758                 }
11759         }
11760 }
11761 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11762         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11763                 let contents = if o.result_ok {
11764                         let result = unsafe { o.contents.result };
11765                         unsafe { o.contents.result = core::ptr::null_mut() };
11766                         CResult_boolPeerHandleErrorZPtr { result }
11767                 } else {
11768                         let err = unsafe { o.contents.err };
11769                         unsafe { o.contents.err = core::ptr::null_mut(); }
11770                         CResult_boolPeerHandleErrorZPtr { err }
11771                 };
11772                 Self {
11773                         contents,
11774                         result_ok: o.result_ok,
11775                 }
11776         }
11777 }
11778 impl Clone for CResult_boolPeerHandleErrorZ {
11779         fn clone(&self) -> Self {
11780                 if self.result_ok {
11781                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11782                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11783                         } }
11784                 } else {
11785                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11786                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11787                         } }
11788                 }
11789         }
11790 }
11791 #[no_mangle]
11792 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11793 /// but with all dynamically-allocated buffers duplicated in new buffers.
11794 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11795 #[repr(C)]
11796 /// The contents of CResult_u32GraphSyncErrorZ
11797 pub union CResult_u32GraphSyncErrorZPtr {
11798         /// A pointer to the contents in the success state.
11799         /// Reading from this pointer when `result_ok` is not set is undefined.
11800         pub result: *mut u32,
11801         /// A pointer to the contents in the error state.
11802         /// Reading from this pointer when `result_ok` is set is undefined.
11803         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
11804 }
11805 #[repr(C)]
11806 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11807 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11809 pub struct CResult_u32GraphSyncErrorZ {
11810         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11811         /// `err` or `result` depending on the state of `result_ok`.
11812         pub contents: CResult_u32GraphSyncErrorZPtr,
11813         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
11814         pub result_ok: bool,
11815 }
11816 #[no_mangle]
11817 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
11818 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
11819         CResult_u32GraphSyncErrorZ {
11820                 contents: CResult_u32GraphSyncErrorZPtr {
11821                         result: Box::into_raw(Box::new(o)),
11822                 },
11823                 result_ok: true,
11824         }
11825 }
11826 #[no_mangle]
11827 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
11828 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
11829         CResult_u32GraphSyncErrorZ {
11830                 contents: CResult_u32GraphSyncErrorZPtr {
11831                         err: Box::into_raw(Box::new(e)),
11832                 },
11833                 result_ok: false,
11834         }
11835 }
11836 /// Checks if the given object is currently in the success state
11837 #[no_mangle]
11838 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
11839         o.result_ok
11840 }
11841 #[no_mangle]
11842 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
11843 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
11844 impl Drop for CResult_u32GraphSyncErrorZ {
11845         fn drop(&mut self) {
11846                 if self.result_ok {
11847                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11848                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11849                         }
11850                 } else {
11851                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11852                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11853                         }
11854                 }
11855         }
11856 }
11857 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
11858         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
11859                 let contents = if o.result_ok {
11860                         let result = unsafe { o.contents.result };
11861                         unsafe { o.contents.result = core::ptr::null_mut() };
11862                         CResult_u32GraphSyncErrorZPtr { result }
11863                 } else {
11864                         let err = unsafe { o.contents.err };
11865                         unsafe { o.contents.err = core::ptr::null_mut(); }
11866                         CResult_u32GraphSyncErrorZPtr { err }
11867                 };
11868                 Self {
11869                         contents,
11870                         result_ok: o.result_ok,
11871                 }
11872         }
11873 }
11874 #[repr(C)]
11875 /// The contents of CResult_NetAddressDecodeErrorZ
11876 pub union CResult_NetAddressDecodeErrorZPtr {
11877         /// A pointer to the contents in the success state.
11878         /// Reading from this pointer when `result_ok` is not set is undefined.
11879         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11880         /// A pointer to the contents in the error state.
11881         /// Reading from this pointer when `result_ok` is set is undefined.
11882         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11883 }
11884 #[repr(C)]
11885 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11886 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11888 pub struct CResult_NetAddressDecodeErrorZ {
11889         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11890         /// `err` or `result` depending on the state of `result_ok`.
11891         pub contents: CResult_NetAddressDecodeErrorZPtr,
11892         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11893         pub result_ok: bool,
11894 }
11895 #[no_mangle]
11896 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11897 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11898         CResult_NetAddressDecodeErrorZ {
11899                 contents: CResult_NetAddressDecodeErrorZPtr {
11900                         result: Box::into_raw(Box::new(o)),
11901                 },
11902                 result_ok: true,
11903         }
11904 }
11905 #[no_mangle]
11906 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11907 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11908         CResult_NetAddressDecodeErrorZ {
11909                 contents: CResult_NetAddressDecodeErrorZPtr {
11910                         err: Box::into_raw(Box::new(e)),
11911                 },
11912                 result_ok: false,
11913         }
11914 }
11915 /// Checks if the given object is currently in the success state
11916 #[no_mangle]
11917 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11918         o.result_ok
11919 }
11920 #[no_mangle]
11921 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11922 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11923 impl Drop for CResult_NetAddressDecodeErrorZ {
11924         fn drop(&mut self) {
11925                 if self.result_ok {
11926                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11927                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11928                         }
11929                 } else {
11930                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11931                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11932                         }
11933                 }
11934         }
11935 }
11936 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11937         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11938                 let contents = if o.result_ok {
11939                         let result = unsafe { o.contents.result };
11940                         unsafe { o.contents.result = core::ptr::null_mut() };
11941                         CResult_NetAddressDecodeErrorZPtr { result }
11942                 } else {
11943                         let err = unsafe { o.contents.err };
11944                         unsafe { o.contents.err = core::ptr::null_mut(); }
11945                         CResult_NetAddressDecodeErrorZPtr { err }
11946                 };
11947                 Self {
11948                         contents,
11949                         result_ok: o.result_ok,
11950                 }
11951         }
11952 }
11953 impl Clone for CResult_NetAddressDecodeErrorZ {
11954         fn clone(&self) -> Self {
11955                 if self.result_ok {
11956                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11957                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11958                         } }
11959                 } else {
11960                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11961                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11962                         } }
11963                 }
11964         }
11965 }
11966 #[no_mangle]
11967 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11968 /// but with all dynamically-allocated buffers duplicated in new buffers.
11969 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11970 #[repr(C)]
11971 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11972 /// This corresponds to std::vector in C++
11973 pub struct CVec_UpdateAddHTLCZ {
11974         /// The elements in the array.
11975         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11976         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11977         /// The number of elements pointed to by `data`.
11978         pub datalen: usize
11979 }
11980 impl CVec_UpdateAddHTLCZ {
11981         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11982                 if self.datalen == 0 { return Vec::new(); }
11983                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11984                 self.data = core::ptr::null_mut();
11985                 self.datalen = 0;
11986                 ret
11987         }
11988         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11989                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11990         }
11991 }
11992 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11993         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11994                 let datalen = v.len();
11995                 let data = Box::into_raw(v.into_boxed_slice());
11996                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11997         }
11998 }
11999 #[no_mangle]
12000 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12001 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12002 impl Drop for CVec_UpdateAddHTLCZ {
12003         fn drop(&mut self) {
12004                 if self.datalen == 0 { return; }
12005                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12006         }
12007 }
12008 impl Clone for CVec_UpdateAddHTLCZ {
12009         fn clone(&self) -> Self {
12010                 let mut res = Vec::new();
12011                 if self.datalen == 0 { return Self::from(res); }
12012                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12013                 Self::from(res)
12014         }
12015 }
12016 #[repr(C)]
12017 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12018 /// This corresponds to std::vector in C++
12019 pub struct CVec_UpdateFulfillHTLCZ {
12020         /// The elements in the array.
12021         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12022         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12023         /// The number of elements pointed to by `data`.
12024         pub datalen: usize
12025 }
12026 impl CVec_UpdateFulfillHTLCZ {
12027         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12028                 if self.datalen == 0 { return Vec::new(); }
12029                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12030                 self.data = core::ptr::null_mut();
12031                 self.datalen = 0;
12032                 ret
12033         }
12034         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12035                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12036         }
12037 }
12038 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12039         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12040                 let datalen = v.len();
12041                 let data = Box::into_raw(v.into_boxed_slice());
12042                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12043         }
12044 }
12045 #[no_mangle]
12046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12047 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12048 impl Drop for CVec_UpdateFulfillHTLCZ {
12049         fn drop(&mut self) {
12050                 if self.datalen == 0 { return; }
12051                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12052         }
12053 }
12054 impl Clone for CVec_UpdateFulfillHTLCZ {
12055         fn clone(&self) -> Self {
12056                 let mut res = Vec::new();
12057                 if self.datalen == 0 { return Self::from(res); }
12058                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12059                 Self::from(res)
12060         }
12061 }
12062 #[repr(C)]
12063 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12064 /// This corresponds to std::vector in C++
12065 pub struct CVec_UpdateFailHTLCZ {
12066         /// The elements in the array.
12067         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12068         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12069         /// The number of elements pointed to by `data`.
12070         pub datalen: usize
12071 }
12072 impl CVec_UpdateFailHTLCZ {
12073         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12074                 if self.datalen == 0 { return Vec::new(); }
12075                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12076                 self.data = core::ptr::null_mut();
12077                 self.datalen = 0;
12078                 ret
12079         }
12080         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12081                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12082         }
12083 }
12084 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12085         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12086                 let datalen = v.len();
12087                 let data = Box::into_raw(v.into_boxed_slice());
12088                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12089         }
12090 }
12091 #[no_mangle]
12092 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12093 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12094 impl Drop for CVec_UpdateFailHTLCZ {
12095         fn drop(&mut self) {
12096                 if self.datalen == 0 { return; }
12097                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12098         }
12099 }
12100 impl Clone for CVec_UpdateFailHTLCZ {
12101         fn clone(&self) -> Self {
12102                 let mut res = Vec::new();
12103                 if self.datalen == 0 { return Self::from(res); }
12104                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12105                 Self::from(res)
12106         }
12107 }
12108 #[repr(C)]
12109 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12110 /// This corresponds to std::vector in C++
12111 pub struct CVec_UpdateFailMalformedHTLCZ {
12112         /// The elements in the array.
12113         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12114         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12115         /// The number of elements pointed to by `data`.
12116         pub datalen: usize
12117 }
12118 impl CVec_UpdateFailMalformedHTLCZ {
12119         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12120                 if self.datalen == 0 { return Vec::new(); }
12121                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12122                 self.data = core::ptr::null_mut();
12123                 self.datalen = 0;
12124                 ret
12125         }
12126         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12127                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12128         }
12129 }
12130 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12131         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12132                 let datalen = v.len();
12133                 let data = Box::into_raw(v.into_boxed_slice());
12134                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12135         }
12136 }
12137 #[no_mangle]
12138 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12139 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12140 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12141         fn drop(&mut self) {
12142                 if self.datalen == 0 { return; }
12143                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12144         }
12145 }
12146 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12147         fn clone(&self) -> Self {
12148                 let mut res = Vec::new();
12149                 if self.datalen == 0 { return Self::from(res); }
12150                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12151                 Self::from(res)
12152         }
12153 }
12154 #[repr(C)]
12155 /// The contents of CResult_AcceptChannelDecodeErrorZ
12156 pub union CResult_AcceptChannelDecodeErrorZPtr {
12157         /// A pointer to the contents in the success state.
12158         /// Reading from this pointer when `result_ok` is not set is undefined.
12159         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12160         /// A pointer to the contents in the error state.
12161         /// Reading from this pointer when `result_ok` is set is undefined.
12162         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12163 }
12164 #[repr(C)]
12165 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12166 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12168 pub struct CResult_AcceptChannelDecodeErrorZ {
12169         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12170         /// `err` or `result` depending on the state of `result_ok`.
12171         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12172         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12173         pub result_ok: bool,
12174 }
12175 #[no_mangle]
12176 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12177 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12178         CResult_AcceptChannelDecodeErrorZ {
12179                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12180                         result: Box::into_raw(Box::new(o)),
12181                 },
12182                 result_ok: true,
12183         }
12184 }
12185 #[no_mangle]
12186 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12187 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12188         CResult_AcceptChannelDecodeErrorZ {
12189                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12190                         err: Box::into_raw(Box::new(e)),
12191                 },
12192                 result_ok: false,
12193         }
12194 }
12195 /// Checks if the given object is currently in the success state
12196 #[no_mangle]
12197 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12198         o.result_ok
12199 }
12200 #[no_mangle]
12201 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12202 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12203 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12204         fn drop(&mut self) {
12205                 if self.result_ok {
12206                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12207                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12208                         }
12209                 } else {
12210                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12211                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12212                         }
12213                 }
12214         }
12215 }
12216 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12217         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12218                 let contents = if o.result_ok {
12219                         let result = unsafe { o.contents.result };
12220                         unsafe { o.contents.result = core::ptr::null_mut() };
12221                         CResult_AcceptChannelDecodeErrorZPtr { result }
12222                 } else {
12223                         let err = unsafe { o.contents.err };
12224                         unsafe { o.contents.err = core::ptr::null_mut(); }
12225                         CResult_AcceptChannelDecodeErrorZPtr { err }
12226                 };
12227                 Self {
12228                         contents,
12229                         result_ok: o.result_ok,
12230                 }
12231         }
12232 }
12233 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12234         fn clone(&self) -> Self {
12235                 if self.result_ok {
12236                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12237                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12238                         } }
12239                 } else {
12240                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12241                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12242                         } }
12243                 }
12244         }
12245 }
12246 #[no_mangle]
12247 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12248 /// but with all dynamically-allocated buffers duplicated in new buffers.
12249 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12250 #[repr(C)]
12251 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12252 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12253         /// A pointer to the contents in the success state.
12254         /// Reading from this pointer when `result_ok` is not set is undefined.
12255         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12256         /// A pointer to the contents in the error state.
12257         /// Reading from this pointer when `result_ok` is set is undefined.
12258         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12259 }
12260 #[repr(C)]
12261 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12262 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12264 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12265         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12266         /// `err` or `result` depending on the state of `result_ok`.
12267         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12268         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12269         pub result_ok: bool,
12270 }
12271 #[no_mangle]
12272 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12273 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12274         CResult_AnnouncementSignaturesDecodeErrorZ {
12275                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12276                         result: Box::into_raw(Box::new(o)),
12277                 },
12278                 result_ok: true,
12279         }
12280 }
12281 #[no_mangle]
12282 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12283 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12284         CResult_AnnouncementSignaturesDecodeErrorZ {
12285                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12286                         err: Box::into_raw(Box::new(e)),
12287                 },
12288                 result_ok: false,
12289         }
12290 }
12291 /// Checks if the given object is currently in the success state
12292 #[no_mangle]
12293 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12294         o.result_ok
12295 }
12296 #[no_mangle]
12297 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12298 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12299 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12300         fn drop(&mut self) {
12301                 if self.result_ok {
12302                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12303                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12304                         }
12305                 } else {
12306                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12307                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12308                         }
12309                 }
12310         }
12311 }
12312 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12313         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12314                 let contents = if o.result_ok {
12315                         let result = unsafe { o.contents.result };
12316                         unsafe { o.contents.result = core::ptr::null_mut() };
12317                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12318                 } else {
12319                         let err = unsafe { o.contents.err };
12320                         unsafe { o.contents.err = core::ptr::null_mut(); }
12321                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12322                 };
12323                 Self {
12324                         contents,
12325                         result_ok: o.result_ok,
12326                 }
12327         }
12328 }
12329 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12330         fn clone(&self) -> Self {
12331                 if self.result_ok {
12332                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12333                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12334                         } }
12335                 } else {
12336                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12337                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12338                         } }
12339                 }
12340         }
12341 }
12342 #[no_mangle]
12343 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12344 /// but with all dynamically-allocated buffers duplicated in new buffers.
12345 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12346 #[repr(C)]
12347 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12348 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12349         /// A pointer to the contents in the success state.
12350         /// Reading from this pointer when `result_ok` is not set is undefined.
12351         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12352         /// A pointer to the contents in the error state.
12353         /// Reading from this pointer when `result_ok` is set is undefined.
12354         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12355 }
12356 #[repr(C)]
12357 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12358 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12360 pub struct CResult_ChannelReestablishDecodeErrorZ {
12361         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12362         /// `err` or `result` depending on the state of `result_ok`.
12363         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12364         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12365         pub result_ok: bool,
12366 }
12367 #[no_mangle]
12368 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12369 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12370         CResult_ChannelReestablishDecodeErrorZ {
12371                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12372                         result: Box::into_raw(Box::new(o)),
12373                 },
12374                 result_ok: true,
12375         }
12376 }
12377 #[no_mangle]
12378 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12379 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12380         CResult_ChannelReestablishDecodeErrorZ {
12381                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12382                         err: Box::into_raw(Box::new(e)),
12383                 },
12384                 result_ok: false,
12385         }
12386 }
12387 /// Checks if the given object is currently in the success state
12388 #[no_mangle]
12389 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12390         o.result_ok
12391 }
12392 #[no_mangle]
12393 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12394 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12395 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12396         fn drop(&mut self) {
12397                 if self.result_ok {
12398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12400                         }
12401                 } else {
12402                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12403                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12404                         }
12405                 }
12406         }
12407 }
12408 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12409         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12410                 let contents = if o.result_ok {
12411                         let result = unsafe { o.contents.result };
12412                         unsafe { o.contents.result = core::ptr::null_mut() };
12413                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12414                 } else {
12415                         let err = unsafe { o.contents.err };
12416                         unsafe { o.contents.err = core::ptr::null_mut(); }
12417                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12418                 };
12419                 Self {
12420                         contents,
12421                         result_ok: o.result_ok,
12422                 }
12423         }
12424 }
12425 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12426         fn clone(&self) -> Self {
12427                 if self.result_ok {
12428                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12429                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12430                         } }
12431                 } else {
12432                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12433                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12434                         } }
12435                 }
12436         }
12437 }
12438 #[no_mangle]
12439 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12440 /// but with all dynamically-allocated buffers duplicated in new buffers.
12441 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12442 #[repr(C)]
12443 /// The contents of CResult_ClosingSignedDecodeErrorZ
12444 pub union CResult_ClosingSignedDecodeErrorZPtr {
12445         /// A pointer to the contents in the success state.
12446         /// Reading from this pointer when `result_ok` is not set is undefined.
12447         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12448         /// A pointer to the contents in the error state.
12449         /// Reading from this pointer when `result_ok` is set is undefined.
12450         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12451 }
12452 #[repr(C)]
12453 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12454 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12455 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12456 pub struct CResult_ClosingSignedDecodeErrorZ {
12457         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12458         /// `err` or `result` depending on the state of `result_ok`.
12459         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12460         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12461         pub result_ok: bool,
12462 }
12463 #[no_mangle]
12464 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12465 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12466         CResult_ClosingSignedDecodeErrorZ {
12467                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12468                         result: Box::into_raw(Box::new(o)),
12469                 },
12470                 result_ok: true,
12471         }
12472 }
12473 #[no_mangle]
12474 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12475 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12476         CResult_ClosingSignedDecodeErrorZ {
12477                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12478                         err: Box::into_raw(Box::new(e)),
12479                 },
12480                 result_ok: false,
12481         }
12482 }
12483 /// Checks if the given object is currently in the success state
12484 #[no_mangle]
12485 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12486         o.result_ok
12487 }
12488 #[no_mangle]
12489 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12490 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12491 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12492         fn drop(&mut self) {
12493                 if self.result_ok {
12494                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12495                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12496                         }
12497                 } else {
12498                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12499                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12500                         }
12501                 }
12502         }
12503 }
12504 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12505         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12506                 let contents = if o.result_ok {
12507                         let result = unsafe { o.contents.result };
12508                         unsafe { o.contents.result = core::ptr::null_mut() };
12509                         CResult_ClosingSignedDecodeErrorZPtr { result }
12510                 } else {
12511                         let err = unsafe { o.contents.err };
12512                         unsafe { o.contents.err = core::ptr::null_mut(); }
12513                         CResult_ClosingSignedDecodeErrorZPtr { err }
12514                 };
12515                 Self {
12516                         contents,
12517                         result_ok: o.result_ok,
12518                 }
12519         }
12520 }
12521 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12522         fn clone(&self) -> Self {
12523                 if self.result_ok {
12524                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12525                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12526                         } }
12527                 } else {
12528                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12529                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12530                         } }
12531                 }
12532         }
12533 }
12534 #[no_mangle]
12535 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12536 /// but with all dynamically-allocated buffers duplicated in new buffers.
12537 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12538 #[repr(C)]
12539 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12540 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12541         /// A pointer to the contents in the success state.
12542         /// Reading from this pointer when `result_ok` is not set is undefined.
12543         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12544         /// A pointer to the contents in the error state.
12545         /// Reading from this pointer when `result_ok` is set is undefined.
12546         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12547 }
12548 #[repr(C)]
12549 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12550 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12551 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12552 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12553         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12554         /// `err` or `result` depending on the state of `result_ok`.
12555         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12556         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12557         pub result_ok: bool,
12558 }
12559 #[no_mangle]
12560 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12561 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12562         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12563                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12564                         result: Box::into_raw(Box::new(o)),
12565                 },
12566                 result_ok: true,
12567         }
12568 }
12569 #[no_mangle]
12570 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12571 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12572         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12573                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12574                         err: Box::into_raw(Box::new(e)),
12575                 },
12576                 result_ok: false,
12577         }
12578 }
12579 /// Checks if the given object is currently in the success state
12580 #[no_mangle]
12581 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12582         o.result_ok
12583 }
12584 #[no_mangle]
12585 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12586 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12587 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12588         fn drop(&mut self) {
12589                 if self.result_ok {
12590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12592                         }
12593                 } else {
12594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12596                         }
12597                 }
12598         }
12599 }
12600 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12601         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12602                 let contents = if o.result_ok {
12603                         let result = unsafe { o.contents.result };
12604                         unsafe { o.contents.result = core::ptr::null_mut() };
12605                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12606                 } else {
12607                         let err = unsafe { o.contents.err };
12608                         unsafe { o.contents.err = core::ptr::null_mut(); }
12609                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12610                 };
12611                 Self {
12612                         contents,
12613                         result_ok: o.result_ok,
12614                 }
12615         }
12616 }
12617 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12618         fn clone(&self) -> Self {
12619                 if self.result_ok {
12620                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12621                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12622                         } }
12623                 } else {
12624                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12625                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12626                         } }
12627                 }
12628         }
12629 }
12630 #[no_mangle]
12631 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12632 /// but with all dynamically-allocated buffers duplicated in new buffers.
12633 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12634 #[repr(C)]
12635 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12636 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12637         /// A pointer to the contents in the success state.
12638         /// Reading from this pointer when `result_ok` is not set is undefined.
12639         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12640         /// A pointer to the contents in the error state.
12641         /// Reading from this pointer when `result_ok` is set is undefined.
12642         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12643 }
12644 #[repr(C)]
12645 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12646 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12648 pub struct CResult_CommitmentSignedDecodeErrorZ {
12649         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12650         /// `err` or `result` depending on the state of `result_ok`.
12651         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12652         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12653         pub result_ok: bool,
12654 }
12655 #[no_mangle]
12656 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12657 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12658         CResult_CommitmentSignedDecodeErrorZ {
12659                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12660                         result: Box::into_raw(Box::new(o)),
12661                 },
12662                 result_ok: true,
12663         }
12664 }
12665 #[no_mangle]
12666 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12667 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12668         CResult_CommitmentSignedDecodeErrorZ {
12669                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12670                         err: Box::into_raw(Box::new(e)),
12671                 },
12672                 result_ok: false,
12673         }
12674 }
12675 /// Checks if the given object is currently in the success state
12676 #[no_mangle]
12677 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12678         o.result_ok
12679 }
12680 #[no_mangle]
12681 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12682 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12683 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12684         fn drop(&mut self) {
12685                 if self.result_ok {
12686                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12687                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12688                         }
12689                 } else {
12690                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12691                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12692                         }
12693                 }
12694         }
12695 }
12696 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12697         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12698                 let contents = if o.result_ok {
12699                         let result = unsafe { o.contents.result };
12700                         unsafe { o.contents.result = core::ptr::null_mut() };
12701                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12702                 } else {
12703                         let err = unsafe { o.contents.err };
12704                         unsafe { o.contents.err = core::ptr::null_mut(); }
12705                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12706                 };
12707                 Self {
12708                         contents,
12709                         result_ok: o.result_ok,
12710                 }
12711         }
12712 }
12713 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12714         fn clone(&self) -> Self {
12715                 if self.result_ok {
12716                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12717                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12718                         } }
12719                 } else {
12720                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12721                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12722                         } }
12723                 }
12724         }
12725 }
12726 #[no_mangle]
12727 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12728 /// but with all dynamically-allocated buffers duplicated in new buffers.
12729 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12730 #[repr(C)]
12731 /// The contents of CResult_FundingCreatedDecodeErrorZ
12732 pub union CResult_FundingCreatedDecodeErrorZPtr {
12733         /// A pointer to the contents in the success state.
12734         /// Reading from this pointer when `result_ok` is not set is undefined.
12735         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12736         /// A pointer to the contents in the error state.
12737         /// Reading from this pointer when `result_ok` is set is undefined.
12738         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12739 }
12740 #[repr(C)]
12741 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12742 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12744 pub struct CResult_FundingCreatedDecodeErrorZ {
12745         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12746         /// `err` or `result` depending on the state of `result_ok`.
12747         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12748         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12749         pub result_ok: bool,
12750 }
12751 #[no_mangle]
12752 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12753 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12754         CResult_FundingCreatedDecodeErrorZ {
12755                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12756                         result: Box::into_raw(Box::new(o)),
12757                 },
12758                 result_ok: true,
12759         }
12760 }
12761 #[no_mangle]
12762 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12763 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12764         CResult_FundingCreatedDecodeErrorZ {
12765                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12766                         err: Box::into_raw(Box::new(e)),
12767                 },
12768                 result_ok: false,
12769         }
12770 }
12771 /// Checks if the given object is currently in the success state
12772 #[no_mangle]
12773 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12774         o.result_ok
12775 }
12776 #[no_mangle]
12777 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12778 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12779 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12780         fn drop(&mut self) {
12781                 if self.result_ok {
12782                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12783                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12784                         }
12785                 } else {
12786                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12787                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12788                         }
12789                 }
12790         }
12791 }
12792 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12793         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12794                 let contents = if o.result_ok {
12795                         let result = unsafe { o.contents.result };
12796                         unsafe { o.contents.result = core::ptr::null_mut() };
12797                         CResult_FundingCreatedDecodeErrorZPtr { result }
12798                 } else {
12799                         let err = unsafe { o.contents.err };
12800                         unsafe { o.contents.err = core::ptr::null_mut(); }
12801                         CResult_FundingCreatedDecodeErrorZPtr { err }
12802                 };
12803                 Self {
12804                         contents,
12805                         result_ok: o.result_ok,
12806                 }
12807         }
12808 }
12809 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12810         fn clone(&self) -> Self {
12811                 if self.result_ok {
12812                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12813                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12814                         } }
12815                 } else {
12816                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12817                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12818                         } }
12819                 }
12820         }
12821 }
12822 #[no_mangle]
12823 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12824 /// but with all dynamically-allocated buffers duplicated in new buffers.
12825 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12826 #[repr(C)]
12827 /// The contents of CResult_FundingSignedDecodeErrorZ
12828 pub union CResult_FundingSignedDecodeErrorZPtr {
12829         /// A pointer to the contents in the success state.
12830         /// Reading from this pointer when `result_ok` is not set is undefined.
12831         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12832         /// A pointer to the contents in the error state.
12833         /// Reading from this pointer when `result_ok` is set is undefined.
12834         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12835 }
12836 #[repr(C)]
12837 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12838 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12840 pub struct CResult_FundingSignedDecodeErrorZ {
12841         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12842         /// `err` or `result` depending on the state of `result_ok`.
12843         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12844         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12845         pub result_ok: bool,
12846 }
12847 #[no_mangle]
12848 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12849 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12850         CResult_FundingSignedDecodeErrorZ {
12851                 contents: CResult_FundingSignedDecodeErrorZPtr {
12852                         result: Box::into_raw(Box::new(o)),
12853                 },
12854                 result_ok: true,
12855         }
12856 }
12857 #[no_mangle]
12858 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12859 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12860         CResult_FundingSignedDecodeErrorZ {
12861                 contents: CResult_FundingSignedDecodeErrorZPtr {
12862                         err: Box::into_raw(Box::new(e)),
12863                 },
12864                 result_ok: false,
12865         }
12866 }
12867 /// Checks if the given object is currently in the success state
12868 #[no_mangle]
12869 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12870         o.result_ok
12871 }
12872 #[no_mangle]
12873 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12874 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12875 impl Drop for CResult_FundingSignedDecodeErrorZ {
12876         fn drop(&mut self) {
12877                 if self.result_ok {
12878                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12879                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12880                         }
12881                 } else {
12882                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12883                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12884                         }
12885                 }
12886         }
12887 }
12888 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12889         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12890                 let contents = if o.result_ok {
12891                         let result = unsafe { o.contents.result };
12892                         unsafe { o.contents.result = core::ptr::null_mut() };
12893                         CResult_FundingSignedDecodeErrorZPtr { result }
12894                 } else {
12895                         let err = unsafe { o.contents.err };
12896                         unsafe { o.contents.err = core::ptr::null_mut(); }
12897                         CResult_FundingSignedDecodeErrorZPtr { err }
12898                 };
12899                 Self {
12900                         contents,
12901                         result_ok: o.result_ok,
12902                 }
12903         }
12904 }
12905 impl Clone for CResult_FundingSignedDecodeErrorZ {
12906         fn clone(&self) -> Self {
12907                 if self.result_ok {
12908                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12909                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12910                         } }
12911                 } else {
12912                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12913                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12914                         } }
12915                 }
12916         }
12917 }
12918 #[no_mangle]
12919 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12920 /// but with all dynamically-allocated buffers duplicated in new buffers.
12921 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12922 #[repr(C)]
12923 /// The contents of CResult_ChannelReadyDecodeErrorZ
12924 pub union CResult_ChannelReadyDecodeErrorZPtr {
12925         /// A pointer to the contents in the success state.
12926         /// Reading from this pointer when `result_ok` is not set is undefined.
12927         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
12928         /// A pointer to the contents in the error state.
12929         /// Reading from this pointer when `result_ok` is set is undefined.
12930         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12931 }
12932 #[repr(C)]
12933 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
12934 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
12935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12936 pub struct CResult_ChannelReadyDecodeErrorZ {
12937         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
12938         /// `err` or `result` depending on the state of `result_ok`.
12939         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
12940         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
12941         pub result_ok: bool,
12942 }
12943 #[no_mangle]
12944 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
12945 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
12946         CResult_ChannelReadyDecodeErrorZ {
12947                 contents: CResult_ChannelReadyDecodeErrorZPtr {
12948                         result: Box::into_raw(Box::new(o)),
12949                 },
12950                 result_ok: true,
12951         }
12952 }
12953 #[no_mangle]
12954 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
12955 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
12956         CResult_ChannelReadyDecodeErrorZ {
12957                 contents: CResult_ChannelReadyDecodeErrorZPtr {
12958                         err: Box::into_raw(Box::new(e)),
12959                 },
12960                 result_ok: false,
12961         }
12962 }
12963 /// Checks if the given object is currently in the success state
12964 #[no_mangle]
12965 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
12966         o.result_ok
12967 }
12968 #[no_mangle]
12969 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
12970 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
12971 impl Drop for CResult_ChannelReadyDecodeErrorZ {
12972         fn drop(&mut self) {
12973                 if self.result_ok {
12974                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12975                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12976                         }
12977                 } else {
12978                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12979                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12980                         }
12981                 }
12982         }
12983 }
12984 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
12985         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
12986                 let contents = if o.result_ok {
12987                         let result = unsafe { o.contents.result };
12988                         unsafe { o.contents.result = core::ptr::null_mut() };
12989                         CResult_ChannelReadyDecodeErrorZPtr { result }
12990                 } else {
12991                         let err = unsafe { o.contents.err };
12992                         unsafe { o.contents.err = core::ptr::null_mut(); }
12993                         CResult_ChannelReadyDecodeErrorZPtr { err }
12994                 };
12995                 Self {
12996                         contents,
12997                         result_ok: o.result_ok,
12998                 }
12999         }
13000 }
13001 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13002         fn clone(&self) -> Self {
13003                 if self.result_ok {
13004                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13005                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13006                         } }
13007                 } else {
13008                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13009                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13010                         } }
13011                 }
13012         }
13013 }
13014 #[no_mangle]
13015 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13016 /// but with all dynamically-allocated buffers duplicated in new buffers.
13017 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13018 #[repr(C)]
13019 /// The contents of CResult_InitDecodeErrorZ
13020 pub union CResult_InitDecodeErrorZPtr {
13021         /// A pointer to the contents in the success state.
13022         /// Reading from this pointer when `result_ok` is not set is undefined.
13023         pub result: *mut crate::lightning::ln::msgs::Init,
13024         /// A pointer to the contents in the error state.
13025         /// Reading from this pointer when `result_ok` is set is undefined.
13026         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13027 }
13028 #[repr(C)]
13029 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13030 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13032 pub struct CResult_InitDecodeErrorZ {
13033         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13034         /// `err` or `result` depending on the state of `result_ok`.
13035         pub contents: CResult_InitDecodeErrorZPtr,
13036         /// Whether this CResult_InitDecodeErrorZ represents a success state.
13037         pub result_ok: bool,
13038 }
13039 #[no_mangle]
13040 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13041 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13042         CResult_InitDecodeErrorZ {
13043                 contents: CResult_InitDecodeErrorZPtr {
13044                         result: Box::into_raw(Box::new(o)),
13045                 },
13046                 result_ok: true,
13047         }
13048 }
13049 #[no_mangle]
13050 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13051 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13052         CResult_InitDecodeErrorZ {
13053                 contents: CResult_InitDecodeErrorZPtr {
13054                         err: Box::into_raw(Box::new(e)),
13055                 },
13056                 result_ok: false,
13057         }
13058 }
13059 /// Checks if the given object is currently in the success state
13060 #[no_mangle]
13061 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13062         o.result_ok
13063 }
13064 #[no_mangle]
13065 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13066 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13067 impl Drop for CResult_InitDecodeErrorZ {
13068         fn drop(&mut self) {
13069                 if self.result_ok {
13070                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13071                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13072                         }
13073                 } else {
13074                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13075                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13076                         }
13077                 }
13078         }
13079 }
13080 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13081         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13082                 let contents = if o.result_ok {
13083                         let result = unsafe { o.contents.result };
13084                         unsafe { o.contents.result = core::ptr::null_mut() };
13085                         CResult_InitDecodeErrorZPtr { result }
13086                 } else {
13087                         let err = unsafe { o.contents.err };
13088                         unsafe { o.contents.err = core::ptr::null_mut(); }
13089                         CResult_InitDecodeErrorZPtr { err }
13090                 };
13091                 Self {
13092                         contents,
13093                         result_ok: o.result_ok,
13094                 }
13095         }
13096 }
13097 impl Clone for CResult_InitDecodeErrorZ {
13098         fn clone(&self) -> Self {
13099                 if self.result_ok {
13100                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13101                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13102                         } }
13103                 } else {
13104                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13105                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13106                         } }
13107                 }
13108         }
13109 }
13110 #[no_mangle]
13111 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13112 /// but with all dynamically-allocated buffers duplicated in new buffers.
13113 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13114 #[repr(C)]
13115 /// The contents of CResult_OpenChannelDecodeErrorZ
13116 pub union CResult_OpenChannelDecodeErrorZPtr {
13117         /// A pointer to the contents in the success state.
13118         /// Reading from this pointer when `result_ok` is not set is undefined.
13119         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13120         /// A pointer to the contents in the error state.
13121         /// Reading from this pointer when `result_ok` is set is undefined.
13122         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13123 }
13124 #[repr(C)]
13125 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13126 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13127 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13128 pub struct CResult_OpenChannelDecodeErrorZ {
13129         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13130         /// `err` or `result` depending on the state of `result_ok`.
13131         pub contents: CResult_OpenChannelDecodeErrorZPtr,
13132         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13133         pub result_ok: bool,
13134 }
13135 #[no_mangle]
13136 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13137 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13138         CResult_OpenChannelDecodeErrorZ {
13139                 contents: CResult_OpenChannelDecodeErrorZPtr {
13140                         result: Box::into_raw(Box::new(o)),
13141                 },
13142                 result_ok: true,
13143         }
13144 }
13145 #[no_mangle]
13146 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13147 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13148         CResult_OpenChannelDecodeErrorZ {
13149                 contents: CResult_OpenChannelDecodeErrorZPtr {
13150                         err: Box::into_raw(Box::new(e)),
13151                 },
13152                 result_ok: false,
13153         }
13154 }
13155 /// Checks if the given object is currently in the success state
13156 #[no_mangle]
13157 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13158         o.result_ok
13159 }
13160 #[no_mangle]
13161 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13162 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13163 impl Drop for CResult_OpenChannelDecodeErrorZ {
13164         fn drop(&mut self) {
13165                 if self.result_ok {
13166                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13167                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13168                         }
13169                 } else {
13170                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13171                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13172                         }
13173                 }
13174         }
13175 }
13176 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13177         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13178                 let contents = if o.result_ok {
13179                         let result = unsafe { o.contents.result };
13180                         unsafe { o.contents.result = core::ptr::null_mut() };
13181                         CResult_OpenChannelDecodeErrorZPtr { result }
13182                 } else {
13183                         let err = unsafe { o.contents.err };
13184                         unsafe { o.contents.err = core::ptr::null_mut(); }
13185                         CResult_OpenChannelDecodeErrorZPtr { err }
13186                 };
13187                 Self {
13188                         contents,
13189                         result_ok: o.result_ok,
13190                 }
13191         }
13192 }
13193 impl Clone for CResult_OpenChannelDecodeErrorZ {
13194         fn clone(&self) -> Self {
13195                 if self.result_ok {
13196                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13197                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13198                         } }
13199                 } else {
13200                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13201                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13202                         } }
13203                 }
13204         }
13205 }
13206 #[no_mangle]
13207 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13208 /// but with all dynamically-allocated buffers duplicated in new buffers.
13209 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13210 #[repr(C)]
13211 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13212 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13213         /// A pointer to the contents in the success state.
13214         /// Reading from this pointer when `result_ok` is not set is undefined.
13215         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13216         /// A pointer to the contents in the error state.
13217         /// Reading from this pointer when `result_ok` is set is undefined.
13218         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13219 }
13220 #[repr(C)]
13221 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13222 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13224 pub struct CResult_RevokeAndACKDecodeErrorZ {
13225         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13226         /// `err` or `result` depending on the state of `result_ok`.
13227         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13228         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13229         pub result_ok: bool,
13230 }
13231 #[no_mangle]
13232 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13233 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13234         CResult_RevokeAndACKDecodeErrorZ {
13235                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13236                         result: Box::into_raw(Box::new(o)),
13237                 },
13238                 result_ok: true,
13239         }
13240 }
13241 #[no_mangle]
13242 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13243 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13244         CResult_RevokeAndACKDecodeErrorZ {
13245                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13246                         err: Box::into_raw(Box::new(e)),
13247                 },
13248                 result_ok: false,
13249         }
13250 }
13251 /// Checks if the given object is currently in the success state
13252 #[no_mangle]
13253 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13254         o.result_ok
13255 }
13256 #[no_mangle]
13257 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13258 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13259 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13260         fn drop(&mut self) {
13261                 if self.result_ok {
13262                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13263                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13264                         }
13265                 } else {
13266                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13267                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13268                         }
13269                 }
13270         }
13271 }
13272 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13273         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13274                 let contents = if o.result_ok {
13275                         let result = unsafe { o.contents.result };
13276                         unsafe { o.contents.result = core::ptr::null_mut() };
13277                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13278                 } else {
13279                         let err = unsafe { o.contents.err };
13280                         unsafe { o.contents.err = core::ptr::null_mut(); }
13281                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13282                 };
13283                 Self {
13284                         contents,
13285                         result_ok: o.result_ok,
13286                 }
13287         }
13288 }
13289 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13290         fn clone(&self) -> Self {
13291                 if self.result_ok {
13292                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13293                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13294                         } }
13295                 } else {
13296                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13297                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13298                         } }
13299                 }
13300         }
13301 }
13302 #[no_mangle]
13303 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13304 /// but with all dynamically-allocated buffers duplicated in new buffers.
13305 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13306 #[repr(C)]
13307 /// The contents of CResult_ShutdownDecodeErrorZ
13308 pub union CResult_ShutdownDecodeErrorZPtr {
13309         /// A pointer to the contents in the success state.
13310         /// Reading from this pointer when `result_ok` is not set is undefined.
13311         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13312         /// A pointer to the contents in the error state.
13313         /// Reading from this pointer when `result_ok` is set is undefined.
13314         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13315 }
13316 #[repr(C)]
13317 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13318 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13320 pub struct CResult_ShutdownDecodeErrorZ {
13321         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13322         /// `err` or `result` depending on the state of `result_ok`.
13323         pub contents: CResult_ShutdownDecodeErrorZPtr,
13324         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13325         pub result_ok: bool,
13326 }
13327 #[no_mangle]
13328 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13329 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13330         CResult_ShutdownDecodeErrorZ {
13331                 contents: CResult_ShutdownDecodeErrorZPtr {
13332                         result: Box::into_raw(Box::new(o)),
13333                 },
13334                 result_ok: true,
13335         }
13336 }
13337 #[no_mangle]
13338 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13339 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13340         CResult_ShutdownDecodeErrorZ {
13341                 contents: CResult_ShutdownDecodeErrorZPtr {
13342                         err: Box::into_raw(Box::new(e)),
13343                 },
13344                 result_ok: false,
13345         }
13346 }
13347 /// Checks if the given object is currently in the success state
13348 #[no_mangle]
13349 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13350         o.result_ok
13351 }
13352 #[no_mangle]
13353 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13354 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13355 impl Drop for CResult_ShutdownDecodeErrorZ {
13356         fn drop(&mut self) {
13357                 if self.result_ok {
13358                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13359                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13360                         }
13361                 } else {
13362                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13363                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13364                         }
13365                 }
13366         }
13367 }
13368 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13369         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13370                 let contents = if o.result_ok {
13371                         let result = unsafe { o.contents.result };
13372                         unsafe { o.contents.result = core::ptr::null_mut() };
13373                         CResult_ShutdownDecodeErrorZPtr { result }
13374                 } else {
13375                         let err = unsafe { o.contents.err };
13376                         unsafe { o.contents.err = core::ptr::null_mut(); }
13377                         CResult_ShutdownDecodeErrorZPtr { err }
13378                 };
13379                 Self {
13380                         contents,
13381                         result_ok: o.result_ok,
13382                 }
13383         }
13384 }
13385 impl Clone for CResult_ShutdownDecodeErrorZ {
13386         fn clone(&self) -> Self {
13387                 if self.result_ok {
13388                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13389                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13390                         } }
13391                 } else {
13392                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13393                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13394                         } }
13395                 }
13396         }
13397 }
13398 #[no_mangle]
13399 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13400 /// but with all dynamically-allocated buffers duplicated in new buffers.
13401 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13402 #[repr(C)]
13403 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13404 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13405         /// A pointer to the contents in the success state.
13406         /// Reading from this pointer when `result_ok` is not set is undefined.
13407         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13408         /// A pointer to the contents in the error state.
13409         /// Reading from this pointer when `result_ok` is set is undefined.
13410         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13411 }
13412 #[repr(C)]
13413 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13414 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13416 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13417         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13418         /// `err` or `result` depending on the state of `result_ok`.
13419         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13420         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13421         pub result_ok: bool,
13422 }
13423 #[no_mangle]
13424 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13425 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13426         CResult_UpdateFailHTLCDecodeErrorZ {
13427                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13428                         result: Box::into_raw(Box::new(o)),
13429                 },
13430                 result_ok: true,
13431         }
13432 }
13433 #[no_mangle]
13434 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13435 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13436         CResult_UpdateFailHTLCDecodeErrorZ {
13437                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13438                         err: Box::into_raw(Box::new(e)),
13439                 },
13440                 result_ok: false,
13441         }
13442 }
13443 /// Checks if the given object is currently in the success state
13444 #[no_mangle]
13445 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13446         o.result_ok
13447 }
13448 #[no_mangle]
13449 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13450 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13451 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13452         fn drop(&mut self) {
13453                 if self.result_ok {
13454                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13455                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13456                         }
13457                 } else {
13458                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13459                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13460                         }
13461                 }
13462         }
13463 }
13464 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13465         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13466                 let contents = if o.result_ok {
13467                         let result = unsafe { o.contents.result };
13468                         unsafe { o.contents.result = core::ptr::null_mut() };
13469                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13470                 } else {
13471                         let err = unsafe { o.contents.err };
13472                         unsafe { o.contents.err = core::ptr::null_mut(); }
13473                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13474                 };
13475                 Self {
13476                         contents,
13477                         result_ok: o.result_ok,
13478                 }
13479         }
13480 }
13481 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13482         fn clone(&self) -> Self {
13483                 if self.result_ok {
13484                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13485                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13486                         } }
13487                 } else {
13488                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13489                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13490                         } }
13491                 }
13492         }
13493 }
13494 #[no_mangle]
13495 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13496 /// but with all dynamically-allocated buffers duplicated in new buffers.
13497 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13498 #[repr(C)]
13499 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13500 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13501         /// A pointer to the contents in the success state.
13502         /// Reading from this pointer when `result_ok` is not set is undefined.
13503         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13504         /// A pointer to the contents in the error state.
13505         /// Reading from this pointer when `result_ok` is set is undefined.
13506         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13507 }
13508 #[repr(C)]
13509 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13510 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13512 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13513         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13514         /// `err` or `result` depending on the state of `result_ok`.
13515         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13516         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13517         pub result_ok: bool,
13518 }
13519 #[no_mangle]
13520 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13521 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13522         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13523                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13524                         result: Box::into_raw(Box::new(o)),
13525                 },
13526                 result_ok: true,
13527         }
13528 }
13529 #[no_mangle]
13530 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13531 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13532         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13533                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13534                         err: Box::into_raw(Box::new(e)),
13535                 },
13536                 result_ok: false,
13537         }
13538 }
13539 /// Checks if the given object is currently in the success state
13540 #[no_mangle]
13541 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13542         o.result_ok
13543 }
13544 #[no_mangle]
13545 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13546 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13547 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13548         fn drop(&mut self) {
13549                 if self.result_ok {
13550                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13551                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13552                         }
13553                 } else {
13554                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13555                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13556                         }
13557                 }
13558         }
13559 }
13560 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13561         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13562                 let contents = if o.result_ok {
13563                         let result = unsafe { o.contents.result };
13564                         unsafe { o.contents.result = core::ptr::null_mut() };
13565                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13566                 } else {
13567                         let err = unsafe { o.contents.err };
13568                         unsafe { o.contents.err = core::ptr::null_mut(); }
13569                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13570                 };
13571                 Self {
13572                         contents,
13573                         result_ok: o.result_ok,
13574                 }
13575         }
13576 }
13577 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13578         fn clone(&self) -> Self {
13579                 if self.result_ok {
13580                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13581                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13582                         } }
13583                 } else {
13584                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13585                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13586                         } }
13587                 }
13588         }
13589 }
13590 #[no_mangle]
13591 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13592 /// but with all dynamically-allocated buffers duplicated in new buffers.
13593 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13594 #[repr(C)]
13595 /// The contents of CResult_UpdateFeeDecodeErrorZ
13596 pub union CResult_UpdateFeeDecodeErrorZPtr {
13597         /// A pointer to the contents in the success state.
13598         /// Reading from this pointer when `result_ok` is not set is undefined.
13599         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13600         /// A pointer to the contents in the error state.
13601         /// Reading from this pointer when `result_ok` is set is undefined.
13602         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13603 }
13604 #[repr(C)]
13605 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13606 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13608 pub struct CResult_UpdateFeeDecodeErrorZ {
13609         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13610         /// `err` or `result` depending on the state of `result_ok`.
13611         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13612         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13613         pub result_ok: bool,
13614 }
13615 #[no_mangle]
13616 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13617 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13618         CResult_UpdateFeeDecodeErrorZ {
13619                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13620                         result: Box::into_raw(Box::new(o)),
13621                 },
13622                 result_ok: true,
13623         }
13624 }
13625 #[no_mangle]
13626 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13627 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13628         CResult_UpdateFeeDecodeErrorZ {
13629                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13630                         err: Box::into_raw(Box::new(e)),
13631                 },
13632                 result_ok: false,
13633         }
13634 }
13635 /// Checks if the given object is currently in the success state
13636 #[no_mangle]
13637 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13638         o.result_ok
13639 }
13640 #[no_mangle]
13641 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13642 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13643 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13644         fn drop(&mut self) {
13645                 if self.result_ok {
13646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13648                         }
13649                 } else {
13650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13652                         }
13653                 }
13654         }
13655 }
13656 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13657         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13658                 let contents = if o.result_ok {
13659                         let result = unsafe { o.contents.result };
13660                         unsafe { o.contents.result = core::ptr::null_mut() };
13661                         CResult_UpdateFeeDecodeErrorZPtr { result }
13662                 } else {
13663                         let err = unsafe { o.contents.err };
13664                         unsafe { o.contents.err = core::ptr::null_mut(); }
13665                         CResult_UpdateFeeDecodeErrorZPtr { err }
13666                 };
13667                 Self {
13668                         contents,
13669                         result_ok: o.result_ok,
13670                 }
13671         }
13672 }
13673 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13674         fn clone(&self) -> Self {
13675                 if self.result_ok {
13676                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13677                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13678                         } }
13679                 } else {
13680                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13681                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13682                         } }
13683                 }
13684         }
13685 }
13686 #[no_mangle]
13687 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13688 /// but with all dynamically-allocated buffers duplicated in new buffers.
13689 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13690 #[repr(C)]
13691 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13692 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13693         /// A pointer to the contents in the success state.
13694         /// Reading from this pointer when `result_ok` is not set is undefined.
13695         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13696         /// A pointer to the contents in the error state.
13697         /// Reading from this pointer when `result_ok` is set is undefined.
13698         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13699 }
13700 #[repr(C)]
13701 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13702 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13704 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13705         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13706         /// `err` or `result` depending on the state of `result_ok`.
13707         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13708         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13709         pub result_ok: bool,
13710 }
13711 #[no_mangle]
13712 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13713 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13714         CResult_UpdateFulfillHTLCDecodeErrorZ {
13715                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13716                         result: Box::into_raw(Box::new(o)),
13717                 },
13718                 result_ok: true,
13719         }
13720 }
13721 #[no_mangle]
13722 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13723 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13724         CResult_UpdateFulfillHTLCDecodeErrorZ {
13725                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13726                         err: Box::into_raw(Box::new(e)),
13727                 },
13728                 result_ok: false,
13729         }
13730 }
13731 /// Checks if the given object is currently in the success state
13732 #[no_mangle]
13733 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13734         o.result_ok
13735 }
13736 #[no_mangle]
13737 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13738 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13739 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13740         fn drop(&mut self) {
13741                 if self.result_ok {
13742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13744                         }
13745                 } else {
13746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13748                         }
13749                 }
13750         }
13751 }
13752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13754                 let contents = if o.result_ok {
13755                         let result = unsafe { o.contents.result };
13756                         unsafe { o.contents.result = core::ptr::null_mut() };
13757                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13758                 } else {
13759                         let err = unsafe { o.contents.err };
13760                         unsafe { o.contents.err = core::ptr::null_mut(); }
13761                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13762                 };
13763                 Self {
13764                         contents,
13765                         result_ok: o.result_ok,
13766                 }
13767         }
13768 }
13769 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13770         fn clone(&self) -> Self {
13771                 if self.result_ok {
13772                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13773                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13774                         } }
13775                 } else {
13776                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13777                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13778                         } }
13779                 }
13780         }
13781 }
13782 #[no_mangle]
13783 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13784 /// but with all dynamically-allocated buffers duplicated in new buffers.
13785 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13786 #[repr(C)]
13787 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13788 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13789         /// A pointer to the contents in the success state.
13790         /// Reading from this pointer when `result_ok` is not set is undefined.
13791         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13792         /// A pointer to the contents in the error state.
13793         /// Reading from this pointer when `result_ok` is set is undefined.
13794         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13795 }
13796 #[repr(C)]
13797 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13798 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13800 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13801         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13802         /// `err` or `result` depending on the state of `result_ok`.
13803         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13804         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13805         pub result_ok: bool,
13806 }
13807 #[no_mangle]
13808 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13809 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13810         CResult_UpdateAddHTLCDecodeErrorZ {
13811                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13812                         result: Box::into_raw(Box::new(o)),
13813                 },
13814                 result_ok: true,
13815         }
13816 }
13817 #[no_mangle]
13818 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13819 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13820         CResult_UpdateAddHTLCDecodeErrorZ {
13821                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13822                         err: Box::into_raw(Box::new(e)),
13823                 },
13824                 result_ok: false,
13825         }
13826 }
13827 /// Checks if the given object is currently in the success state
13828 #[no_mangle]
13829 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13830         o.result_ok
13831 }
13832 #[no_mangle]
13833 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13834 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13835 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13836         fn drop(&mut self) {
13837                 if self.result_ok {
13838                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13839                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13840                         }
13841                 } else {
13842                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13843                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13844                         }
13845                 }
13846         }
13847 }
13848 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13849         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13850                 let contents = if o.result_ok {
13851                         let result = unsafe { o.contents.result };
13852                         unsafe { o.contents.result = core::ptr::null_mut() };
13853                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13854                 } else {
13855                         let err = unsafe { o.contents.err };
13856                         unsafe { o.contents.err = core::ptr::null_mut(); }
13857                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13858                 };
13859                 Self {
13860                         contents,
13861                         result_ok: o.result_ok,
13862                 }
13863         }
13864 }
13865 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13866         fn clone(&self) -> Self {
13867                 if self.result_ok {
13868                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13869                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13870                         } }
13871                 } else {
13872                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13873                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13874                         } }
13875                 }
13876         }
13877 }
13878 #[no_mangle]
13879 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13880 /// but with all dynamically-allocated buffers duplicated in new buffers.
13881 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13882 #[repr(C)]
13883 /// The contents of CResult_PingDecodeErrorZ
13884 pub union CResult_PingDecodeErrorZPtr {
13885         /// A pointer to the contents in the success state.
13886         /// Reading from this pointer when `result_ok` is not set is undefined.
13887         pub result: *mut crate::lightning::ln::msgs::Ping,
13888         /// A pointer to the contents in the error state.
13889         /// Reading from this pointer when `result_ok` is set is undefined.
13890         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13891 }
13892 #[repr(C)]
13893 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13894 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13896 pub struct CResult_PingDecodeErrorZ {
13897         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13898         /// `err` or `result` depending on the state of `result_ok`.
13899         pub contents: CResult_PingDecodeErrorZPtr,
13900         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13901         pub result_ok: bool,
13902 }
13903 #[no_mangle]
13904 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13905 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13906         CResult_PingDecodeErrorZ {
13907                 contents: CResult_PingDecodeErrorZPtr {
13908                         result: Box::into_raw(Box::new(o)),
13909                 },
13910                 result_ok: true,
13911         }
13912 }
13913 #[no_mangle]
13914 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13915 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13916         CResult_PingDecodeErrorZ {
13917                 contents: CResult_PingDecodeErrorZPtr {
13918                         err: Box::into_raw(Box::new(e)),
13919                 },
13920                 result_ok: false,
13921         }
13922 }
13923 /// Checks if the given object is currently in the success state
13924 #[no_mangle]
13925 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13926         o.result_ok
13927 }
13928 #[no_mangle]
13929 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13930 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13931 impl Drop for CResult_PingDecodeErrorZ {
13932         fn drop(&mut self) {
13933                 if self.result_ok {
13934                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13935                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13936                         }
13937                 } else {
13938                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13939                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13940                         }
13941                 }
13942         }
13943 }
13944 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13945         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13946                 let contents = if o.result_ok {
13947                         let result = unsafe { o.contents.result };
13948                         unsafe { o.contents.result = core::ptr::null_mut() };
13949                         CResult_PingDecodeErrorZPtr { result }
13950                 } else {
13951                         let err = unsafe { o.contents.err };
13952                         unsafe { o.contents.err = core::ptr::null_mut(); }
13953                         CResult_PingDecodeErrorZPtr { err }
13954                 };
13955                 Self {
13956                         contents,
13957                         result_ok: o.result_ok,
13958                 }
13959         }
13960 }
13961 impl Clone for CResult_PingDecodeErrorZ {
13962         fn clone(&self) -> Self {
13963                 if self.result_ok {
13964                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13965                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13966                         } }
13967                 } else {
13968                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13969                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13970                         } }
13971                 }
13972         }
13973 }
13974 #[no_mangle]
13975 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13976 /// but with all dynamically-allocated buffers duplicated in new buffers.
13977 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13978 #[repr(C)]
13979 /// The contents of CResult_PongDecodeErrorZ
13980 pub union CResult_PongDecodeErrorZPtr {
13981         /// A pointer to the contents in the success state.
13982         /// Reading from this pointer when `result_ok` is not set is undefined.
13983         pub result: *mut crate::lightning::ln::msgs::Pong,
13984         /// A pointer to the contents in the error state.
13985         /// Reading from this pointer when `result_ok` is set is undefined.
13986         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13987 }
13988 #[repr(C)]
13989 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13990 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13992 pub struct CResult_PongDecodeErrorZ {
13993         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13994         /// `err` or `result` depending on the state of `result_ok`.
13995         pub contents: CResult_PongDecodeErrorZPtr,
13996         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13997         pub result_ok: bool,
13998 }
13999 #[no_mangle]
14000 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14001 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14002         CResult_PongDecodeErrorZ {
14003                 contents: CResult_PongDecodeErrorZPtr {
14004                         result: Box::into_raw(Box::new(o)),
14005                 },
14006                 result_ok: true,
14007         }
14008 }
14009 #[no_mangle]
14010 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14011 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14012         CResult_PongDecodeErrorZ {
14013                 contents: CResult_PongDecodeErrorZPtr {
14014                         err: Box::into_raw(Box::new(e)),
14015                 },
14016                 result_ok: false,
14017         }
14018 }
14019 /// Checks if the given object is currently in the success state
14020 #[no_mangle]
14021 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14022         o.result_ok
14023 }
14024 #[no_mangle]
14025 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14026 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14027 impl Drop for CResult_PongDecodeErrorZ {
14028         fn drop(&mut self) {
14029                 if self.result_ok {
14030                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14031                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14032                         }
14033                 } else {
14034                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14035                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14036                         }
14037                 }
14038         }
14039 }
14040 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14041         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14042                 let contents = if o.result_ok {
14043                         let result = unsafe { o.contents.result };
14044                         unsafe { o.contents.result = core::ptr::null_mut() };
14045                         CResult_PongDecodeErrorZPtr { result }
14046                 } else {
14047                         let err = unsafe { o.contents.err };
14048                         unsafe { o.contents.err = core::ptr::null_mut(); }
14049                         CResult_PongDecodeErrorZPtr { err }
14050                 };
14051                 Self {
14052                         contents,
14053                         result_ok: o.result_ok,
14054                 }
14055         }
14056 }
14057 impl Clone for CResult_PongDecodeErrorZ {
14058         fn clone(&self) -> Self {
14059                 if self.result_ok {
14060                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14061                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14062                         } }
14063                 } else {
14064                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14065                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14066                         } }
14067                 }
14068         }
14069 }
14070 #[no_mangle]
14071 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14072 /// but with all dynamically-allocated buffers duplicated in new buffers.
14073 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14074 #[repr(C)]
14075 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14076 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14077         /// A pointer to the contents in the success state.
14078         /// Reading from this pointer when `result_ok` is not set is undefined.
14079         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14080         /// A pointer to the contents in the error state.
14081         /// Reading from this pointer when `result_ok` is set is undefined.
14082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14083 }
14084 #[repr(C)]
14085 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14086 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14088 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14089         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14090         /// `err` or `result` depending on the state of `result_ok`.
14091         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14092         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14093         pub result_ok: bool,
14094 }
14095 #[no_mangle]
14096 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14097 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14098         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14099                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14100                         result: Box::into_raw(Box::new(o)),
14101                 },
14102                 result_ok: true,
14103         }
14104 }
14105 #[no_mangle]
14106 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14107 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14108         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14109                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14110                         err: Box::into_raw(Box::new(e)),
14111                 },
14112                 result_ok: false,
14113         }
14114 }
14115 /// Checks if the given object is currently in the success state
14116 #[no_mangle]
14117 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14118         o.result_ok
14119 }
14120 #[no_mangle]
14121 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14122 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14123 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14124         fn drop(&mut self) {
14125                 if self.result_ok {
14126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14128                         }
14129                 } else {
14130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14132                         }
14133                 }
14134         }
14135 }
14136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14138                 let contents = if o.result_ok {
14139                         let result = unsafe { o.contents.result };
14140                         unsafe { o.contents.result = core::ptr::null_mut() };
14141                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14142                 } else {
14143                         let err = unsafe { o.contents.err };
14144                         unsafe { o.contents.err = core::ptr::null_mut(); }
14145                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14146                 };
14147                 Self {
14148                         contents,
14149                         result_ok: o.result_ok,
14150                 }
14151         }
14152 }
14153 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14154         fn clone(&self) -> Self {
14155                 if self.result_ok {
14156                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14158                         } }
14159                 } else {
14160                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14162                         } }
14163                 }
14164         }
14165 }
14166 #[no_mangle]
14167 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14168 /// but with all dynamically-allocated buffers duplicated in new buffers.
14169 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14170 #[repr(C)]
14171 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14172 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14173         /// A pointer to the contents in the success state.
14174         /// Reading from this pointer when `result_ok` is not set is undefined.
14175         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14176         /// A pointer to the contents in the error state.
14177         /// Reading from this pointer when `result_ok` is set is undefined.
14178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14179 }
14180 #[repr(C)]
14181 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14182 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14184 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14185         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14186         /// `err` or `result` depending on the state of `result_ok`.
14187         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14188         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14189         pub result_ok: bool,
14190 }
14191 #[no_mangle]
14192 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14193 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14194         CResult_ChannelAnnouncementDecodeErrorZ {
14195                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14196                         result: Box::into_raw(Box::new(o)),
14197                 },
14198                 result_ok: true,
14199         }
14200 }
14201 #[no_mangle]
14202 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14203 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14204         CResult_ChannelAnnouncementDecodeErrorZ {
14205                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14206                         err: Box::into_raw(Box::new(e)),
14207                 },
14208                 result_ok: false,
14209         }
14210 }
14211 /// Checks if the given object is currently in the success state
14212 #[no_mangle]
14213 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14214         o.result_ok
14215 }
14216 #[no_mangle]
14217 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14218 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14219 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14220         fn drop(&mut self) {
14221                 if self.result_ok {
14222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14224                         }
14225                 } else {
14226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14228                         }
14229                 }
14230         }
14231 }
14232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14234                 let contents = if o.result_ok {
14235                         let result = unsafe { o.contents.result };
14236                         unsafe { o.contents.result = core::ptr::null_mut() };
14237                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14238                 } else {
14239                         let err = unsafe { o.contents.err };
14240                         unsafe { o.contents.err = core::ptr::null_mut(); }
14241                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14242                 };
14243                 Self {
14244                         contents,
14245                         result_ok: o.result_ok,
14246                 }
14247         }
14248 }
14249 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14250         fn clone(&self) -> Self {
14251                 if self.result_ok {
14252                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14254                         } }
14255                 } else {
14256                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14258                         } }
14259                 }
14260         }
14261 }
14262 #[no_mangle]
14263 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14264 /// but with all dynamically-allocated buffers duplicated in new buffers.
14265 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14266 #[repr(C)]
14267 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14268 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14269         /// A pointer to the contents in the success state.
14270         /// Reading from this pointer when `result_ok` is not set is undefined.
14271         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14272         /// A pointer to the contents in the error state.
14273         /// Reading from this pointer when `result_ok` is set is undefined.
14274         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14275 }
14276 #[repr(C)]
14277 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14278 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14280 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14281         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14282         /// `err` or `result` depending on the state of `result_ok`.
14283         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14284         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14285         pub result_ok: bool,
14286 }
14287 #[no_mangle]
14288 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14289 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14290         CResult_UnsignedChannelUpdateDecodeErrorZ {
14291                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14292                         result: Box::into_raw(Box::new(o)),
14293                 },
14294                 result_ok: true,
14295         }
14296 }
14297 #[no_mangle]
14298 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14299 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14300         CResult_UnsignedChannelUpdateDecodeErrorZ {
14301                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14302                         err: Box::into_raw(Box::new(e)),
14303                 },
14304                 result_ok: false,
14305         }
14306 }
14307 /// Checks if the given object is currently in the success state
14308 #[no_mangle]
14309 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14310         o.result_ok
14311 }
14312 #[no_mangle]
14313 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14314 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14315 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14316         fn drop(&mut self) {
14317                 if self.result_ok {
14318                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14319                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14320                         }
14321                 } else {
14322                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14323                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14324                         }
14325                 }
14326         }
14327 }
14328 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14329         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14330                 let contents = if o.result_ok {
14331                         let result = unsafe { o.contents.result };
14332                         unsafe { o.contents.result = core::ptr::null_mut() };
14333                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14334                 } else {
14335                         let err = unsafe { o.contents.err };
14336                         unsafe { o.contents.err = core::ptr::null_mut(); }
14337                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14338                 };
14339                 Self {
14340                         contents,
14341                         result_ok: o.result_ok,
14342                 }
14343         }
14344 }
14345 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14346         fn clone(&self) -> Self {
14347                 if self.result_ok {
14348                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14349                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14350                         } }
14351                 } else {
14352                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14353                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14354                         } }
14355                 }
14356         }
14357 }
14358 #[no_mangle]
14359 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14360 /// but with all dynamically-allocated buffers duplicated in new buffers.
14361 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14362 #[repr(C)]
14363 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14364 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14365         /// A pointer to the contents in the success state.
14366         /// Reading from this pointer when `result_ok` is not set is undefined.
14367         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14368         /// A pointer to the contents in the error state.
14369         /// Reading from this pointer when `result_ok` is set is undefined.
14370         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14371 }
14372 #[repr(C)]
14373 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14374 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14376 pub struct CResult_ChannelUpdateDecodeErrorZ {
14377         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14378         /// `err` or `result` depending on the state of `result_ok`.
14379         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14380         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14381         pub result_ok: bool,
14382 }
14383 #[no_mangle]
14384 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14385 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14386         CResult_ChannelUpdateDecodeErrorZ {
14387                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14388                         result: Box::into_raw(Box::new(o)),
14389                 },
14390                 result_ok: true,
14391         }
14392 }
14393 #[no_mangle]
14394 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14395 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14396         CResult_ChannelUpdateDecodeErrorZ {
14397                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14398                         err: Box::into_raw(Box::new(e)),
14399                 },
14400                 result_ok: false,
14401         }
14402 }
14403 /// Checks if the given object is currently in the success state
14404 #[no_mangle]
14405 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14406         o.result_ok
14407 }
14408 #[no_mangle]
14409 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14410 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14411 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14412         fn drop(&mut self) {
14413                 if self.result_ok {
14414                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14415                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14416                         }
14417                 } else {
14418                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14419                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14420                         }
14421                 }
14422         }
14423 }
14424 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14425         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14426                 let contents = if o.result_ok {
14427                         let result = unsafe { o.contents.result };
14428                         unsafe { o.contents.result = core::ptr::null_mut() };
14429                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14430                 } else {
14431                         let err = unsafe { o.contents.err };
14432                         unsafe { o.contents.err = core::ptr::null_mut(); }
14433                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14434                 };
14435                 Self {
14436                         contents,
14437                         result_ok: o.result_ok,
14438                 }
14439         }
14440 }
14441 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14442         fn clone(&self) -> Self {
14443                 if self.result_ok {
14444                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14445                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14446                         } }
14447                 } else {
14448                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14449                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14450                         } }
14451                 }
14452         }
14453 }
14454 #[no_mangle]
14455 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14456 /// but with all dynamically-allocated buffers duplicated in new buffers.
14457 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14458 #[repr(C)]
14459 /// The contents of CResult_ErrorMessageDecodeErrorZ
14460 pub union CResult_ErrorMessageDecodeErrorZPtr {
14461         /// A pointer to the contents in the success state.
14462         /// Reading from this pointer when `result_ok` is not set is undefined.
14463         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14464         /// A pointer to the contents in the error state.
14465         /// Reading from this pointer when `result_ok` is set is undefined.
14466         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14467 }
14468 #[repr(C)]
14469 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14470 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14471 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14472 pub struct CResult_ErrorMessageDecodeErrorZ {
14473         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14474         /// `err` or `result` depending on the state of `result_ok`.
14475         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14476         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14477         pub result_ok: bool,
14478 }
14479 #[no_mangle]
14480 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14481 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14482         CResult_ErrorMessageDecodeErrorZ {
14483                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14484                         result: Box::into_raw(Box::new(o)),
14485                 },
14486                 result_ok: true,
14487         }
14488 }
14489 #[no_mangle]
14490 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14491 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14492         CResult_ErrorMessageDecodeErrorZ {
14493                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14494                         err: Box::into_raw(Box::new(e)),
14495                 },
14496                 result_ok: false,
14497         }
14498 }
14499 /// Checks if the given object is currently in the success state
14500 #[no_mangle]
14501 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14502         o.result_ok
14503 }
14504 #[no_mangle]
14505 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14506 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14507 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14508         fn drop(&mut self) {
14509                 if self.result_ok {
14510                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14511                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14512                         }
14513                 } else {
14514                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14515                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14516                         }
14517                 }
14518         }
14519 }
14520 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14521         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14522                 let contents = if o.result_ok {
14523                         let result = unsafe { o.contents.result };
14524                         unsafe { o.contents.result = core::ptr::null_mut() };
14525                         CResult_ErrorMessageDecodeErrorZPtr { result }
14526                 } else {
14527                         let err = unsafe { o.contents.err };
14528                         unsafe { o.contents.err = core::ptr::null_mut(); }
14529                         CResult_ErrorMessageDecodeErrorZPtr { err }
14530                 };
14531                 Self {
14532                         contents,
14533                         result_ok: o.result_ok,
14534                 }
14535         }
14536 }
14537 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14538         fn clone(&self) -> Self {
14539                 if self.result_ok {
14540                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14541                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14542                         } }
14543                 } else {
14544                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14545                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14546                         } }
14547                 }
14548         }
14549 }
14550 #[no_mangle]
14551 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14552 /// but with all dynamically-allocated buffers duplicated in new buffers.
14553 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14554 #[repr(C)]
14555 /// The contents of CResult_WarningMessageDecodeErrorZ
14556 pub union CResult_WarningMessageDecodeErrorZPtr {
14557         /// A pointer to the contents in the success state.
14558         /// Reading from this pointer when `result_ok` is not set is undefined.
14559         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14560         /// A pointer to the contents in the error state.
14561         /// Reading from this pointer when `result_ok` is set is undefined.
14562         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14563 }
14564 #[repr(C)]
14565 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14566 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14568 pub struct CResult_WarningMessageDecodeErrorZ {
14569         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14570         /// `err` or `result` depending on the state of `result_ok`.
14571         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14572         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14573         pub result_ok: bool,
14574 }
14575 #[no_mangle]
14576 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14577 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14578         CResult_WarningMessageDecodeErrorZ {
14579                 contents: CResult_WarningMessageDecodeErrorZPtr {
14580                         result: Box::into_raw(Box::new(o)),
14581                 },
14582                 result_ok: true,
14583         }
14584 }
14585 #[no_mangle]
14586 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14587 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14588         CResult_WarningMessageDecodeErrorZ {
14589                 contents: CResult_WarningMessageDecodeErrorZPtr {
14590                         err: Box::into_raw(Box::new(e)),
14591                 },
14592                 result_ok: false,
14593         }
14594 }
14595 /// Checks if the given object is currently in the success state
14596 #[no_mangle]
14597 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14598         o.result_ok
14599 }
14600 #[no_mangle]
14601 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14602 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14603 impl Drop for CResult_WarningMessageDecodeErrorZ {
14604         fn drop(&mut self) {
14605                 if self.result_ok {
14606                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14607                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14608                         }
14609                 } else {
14610                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14611                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14612                         }
14613                 }
14614         }
14615 }
14616 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14617         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14618                 let contents = if o.result_ok {
14619                         let result = unsafe { o.contents.result };
14620                         unsafe { o.contents.result = core::ptr::null_mut() };
14621                         CResult_WarningMessageDecodeErrorZPtr { result }
14622                 } else {
14623                         let err = unsafe { o.contents.err };
14624                         unsafe { o.contents.err = core::ptr::null_mut(); }
14625                         CResult_WarningMessageDecodeErrorZPtr { err }
14626                 };
14627                 Self {
14628                         contents,
14629                         result_ok: o.result_ok,
14630                 }
14631         }
14632 }
14633 impl Clone for CResult_WarningMessageDecodeErrorZ {
14634         fn clone(&self) -> Self {
14635                 if self.result_ok {
14636                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14637                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14638                         } }
14639                 } else {
14640                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14641                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14642                         } }
14643                 }
14644         }
14645 }
14646 #[no_mangle]
14647 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14648 /// but with all dynamically-allocated buffers duplicated in new buffers.
14649 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14650 #[repr(C)]
14651 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14652 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14653         /// A pointer to the contents in the success state.
14654         /// Reading from this pointer when `result_ok` is not set is undefined.
14655         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14656         /// A pointer to the contents in the error state.
14657         /// Reading from this pointer when `result_ok` is set is undefined.
14658         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14659 }
14660 #[repr(C)]
14661 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14662 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14664 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14665         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14666         /// `err` or `result` depending on the state of `result_ok`.
14667         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14668         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14669         pub result_ok: bool,
14670 }
14671 #[no_mangle]
14672 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14673 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14674         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14675                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14676                         result: Box::into_raw(Box::new(o)),
14677                 },
14678                 result_ok: true,
14679         }
14680 }
14681 #[no_mangle]
14682 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14683 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14684         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14685                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14686                         err: Box::into_raw(Box::new(e)),
14687                 },
14688                 result_ok: false,
14689         }
14690 }
14691 /// Checks if the given object is currently in the success state
14692 #[no_mangle]
14693 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14694         o.result_ok
14695 }
14696 #[no_mangle]
14697 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14698 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14699 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14700         fn drop(&mut self) {
14701                 if self.result_ok {
14702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14704                         }
14705                 } else {
14706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14708                         }
14709                 }
14710         }
14711 }
14712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14714                 let contents = if o.result_ok {
14715                         let result = unsafe { o.contents.result };
14716                         unsafe { o.contents.result = core::ptr::null_mut() };
14717                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14718                 } else {
14719                         let err = unsafe { o.contents.err };
14720                         unsafe { o.contents.err = core::ptr::null_mut(); }
14721                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14722                 };
14723                 Self {
14724                         contents,
14725                         result_ok: o.result_ok,
14726                 }
14727         }
14728 }
14729 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14730         fn clone(&self) -> Self {
14731                 if self.result_ok {
14732                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14733                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14734                         } }
14735                 } else {
14736                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14737                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14738                         } }
14739                 }
14740         }
14741 }
14742 #[no_mangle]
14743 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14744 /// but with all dynamically-allocated buffers duplicated in new buffers.
14745 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14746 #[repr(C)]
14747 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14748 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14749         /// A pointer to the contents in the success state.
14750         /// Reading from this pointer when `result_ok` is not set is undefined.
14751         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14752         /// A pointer to the contents in the error state.
14753         /// Reading from this pointer when `result_ok` is set is undefined.
14754         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14755 }
14756 #[repr(C)]
14757 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14758 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14760 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14761         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14762         /// `err` or `result` depending on the state of `result_ok`.
14763         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14764         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14765         pub result_ok: bool,
14766 }
14767 #[no_mangle]
14768 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14769 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14770         CResult_NodeAnnouncementDecodeErrorZ {
14771                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14772                         result: Box::into_raw(Box::new(o)),
14773                 },
14774                 result_ok: true,
14775         }
14776 }
14777 #[no_mangle]
14778 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14779 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14780         CResult_NodeAnnouncementDecodeErrorZ {
14781                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14782                         err: Box::into_raw(Box::new(e)),
14783                 },
14784                 result_ok: false,
14785         }
14786 }
14787 /// Checks if the given object is currently in the success state
14788 #[no_mangle]
14789 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14790         o.result_ok
14791 }
14792 #[no_mangle]
14793 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14794 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14795 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14796         fn drop(&mut self) {
14797                 if self.result_ok {
14798                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14799                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14800                         }
14801                 } else {
14802                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14803                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14804                         }
14805                 }
14806         }
14807 }
14808 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14809         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14810                 let contents = if o.result_ok {
14811                         let result = unsafe { o.contents.result };
14812                         unsafe { o.contents.result = core::ptr::null_mut() };
14813                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14814                 } else {
14815                         let err = unsafe { o.contents.err };
14816                         unsafe { o.contents.err = core::ptr::null_mut(); }
14817                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14818                 };
14819                 Self {
14820                         contents,
14821                         result_ok: o.result_ok,
14822                 }
14823         }
14824 }
14825 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14826         fn clone(&self) -> Self {
14827                 if self.result_ok {
14828                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14829                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14830                         } }
14831                 } else {
14832                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14833                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14834                         } }
14835                 }
14836         }
14837 }
14838 #[no_mangle]
14839 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14840 /// but with all dynamically-allocated buffers duplicated in new buffers.
14841 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14842 #[repr(C)]
14843 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14844 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14845         /// A pointer to the contents in the success state.
14846         /// Reading from this pointer when `result_ok` is not set is undefined.
14847         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14848         /// A pointer to the contents in the error state.
14849         /// Reading from this pointer when `result_ok` is set is undefined.
14850         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14851 }
14852 #[repr(C)]
14853 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14854 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14856 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14857         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14858         /// `err` or `result` depending on the state of `result_ok`.
14859         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14860         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14861         pub result_ok: bool,
14862 }
14863 #[no_mangle]
14864 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14865 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14866         CResult_QueryShortChannelIdsDecodeErrorZ {
14867                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14868                         result: Box::into_raw(Box::new(o)),
14869                 },
14870                 result_ok: true,
14871         }
14872 }
14873 #[no_mangle]
14874 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14875 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14876         CResult_QueryShortChannelIdsDecodeErrorZ {
14877                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14878                         err: Box::into_raw(Box::new(e)),
14879                 },
14880                 result_ok: false,
14881         }
14882 }
14883 /// Checks if the given object is currently in the success state
14884 #[no_mangle]
14885 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14886         o.result_ok
14887 }
14888 #[no_mangle]
14889 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14890 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14891 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14892         fn drop(&mut self) {
14893                 if self.result_ok {
14894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14896                         }
14897                 } else {
14898                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14899                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14900                         }
14901                 }
14902         }
14903 }
14904 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14905         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14906                 let contents = if o.result_ok {
14907                         let result = unsafe { o.contents.result };
14908                         unsafe { o.contents.result = core::ptr::null_mut() };
14909                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14910                 } else {
14911                         let err = unsafe { o.contents.err };
14912                         unsafe { o.contents.err = core::ptr::null_mut(); }
14913                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14914                 };
14915                 Self {
14916                         contents,
14917                         result_ok: o.result_ok,
14918                 }
14919         }
14920 }
14921 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14922         fn clone(&self) -> Self {
14923                 if self.result_ok {
14924                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14925                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14926                         } }
14927                 } else {
14928                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14929                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14930                         } }
14931                 }
14932         }
14933 }
14934 #[no_mangle]
14935 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14936 /// but with all dynamically-allocated buffers duplicated in new buffers.
14937 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14938 #[repr(C)]
14939 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14940 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14941         /// A pointer to the contents in the success state.
14942         /// Reading from this pointer when `result_ok` is not set is undefined.
14943         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14944         /// A pointer to the contents in the error state.
14945         /// Reading from this pointer when `result_ok` is set is undefined.
14946         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14947 }
14948 #[repr(C)]
14949 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14950 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14952 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14953         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14954         /// `err` or `result` depending on the state of `result_ok`.
14955         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14956         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14957         pub result_ok: bool,
14958 }
14959 #[no_mangle]
14960 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14961 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14962         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14963                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14964                         result: Box::into_raw(Box::new(o)),
14965                 },
14966                 result_ok: true,
14967         }
14968 }
14969 #[no_mangle]
14970 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14971 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14972         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14973                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14974                         err: Box::into_raw(Box::new(e)),
14975                 },
14976                 result_ok: false,
14977         }
14978 }
14979 /// Checks if the given object is currently in the success state
14980 #[no_mangle]
14981 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14982         o.result_ok
14983 }
14984 #[no_mangle]
14985 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14986 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14987 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14988         fn drop(&mut self) {
14989                 if self.result_ok {
14990                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14991                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14992                         }
14993                 } else {
14994                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14995                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14996                         }
14997                 }
14998         }
14999 }
15000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15002                 let contents = if o.result_ok {
15003                         let result = unsafe { o.contents.result };
15004                         unsafe { o.contents.result = core::ptr::null_mut() };
15005                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15006                 } else {
15007                         let err = unsafe { o.contents.err };
15008                         unsafe { o.contents.err = core::ptr::null_mut(); }
15009                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15010                 };
15011                 Self {
15012                         contents,
15013                         result_ok: o.result_ok,
15014                 }
15015         }
15016 }
15017 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15018         fn clone(&self) -> Self {
15019                 if self.result_ok {
15020                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15021                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15022                         } }
15023                 } else {
15024                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15025                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15026                         } }
15027                 }
15028         }
15029 }
15030 #[no_mangle]
15031 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15032 /// but with all dynamically-allocated buffers duplicated in new buffers.
15033 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15034 #[repr(C)]
15035 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15036 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15037         /// A pointer to the contents in the success state.
15038         /// Reading from this pointer when `result_ok` is not set is undefined.
15039         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15040         /// A pointer to the contents in the error state.
15041         /// Reading from this pointer when `result_ok` is set is undefined.
15042         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15043 }
15044 #[repr(C)]
15045 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15046 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15048 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15049         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15050         /// `err` or `result` depending on the state of `result_ok`.
15051         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15052         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15053         pub result_ok: bool,
15054 }
15055 #[no_mangle]
15056 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15057 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15058         CResult_QueryChannelRangeDecodeErrorZ {
15059                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15060                         result: Box::into_raw(Box::new(o)),
15061                 },
15062                 result_ok: true,
15063         }
15064 }
15065 #[no_mangle]
15066 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15067 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15068         CResult_QueryChannelRangeDecodeErrorZ {
15069                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15070                         err: Box::into_raw(Box::new(e)),
15071                 },
15072                 result_ok: false,
15073         }
15074 }
15075 /// Checks if the given object is currently in the success state
15076 #[no_mangle]
15077 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15078         o.result_ok
15079 }
15080 #[no_mangle]
15081 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15082 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15083 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15084         fn drop(&mut self) {
15085                 if self.result_ok {
15086                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15087                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15088                         }
15089                 } else {
15090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15092                         }
15093                 }
15094         }
15095 }
15096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15097         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15098                 let contents = if o.result_ok {
15099                         let result = unsafe { o.contents.result };
15100                         unsafe { o.contents.result = core::ptr::null_mut() };
15101                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
15102                 } else {
15103                         let err = unsafe { o.contents.err };
15104                         unsafe { o.contents.err = core::ptr::null_mut(); }
15105                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
15106                 };
15107                 Self {
15108                         contents,
15109                         result_ok: o.result_ok,
15110                 }
15111         }
15112 }
15113 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15114         fn clone(&self) -> Self {
15115                 if self.result_ok {
15116                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15117                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15118                         } }
15119                 } else {
15120                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15121                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15122                         } }
15123                 }
15124         }
15125 }
15126 #[no_mangle]
15127 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15128 /// but with all dynamically-allocated buffers duplicated in new buffers.
15129 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15130 #[repr(C)]
15131 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15132 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15133         /// A pointer to the contents in the success state.
15134         /// Reading from this pointer when `result_ok` is not set is undefined.
15135         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15136         /// A pointer to the contents in the error state.
15137         /// Reading from this pointer when `result_ok` is set is undefined.
15138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15139 }
15140 #[repr(C)]
15141 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15142 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15144 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15145         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15146         /// `err` or `result` depending on the state of `result_ok`.
15147         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15148         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15149         pub result_ok: bool,
15150 }
15151 #[no_mangle]
15152 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15153 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15154         CResult_ReplyChannelRangeDecodeErrorZ {
15155                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15156                         result: Box::into_raw(Box::new(o)),
15157                 },
15158                 result_ok: true,
15159         }
15160 }
15161 #[no_mangle]
15162 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15163 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15164         CResult_ReplyChannelRangeDecodeErrorZ {
15165                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15166                         err: Box::into_raw(Box::new(e)),
15167                 },
15168                 result_ok: false,
15169         }
15170 }
15171 /// Checks if the given object is currently in the success state
15172 #[no_mangle]
15173 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15174         o.result_ok
15175 }
15176 #[no_mangle]
15177 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15178 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15179 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15180         fn drop(&mut self) {
15181                 if self.result_ok {
15182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15184                         }
15185                 } else {
15186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15188                         }
15189                 }
15190         }
15191 }
15192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15194                 let contents = if o.result_ok {
15195                         let result = unsafe { o.contents.result };
15196                         unsafe { o.contents.result = core::ptr::null_mut() };
15197                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15198                 } else {
15199                         let err = unsafe { o.contents.err };
15200                         unsafe { o.contents.err = core::ptr::null_mut(); }
15201                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15202                 };
15203                 Self {
15204                         contents,
15205                         result_ok: o.result_ok,
15206                 }
15207         }
15208 }
15209 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15210         fn clone(&self) -> Self {
15211                 if self.result_ok {
15212                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15214                         } }
15215                 } else {
15216                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15218                         } }
15219                 }
15220         }
15221 }
15222 #[no_mangle]
15223 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15224 /// but with all dynamically-allocated buffers duplicated in new buffers.
15225 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15226 #[repr(C)]
15227 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15228 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15229         /// A pointer to the contents in the success state.
15230         /// Reading from this pointer when `result_ok` is not set is undefined.
15231         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15232         /// A pointer to the contents in the error state.
15233         /// Reading from this pointer when `result_ok` is set is undefined.
15234         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15235 }
15236 #[repr(C)]
15237 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15238 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15240 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15241         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15242         /// `err` or `result` depending on the state of `result_ok`.
15243         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15244         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15245         pub result_ok: bool,
15246 }
15247 #[no_mangle]
15248 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15249 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15250         CResult_GossipTimestampFilterDecodeErrorZ {
15251                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15252                         result: Box::into_raw(Box::new(o)),
15253                 },
15254                 result_ok: true,
15255         }
15256 }
15257 #[no_mangle]
15258 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15259 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15260         CResult_GossipTimestampFilterDecodeErrorZ {
15261                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15262                         err: Box::into_raw(Box::new(e)),
15263                 },
15264                 result_ok: false,
15265         }
15266 }
15267 /// Checks if the given object is currently in the success state
15268 #[no_mangle]
15269 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15270         o.result_ok
15271 }
15272 #[no_mangle]
15273 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15274 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15275 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15276         fn drop(&mut self) {
15277                 if self.result_ok {
15278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15280                         }
15281                 } else {
15282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15284                         }
15285                 }
15286         }
15287 }
15288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15290                 let contents = if o.result_ok {
15291                         let result = unsafe { o.contents.result };
15292                         unsafe { o.contents.result = core::ptr::null_mut() };
15293                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15294                 } else {
15295                         let err = unsafe { o.contents.err };
15296                         unsafe { o.contents.err = core::ptr::null_mut(); }
15297                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15298                 };
15299                 Self {
15300                         contents,
15301                         result_ok: o.result_ok,
15302                 }
15303         }
15304 }
15305 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15306         fn clone(&self) -> Self {
15307                 if self.result_ok {
15308                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15309                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15310                         } }
15311                 } else {
15312                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15314                         } }
15315                 }
15316         }
15317 }
15318 #[no_mangle]
15319 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15320 /// but with all dynamically-allocated buffers duplicated in new buffers.
15321 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15322 #[repr(C)]
15323 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15324 /// This corresponds to std::vector in C++
15325 pub struct CVec_PhantomRouteHintsZ {
15326         /// The elements in the array.
15327         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15328         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15329         /// The number of elements pointed to by `data`.
15330         pub datalen: usize
15331 }
15332 impl CVec_PhantomRouteHintsZ {
15333         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15334                 if self.datalen == 0 { return Vec::new(); }
15335                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15336                 self.data = core::ptr::null_mut();
15337                 self.datalen = 0;
15338                 ret
15339         }
15340         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15341                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15342         }
15343 }
15344 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15345         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15346                 let datalen = v.len();
15347                 let data = Box::into_raw(v.into_boxed_slice());
15348                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15349         }
15350 }
15351 #[no_mangle]
15352 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15353 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15354 impl Drop for CVec_PhantomRouteHintsZ {
15355         fn drop(&mut self) {
15356                 if self.datalen == 0 { return; }
15357                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15358         }
15359 }
15360 impl Clone for CVec_PhantomRouteHintsZ {
15361         fn clone(&self) -> Self {
15362                 let mut res = Vec::new();
15363                 if self.datalen == 0 { return Self::from(res); }
15364                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15365                 Self::from(res)
15366         }
15367 }
15368 #[repr(C)]
15369 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15370 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15371         /// A pointer to the contents in the success state.
15372         /// Reading from this pointer when `result_ok` is not set is undefined.
15373         pub result: *mut crate::lightning_invoice::Invoice,
15374         /// A pointer to the contents in the error state.
15375         /// Reading from this pointer when `result_ok` is set is undefined.
15376         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15377 }
15378 #[repr(C)]
15379 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15380 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15381 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15382 pub struct CResult_InvoiceSignOrCreationErrorZ {
15383         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15384         /// `err` or `result` depending on the state of `result_ok`.
15385         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15386         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15387         pub result_ok: bool,
15388 }
15389 #[no_mangle]
15390 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15391 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15392         CResult_InvoiceSignOrCreationErrorZ {
15393                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15394                         result: Box::into_raw(Box::new(o)),
15395                 },
15396                 result_ok: true,
15397         }
15398 }
15399 #[no_mangle]
15400 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15401 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15402         CResult_InvoiceSignOrCreationErrorZ {
15403                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15404                         err: Box::into_raw(Box::new(e)),
15405                 },
15406                 result_ok: false,
15407         }
15408 }
15409 /// Checks if the given object is currently in the success state
15410 #[no_mangle]
15411 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15412         o.result_ok
15413 }
15414 #[no_mangle]
15415 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15416 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15417 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15418         fn drop(&mut self) {
15419                 if self.result_ok {
15420                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15421                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15422                         }
15423                 } else {
15424                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15425                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15426                         }
15427                 }
15428         }
15429 }
15430 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15431         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15432                 let contents = if o.result_ok {
15433                         let result = unsafe { o.contents.result };
15434                         unsafe { o.contents.result = core::ptr::null_mut() };
15435                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15436                 } else {
15437                         let err = unsafe { o.contents.err };
15438                         unsafe { o.contents.err = core::ptr::null_mut(); }
15439                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15440                 };
15441                 Self {
15442                         contents,
15443                         result_ok: o.result_ok,
15444                 }
15445         }
15446 }
15447 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15448         fn clone(&self) -> Self {
15449                 if self.result_ok {
15450                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15451                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15452                         } }
15453                 } else {
15454                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15455                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15456                         } }
15457                 }
15458         }
15459 }
15460 #[no_mangle]
15461 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15462 /// but with all dynamically-allocated buffers duplicated in new buffers.
15463 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15464 #[repr(C)]
15465 /// An enum which can either contain a crate::lightning::chain::Filter or not
15466 pub enum COption_FilterZ {
15467         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15468         Some(crate::lightning::chain::Filter),
15469         /// When we're in this state, this COption_FilterZ contains nothing
15470         None
15471 }
15472 impl COption_FilterZ {
15473         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15474                 if let Self::None = self { false } else { true }
15475         }
15476         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15477                 !self.is_some()
15478         }
15479         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15480                 if let Self::Some(v) = self { v } else { unreachable!() }
15481         }
15482 }
15483 #[no_mangle]
15484 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15485 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15486         COption_FilterZ::Some(o)
15487 }
15488 #[no_mangle]
15489 /// Constructs a new COption_FilterZ containing nothing
15490 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15491         COption_FilterZ::None
15492 }
15493 #[no_mangle]
15494 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15495 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15496 #[repr(C)]
15497 /// The contents of CResult_LockedChannelMonitorNoneZ
15498 pub union CResult_LockedChannelMonitorNoneZPtr {
15499         /// A pointer to the contents in the success state.
15500         /// Reading from this pointer when `result_ok` is not set is undefined.
15501         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15502         /// Note that this value is always NULL, as there are no contents in the Err variant
15503         pub err: *mut core::ffi::c_void,
15504 }
15505 #[repr(C)]
15506 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15507 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15508 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15509 pub struct CResult_LockedChannelMonitorNoneZ {
15510         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15511         /// `err` or `result` depending on the state of `result_ok`.
15512         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15513         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15514         pub result_ok: bool,
15515 }
15516 #[no_mangle]
15517 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15518 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15519         CResult_LockedChannelMonitorNoneZ {
15520                 contents: CResult_LockedChannelMonitorNoneZPtr {
15521                         result: Box::into_raw(Box::new(o)),
15522                 },
15523                 result_ok: true,
15524         }
15525 }
15526 #[no_mangle]
15527 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15528 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15529         CResult_LockedChannelMonitorNoneZ {
15530                 contents: CResult_LockedChannelMonitorNoneZPtr {
15531                         err: core::ptr::null_mut(),
15532                 },
15533                 result_ok: false,
15534         }
15535 }
15536 /// Checks if the given object is currently in the success state
15537 #[no_mangle]
15538 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15539         o.result_ok
15540 }
15541 #[no_mangle]
15542 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15543 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15544 impl Drop for CResult_LockedChannelMonitorNoneZ {
15545         fn drop(&mut self) {
15546                 if self.result_ok {
15547                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15548                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15549                         }
15550                 } else {
15551                 }
15552         }
15553 }
15554 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15555         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15556                 let contents = if o.result_ok {
15557                         let result = unsafe { o.contents.result };
15558                         unsafe { o.contents.result = core::ptr::null_mut() };
15559                         CResult_LockedChannelMonitorNoneZPtr { result }
15560                 } else {
15561                         let _ = unsafe { Box::from_raw(o.contents.err) };
15562                         o.contents.err = core::ptr::null_mut();
15563                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15564                 };
15565                 Self {
15566                         contents,
15567                         result_ok: o.result_ok,
15568                 }
15569         }
15570 }
15571 #[repr(C)]
15572 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15573 /// This corresponds to std::vector in C++
15574 pub struct CVec_OutPointZ {
15575         /// The elements in the array.
15576         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15577         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15578         /// The number of elements pointed to by `data`.
15579         pub datalen: usize
15580 }
15581 impl CVec_OutPointZ {
15582         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15583                 if self.datalen == 0 { return Vec::new(); }
15584                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15585                 self.data = core::ptr::null_mut();
15586                 self.datalen = 0;
15587                 ret
15588         }
15589         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15590                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15591         }
15592 }
15593 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15594         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15595                 let datalen = v.len();
15596                 let data = Box::into_raw(v.into_boxed_slice());
15597                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15598         }
15599 }
15600 #[no_mangle]
15601 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15602 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15603 impl Drop for CVec_OutPointZ {
15604         fn drop(&mut self) {
15605                 if self.datalen == 0 { return; }
15606                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15607         }
15608 }
15609 impl Clone for CVec_OutPointZ {
15610         fn clone(&self) -> Self {
15611                 let mut res = Vec::new();
15612                 if self.datalen == 0 { return Self::from(res); }
15613                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15614                 Self::from(res)
15615         }
15616 }