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 /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1798 pub enum COption_WriteableScoreZ {
1799         /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1800         Some(crate::lightning::routing::scoring::WriteableScore),
1801         /// When we're in this state, this COption_WriteableScoreZ contains nothing
1802         None
1803 }
1804 impl COption_WriteableScoreZ {
1805         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
1806                 if let Self::None = self { false } else { true }
1807         }
1808         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
1809                 !self.is_some()
1810         }
1811         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore {
1812                 if let Self::Some(v) = self { v } else { unreachable!() }
1813         }
1814 }
1815 #[no_mangle]
1816 /// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
1817 pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ {
1818         COption_WriteableScoreZ::Some(o)
1819 }
1820 #[no_mangle]
1821 /// Constructs a new COption_WriteableScoreZ containing nothing
1822 pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ {
1823         COption_WriteableScoreZ::None
1824 }
1825 #[no_mangle]
1826 /// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
1827 pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { }
1828 #[repr(C)]
1829 /// The contents of CResult_NoneErrorZ
1830 pub union CResult_NoneErrorZPtr {
1831         /// Note that this value is always NULL, as there are no contents in the OK variant
1832         pub result: *mut core::ffi::c_void,
1833         /// A pointer to the contents in the error state.
1834         /// Reading from this pointer when `result_ok` is set is undefined.
1835         pub err: *mut crate::c_types::IOError,
1836 }
1837 #[repr(C)]
1838 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1839 /// containing a () on success and a crate::c_types::IOError on failure.
1840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1841 pub struct CResult_NoneErrorZ {
1842         /// The contents of this CResult_NoneErrorZ, accessible via either
1843         /// `err` or `result` depending on the state of `result_ok`.
1844         pub contents: CResult_NoneErrorZPtr,
1845         /// Whether this CResult_NoneErrorZ represents a success state.
1846         pub result_ok: bool,
1847 }
1848 #[no_mangle]
1849 /// Creates a new CResult_NoneErrorZ in the success state.
1850 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1851         CResult_NoneErrorZ {
1852                 contents: CResult_NoneErrorZPtr {
1853                         result: core::ptr::null_mut(),
1854                 },
1855                 result_ok: true,
1856         }
1857 }
1858 #[no_mangle]
1859 /// Creates a new CResult_NoneErrorZ in the error state.
1860 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1861         CResult_NoneErrorZ {
1862                 contents: CResult_NoneErrorZPtr {
1863                         err: Box::into_raw(Box::new(e)),
1864                 },
1865                 result_ok: false,
1866         }
1867 }
1868 /// Checks if the given object is currently in the success state
1869 #[no_mangle]
1870 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1871         o.result_ok
1872 }
1873 #[no_mangle]
1874 /// Frees any resources used by the CResult_NoneErrorZ.
1875 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1876 impl Drop for CResult_NoneErrorZ {
1877         fn drop(&mut self) {
1878                 if self.result_ok {
1879                 } else {
1880                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1881                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1882                         }
1883                 }
1884         }
1885 }
1886 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1887         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1888                 let contents = if o.result_ok {
1889                         let _ = unsafe { Box::from_raw(o.contents.result) };
1890                         o.contents.result = core::ptr::null_mut();
1891                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1892                 } else {
1893                         let err = unsafe { o.contents.err };
1894                         unsafe { o.contents.err = core::ptr::null_mut(); }
1895                         CResult_NoneErrorZPtr { err }
1896                 };
1897                 Self {
1898                         contents,
1899                         result_ok: o.result_ok,
1900                 }
1901         }
1902 }
1903 impl Clone for CResult_NoneErrorZ {
1904         fn clone(&self) -> Self {
1905                 if self.result_ok {
1906                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1907                                 result: core::ptr::null_mut()
1908                         } }
1909                 } else {
1910                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1911                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1912                         } }
1913                 }
1914         }
1915 }
1916 #[no_mangle]
1917 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1918 /// but with all dynamically-allocated buffers duplicated in new buffers.
1919 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1920 #[repr(C)]
1921 /// The contents of CResult_RouteHopDecodeErrorZ
1922 pub union CResult_RouteHopDecodeErrorZPtr {
1923         /// A pointer to the contents in the success state.
1924         /// Reading from this pointer when `result_ok` is not set is undefined.
1925         pub result: *mut crate::lightning::routing::router::RouteHop,
1926         /// A pointer to the contents in the error state.
1927         /// Reading from this pointer when `result_ok` is set is undefined.
1928         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1929 }
1930 #[repr(C)]
1931 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1932 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1933 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1934 pub struct CResult_RouteHopDecodeErrorZ {
1935         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1936         /// `err` or `result` depending on the state of `result_ok`.
1937         pub contents: CResult_RouteHopDecodeErrorZPtr,
1938         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1939         pub result_ok: bool,
1940 }
1941 #[no_mangle]
1942 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1943 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1944         CResult_RouteHopDecodeErrorZ {
1945                 contents: CResult_RouteHopDecodeErrorZPtr {
1946                         result: Box::into_raw(Box::new(o)),
1947                 },
1948                 result_ok: true,
1949         }
1950 }
1951 #[no_mangle]
1952 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1953 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1954         CResult_RouteHopDecodeErrorZ {
1955                 contents: CResult_RouteHopDecodeErrorZPtr {
1956                         err: Box::into_raw(Box::new(e)),
1957                 },
1958                 result_ok: false,
1959         }
1960 }
1961 /// Checks if the given object is currently in the success state
1962 #[no_mangle]
1963 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1964         o.result_ok
1965 }
1966 #[no_mangle]
1967 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1968 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1969 impl Drop for CResult_RouteHopDecodeErrorZ {
1970         fn drop(&mut self) {
1971                 if self.result_ok {
1972                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1973                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1974                         }
1975                 } else {
1976                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1977                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1978                         }
1979                 }
1980         }
1981 }
1982 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1983         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1984                 let contents = if o.result_ok {
1985                         let result = unsafe { o.contents.result };
1986                         unsafe { o.contents.result = core::ptr::null_mut() };
1987                         CResult_RouteHopDecodeErrorZPtr { result }
1988                 } else {
1989                         let err = unsafe { o.contents.err };
1990                         unsafe { o.contents.err = core::ptr::null_mut(); }
1991                         CResult_RouteHopDecodeErrorZPtr { err }
1992                 };
1993                 Self {
1994                         contents,
1995                         result_ok: o.result_ok,
1996                 }
1997         }
1998 }
1999 impl Clone for CResult_RouteHopDecodeErrorZ {
2000         fn clone(&self) -> Self {
2001                 if self.result_ok {
2002                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
2003                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
2004                         } }
2005                 } else {
2006                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
2007                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2008                         } }
2009                 }
2010         }
2011 }
2012 #[no_mangle]
2013 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
2014 /// but with all dynamically-allocated buffers duplicated in new buffers.
2015 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
2016 #[repr(C)]
2017 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2018 /// This corresponds to std::vector in C++
2019 pub struct CVec_RouteHopZ {
2020         /// The elements in the array.
2021         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2022         pub data: *mut crate::lightning::routing::router::RouteHop,
2023         /// The number of elements pointed to by `data`.
2024         pub datalen: usize
2025 }
2026 impl CVec_RouteHopZ {
2027         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2028                 if self.datalen == 0 { return Vec::new(); }
2029                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2030                 self.data = core::ptr::null_mut();
2031                 self.datalen = 0;
2032                 ret
2033         }
2034         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2035                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2036         }
2037 }
2038 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2039         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2040                 let datalen = v.len();
2041                 let data = Box::into_raw(v.into_boxed_slice());
2042                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2043         }
2044 }
2045 #[no_mangle]
2046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2047 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2048 impl Drop for CVec_RouteHopZ {
2049         fn drop(&mut self) {
2050                 if self.datalen == 0 { return; }
2051                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2052         }
2053 }
2054 impl Clone for CVec_RouteHopZ {
2055         fn clone(&self) -> Self {
2056                 let mut res = Vec::new();
2057                 if self.datalen == 0 { return Self::from(res); }
2058                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2059                 Self::from(res)
2060         }
2061 }
2062 #[repr(C)]
2063 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2064 /// This corresponds to std::vector in C++
2065 pub struct CVec_CVec_RouteHopZZ {
2066         /// The elements in the array.
2067         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2068         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2069         /// The number of elements pointed to by `data`.
2070         pub datalen: usize
2071 }
2072 impl CVec_CVec_RouteHopZZ {
2073         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2074                 if self.datalen == 0 { return Vec::new(); }
2075                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2076                 self.data = core::ptr::null_mut();
2077                 self.datalen = 0;
2078                 ret
2079         }
2080         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2081                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2082         }
2083 }
2084 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2085         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2086                 let datalen = v.len();
2087                 let data = Box::into_raw(v.into_boxed_slice());
2088                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2089         }
2090 }
2091 #[no_mangle]
2092 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2093 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2094 impl Drop for CVec_CVec_RouteHopZZ {
2095         fn drop(&mut self) {
2096                 if self.datalen == 0 { return; }
2097                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2098         }
2099 }
2100 impl Clone for CVec_CVec_RouteHopZZ {
2101         fn clone(&self) -> Self {
2102                 let mut res = Vec::new();
2103                 if self.datalen == 0 { return Self::from(res); }
2104                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2105                 Self::from(res)
2106         }
2107 }
2108 #[repr(C)]
2109 /// The contents of CResult_RouteDecodeErrorZ
2110 pub union CResult_RouteDecodeErrorZPtr {
2111         /// A pointer to the contents in the success state.
2112         /// Reading from this pointer when `result_ok` is not set is undefined.
2113         pub result: *mut crate::lightning::routing::router::Route,
2114         /// A pointer to the contents in the error state.
2115         /// Reading from this pointer when `result_ok` is set is undefined.
2116         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2117 }
2118 #[repr(C)]
2119 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2120 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2122 pub struct CResult_RouteDecodeErrorZ {
2123         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2124         /// `err` or `result` depending on the state of `result_ok`.
2125         pub contents: CResult_RouteDecodeErrorZPtr,
2126         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2127         pub result_ok: bool,
2128 }
2129 #[no_mangle]
2130 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2131 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2132         CResult_RouteDecodeErrorZ {
2133                 contents: CResult_RouteDecodeErrorZPtr {
2134                         result: Box::into_raw(Box::new(o)),
2135                 },
2136                 result_ok: true,
2137         }
2138 }
2139 #[no_mangle]
2140 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2141 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2142         CResult_RouteDecodeErrorZ {
2143                 contents: CResult_RouteDecodeErrorZPtr {
2144                         err: Box::into_raw(Box::new(e)),
2145                 },
2146                 result_ok: false,
2147         }
2148 }
2149 /// Checks if the given object is currently in the success state
2150 #[no_mangle]
2151 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2152         o.result_ok
2153 }
2154 #[no_mangle]
2155 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2156 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2157 impl Drop for CResult_RouteDecodeErrorZ {
2158         fn drop(&mut self) {
2159                 if self.result_ok {
2160                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2161                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2162                         }
2163                 } else {
2164                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2165                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2166                         }
2167                 }
2168         }
2169 }
2170 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2171         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2172                 let contents = if o.result_ok {
2173                         let result = unsafe { o.contents.result };
2174                         unsafe { o.contents.result = core::ptr::null_mut() };
2175                         CResult_RouteDecodeErrorZPtr { result }
2176                 } else {
2177                         let err = unsafe { o.contents.err };
2178                         unsafe { o.contents.err = core::ptr::null_mut(); }
2179                         CResult_RouteDecodeErrorZPtr { err }
2180                 };
2181                 Self {
2182                         contents,
2183                         result_ok: o.result_ok,
2184                 }
2185         }
2186 }
2187 impl Clone for CResult_RouteDecodeErrorZ {
2188         fn clone(&self) -> Self {
2189                 if self.result_ok {
2190                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2191                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2192                         } }
2193                 } else {
2194                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2195                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2196                         } }
2197                 }
2198         }
2199 }
2200 #[no_mangle]
2201 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2202 /// but with all dynamically-allocated buffers duplicated in new buffers.
2203 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2204 #[repr(C)]
2205 /// The contents of CResult_RouteParametersDecodeErrorZ
2206 pub union CResult_RouteParametersDecodeErrorZPtr {
2207         /// A pointer to the contents in the success state.
2208         /// Reading from this pointer when `result_ok` is not set is undefined.
2209         pub result: *mut crate::lightning::routing::router::RouteParameters,
2210         /// A pointer to the contents in the error state.
2211         /// Reading from this pointer when `result_ok` is set is undefined.
2212         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2213 }
2214 #[repr(C)]
2215 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2216 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2218 pub struct CResult_RouteParametersDecodeErrorZ {
2219         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2220         /// `err` or `result` depending on the state of `result_ok`.
2221         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2222         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2223         pub result_ok: bool,
2224 }
2225 #[no_mangle]
2226 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2227 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2228         CResult_RouteParametersDecodeErrorZ {
2229                 contents: CResult_RouteParametersDecodeErrorZPtr {
2230                         result: Box::into_raw(Box::new(o)),
2231                 },
2232                 result_ok: true,
2233         }
2234 }
2235 #[no_mangle]
2236 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2237 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2238         CResult_RouteParametersDecodeErrorZ {
2239                 contents: CResult_RouteParametersDecodeErrorZPtr {
2240                         err: Box::into_raw(Box::new(e)),
2241                 },
2242                 result_ok: false,
2243         }
2244 }
2245 /// Checks if the given object is currently in the success state
2246 #[no_mangle]
2247 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2248         o.result_ok
2249 }
2250 #[no_mangle]
2251 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2252 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2253 impl Drop for CResult_RouteParametersDecodeErrorZ {
2254         fn drop(&mut self) {
2255                 if self.result_ok {
2256                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2257                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2258                         }
2259                 } else {
2260                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2261                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2262                         }
2263                 }
2264         }
2265 }
2266 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2268                 let contents = if o.result_ok {
2269                         let result = unsafe { o.contents.result };
2270                         unsafe { o.contents.result = core::ptr::null_mut() };
2271                         CResult_RouteParametersDecodeErrorZPtr { result }
2272                 } else {
2273                         let err = unsafe { o.contents.err };
2274                         unsafe { o.contents.err = core::ptr::null_mut(); }
2275                         CResult_RouteParametersDecodeErrorZPtr { err }
2276                 };
2277                 Self {
2278                         contents,
2279                         result_ok: o.result_ok,
2280                 }
2281         }
2282 }
2283 impl Clone for CResult_RouteParametersDecodeErrorZ {
2284         fn clone(&self) -> Self {
2285                 if self.result_ok {
2286                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2287                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2288                         } }
2289                 } else {
2290                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2291                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2292                         } }
2293                 }
2294         }
2295 }
2296 #[no_mangle]
2297 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2298 /// but with all dynamically-allocated buffers duplicated in new buffers.
2299 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2300 #[repr(C)]
2301 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2302 /// This corresponds to std::vector in C++
2303 pub struct CVec_RouteHintZ {
2304         /// The elements in the array.
2305         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2306         pub data: *mut crate::lightning::routing::router::RouteHint,
2307         /// The number of elements pointed to by `data`.
2308         pub datalen: usize
2309 }
2310 impl CVec_RouteHintZ {
2311         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2312                 if self.datalen == 0 { return Vec::new(); }
2313                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2314                 self.data = core::ptr::null_mut();
2315                 self.datalen = 0;
2316                 ret
2317         }
2318         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2319                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2320         }
2321 }
2322 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2323         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2324                 let datalen = v.len();
2325                 let data = Box::into_raw(v.into_boxed_slice());
2326                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2327         }
2328 }
2329 #[no_mangle]
2330 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2331 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2332 impl Drop for CVec_RouteHintZ {
2333         fn drop(&mut self) {
2334                 if self.datalen == 0 { return; }
2335                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2336         }
2337 }
2338 impl Clone for CVec_RouteHintZ {
2339         fn clone(&self) -> Self {
2340                 let mut res = Vec::new();
2341                 if self.datalen == 0 { return Self::from(res); }
2342                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2343                 Self::from(res)
2344         }
2345 }
2346 #[repr(C)]
2347 #[derive(Clone)]
2348 /// An enum which can either contain a u64 or not
2349 pub enum COption_u64Z {
2350         /// When we're in this state, this COption_u64Z contains a u64
2351         Some(u64),
2352         /// When we're in this state, this COption_u64Z contains nothing
2353         None
2354 }
2355 impl COption_u64Z {
2356         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2357                 if let Self::None = self { false } else { true }
2358         }
2359         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2360                 !self.is_some()
2361         }
2362         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2363                 if let Self::Some(v) = self { v } else { unreachable!() }
2364         }
2365 }
2366 #[no_mangle]
2367 /// Constructs a new COption_u64Z containing a u64
2368 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2369         COption_u64Z::Some(o)
2370 }
2371 #[no_mangle]
2372 /// Constructs a new COption_u64Z containing nothing
2373 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2374         COption_u64Z::None
2375 }
2376 #[no_mangle]
2377 /// Frees any resources associated with the u64, if we are in the Some state
2378 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2379 #[no_mangle]
2380 /// Creates a new COption_u64Z which has the same data as `orig`
2381 /// but with all dynamically-allocated buffers duplicated in new buffers.
2382 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2383 #[repr(C)]
2384 /// The contents of CResult_PaymentParametersDecodeErrorZ
2385 pub union CResult_PaymentParametersDecodeErrorZPtr {
2386         /// A pointer to the contents in the success state.
2387         /// Reading from this pointer when `result_ok` is not set is undefined.
2388         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2389         /// A pointer to the contents in the error state.
2390         /// Reading from this pointer when `result_ok` is set is undefined.
2391         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2392 }
2393 #[repr(C)]
2394 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2395 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2397 pub struct CResult_PaymentParametersDecodeErrorZ {
2398         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2399         /// `err` or `result` depending on the state of `result_ok`.
2400         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2401         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2402         pub result_ok: bool,
2403 }
2404 #[no_mangle]
2405 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2406 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2407         CResult_PaymentParametersDecodeErrorZ {
2408                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2409                         result: Box::into_raw(Box::new(o)),
2410                 },
2411                 result_ok: true,
2412         }
2413 }
2414 #[no_mangle]
2415 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2416 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2417         CResult_PaymentParametersDecodeErrorZ {
2418                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2419                         err: Box::into_raw(Box::new(e)),
2420                 },
2421                 result_ok: false,
2422         }
2423 }
2424 /// Checks if the given object is currently in the success state
2425 #[no_mangle]
2426 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2427         o.result_ok
2428 }
2429 #[no_mangle]
2430 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2431 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2432 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2433         fn drop(&mut self) {
2434                 if self.result_ok {
2435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2437                         }
2438                 } else {
2439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2441                         }
2442                 }
2443         }
2444 }
2445 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2446         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2447                 let contents = if o.result_ok {
2448                         let result = unsafe { o.contents.result };
2449                         unsafe { o.contents.result = core::ptr::null_mut() };
2450                         CResult_PaymentParametersDecodeErrorZPtr { result }
2451                 } else {
2452                         let err = unsafe { o.contents.err };
2453                         unsafe { o.contents.err = core::ptr::null_mut(); }
2454                         CResult_PaymentParametersDecodeErrorZPtr { err }
2455                 };
2456                 Self {
2457                         contents,
2458                         result_ok: o.result_ok,
2459                 }
2460         }
2461 }
2462 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2463         fn clone(&self) -> Self {
2464                 if self.result_ok {
2465                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2466                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2467                         } }
2468                 } else {
2469                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2470                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2471                         } }
2472                 }
2473         }
2474 }
2475 #[no_mangle]
2476 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2477 /// but with all dynamically-allocated buffers duplicated in new buffers.
2478 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2479 #[repr(C)]
2480 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2481 /// This corresponds to std::vector in C++
2482 pub struct CVec_RouteHintHopZ {
2483         /// The elements in the array.
2484         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2485         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2486         /// The number of elements pointed to by `data`.
2487         pub datalen: usize
2488 }
2489 impl CVec_RouteHintHopZ {
2490         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2491                 if self.datalen == 0 { return Vec::new(); }
2492                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2493                 self.data = core::ptr::null_mut();
2494                 self.datalen = 0;
2495                 ret
2496         }
2497         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2498                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2499         }
2500 }
2501 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2502         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2503                 let datalen = v.len();
2504                 let data = Box::into_raw(v.into_boxed_slice());
2505                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2506         }
2507 }
2508 #[no_mangle]
2509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2510 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2511 impl Drop for CVec_RouteHintHopZ {
2512         fn drop(&mut self) {
2513                 if self.datalen == 0 { return; }
2514                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2515         }
2516 }
2517 impl Clone for CVec_RouteHintHopZ {
2518         fn clone(&self) -> Self {
2519                 let mut res = Vec::new();
2520                 if self.datalen == 0 { return Self::from(res); }
2521                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2522                 Self::from(res)
2523         }
2524 }
2525 #[repr(C)]
2526 /// The contents of CResult_RouteHintDecodeErrorZ
2527 pub union CResult_RouteHintDecodeErrorZPtr {
2528         /// A pointer to the contents in the success state.
2529         /// Reading from this pointer when `result_ok` is not set is undefined.
2530         pub result: *mut crate::lightning::routing::router::RouteHint,
2531         /// A pointer to the contents in the error state.
2532         /// Reading from this pointer when `result_ok` is set is undefined.
2533         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2534 }
2535 #[repr(C)]
2536 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2537 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2539 pub struct CResult_RouteHintDecodeErrorZ {
2540         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2541         /// `err` or `result` depending on the state of `result_ok`.
2542         pub contents: CResult_RouteHintDecodeErrorZPtr,
2543         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2544         pub result_ok: bool,
2545 }
2546 #[no_mangle]
2547 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2548 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2549         CResult_RouteHintDecodeErrorZ {
2550                 contents: CResult_RouteHintDecodeErrorZPtr {
2551                         result: Box::into_raw(Box::new(o)),
2552                 },
2553                 result_ok: true,
2554         }
2555 }
2556 #[no_mangle]
2557 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2558 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2559         CResult_RouteHintDecodeErrorZ {
2560                 contents: CResult_RouteHintDecodeErrorZPtr {
2561                         err: Box::into_raw(Box::new(e)),
2562                 },
2563                 result_ok: false,
2564         }
2565 }
2566 /// Checks if the given object is currently in the success state
2567 #[no_mangle]
2568 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2569         o.result_ok
2570 }
2571 #[no_mangle]
2572 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2573 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2574 impl Drop for CResult_RouteHintDecodeErrorZ {
2575         fn drop(&mut self) {
2576                 if self.result_ok {
2577                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2578                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2579                         }
2580                 } else {
2581                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2582                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2583                         }
2584                 }
2585         }
2586 }
2587 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2588         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2589                 let contents = if o.result_ok {
2590                         let result = unsafe { o.contents.result };
2591                         unsafe { o.contents.result = core::ptr::null_mut() };
2592                         CResult_RouteHintDecodeErrorZPtr { result }
2593                 } else {
2594                         let err = unsafe { o.contents.err };
2595                         unsafe { o.contents.err = core::ptr::null_mut(); }
2596                         CResult_RouteHintDecodeErrorZPtr { err }
2597                 };
2598                 Self {
2599                         contents,
2600                         result_ok: o.result_ok,
2601                 }
2602         }
2603 }
2604 impl Clone for CResult_RouteHintDecodeErrorZ {
2605         fn clone(&self) -> Self {
2606                 if self.result_ok {
2607                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2608                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2609                         } }
2610                 } else {
2611                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2612                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2613                         } }
2614                 }
2615         }
2616 }
2617 #[no_mangle]
2618 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2619 /// but with all dynamically-allocated buffers duplicated in new buffers.
2620 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2621 #[repr(C)]
2622 /// The contents of CResult_RouteHintHopDecodeErrorZ
2623 pub union CResult_RouteHintHopDecodeErrorZPtr {
2624         /// A pointer to the contents in the success state.
2625         /// Reading from this pointer when `result_ok` is not set is undefined.
2626         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2627         /// A pointer to the contents in the error state.
2628         /// Reading from this pointer when `result_ok` is set is undefined.
2629         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2630 }
2631 #[repr(C)]
2632 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2633 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2635 pub struct CResult_RouteHintHopDecodeErrorZ {
2636         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2637         /// `err` or `result` depending on the state of `result_ok`.
2638         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2639         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2640         pub result_ok: bool,
2641 }
2642 #[no_mangle]
2643 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2644 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2645         CResult_RouteHintHopDecodeErrorZ {
2646                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2647                         result: Box::into_raw(Box::new(o)),
2648                 },
2649                 result_ok: true,
2650         }
2651 }
2652 #[no_mangle]
2653 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2654 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2655         CResult_RouteHintHopDecodeErrorZ {
2656                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2657                         err: Box::into_raw(Box::new(e)),
2658                 },
2659                 result_ok: false,
2660         }
2661 }
2662 /// Checks if the given object is currently in the success state
2663 #[no_mangle]
2664 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2665         o.result_ok
2666 }
2667 #[no_mangle]
2668 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2669 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2670 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2671         fn drop(&mut self) {
2672                 if self.result_ok {
2673                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2674                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2675                         }
2676                 } else {
2677                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2678                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2679                         }
2680                 }
2681         }
2682 }
2683 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2684         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2685                 let contents = if o.result_ok {
2686                         let result = unsafe { o.contents.result };
2687                         unsafe { o.contents.result = core::ptr::null_mut() };
2688                         CResult_RouteHintHopDecodeErrorZPtr { result }
2689                 } else {
2690                         let err = unsafe { o.contents.err };
2691                         unsafe { o.contents.err = core::ptr::null_mut(); }
2692                         CResult_RouteHintHopDecodeErrorZPtr { err }
2693                 };
2694                 Self {
2695                         contents,
2696                         result_ok: o.result_ok,
2697                 }
2698         }
2699 }
2700 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2701         fn clone(&self) -> Self {
2702                 if self.result_ok {
2703                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2704                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2705                         } }
2706                 } else {
2707                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2708                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2709                         } }
2710                 }
2711         }
2712 }
2713 #[no_mangle]
2714 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2715 /// but with all dynamically-allocated buffers duplicated in new buffers.
2716 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2717 #[repr(C)]
2718 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2719 /// This corresponds to std::vector in C++
2720 pub struct CVec_ChannelDetailsZ {
2721         /// The elements in the array.
2722         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2723         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2724         /// The number of elements pointed to by `data`.
2725         pub datalen: usize
2726 }
2727 impl CVec_ChannelDetailsZ {
2728         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2729                 if self.datalen == 0 { return Vec::new(); }
2730                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2731                 self.data = core::ptr::null_mut();
2732                 self.datalen = 0;
2733                 ret
2734         }
2735         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2736                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2737         }
2738 }
2739 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2740         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2741                 let datalen = v.len();
2742                 let data = Box::into_raw(v.into_boxed_slice());
2743                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2744         }
2745 }
2746 #[no_mangle]
2747 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2748 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2749 impl Drop for CVec_ChannelDetailsZ {
2750         fn drop(&mut self) {
2751                 if self.datalen == 0 { return; }
2752                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2753         }
2754 }
2755 impl Clone for CVec_ChannelDetailsZ {
2756         fn clone(&self) -> Self {
2757                 let mut res = Vec::new();
2758                 if self.datalen == 0 { return Self::from(res); }
2759                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2760                 Self::from(res)
2761         }
2762 }
2763 #[repr(C)]
2764 /// The contents of CResult_RouteLightningErrorZ
2765 pub union CResult_RouteLightningErrorZPtr {
2766         /// A pointer to the contents in the success state.
2767         /// Reading from this pointer when `result_ok` is not set is undefined.
2768         pub result: *mut crate::lightning::routing::router::Route,
2769         /// A pointer to the contents in the error state.
2770         /// Reading from this pointer when `result_ok` is set is undefined.
2771         pub err: *mut crate::lightning::ln::msgs::LightningError,
2772 }
2773 #[repr(C)]
2774 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2775 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2776 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2777 pub struct CResult_RouteLightningErrorZ {
2778         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2779         /// `err` or `result` depending on the state of `result_ok`.
2780         pub contents: CResult_RouteLightningErrorZPtr,
2781         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2782         pub result_ok: bool,
2783 }
2784 #[no_mangle]
2785 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2786 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2787         CResult_RouteLightningErrorZ {
2788                 contents: CResult_RouteLightningErrorZPtr {
2789                         result: Box::into_raw(Box::new(o)),
2790                 },
2791                 result_ok: true,
2792         }
2793 }
2794 #[no_mangle]
2795 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2796 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2797         CResult_RouteLightningErrorZ {
2798                 contents: CResult_RouteLightningErrorZPtr {
2799                         err: Box::into_raw(Box::new(e)),
2800                 },
2801                 result_ok: false,
2802         }
2803 }
2804 /// Checks if the given object is currently in the success state
2805 #[no_mangle]
2806 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2807         o.result_ok
2808 }
2809 #[no_mangle]
2810 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2811 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2812 impl Drop for CResult_RouteLightningErrorZ {
2813         fn drop(&mut self) {
2814                 if self.result_ok {
2815                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2816                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2817                         }
2818                 } else {
2819                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2820                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2821                         }
2822                 }
2823         }
2824 }
2825 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2826         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2827                 let contents = if o.result_ok {
2828                         let result = unsafe { o.contents.result };
2829                         unsafe { o.contents.result = core::ptr::null_mut() };
2830                         CResult_RouteLightningErrorZPtr { result }
2831                 } else {
2832                         let err = unsafe { o.contents.err };
2833                         unsafe { o.contents.err = core::ptr::null_mut(); }
2834                         CResult_RouteLightningErrorZPtr { err }
2835                 };
2836                 Self {
2837                         contents,
2838                         result_ok: o.result_ok,
2839                 }
2840         }
2841 }
2842 impl Clone for CResult_RouteLightningErrorZ {
2843         fn clone(&self) -> Self {
2844                 if self.result_ok {
2845                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2846                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2847                         } }
2848                 } else {
2849                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2850                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2851                         } }
2852                 }
2853         }
2854 }
2855 #[no_mangle]
2856 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2857 /// but with all dynamically-allocated buffers duplicated in new buffers.
2858 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2859 #[repr(C)]
2860 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2861 /// This corresponds to std::vector in C++
2862 pub struct CVec_PublicKeyZ {
2863         /// The elements in the array.
2864         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2865         pub data: *mut crate::c_types::PublicKey,
2866         /// The number of elements pointed to by `data`.
2867         pub datalen: usize
2868 }
2869 impl CVec_PublicKeyZ {
2870         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2871                 if self.datalen == 0 { return Vec::new(); }
2872                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2873                 self.data = core::ptr::null_mut();
2874                 self.datalen = 0;
2875                 ret
2876         }
2877         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2878                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2879         }
2880 }
2881 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2882         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2883                 let datalen = v.len();
2884                 let data = Box::into_raw(v.into_boxed_slice());
2885                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2886         }
2887 }
2888 #[no_mangle]
2889 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2890 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2891 impl Drop for CVec_PublicKeyZ {
2892         fn drop(&mut self) {
2893                 if self.datalen == 0 { return; }
2894                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2895         }
2896 }
2897 impl Clone for CVec_PublicKeyZ {
2898         fn clone(&self) -> Self {
2899                 let mut res = Vec::new();
2900                 if self.datalen == 0 { return Self::from(res); }
2901                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2902                 Self::from(res)
2903         }
2904 }
2905 #[repr(C)]
2906 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2907 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2908         /// A pointer to the contents in the success state.
2909         /// Reading from this pointer when `result_ok` is not set is undefined.
2910         pub result: *mut crate::lightning::util::events::PaymentPurpose,
2911         /// A pointer to the contents in the error state.
2912         /// Reading from this pointer when `result_ok` is set is undefined.
2913         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2914 }
2915 #[repr(C)]
2916 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2917 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2918 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2919 pub struct CResult_PaymentPurposeDecodeErrorZ {
2920         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2921         /// `err` or `result` depending on the state of `result_ok`.
2922         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2923         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2924         pub result_ok: bool,
2925 }
2926 #[no_mangle]
2927 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2928 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2929         CResult_PaymentPurposeDecodeErrorZ {
2930                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2931                         result: Box::into_raw(Box::new(o)),
2932                 },
2933                 result_ok: true,
2934         }
2935 }
2936 #[no_mangle]
2937 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2938 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2939         CResult_PaymentPurposeDecodeErrorZ {
2940                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2941                         err: Box::into_raw(Box::new(e)),
2942                 },
2943                 result_ok: false,
2944         }
2945 }
2946 /// Checks if the given object is currently in the success state
2947 #[no_mangle]
2948 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2949         o.result_ok
2950 }
2951 #[no_mangle]
2952 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2953 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2954 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2955         fn drop(&mut self) {
2956                 if self.result_ok {
2957                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2958                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2959                         }
2960                 } else {
2961                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2962                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2963                         }
2964                 }
2965         }
2966 }
2967 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2968         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2969                 let contents = if o.result_ok {
2970                         let result = unsafe { o.contents.result };
2971                         unsafe { o.contents.result = core::ptr::null_mut() };
2972                         CResult_PaymentPurposeDecodeErrorZPtr { result }
2973                 } else {
2974                         let err = unsafe { o.contents.err };
2975                         unsafe { o.contents.err = core::ptr::null_mut(); }
2976                         CResult_PaymentPurposeDecodeErrorZPtr { err }
2977                 };
2978                 Self {
2979                         contents,
2980                         result_ok: o.result_ok,
2981                 }
2982         }
2983 }
2984 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2985         fn clone(&self) -> Self {
2986                 if self.result_ok {
2987                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2988                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
2989                         } }
2990                 } else {
2991                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2992                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2993                         } }
2994                 }
2995         }
2996 }
2997 #[no_mangle]
2998 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
2999 /// but with all dynamically-allocated buffers duplicated in new buffers.
3000 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3001 #[repr(C)]
3002 #[derive(Clone)]
3003 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3004 pub enum COption_ClosureReasonZ {
3005         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3006         Some(crate::lightning::util::events::ClosureReason),
3007         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3008         None
3009 }
3010 impl COption_ClosureReasonZ {
3011         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3012                 if let Self::None = self { false } else { true }
3013         }
3014         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3015                 !self.is_some()
3016         }
3017         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3018                 if let Self::Some(v) = self { v } else { unreachable!() }
3019         }
3020 }
3021 #[no_mangle]
3022 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3023 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3024         COption_ClosureReasonZ::Some(o)
3025 }
3026 #[no_mangle]
3027 /// Constructs a new COption_ClosureReasonZ containing nothing
3028 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3029         COption_ClosureReasonZ::None
3030 }
3031 #[no_mangle]
3032 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3033 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3034 #[no_mangle]
3035 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3036 /// but with all dynamically-allocated buffers duplicated in new buffers.
3037 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3038 #[repr(C)]
3039 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3040 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3041         /// A pointer to the contents in the success state.
3042         /// Reading from this pointer when `result_ok` is not set is undefined.
3043         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3044         /// A pointer to the contents in the error state.
3045         /// Reading from this pointer when `result_ok` is set is undefined.
3046         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3047 }
3048 #[repr(C)]
3049 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3050 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3052 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3053         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3054         /// `err` or `result` depending on the state of `result_ok`.
3055         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3056         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3057         pub result_ok: bool,
3058 }
3059 #[no_mangle]
3060 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3061 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3062         CResult_COption_ClosureReasonZDecodeErrorZ {
3063                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3064                         result: Box::into_raw(Box::new(o)),
3065                 },
3066                 result_ok: true,
3067         }
3068 }
3069 #[no_mangle]
3070 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3071 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3072         CResult_COption_ClosureReasonZDecodeErrorZ {
3073                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3074                         err: Box::into_raw(Box::new(e)),
3075                 },
3076                 result_ok: false,
3077         }
3078 }
3079 /// Checks if the given object is currently in the success state
3080 #[no_mangle]
3081 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3082         o.result_ok
3083 }
3084 #[no_mangle]
3085 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3086 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3087 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3088         fn drop(&mut self) {
3089                 if self.result_ok {
3090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3092                         }
3093                 } else {
3094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3096                         }
3097                 }
3098         }
3099 }
3100 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3101         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3102                 let contents = if o.result_ok {
3103                         let result = unsafe { o.contents.result };
3104                         unsafe { o.contents.result = core::ptr::null_mut() };
3105                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3106                 } else {
3107                         let err = unsafe { o.contents.err };
3108                         unsafe { o.contents.err = core::ptr::null_mut(); }
3109                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3110                 };
3111                 Self {
3112                         contents,
3113                         result_ok: o.result_ok,
3114                 }
3115         }
3116 }
3117 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3118         fn clone(&self) -> Self {
3119                 if self.result_ok {
3120                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3121                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3122                         } }
3123                 } else {
3124                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3126                         } }
3127                 }
3128         }
3129 }
3130 #[no_mangle]
3131 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3132 /// but with all dynamically-allocated buffers duplicated in new buffers.
3133 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3134 #[repr(C)]
3135 #[derive(Clone)]
3136 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3137 pub enum COption_NetworkUpdateZ {
3138         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3139         Some(crate::lightning::routing::gossip::NetworkUpdate),
3140         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3141         None
3142 }
3143 impl COption_NetworkUpdateZ {
3144         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3145                 if let Self::None = self { false } else { true }
3146         }
3147         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3148                 !self.is_some()
3149         }
3150         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3151                 if let Self::Some(v) = self { v } else { unreachable!() }
3152         }
3153 }
3154 #[no_mangle]
3155 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3156 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3157         COption_NetworkUpdateZ::Some(o)
3158 }
3159 #[no_mangle]
3160 /// Constructs a new COption_NetworkUpdateZ containing nothing
3161 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3162         COption_NetworkUpdateZ::None
3163 }
3164 #[no_mangle]
3165 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3166 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3167 #[no_mangle]
3168 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3169 /// but with all dynamically-allocated buffers duplicated in new buffers.
3170 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3171 #[repr(C)]
3172 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3173 /// This corresponds to std::vector in C++
3174 pub struct CVec_SpendableOutputDescriptorZ {
3175         /// The elements in the array.
3176         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3177         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3178         /// The number of elements pointed to by `data`.
3179         pub datalen: usize
3180 }
3181 impl CVec_SpendableOutputDescriptorZ {
3182         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3183                 if self.datalen == 0 { return Vec::new(); }
3184                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3185                 self.data = core::ptr::null_mut();
3186                 self.datalen = 0;
3187                 ret
3188         }
3189         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3190                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3191         }
3192 }
3193 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3194         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3195                 let datalen = v.len();
3196                 let data = Box::into_raw(v.into_boxed_slice());
3197                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3198         }
3199 }
3200 #[no_mangle]
3201 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3202 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3203 impl Drop for CVec_SpendableOutputDescriptorZ {
3204         fn drop(&mut self) {
3205                 if self.datalen == 0 { return; }
3206                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3207         }
3208 }
3209 impl Clone for CVec_SpendableOutputDescriptorZ {
3210         fn clone(&self) -> Self {
3211                 let mut res = Vec::new();
3212                 if self.datalen == 0 { return Self::from(res); }
3213                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3214                 Self::from(res)
3215         }
3216 }
3217 #[repr(C)]
3218 #[derive(Clone)]
3219 /// An enum which can either contain a crate::lightning::util::events::Event or not
3220 pub enum COption_EventZ {
3221         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3222         Some(crate::lightning::util::events::Event),
3223         /// When we're in this state, this COption_EventZ contains nothing
3224         None
3225 }
3226 impl COption_EventZ {
3227         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3228                 if let Self::None = self { false } else { true }
3229         }
3230         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3231                 !self.is_some()
3232         }
3233         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3234                 if let Self::Some(v) = self { v } else { unreachable!() }
3235         }
3236 }
3237 #[no_mangle]
3238 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3239 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3240         COption_EventZ::Some(o)
3241 }
3242 #[no_mangle]
3243 /// Constructs a new COption_EventZ containing nothing
3244 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3245         COption_EventZ::None
3246 }
3247 #[no_mangle]
3248 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3249 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3250 #[no_mangle]
3251 /// Creates a new COption_EventZ which has the same data as `orig`
3252 /// but with all dynamically-allocated buffers duplicated in new buffers.
3253 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3254 #[repr(C)]
3255 /// The contents of CResult_COption_EventZDecodeErrorZ
3256 pub union CResult_COption_EventZDecodeErrorZPtr {
3257         /// A pointer to the contents in the success state.
3258         /// Reading from this pointer when `result_ok` is not set is undefined.
3259         pub result: *mut crate::c_types::derived::COption_EventZ,
3260         /// A pointer to the contents in the error state.
3261         /// Reading from this pointer when `result_ok` is set is undefined.
3262         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3263 }
3264 #[repr(C)]
3265 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3266 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3268 pub struct CResult_COption_EventZDecodeErrorZ {
3269         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3270         /// `err` or `result` depending on the state of `result_ok`.
3271         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3272         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3273         pub result_ok: bool,
3274 }
3275 #[no_mangle]
3276 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3277 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3278         CResult_COption_EventZDecodeErrorZ {
3279                 contents: CResult_COption_EventZDecodeErrorZPtr {
3280                         result: Box::into_raw(Box::new(o)),
3281                 },
3282                 result_ok: true,
3283         }
3284 }
3285 #[no_mangle]
3286 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3287 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3288         CResult_COption_EventZDecodeErrorZ {
3289                 contents: CResult_COption_EventZDecodeErrorZPtr {
3290                         err: Box::into_raw(Box::new(e)),
3291                 },
3292                 result_ok: false,
3293         }
3294 }
3295 /// Checks if the given object is currently in the success state
3296 #[no_mangle]
3297 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3298         o.result_ok
3299 }
3300 #[no_mangle]
3301 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3302 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3303 impl Drop for CResult_COption_EventZDecodeErrorZ {
3304         fn drop(&mut self) {
3305                 if self.result_ok {
3306                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3307                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3308                         }
3309                 } else {
3310                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3311                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3312                         }
3313                 }
3314         }
3315 }
3316 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3317         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3318                 let contents = if o.result_ok {
3319                         let result = unsafe { o.contents.result };
3320                         unsafe { o.contents.result = core::ptr::null_mut() };
3321                         CResult_COption_EventZDecodeErrorZPtr { result }
3322                 } else {
3323                         let err = unsafe { o.contents.err };
3324                         unsafe { o.contents.err = core::ptr::null_mut(); }
3325                         CResult_COption_EventZDecodeErrorZPtr { err }
3326                 };
3327                 Self {
3328                         contents,
3329                         result_ok: o.result_ok,
3330                 }
3331         }
3332 }
3333 impl Clone for CResult_COption_EventZDecodeErrorZ {
3334         fn clone(&self) -> Self {
3335                 if self.result_ok {
3336                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3337                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3338                         } }
3339                 } else {
3340                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3341                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3342                         } }
3343                 }
3344         }
3345 }
3346 #[no_mangle]
3347 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3348 /// but with all dynamically-allocated buffers duplicated in new buffers.
3349 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3350 #[repr(C)]
3351 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3352 /// This corresponds to std::vector in C++
3353 pub struct CVec_MessageSendEventZ {
3354         /// The elements in the array.
3355         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3356         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3357         /// The number of elements pointed to by `data`.
3358         pub datalen: usize
3359 }
3360 impl CVec_MessageSendEventZ {
3361         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3362                 if self.datalen == 0 { return Vec::new(); }
3363                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3364                 self.data = core::ptr::null_mut();
3365                 self.datalen = 0;
3366                 ret
3367         }
3368         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3369                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3370         }
3371 }
3372 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3373         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3374                 let datalen = v.len();
3375                 let data = Box::into_raw(v.into_boxed_slice());
3376                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3377         }
3378 }
3379 #[no_mangle]
3380 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3381 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3382 impl Drop for CVec_MessageSendEventZ {
3383         fn drop(&mut self) {
3384                 if self.datalen == 0 { return; }
3385                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3386         }
3387 }
3388 impl Clone for CVec_MessageSendEventZ {
3389         fn clone(&self) -> Self {
3390                 let mut res = Vec::new();
3391                 if self.datalen == 0 { return Self::from(res); }
3392                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3393                 Self::from(res)
3394         }
3395 }
3396 #[repr(C)]
3397 /// The contents of CResult_TxOutAccessErrorZ
3398 pub union CResult_TxOutAccessErrorZPtr {
3399         /// A pointer to the contents in the success state.
3400         /// Reading from this pointer when `result_ok` is not set is undefined.
3401         pub result: *mut crate::c_types::TxOut,
3402         /// A pointer to the contents in the error state.
3403         /// Reading from this pointer when `result_ok` is set is undefined.
3404         pub err: *mut crate::lightning::chain::AccessError,
3405 }
3406 #[repr(C)]
3407 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3408 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3410 pub struct CResult_TxOutAccessErrorZ {
3411         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3412         /// `err` or `result` depending on the state of `result_ok`.
3413         pub contents: CResult_TxOutAccessErrorZPtr,
3414         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3415         pub result_ok: bool,
3416 }
3417 #[no_mangle]
3418 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3419 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3420         CResult_TxOutAccessErrorZ {
3421                 contents: CResult_TxOutAccessErrorZPtr {
3422                         result: Box::into_raw(Box::new(o)),
3423                 },
3424                 result_ok: true,
3425         }
3426 }
3427 #[no_mangle]
3428 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3429 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3430         CResult_TxOutAccessErrorZ {
3431                 contents: CResult_TxOutAccessErrorZPtr {
3432                         err: Box::into_raw(Box::new(e)),
3433                 },
3434                 result_ok: false,
3435         }
3436 }
3437 /// Checks if the given object is currently in the success state
3438 #[no_mangle]
3439 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3440         o.result_ok
3441 }
3442 #[no_mangle]
3443 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3444 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3445 impl Drop for CResult_TxOutAccessErrorZ {
3446         fn drop(&mut self) {
3447                 if self.result_ok {
3448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3450                         }
3451                 } else {
3452                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3453                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3454                         }
3455                 }
3456         }
3457 }
3458 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3459         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3460                 let contents = if o.result_ok {
3461                         let result = unsafe { o.contents.result };
3462                         unsafe { o.contents.result = core::ptr::null_mut() };
3463                         CResult_TxOutAccessErrorZPtr { result }
3464                 } else {
3465                         let err = unsafe { o.contents.err };
3466                         unsafe { o.contents.err = core::ptr::null_mut(); }
3467                         CResult_TxOutAccessErrorZPtr { err }
3468                 };
3469                 Self {
3470                         contents,
3471                         result_ok: o.result_ok,
3472                 }
3473         }
3474 }
3475 impl Clone for CResult_TxOutAccessErrorZ {
3476         fn clone(&self) -> Self {
3477                 if self.result_ok {
3478                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3479                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3480                         } }
3481                 } else {
3482                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3483                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3484                         } }
3485                 }
3486         }
3487 }
3488 #[no_mangle]
3489 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3490 /// but with all dynamically-allocated buffers duplicated in new buffers.
3491 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3492 #[repr(C)]
3493 /// A tuple of 2 elements. See the individual fields for the types contained.
3494 pub struct C2Tuple_usizeTransactionZ {
3495         /// The element at position 0
3496         pub a: usize,
3497         /// The element at position 1
3498         pub b: crate::c_types::Transaction,
3499 }
3500 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3501         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3502                 Self {
3503                         a: tup.0,
3504                         b: tup.1,
3505                 }
3506         }
3507 }
3508 impl C2Tuple_usizeTransactionZ {
3509         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3510                 (self.a, self.b)
3511         }
3512 }
3513 impl Clone for C2Tuple_usizeTransactionZ {
3514         fn clone(&self) -> Self {
3515                 Self {
3516                         a: Clone::clone(&self.a),
3517                         b: Clone::clone(&self.b),
3518                 }
3519         }
3520 }
3521 #[no_mangle]
3522 /// Creates a new tuple which has the same data as `orig`
3523 /// but with all dynamically-allocated buffers duplicated in new buffers.
3524 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3525 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3526 #[no_mangle]
3527 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3528         C2Tuple_usizeTransactionZ { a, b, }
3529 }
3530
3531 #[no_mangle]
3532 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3533 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3534 #[repr(C)]
3535 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3536 /// This corresponds to std::vector in C++
3537 pub struct CVec_C2Tuple_usizeTransactionZZ {
3538         /// The elements in the array.
3539         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3540         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3541         /// The number of elements pointed to by `data`.
3542         pub datalen: usize
3543 }
3544 impl CVec_C2Tuple_usizeTransactionZZ {
3545         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3546                 if self.datalen == 0 { return Vec::new(); }
3547                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3548                 self.data = core::ptr::null_mut();
3549                 self.datalen = 0;
3550                 ret
3551         }
3552         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3553                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3554         }
3555 }
3556 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3557         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3558                 let datalen = v.len();
3559                 let data = Box::into_raw(v.into_boxed_slice());
3560                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3561         }
3562 }
3563 #[no_mangle]
3564 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3565 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3566 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3567         fn drop(&mut self) {
3568                 if self.datalen == 0 { return; }
3569                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3570         }
3571 }
3572 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3573         fn clone(&self) -> Self {
3574                 let mut res = Vec::new();
3575                 if self.datalen == 0 { return Self::from(res); }
3576                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3577                 Self::from(res)
3578         }
3579 }
3580 #[repr(C)]
3581 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3582 /// This corresponds to std::vector in C++
3583 pub struct CVec_TxidZ {
3584         /// The elements in the array.
3585         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3586         pub data: *mut crate::c_types::ThirtyTwoBytes,
3587         /// The number of elements pointed to by `data`.
3588         pub datalen: usize
3589 }
3590 impl CVec_TxidZ {
3591         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3592                 if self.datalen == 0 { return Vec::new(); }
3593                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3594                 self.data = core::ptr::null_mut();
3595                 self.datalen = 0;
3596                 ret
3597         }
3598         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3599                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3600         }
3601 }
3602 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3603         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3604                 let datalen = v.len();
3605                 let data = Box::into_raw(v.into_boxed_slice());
3606                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3607         }
3608 }
3609 #[no_mangle]
3610 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3611 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3612 impl Drop for CVec_TxidZ {
3613         fn drop(&mut self) {
3614                 if self.datalen == 0 { return; }
3615                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3616         }
3617 }
3618 impl Clone for CVec_TxidZ {
3619         fn clone(&self) -> Self {
3620                 let mut res = Vec::new();
3621                 if self.datalen == 0 { return Self::from(res); }
3622                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3623                 Self::from(res)
3624         }
3625 }
3626 #[repr(C)]
3627 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3628 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3629         /// Note that this value is always NULL, as there are no contents in the OK variant
3630         pub result: *mut core::ffi::c_void,
3631         /// A pointer to the contents in the error state.
3632         /// Reading from this pointer when `result_ok` is set is undefined.
3633         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3634 }
3635 #[repr(C)]
3636 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3637 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3639 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3640         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3641         /// `err` or `result` depending on the state of `result_ok`.
3642         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3643         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3644         pub result_ok: bool,
3645 }
3646 #[no_mangle]
3647 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3648 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3649         CResult_NoneChannelMonitorUpdateErrZ {
3650                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3651                         result: core::ptr::null_mut(),
3652                 },
3653                 result_ok: true,
3654         }
3655 }
3656 #[no_mangle]
3657 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3658 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3659         CResult_NoneChannelMonitorUpdateErrZ {
3660                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3661                         err: Box::into_raw(Box::new(e)),
3662                 },
3663                 result_ok: false,
3664         }
3665 }
3666 /// Checks if the given object is currently in the success state
3667 #[no_mangle]
3668 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3669         o.result_ok
3670 }
3671 #[no_mangle]
3672 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3673 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3674 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3675         fn drop(&mut self) {
3676                 if self.result_ok {
3677                 } else {
3678                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3679                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3680                         }
3681                 }
3682         }
3683 }
3684 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3685         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3686                 let contents = if o.result_ok {
3687                         let _ = unsafe { Box::from_raw(o.contents.result) };
3688                         o.contents.result = core::ptr::null_mut();
3689                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3690                 } else {
3691                         let err = unsafe { o.contents.err };
3692                         unsafe { o.contents.err = core::ptr::null_mut(); }
3693                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3694                 };
3695                 Self {
3696                         contents,
3697                         result_ok: o.result_ok,
3698                 }
3699         }
3700 }
3701 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3702         fn clone(&self) -> Self {
3703                 if self.result_ok {
3704                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3705                                 result: core::ptr::null_mut()
3706                         } }
3707                 } else {
3708                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3709                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3710                         } }
3711                 }
3712         }
3713 }
3714 #[no_mangle]
3715 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3716 /// but with all dynamically-allocated buffers duplicated in new buffers.
3717 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3718 #[repr(C)]
3719 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3720 /// This corresponds to std::vector in C++
3721 pub struct CVec_MonitorEventZ {
3722         /// The elements in the array.
3723         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3724         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3725         /// The number of elements pointed to by `data`.
3726         pub datalen: usize
3727 }
3728 impl CVec_MonitorEventZ {
3729         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3730                 if self.datalen == 0 { return Vec::new(); }
3731                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3732                 self.data = core::ptr::null_mut();
3733                 self.datalen = 0;
3734                 ret
3735         }
3736         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3737                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3738         }
3739 }
3740 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3741         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3742                 let datalen = v.len();
3743                 let data = Box::into_raw(v.into_boxed_slice());
3744                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3745         }
3746 }
3747 #[no_mangle]
3748 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3749 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3750 impl Drop for CVec_MonitorEventZ {
3751         fn drop(&mut self) {
3752                 if self.datalen == 0 { return; }
3753                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3754         }
3755 }
3756 impl Clone for CVec_MonitorEventZ {
3757         fn clone(&self) -> Self {
3758                 let mut res = Vec::new();
3759                 if self.datalen == 0 { return Self::from(res); }
3760                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3761                 Self::from(res)
3762         }
3763 }
3764 #[repr(C)]
3765 /// A tuple of 2 elements. See the individual fields for the types contained.
3766 pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
3767         /// The element at position 0
3768         pub a: crate::lightning::chain::transaction::OutPoint,
3769         /// The element at position 1
3770         pub b: crate::c_types::derived::CVec_MonitorEventZ,
3771 }
3772 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
3773         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
3774                 Self {
3775                         a: tup.0,
3776                         b: tup.1,
3777                 }
3778         }
3779 }
3780 impl C2Tuple_OutPointCVec_MonitorEventZZ {
3781         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
3782                 (self.a, self.b)
3783         }
3784 }
3785 impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
3786         fn clone(&self) -> Self {
3787                 Self {
3788                         a: Clone::clone(&self.a),
3789                         b: Clone::clone(&self.b),
3790                 }
3791         }
3792 }
3793 #[no_mangle]
3794 /// Creates a new tuple which has the same data as `orig`
3795 /// but with all dynamically-allocated buffers duplicated in new buffers.
3796 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
3797 /// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
3798 #[no_mangle]
3799 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
3800         C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
3801 }
3802
3803 #[no_mangle]
3804 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
3805 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
3806 #[repr(C)]
3807 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
3808 /// This corresponds to std::vector in C++
3809 pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3810         /// The elements in the array.
3811         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3812         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ,
3813         /// The number of elements pointed to by `data`.
3814         pub datalen: usize
3815 }
3816 impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3817         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
3818                 if self.datalen == 0 { return Vec::new(); }
3819                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3820                 self.data = core::ptr::null_mut();
3821                 self.datalen = 0;
3822                 ret
3823         }
3824         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ] {
3825                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3826         }
3827 }
3828 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3829         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> Self {
3830                 let datalen = v.len();
3831                 let data = Box::into_raw(v.into_boxed_slice());
3832                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3833         }
3834 }
3835 #[no_mangle]
3836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3837 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
3838 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3839         fn drop(&mut self) {
3840                 if self.datalen == 0 { return; }
3841                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3842         }
3843 }
3844 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3845         fn clone(&self) -> Self {
3846                 let mut res = Vec::new();
3847                 if self.datalen == 0 { return Self::from(res); }
3848                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3849                 Self::from(res)
3850         }
3851 }
3852 #[repr(C)]
3853 #[derive(Clone)]
3854 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3855 pub enum COption_C2Tuple_usizeTransactionZZ {
3856         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3857         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3858         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3859         None
3860 }
3861 impl COption_C2Tuple_usizeTransactionZZ {
3862         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3863                 if let Self::None = self { false } else { true }
3864         }
3865         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3866                 !self.is_some()
3867         }
3868         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3869                 if let Self::Some(v) = self { v } else { unreachable!() }
3870         }
3871 }
3872 #[no_mangle]
3873 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3874 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3875         COption_C2Tuple_usizeTransactionZZ::Some(o)
3876 }
3877 #[no_mangle]
3878 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3879 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3880         COption_C2Tuple_usizeTransactionZZ::None
3881 }
3882 #[no_mangle]
3883 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3884 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3885 #[no_mangle]
3886 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3887 /// but with all dynamically-allocated buffers duplicated in new buffers.
3888 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3889 #[repr(C)]
3890 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3891 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3892         /// A pointer to the contents in the success state.
3893         /// Reading from this pointer when `result_ok` is not set is undefined.
3894         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3895         /// A pointer to the contents in the error state.
3896         /// Reading from this pointer when `result_ok` is set is undefined.
3897         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3898 }
3899 #[repr(C)]
3900 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3901 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3903 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3904         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3905         /// `err` or `result` depending on the state of `result_ok`.
3906         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3907         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3908         pub result_ok: bool,
3909 }
3910 #[no_mangle]
3911 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3912 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3913         CResult_FixedPenaltyScorerDecodeErrorZ {
3914                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3915                         result: Box::into_raw(Box::new(o)),
3916                 },
3917                 result_ok: true,
3918         }
3919 }
3920 #[no_mangle]
3921 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3922 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3923         CResult_FixedPenaltyScorerDecodeErrorZ {
3924                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3925                         err: Box::into_raw(Box::new(e)),
3926                 },
3927                 result_ok: false,
3928         }
3929 }
3930 /// Checks if the given object is currently in the success state
3931 #[no_mangle]
3932 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3933         o.result_ok
3934 }
3935 #[no_mangle]
3936 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3937 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3938 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3939         fn drop(&mut self) {
3940                 if self.result_ok {
3941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3943                         }
3944                 } else {
3945                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3946                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3947                         }
3948                 }
3949         }
3950 }
3951 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3953                 let contents = if o.result_ok {
3954                         let result = unsafe { o.contents.result };
3955                         unsafe { o.contents.result = core::ptr::null_mut() };
3956                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3957                 } else {
3958                         let err = unsafe { o.contents.err };
3959                         unsafe { o.contents.err = core::ptr::null_mut(); }
3960                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3961                 };
3962                 Self {
3963                         contents,
3964                         result_ok: o.result_ok,
3965                 }
3966         }
3967 }
3968 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3969         fn clone(&self) -> Self {
3970                 if self.result_ok {
3971                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3972                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3973                         } }
3974                 } else {
3975                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3976                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3977                         } }
3978                 }
3979         }
3980 }
3981 #[no_mangle]
3982 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3983 /// but with all dynamically-allocated buffers duplicated in new buffers.
3984 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3985 #[repr(C)]
3986 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3987 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3988         /// A pointer to the contents in the success state.
3989         /// Reading from this pointer when `result_ok` is not set is undefined.
3990         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3991         /// A pointer to the contents in the error state.
3992         /// Reading from this pointer when `result_ok` is set is undefined.
3993         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3994 }
3995 #[repr(C)]
3996 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3997 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3999 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4000         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4001         /// `err` or `result` depending on the state of `result_ok`.
4002         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4003         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4004         pub result_ok: bool,
4005 }
4006 #[no_mangle]
4007 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4008 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4009         CResult_ProbabilisticScorerDecodeErrorZ {
4010                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4011                         result: Box::into_raw(Box::new(o)),
4012                 },
4013                 result_ok: true,
4014         }
4015 }
4016 #[no_mangle]
4017 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4018 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4019         CResult_ProbabilisticScorerDecodeErrorZ {
4020                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4021                         err: Box::into_raw(Box::new(e)),
4022                 },
4023                 result_ok: false,
4024         }
4025 }
4026 /// Checks if the given object is currently in the success state
4027 #[no_mangle]
4028 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4029         o.result_ok
4030 }
4031 #[no_mangle]
4032 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4033 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4034 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4035         fn drop(&mut self) {
4036                 if self.result_ok {
4037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4039                         }
4040                 } else {
4041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4043                         }
4044                 }
4045         }
4046 }
4047 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4049                 let contents = if o.result_ok {
4050                         let result = unsafe { o.contents.result };
4051                         unsafe { o.contents.result = core::ptr::null_mut() };
4052                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4053                 } else {
4054                         let err = unsafe { o.contents.err };
4055                         unsafe { o.contents.err = core::ptr::null_mut(); }
4056                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4057                 };
4058                 Self {
4059                         contents,
4060                         result_ok: o.result_ok,
4061                 }
4062         }
4063 }
4064 #[repr(C)]
4065 /// The contents of CResult_InitFeaturesDecodeErrorZ
4066 pub union CResult_InitFeaturesDecodeErrorZPtr {
4067         /// A pointer to the contents in the success state.
4068         /// Reading from this pointer when `result_ok` is not set is undefined.
4069         pub result: *mut crate::lightning::ln::features::InitFeatures,
4070         /// A pointer to the contents in the error state.
4071         /// Reading from this pointer when `result_ok` is set is undefined.
4072         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4073 }
4074 #[repr(C)]
4075 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4076 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4078 pub struct CResult_InitFeaturesDecodeErrorZ {
4079         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4080         /// `err` or `result` depending on the state of `result_ok`.
4081         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4082         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4083         pub result_ok: bool,
4084 }
4085 #[no_mangle]
4086 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4087 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4088         CResult_InitFeaturesDecodeErrorZ {
4089                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4090                         result: Box::into_raw(Box::new(o)),
4091                 },
4092                 result_ok: true,
4093         }
4094 }
4095 #[no_mangle]
4096 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4097 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4098         CResult_InitFeaturesDecodeErrorZ {
4099                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4100                         err: Box::into_raw(Box::new(e)),
4101                 },
4102                 result_ok: false,
4103         }
4104 }
4105 /// Checks if the given object is currently in the success state
4106 #[no_mangle]
4107 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4108         o.result_ok
4109 }
4110 #[no_mangle]
4111 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4112 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4113 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4114         fn drop(&mut self) {
4115                 if self.result_ok {
4116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4118                         }
4119                 } else {
4120                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4121                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4122                         }
4123                 }
4124         }
4125 }
4126 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4127         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4128                 let contents = if o.result_ok {
4129                         let result = unsafe { o.contents.result };
4130                         unsafe { o.contents.result = core::ptr::null_mut() };
4131                         CResult_InitFeaturesDecodeErrorZPtr { result }
4132                 } else {
4133                         let err = unsafe { o.contents.err };
4134                         unsafe { o.contents.err = core::ptr::null_mut(); }
4135                         CResult_InitFeaturesDecodeErrorZPtr { err }
4136                 };
4137                 Self {
4138                         contents,
4139                         result_ok: o.result_ok,
4140                 }
4141         }
4142 }
4143 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4144         fn clone(&self) -> Self {
4145                 if self.result_ok {
4146                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4147                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4148                         } }
4149                 } else {
4150                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4151                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4152                         } }
4153                 }
4154         }
4155 }
4156 #[no_mangle]
4157 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4158 /// but with all dynamically-allocated buffers duplicated in new buffers.
4159 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4160 #[repr(C)]
4161 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4162 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4163         /// A pointer to the contents in the success state.
4164         /// Reading from this pointer when `result_ok` is not set is undefined.
4165         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4166         /// A pointer to the contents in the error state.
4167         /// Reading from this pointer when `result_ok` is set is undefined.
4168         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4169 }
4170 #[repr(C)]
4171 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4172 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4174 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4175         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4176         /// `err` or `result` depending on the state of `result_ok`.
4177         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4178         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4179         pub result_ok: bool,
4180 }
4181 #[no_mangle]
4182 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4183 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4184         CResult_ChannelFeaturesDecodeErrorZ {
4185                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4186                         result: Box::into_raw(Box::new(o)),
4187                 },
4188                 result_ok: true,
4189         }
4190 }
4191 #[no_mangle]
4192 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4193 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4194         CResult_ChannelFeaturesDecodeErrorZ {
4195                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4196                         err: Box::into_raw(Box::new(e)),
4197                 },
4198                 result_ok: false,
4199         }
4200 }
4201 /// Checks if the given object is currently in the success state
4202 #[no_mangle]
4203 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4204         o.result_ok
4205 }
4206 #[no_mangle]
4207 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4208 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4209 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4210         fn drop(&mut self) {
4211                 if self.result_ok {
4212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4214                         }
4215                 } else {
4216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4218                         }
4219                 }
4220         }
4221 }
4222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4224                 let contents = if o.result_ok {
4225                         let result = unsafe { o.contents.result };
4226                         unsafe { o.contents.result = core::ptr::null_mut() };
4227                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4228                 } else {
4229                         let err = unsafe { o.contents.err };
4230                         unsafe { o.contents.err = core::ptr::null_mut(); }
4231                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4232                 };
4233                 Self {
4234                         contents,
4235                         result_ok: o.result_ok,
4236                 }
4237         }
4238 }
4239 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4240         fn clone(&self) -> Self {
4241                 if self.result_ok {
4242                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4243                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4244                         } }
4245                 } else {
4246                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4247                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4248                         } }
4249                 }
4250         }
4251 }
4252 #[no_mangle]
4253 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4254 /// but with all dynamically-allocated buffers duplicated in new buffers.
4255 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4256 #[repr(C)]
4257 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4258 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4259         /// A pointer to the contents in the success state.
4260         /// Reading from this pointer when `result_ok` is not set is undefined.
4261         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4262         /// A pointer to the contents in the error state.
4263         /// Reading from this pointer when `result_ok` is set is undefined.
4264         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4265 }
4266 #[repr(C)]
4267 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4268 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4270 pub struct CResult_NodeFeaturesDecodeErrorZ {
4271         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4272         /// `err` or `result` depending on the state of `result_ok`.
4273         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4274         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4275         pub result_ok: bool,
4276 }
4277 #[no_mangle]
4278 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4279 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4280         CResult_NodeFeaturesDecodeErrorZ {
4281                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4282                         result: Box::into_raw(Box::new(o)),
4283                 },
4284                 result_ok: true,
4285         }
4286 }
4287 #[no_mangle]
4288 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4289 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4290         CResult_NodeFeaturesDecodeErrorZ {
4291                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4292                         err: Box::into_raw(Box::new(e)),
4293                 },
4294                 result_ok: false,
4295         }
4296 }
4297 /// Checks if the given object is currently in the success state
4298 #[no_mangle]
4299 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4300         o.result_ok
4301 }
4302 #[no_mangle]
4303 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4304 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4305 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4306         fn drop(&mut self) {
4307                 if self.result_ok {
4308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4310                         }
4311                 } else {
4312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4314                         }
4315                 }
4316         }
4317 }
4318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4319         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4320                 let contents = if o.result_ok {
4321                         let result = unsafe { o.contents.result };
4322                         unsafe { o.contents.result = core::ptr::null_mut() };
4323                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4324                 } else {
4325                         let err = unsafe { o.contents.err };
4326                         unsafe { o.contents.err = core::ptr::null_mut(); }
4327                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4328                 };
4329                 Self {
4330                         contents,
4331                         result_ok: o.result_ok,
4332                 }
4333         }
4334 }
4335 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4336         fn clone(&self) -> Self {
4337                 if self.result_ok {
4338                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4339                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4340                         } }
4341                 } else {
4342                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4343                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4344                         } }
4345                 }
4346         }
4347 }
4348 #[no_mangle]
4349 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4350 /// but with all dynamically-allocated buffers duplicated in new buffers.
4351 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4352 #[repr(C)]
4353 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4354 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4355         /// A pointer to the contents in the success state.
4356         /// Reading from this pointer when `result_ok` is not set is undefined.
4357         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4358         /// A pointer to the contents in the error state.
4359         /// Reading from this pointer when `result_ok` is set is undefined.
4360         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4361 }
4362 #[repr(C)]
4363 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4364 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4366 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4367         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4368         /// `err` or `result` depending on the state of `result_ok`.
4369         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4370         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4371         pub result_ok: bool,
4372 }
4373 #[no_mangle]
4374 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4375 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4376         CResult_InvoiceFeaturesDecodeErrorZ {
4377                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4378                         result: Box::into_raw(Box::new(o)),
4379                 },
4380                 result_ok: true,
4381         }
4382 }
4383 #[no_mangle]
4384 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4385 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4386         CResult_InvoiceFeaturesDecodeErrorZ {
4387                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4388                         err: Box::into_raw(Box::new(e)),
4389                 },
4390                 result_ok: false,
4391         }
4392 }
4393 /// Checks if the given object is currently in the success state
4394 #[no_mangle]
4395 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4396         o.result_ok
4397 }
4398 #[no_mangle]
4399 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4400 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4401 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4402         fn drop(&mut self) {
4403                 if self.result_ok {
4404                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4405                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4406                         }
4407                 } else {
4408                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4409                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4410                         }
4411                 }
4412         }
4413 }
4414 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4415         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4416                 let contents = if o.result_ok {
4417                         let result = unsafe { o.contents.result };
4418                         unsafe { o.contents.result = core::ptr::null_mut() };
4419                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4420                 } else {
4421                         let err = unsafe { o.contents.err };
4422                         unsafe { o.contents.err = core::ptr::null_mut(); }
4423                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4424                 };
4425                 Self {
4426                         contents,
4427                         result_ok: o.result_ok,
4428                 }
4429         }
4430 }
4431 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4432         fn clone(&self) -> Self {
4433                 if self.result_ok {
4434                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4435                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4436                         } }
4437                 } else {
4438                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4439                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4440                         } }
4441                 }
4442         }
4443 }
4444 #[no_mangle]
4445 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4446 /// but with all dynamically-allocated buffers duplicated in new buffers.
4447 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4448 #[repr(C)]
4449 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4450 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4451         /// A pointer to the contents in the success state.
4452         /// Reading from this pointer when `result_ok` is not set is undefined.
4453         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4454         /// A pointer to the contents in the error state.
4455         /// Reading from this pointer when `result_ok` is set is undefined.
4456         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4457 }
4458 #[repr(C)]
4459 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4460 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4462 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4463         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4464         /// `err` or `result` depending on the state of `result_ok`.
4465         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4466         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4467         pub result_ok: bool,
4468 }
4469 #[no_mangle]
4470 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4471 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4472         CResult_ChannelTypeFeaturesDecodeErrorZ {
4473                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4474                         result: Box::into_raw(Box::new(o)),
4475                 },
4476                 result_ok: true,
4477         }
4478 }
4479 #[no_mangle]
4480 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4481 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4482         CResult_ChannelTypeFeaturesDecodeErrorZ {
4483                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4484                         err: Box::into_raw(Box::new(e)),
4485                 },
4486                 result_ok: false,
4487         }
4488 }
4489 /// Checks if the given object is currently in the success state
4490 #[no_mangle]
4491 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4492         o.result_ok
4493 }
4494 #[no_mangle]
4495 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4496 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4497 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4498         fn drop(&mut self) {
4499                 if self.result_ok {
4500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4502                         }
4503                 } else {
4504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4506                         }
4507                 }
4508         }
4509 }
4510 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4512                 let contents = if o.result_ok {
4513                         let result = unsafe { o.contents.result };
4514                         unsafe { o.contents.result = core::ptr::null_mut() };
4515                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4516                 } else {
4517                         let err = unsafe { o.contents.err };
4518                         unsafe { o.contents.err = core::ptr::null_mut(); }
4519                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4520                 };
4521                 Self {
4522                         contents,
4523                         result_ok: o.result_ok,
4524                 }
4525         }
4526 }
4527 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4528         fn clone(&self) -> Self {
4529                 if self.result_ok {
4530                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4531                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4532                         } }
4533                 } else {
4534                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4536                         } }
4537                 }
4538         }
4539 }
4540 #[no_mangle]
4541 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4542 /// but with all dynamically-allocated buffers duplicated in new buffers.
4543 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4544 #[repr(C)]
4545 /// The contents of CResult_NodeIdDecodeErrorZ
4546 pub union CResult_NodeIdDecodeErrorZPtr {
4547         /// A pointer to the contents in the success state.
4548         /// Reading from this pointer when `result_ok` is not set is undefined.
4549         pub result: *mut crate::lightning::routing::gossip::NodeId,
4550         /// A pointer to the contents in the error state.
4551         /// Reading from this pointer when `result_ok` is set is undefined.
4552         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4553 }
4554 #[repr(C)]
4555 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4556 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4558 pub struct CResult_NodeIdDecodeErrorZ {
4559         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4560         /// `err` or `result` depending on the state of `result_ok`.
4561         pub contents: CResult_NodeIdDecodeErrorZPtr,
4562         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4563         pub result_ok: bool,
4564 }
4565 #[no_mangle]
4566 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4567 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4568         CResult_NodeIdDecodeErrorZ {
4569                 contents: CResult_NodeIdDecodeErrorZPtr {
4570                         result: Box::into_raw(Box::new(o)),
4571                 },
4572                 result_ok: true,
4573         }
4574 }
4575 #[no_mangle]
4576 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4577 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4578         CResult_NodeIdDecodeErrorZ {
4579                 contents: CResult_NodeIdDecodeErrorZPtr {
4580                         err: Box::into_raw(Box::new(e)),
4581                 },
4582                 result_ok: false,
4583         }
4584 }
4585 /// Checks if the given object is currently in the success state
4586 #[no_mangle]
4587 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4588         o.result_ok
4589 }
4590 #[no_mangle]
4591 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4592 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4593 impl Drop for CResult_NodeIdDecodeErrorZ {
4594         fn drop(&mut self) {
4595                 if self.result_ok {
4596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4598                         }
4599                 } else {
4600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4602                         }
4603                 }
4604         }
4605 }
4606 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4607         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4608                 let contents = if o.result_ok {
4609                         let result = unsafe { o.contents.result };
4610                         unsafe { o.contents.result = core::ptr::null_mut() };
4611                         CResult_NodeIdDecodeErrorZPtr { result }
4612                 } else {
4613                         let err = unsafe { o.contents.err };
4614                         unsafe { o.contents.err = core::ptr::null_mut(); }
4615                         CResult_NodeIdDecodeErrorZPtr { err }
4616                 };
4617                 Self {
4618                         contents,
4619                         result_ok: o.result_ok,
4620                 }
4621         }
4622 }
4623 impl Clone for CResult_NodeIdDecodeErrorZ {
4624         fn clone(&self) -> Self {
4625                 if self.result_ok {
4626                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4627                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4628                         } }
4629                 } else {
4630                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4631                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4632                         } }
4633                 }
4634         }
4635 }
4636 #[no_mangle]
4637 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4638 /// but with all dynamically-allocated buffers duplicated in new buffers.
4639 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4640 #[repr(C)]
4641 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4642 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4643         /// A pointer to the contents in the success state.
4644         /// Reading from this pointer when `result_ok` is not set is undefined.
4645         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4646         /// A pointer to the contents in the error state.
4647         /// Reading from this pointer when `result_ok` is set is undefined.
4648         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4649 }
4650 #[repr(C)]
4651 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4652 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4654 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4655         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4656         /// `err` or `result` depending on the state of `result_ok`.
4657         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4658         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4659         pub result_ok: bool,
4660 }
4661 #[no_mangle]
4662 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4663 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4664         CResult_COption_NetworkUpdateZDecodeErrorZ {
4665                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4666                         result: Box::into_raw(Box::new(o)),
4667                 },
4668                 result_ok: true,
4669         }
4670 }
4671 #[no_mangle]
4672 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4673 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4674         CResult_COption_NetworkUpdateZDecodeErrorZ {
4675                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4676                         err: Box::into_raw(Box::new(e)),
4677                 },
4678                 result_ok: false,
4679         }
4680 }
4681 /// Checks if the given object is currently in the success state
4682 #[no_mangle]
4683 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4684         o.result_ok
4685 }
4686 #[no_mangle]
4687 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4688 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4689 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4690         fn drop(&mut self) {
4691                 if self.result_ok {
4692                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4693                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4694                         }
4695                 } else {
4696                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4697                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4698                         }
4699                 }
4700         }
4701 }
4702 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4703         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4704                 let contents = if o.result_ok {
4705                         let result = unsafe { o.contents.result };
4706                         unsafe { o.contents.result = core::ptr::null_mut() };
4707                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4708                 } else {
4709                         let err = unsafe { o.contents.err };
4710                         unsafe { o.contents.err = core::ptr::null_mut(); }
4711                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4712                 };
4713                 Self {
4714                         contents,
4715                         result_ok: o.result_ok,
4716                 }
4717         }
4718 }
4719 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4720         fn clone(&self) -> Self {
4721                 if self.result_ok {
4722                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4723                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
4724                         } }
4725                 } else {
4726                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4727                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4728                         } }
4729                 }
4730         }
4731 }
4732 #[no_mangle]
4733 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
4734 /// but with all dynamically-allocated buffers duplicated in new buffers.
4735 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
4736 #[repr(C)]
4737 /// An enum which can either contain a crate::lightning::chain::Access or not
4738 pub enum COption_AccessZ {
4739         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4740         Some(crate::lightning::chain::Access),
4741         /// When we're in this state, this COption_AccessZ contains nothing
4742         None
4743 }
4744 impl COption_AccessZ {
4745         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4746                 if let Self::None = self { false } else { true }
4747         }
4748         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4749                 !self.is_some()
4750         }
4751         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
4752                 if let Self::Some(v) = self { v } else { unreachable!() }
4753         }
4754 }
4755 #[no_mangle]
4756 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
4757 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
4758         COption_AccessZ::Some(o)
4759 }
4760 #[no_mangle]
4761 /// Constructs a new COption_AccessZ containing nothing
4762 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
4763         COption_AccessZ::None
4764 }
4765 #[no_mangle]
4766 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
4767 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
4768 #[repr(C)]
4769 /// The contents of CResult_boolLightningErrorZ
4770 pub union CResult_boolLightningErrorZPtr {
4771         /// A pointer to the contents in the success state.
4772         /// Reading from this pointer when `result_ok` is not set is undefined.
4773         pub result: *mut bool,
4774         /// A pointer to the contents in the error state.
4775         /// Reading from this pointer when `result_ok` is set is undefined.
4776         pub err: *mut crate::lightning::ln::msgs::LightningError,
4777 }
4778 #[repr(C)]
4779 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4780 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782 pub struct CResult_boolLightningErrorZ {
4783         /// The contents of this CResult_boolLightningErrorZ, accessible via either
4784         /// `err` or `result` depending on the state of `result_ok`.
4785         pub contents: CResult_boolLightningErrorZPtr,
4786         /// Whether this CResult_boolLightningErrorZ represents a success state.
4787         pub result_ok: bool,
4788 }
4789 #[no_mangle]
4790 /// Creates a new CResult_boolLightningErrorZ in the success state.
4791 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4792         CResult_boolLightningErrorZ {
4793                 contents: CResult_boolLightningErrorZPtr {
4794                         result: Box::into_raw(Box::new(o)),
4795                 },
4796                 result_ok: true,
4797         }
4798 }
4799 #[no_mangle]
4800 /// Creates a new CResult_boolLightningErrorZ in the error state.
4801 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4802         CResult_boolLightningErrorZ {
4803                 contents: CResult_boolLightningErrorZPtr {
4804                         err: Box::into_raw(Box::new(e)),
4805                 },
4806                 result_ok: false,
4807         }
4808 }
4809 /// Checks if the given object is currently in the success state
4810 #[no_mangle]
4811 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
4812         o.result_ok
4813 }
4814 #[no_mangle]
4815 /// Frees any resources used by the CResult_boolLightningErrorZ.
4816 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4817 impl Drop for CResult_boolLightningErrorZ {
4818         fn drop(&mut self) {
4819                 if self.result_ok {
4820                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4821                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4822                         }
4823                 } else {
4824                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4825                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4826                         }
4827                 }
4828         }
4829 }
4830 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4831         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4832                 let contents = if o.result_ok {
4833                         let result = unsafe { o.contents.result };
4834                         unsafe { o.contents.result = core::ptr::null_mut() };
4835                         CResult_boolLightningErrorZPtr { result }
4836                 } else {
4837                         let err = unsafe { o.contents.err };
4838                         unsafe { o.contents.err = core::ptr::null_mut(); }
4839                         CResult_boolLightningErrorZPtr { err }
4840                 };
4841                 Self {
4842                         contents,
4843                         result_ok: o.result_ok,
4844                 }
4845         }
4846 }
4847 impl Clone for CResult_boolLightningErrorZ {
4848         fn clone(&self) -> Self {
4849                 if self.result_ok {
4850                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4851                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4852                         } }
4853                 } else {
4854                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4855                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4856                         } }
4857                 }
4858         }
4859 }
4860 #[no_mangle]
4861 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4862 /// but with all dynamically-allocated buffers duplicated in new buffers.
4863 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
4864 #[repr(C)]
4865 /// A tuple of 3 elements. See the individual fields for the types contained.
4866 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4867         /// The element at position 0
4868         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4869         /// The element at position 1
4870         pub b: crate::lightning::ln::msgs::ChannelUpdate,
4871         /// The element at position 2
4872         pub c: crate::lightning::ln::msgs::ChannelUpdate,
4873 }
4874 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4875         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4876                 Self {
4877                         a: tup.0,
4878                         b: tup.1,
4879                         c: tup.2,
4880                 }
4881         }
4882 }
4883 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4884         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4885                 (self.a, self.b, self.c)
4886         }
4887 }
4888 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4889         fn clone(&self) -> Self {
4890                 Self {
4891                         a: Clone::clone(&self.a),
4892                         b: Clone::clone(&self.b),
4893                         c: Clone::clone(&self.c),
4894                 }
4895         }
4896 }
4897 #[no_mangle]
4898 /// Creates a new tuple which has the same data as `orig`
4899 /// but with all dynamically-allocated buffers duplicated in new buffers.
4900 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
4901 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4902 #[no_mangle]
4903 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 {
4904         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4905 }
4906
4907 #[no_mangle]
4908 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
4909 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
4910 #[repr(C)]
4911 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4912 /// This corresponds to std::vector in C++
4913 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4914         /// The elements in the array.
4915         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4916         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
4917         /// The number of elements pointed to by `data`.
4918         pub datalen: usize
4919 }
4920 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4921         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
4922                 if self.datalen == 0 { return Vec::new(); }
4923                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4924                 self.data = core::ptr::null_mut();
4925                 self.datalen = 0;
4926                 ret
4927         }
4928         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
4929                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4930         }
4931 }
4932 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4933         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
4934                 let datalen = v.len();
4935                 let data = Box::into_raw(v.into_boxed_slice());
4936                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4937         }
4938 }
4939 #[no_mangle]
4940 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4941 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
4942 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4943         fn drop(&mut self) {
4944                 if self.datalen == 0 { return; }
4945                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4946         }
4947 }
4948 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4949         fn clone(&self) -> Self {
4950                 let mut res = Vec::new();
4951                 if self.datalen == 0 { return Self::from(res); }
4952                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4953                 Self::from(res)
4954         }
4955 }
4956 #[repr(C)]
4957 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
4958 /// This corresponds to std::vector in C++
4959 pub struct CVec_NodeAnnouncementZ {
4960         /// The elements in the array.
4961         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4962         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
4963         /// The number of elements pointed to by `data`.
4964         pub datalen: usize
4965 }
4966 impl CVec_NodeAnnouncementZ {
4967         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
4968                 if self.datalen == 0 { return Vec::new(); }
4969                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4970                 self.data = core::ptr::null_mut();
4971                 self.datalen = 0;
4972                 ret
4973         }
4974         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
4975                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4976         }
4977 }
4978 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
4979         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
4980                 let datalen = v.len();
4981                 let data = Box::into_raw(v.into_boxed_slice());
4982                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4983         }
4984 }
4985 #[no_mangle]
4986 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4987 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
4988 impl Drop for CVec_NodeAnnouncementZ {
4989         fn drop(&mut self) {
4990                 if self.datalen == 0 { return; }
4991                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4992         }
4993 }
4994 impl Clone for CVec_NodeAnnouncementZ {
4995         fn clone(&self) -> Self {
4996                 let mut res = Vec::new();
4997                 if self.datalen == 0 { return Self::from(res); }
4998                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4999                 Self::from(res)
5000         }
5001 }
5002 #[repr(C)]
5003 /// The contents of CResult_NoneLightningErrorZ
5004 pub union CResult_NoneLightningErrorZPtr {
5005         /// Note that this value is always NULL, as there are no contents in the OK variant
5006         pub result: *mut core::ffi::c_void,
5007         /// A pointer to the contents in the error state.
5008         /// Reading from this pointer when `result_ok` is set is undefined.
5009         pub err: *mut crate::lightning::ln::msgs::LightningError,
5010 }
5011 #[repr(C)]
5012 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5013 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5015 pub struct CResult_NoneLightningErrorZ {
5016         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5017         /// `err` or `result` depending on the state of `result_ok`.
5018         pub contents: CResult_NoneLightningErrorZPtr,
5019         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5020         pub result_ok: bool,
5021 }
5022 #[no_mangle]
5023 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5024 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5025         CResult_NoneLightningErrorZ {
5026                 contents: CResult_NoneLightningErrorZPtr {
5027                         result: core::ptr::null_mut(),
5028                 },
5029                 result_ok: true,
5030         }
5031 }
5032 #[no_mangle]
5033 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5034 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5035         CResult_NoneLightningErrorZ {
5036                 contents: CResult_NoneLightningErrorZPtr {
5037                         err: Box::into_raw(Box::new(e)),
5038                 },
5039                 result_ok: false,
5040         }
5041 }
5042 /// Checks if the given object is currently in the success state
5043 #[no_mangle]
5044 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5045         o.result_ok
5046 }
5047 #[no_mangle]
5048 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5049 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5050 impl Drop for CResult_NoneLightningErrorZ {
5051         fn drop(&mut self) {
5052                 if self.result_ok {
5053                 } else {
5054                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5055                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5056                         }
5057                 }
5058         }
5059 }
5060 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5061         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5062                 let contents = if o.result_ok {
5063                         let _ = unsafe { Box::from_raw(o.contents.result) };
5064                         o.contents.result = core::ptr::null_mut();
5065                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5066                 } else {
5067                         let err = unsafe { o.contents.err };
5068                         unsafe { o.contents.err = core::ptr::null_mut(); }
5069                         CResult_NoneLightningErrorZPtr { err }
5070                 };
5071                 Self {
5072                         contents,
5073                         result_ok: o.result_ok,
5074                 }
5075         }
5076 }
5077 impl Clone for CResult_NoneLightningErrorZ {
5078         fn clone(&self) -> Self {
5079                 if self.result_ok {
5080                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5081                                 result: core::ptr::null_mut()
5082                         } }
5083                 } else {
5084                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5085                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5086                         } }
5087                 }
5088         }
5089 }
5090 #[no_mangle]
5091 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5092 /// but with all dynamically-allocated buffers duplicated in new buffers.
5093 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5094 #[repr(C)]
5095 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5096 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5097         /// A pointer to the contents in the success state.
5098         /// Reading from this pointer when `result_ok` is not set is undefined.
5099         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5100         /// A pointer to the contents in the error state.
5101         /// Reading from this pointer when `result_ok` is set is undefined.
5102         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5103 }
5104 #[repr(C)]
5105 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5106 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5108 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5109         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5110         /// `err` or `result` depending on the state of `result_ok`.
5111         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5112         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5113         pub result_ok: bool,
5114 }
5115 #[no_mangle]
5116 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5117 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5118         CResult_ChannelUpdateInfoDecodeErrorZ {
5119                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5120                         result: Box::into_raw(Box::new(o)),
5121                 },
5122                 result_ok: true,
5123         }
5124 }
5125 #[no_mangle]
5126 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5127 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5128         CResult_ChannelUpdateInfoDecodeErrorZ {
5129                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5130                         err: Box::into_raw(Box::new(e)),
5131                 },
5132                 result_ok: false,
5133         }
5134 }
5135 /// Checks if the given object is currently in the success state
5136 #[no_mangle]
5137 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5138         o.result_ok
5139 }
5140 #[no_mangle]
5141 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5142 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5143 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5144         fn drop(&mut self) {
5145                 if self.result_ok {
5146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5148                         }
5149                 } else {
5150                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5151                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5152                         }
5153                 }
5154         }
5155 }
5156 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5157         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5158                 let contents = if o.result_ok {
5159                         let result = unsafe { o.contents.result };
5160                         unsafe { o.contents.result = core::ptr::null_mut() };
5161                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5162                 } else {
5163                         let err = unsafe { o.contents.err };
5164                         unsafe { o.contents.err = core::ptr::null_mut(); }
5165                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5166                 };
5167                 Self {
5168                         contents,
5169                         result_ok: o.result_ok,
5170                 }
5171         }
5172 }
5173 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5174         fn clone(&self) -> Self {
5175                 if self.result_ok {
5176                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5177                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5178                         } }
5179                 } else {
5180                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5181                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5182                         } }
5183                 }
5184         }
5185 }
5186 #[no_mangle]
5187 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5188 /// but with all dynamically-allocated buffers duplicated in new buffers.
5189 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5190 #[repr(C)]
5191 /// The contents of CResult_ChannelInfoDecodeErrorZ
5192 pub union CResult_ChannelInfoDecodeErrorZPtr {
5193         /// A pointer to the contents in the success state.
5194         /// Reading from this pointer when `result_ok` is not set is undefined.
5195         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5196         /// A pointer to the contents in the error state.
5197         /// Reading from this pointer when `result_ok` is set is undefined.
5198         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5199 }
5200 #[repr(C)]
5201 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5202 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5204 pub struct CResult_ChannelInfoDecodeErrorZ {
5205         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5206         /// `err` or `result` depending on the state of `result_ok`.
5207         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5208         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5209         pub result_ok: bool,
5210 }
5211 #[no_mangle]
5212 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5213 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5214         CResult_ChannelInfoDecodeErrorZ {
5215                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5216                         result: Box::into_raw(Box::new(o)),
5217                 },
5218                 result_ok: true,
5219         }
5220 }
5221 #[no_mangle]
5222 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5223 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5224         CResult_ChannelInfoDecodeErrorZ {
5225                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5226                         err: Box::into_raw(Box::new(e)),
5227                 },
5228                 result_ok: false,
5229         }
5230 }
5231 /// Checks if the given object is currently in the success state
5232 #[no_mangle]
5233 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5234         o.result_ok
5235 }
5236 #[no_mangle]
5237 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5238 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5239 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5240         fn drop(&mut self) {
5241                 if self.result_ok {
5242                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5243                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5244                         }
5245                 } else {
5246                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5247                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5248                         }
5249                 }
5250         }
5251 }
5252 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5253         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5254                 let contents = if o.result_ok {
5255                         let result = unsafe { o.contents.result };
5256                         unsafe { o.contents.result = core::ptr::null_mut() };
5257                         CResult_ChannelInfoDecodeErrorZPtr { result }
5258                 } else {
5259                         let err = unsafe { o.contents.err };
5260                         unsafe { o.contents.err = core::ptr::null_mut(); }
5261                         CResult_ChannelInfoDecodeErrorZPtr { err }
5262                 };
5263                 Self {
5264                         contents,
5265                         result_ok: o.result_ok,
5266                 }
5267         }
5268 }
5269 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5270         fn clone(&self) -> Self {
5271                 if self.result_ok {
5272                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5273                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5274                         } }
5275                 } else {
5276                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5277                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5278                         } }
5279                 }
5280         }
5281 }
5282 #[no_mangle]
5283 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5284 /// but with all dynamically-allocated buffers duplicated in new buffers.
5285 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5286 #[repr(C)]
5287 /// The contents of CResult_RoutingFeesDecodeErrorZ
5288 pub union CResult_RoutingFeesDecodeErrorZPtr {
5289         /// A pointer to the contents in the success state.
5290         /// Reading from this pointer when `result_ok` is not set is undefined.
5291         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5292         /// A pointer to the contents in the error state.
5293         /// Reading from this pointer when `result_ok` is set is undefined.
5294         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5295 }
5296 #[repr(C)]
5297 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5298 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5300 pub struct CResult_RoutingFeesDecodeErrorZ {
5301         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5302         /// `err` or `result` depending on the state of `result_ok`.
5303         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5304         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5305         pub result_ok: bool,
5306 }
5307 #[no_mangle]
5308 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5309 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5310         CResult_RoutingFeesDecodeErrorZ {
5311                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5312                         result: Box::into_raw(Box::new(o)),
5313                 },
5314                 result_ok: true,
5315         }
5316 }
5317 #[no_mangle]
5318 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5319 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5320         CResult_RoutingFeesDecodeErrorZ {
5321                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5322                         err: Box::into_raw(Box::new(e)),
5323                 },
5324                 result_ok: false,
5325         }
5326 }
5327 /// Checks if the given object is currently in the success state
5328 #[no_mangle]
5329 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5330         o.result_ok
5331 }
5332 #[no_mangle]
5333 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5334 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5335 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5336         fn drop(&mut self) {
5337                 if self.result_ok {
5338                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5339                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5340                         }
5341                 } else {
5342                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5343                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5344                         }
5345                 }
5346         }
5347 }
5348 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5349         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5350                 let contents = if o.result_ok {
5351                         let result = unsafe { o.contents.result };
5352                         unsafe { o.contents.result = core::ptr::null_mut() };
5353                         CResult_RoutingFeesDecodeErrorZPtr { result }
5354                 } else {
5355                         let err = unsafe { o.contents.err };
5356                         unsafe { o.contents.err = core::ptr::null_mut(); }
5357                         CResult_RoutingFeesDecodeErrorZPtr { err }
5358                 };
5359                 Self {
5360                         contents,
5361                         result_ok: o.result_ok,
5362                 }
5363         }
5364 }
5365 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5366         fn clone(&self) -> Self {
5367                 if self.result_ok {
5368                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5369                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5370                         } }
5371                 } else {
5372                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5373                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5374                         } }
5375                 }
5376         }
5377 }
5378 #[no_mangle]
5379 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5380 /// but with all dynamically-allocated buffers duplicated in new buffers.
5381 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5382 #[repr(C)]
5383 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5384 /// This corresponds to std::vector in C++
5385 pub struct CVec_NetAddressZ {
5386         /// The elements in the array.
5387         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5388         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5389         /// The number of elements pointed to by `data`.
5390         pub datalen: usize
5391 }
5392 impl CVec_NetAddressZ {
5393         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5394                 if self.datalen == 0 { return Vec::new(); }
5395                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5396                 self.data = core::ptr::null_mut();
5397                 self.datalen = 0;
5398                 ret
5399         }
5400         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5401                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5402         }
5403 }
5404 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5405         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5406                 let datalen = v.len();
5407                 let data = Box::into_raw(v.into_boxed_slice());
5408                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5409         }
5410 }
5411 #[no_mangle]
5412 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5413 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5414 impl Drop for CVec_NetAddressZ {
5415         fn drop(&mut self) {
5416                 if self.datalen == 0 { return; }
5417                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5418         }
5419 }
5420 impl Clone for CVec_NetAddressZ {
5421         fn clone(&self) -> Self {
5422                 let mut res = Vec::new();
5423                 if self.datalen == 0 { return Self::from(res); }
5424                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5425                 Self::from(res)
5426         }
5427 }
5428 #[repr(C)]
5429 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5430 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5431         /// A pointer to the contents in the success state.
5432         /// Reading from this pointer when `result_ok` is not set is undefined.
5433         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5434         /// A pointer to the contents in the error state.
5435         /// Reading from this pointer when `result_ok` is set is undefined.
5436         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5437 }
5438 #[repr(C)]
5439 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5440 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5442 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5443         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5444         /// `err` or `result` depending on the state of `result_ok`.
5445         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5446         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5447         pub result_ok: bool,
5448 }
5449 #[no_mangle]
5450 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5451 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5452         CResult_NodeAnnouncementInfoDecodeErrorZ {
5453                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5454                         result: Box::into_raw(Box::new(o)),
5455                 },
5456                 result_ok: true,
5457         }
5458 }
5459 #[no_mangle]
5460 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5461 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5462         CResult_NodeAnnouncementInfoDecodeErrorZ {
5463                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5464                         err: Box::into_raw(Box::new(e)),
5465                 },
5466                 result_ok: false,
5467         }
5468 }
5469 /// Checks if the given object is currently in the success state
5470 #[no_mangle]
5471 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5472         o.result_ok
5473 }
5474 #[no_mangle]
5475 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5476 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5477 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5478         fn drop(&mut self) {
5479                 if self.result_ok {
5480                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5481                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5482                         }
5483                 } else {
5484                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5485                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5486                         }
5487                 }
5488         }
5489 }
5490 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5491         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5492                 let contents = if o.result_ok {
5493                         let result = unsafe { o.contents.result };
5494                         unsafe { o.contents.result = core::ptr::null_mut() };
5495                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5496                 } else {
5497                         let err = unsafe { o.contents.err };
5498                         unsafe { o.contents.err = core::ptr::null_mut(); }
5499                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5500                 };
5501                 Self {
5502                         contents,
5503                         result_ok: o.result_ok,
5504                 }
5505         }
5506 }
5507 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5508         fn clone(&self) -> Self {
5509                 if self.result_ok {
5510                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5511                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5512                         } }
5513                 } else {
5514                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5515                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5516                         } }
5517                 }
5518         }
5519 }
5520 #[no_mangle]
5521 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5522 /// but with all dynamically-allocated buffers duplicated in new buffers.
5523 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5524 #[repr(C)]
5525 /// A dynamically-allocated array of u64s of arbitrary size.
5526 /// This corresponds to std::vector in C++
5527 pub struct CVec_u64Z {
5528         /// The elements in the array.
5529         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5530         pub data: *mut u64,
5531         /// The number of elements pointed to by `data`.
5532         pub datalen: usize
5533 }
5534 impl CVec_u64Z {
5535         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5536                 if self.datalen == 0 { return Vec::new(); }
5537                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5538                 self.data = core::ptr::null_mut();
5539                 self.datalen = 0;
5540                 ret
5541         }
5542         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5543                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5544         }
5545 }
5546 impl From<Vec<u64>> for CVec_u64Z {
5547         fn from(v: Vec<u64>) -> Self {
5548                 let datalen = v.len();
5549                 let data = Box::into_raw(v.into_boxed_slice());
5550                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5551         }
5552 }
5553 #[no_mangle]
5554 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5555 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5556 impl Drop for CVec_u64Z {
5557         fn drop(&mut self) {
5558                 if self.datalen == 0 { return; }
5559                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5560         }
5561 }
5562 impl Clone for CVec_u64Z {
5563         fn clone(&self) -> Self {
5564                 let mut res = Vec::new();
5565                 if self.datalen == 0 { return Self::from(res); }
5566                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5567                 Self::from(res)
5568         }
5569 }
5570 #[repr(C)]
5571 /// The contents of CResult_NodeInfoDecodeErrorZ
5572 pub union CResult_NodeInfoDecodeErrorZPtr {
5573         /// A pointer to the contents in the success state.
5574         /// Reading from this pointer when `result_ok` is not set is undefined.
5575         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5576         /// A pointer to the contents in the error state.
5577         /// Reading from this pointer when `result_ok` is set is undefined.
5578         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5579 }
5580 #[repr(C)]
5581 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5582 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5583 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5584 pub struct CResult_NodeInfoDecodeErrorZ {
5585         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5586         /// `err` or `result` depending on the state of `result_ok`.
5587         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5588         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5589         pub result_ok: bool,
5590 }
5591 #[no_mangle]
5592 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5593 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5594         CResult_NodeInfoDecodeErrorZ {
5595                 contents: CResult_NodeInfoDecodeErrorZPtr {
5596                         result: Box::into_raw(Box::new(o)),
5597                 },
5598                 result_ok: true,
5599         }
5600 }
5601 #[no_mangle]
5602 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5603 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5604         CResult_NodeInfoDecodeErrorZ {
5605                 contents: CResult_NodeInfoDecodeErrorZPtr {
5606                         err: Box::into_raw(Box::new(e)),
5607                 },
5608                 result_ok: false,
5609         }
5610 }
5611 /// Checks if the given object is currently in the success state
5612 #[no_mangle]
5613 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5614         o.result_ok
5615 }
5616 #[no_mangle]
5617 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5618 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5619 impl Drop for CResult_NodeInfoDecodeErrorZ {
5620         fn drop(&mut self) {
5621                 if self.result_ok {
5622                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5623                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5624                         }
5625                 } else {
5626                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5627                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5628                         }
5629                 }
5630         }
5631 }
5632 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5633         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5634                 let contents = if o.result_ok {
5635                         let result = unsafe { o.contents.result };
5636                         unsafe { o.contents.result = core::ptr::null_mut() };
5637                         CResult_NodeInfoDecodeErrorZPtr { result }
5638                 } else {
5639                         let err = unsafe { o.contents.err };
5640                         unsafe { o.contents.err = core::ptr::null_mut(); }
5641                         CResult_NodeInfoDecodeErrorZPtr { err }
5642                 };
5643                 Self {
5644                         contents,
5645                         result_ok: o.result_ok,
5646                 }
5647         }
5648 }
5649 impl Clone for CResult_NodeInfoDecodeErrorZ {
5650         fn clone(&self) -> Self {
5651                 if self.result_ok {
5652                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5653                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5654                         } }
5655                 } else {
5656                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5657                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5658                         } }
5659                 }
5660         }
5661 }
5662 #[no_mangle]
5663 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5664 /// but with all dynamically-allocated buffers duplicated in new buffers.
5665 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5666 #[repr(C)]
5667 /// The contents of CResult_NetworkGraphDecodeErrorZ
5668 pub union CResult_NetworkGraphDecodeErrorZPtr {
5669         /// A pointer to the contents in the success state.
5670         /// Reading from this pointer when `result_ok` is not set is undefined.
5671         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5672         /// A pointer to the contents in the error state.
5673         /// Reading from this pointer when `result_ok` is set is undefined.
5674         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5675 }
5676 #[repr(C)]
5677 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5678 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5680 pub struct CResult_NetworkGraphDecodeErrorZ {
5681         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5682         /// `err` or `result` depending on the state of `result_ok`.
5683         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5684         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5685         pub result_ok: bool,
5686 }
5687 #[no_mangle]
5688 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5689 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5690         CResult_NetworkGraphDecodeErrorZ {
5691                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5692                         result: Box::into_raw(Box::new(o)),
5693                 },
5694                 result_ok: true,
5695         }
5696 }
5697 #[no_mangle]
5698 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5699 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5700         CResult_NetworkGraphDecodeErrorZ {
5701                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5702                         err: Box::into_raw(Box::new(e)),
5703                 },
5704                 result_ok: false,
5705         }
5706 }
5707 /// Checks if the given object is currently in the success state
5708 #[no_mangle]
5709 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
5710         o.result_ok
5711 }
5712 #[no_mangle]
5713 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5714 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5715 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5716         fn drop(&mut self) {
5717                 if self.result_ok {
5718                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5719                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5720                         }
5721                 } else {
5722                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5723                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5724                         }
5725                 }
5726         }
5727 }
5728 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5729         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5730                 let contents = if o.result_ok {
5731                         let result = unsafe { o.contents.result };
5732                         unsafe { o.contents.result = core::ptr::null_mut() };
5733                         CResult_NetworkGraphDecodeErrorZPtr { result }
5734                 } else {
5735                         let err = unsafe { o.contents.err };
5736                         unsafe { o.contents.err = core::ptr::null_mut(); }
5737                         CResult_NetworkGraphDecodeErrorZPtr { err }
5738                 };
5739                 Self {
5740                         contents,
5741                         result_ok: o.result_ok,
5742                 }
5743         }
5744 }
5745 #[repr(C)]
5746 #[derive(Clone)]
5747 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5748 pub enum COption_CVec_NetAddressZZ {
5749         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5750         Some(crate::c_types::derived::CVec_NetAddressZ),
5751         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5752         None
5753 }
5754 impl COption_CVec_NetAddressZZ {
5755         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5756                 if let Self::None = self { false } else { true }
5757         }
5758         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5759                 !self.is_some()
5760         }
5761         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
5762                 if let Self::Some(v) = self { v } else { unreachable!() }
5763         }
5764 }
5765 #[no_mangle]
5766 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
5767 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
5768         COption_CVec_NetAddressZZ::Some(o)
5769 }
5770 #[no_mangle]
5771 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
5772 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
5773         COption_CVec_NetAddressZZ::None
5774 }
5775 #[no_mangle]
5776 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
5777 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
5778 #[no_mangle]
5779 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
5780 /// but with all dynamically-allocated buffers duplicated in new buffers.
5781 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
5782 #[repr(C)]
5783 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5784 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5785         /// A pointer to the contents in the success state.
5786         /// Reading from this pointer when `result_ok` is not set is undefined.
5787         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
5788         /// A pointer to the contents in the error state.
5789         /// Reading from this pointer when `result_ok` is set is undefined.
5790         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5791 }
5792 #[repr(C)]
5793 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5794 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5795 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5796 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5797         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5798         /// `err` or `result` depending on the state of `result_ok`.
5799         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
5800         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5801         pub result_ok: bool,
5802 }
5803 #[no_mangle]
5804 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
5805 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5806         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5807                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5808                         result: Box::into_raw(Box::new(o)),
5809                 },
5810                 result_ok: true,
5811         }
5812 }
5813 #[no_mangle]
5814 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
5815 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5816         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5817                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5818                         err: Box::into_raw(Box::new(e)),
5819                 },
5820                 result_ok: false,
5821         }
5822 }
5823 /// Checks if the given object is currently in the success state
5824 #[no_mangle]
5825 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
5826         o.result_ok
5827 }
5828 #[no_mangle]
5829 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
5830 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
5831 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5832         fn drop(&mut self) {
5833                 if self.result_ok {
5834                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5835                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5836                         }
5837                 } else {
5838                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5839                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5840                         }
5841                 }
5842         }
5843 }
5844 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5845         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5846                 let contents = if o.result_ok {
5847                         let result = unsafe { o.contents.result };
5848                         unsafe { o.contents.result = core::ptr::null_mut() };
5849                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
5850                 } else {
5851                         let err = unsafe { o.contents.err };
5852                         unsafe { o.contents.err = core::ptr::null_mut(); }
5853                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
5854                 };
5855                 Self {
5856                         contents,
5857                         result_ok: o.result_ok,
5858                 }
5859         }
5860 }
5861 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5862         fn clone(&self) -> Self {
5863                 if self.result_ok {
5864                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5865                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5866                         } }
5867                 } else {
5868                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5869                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5870                         } }
5871                 }
5872         }
5873 }
5874 #[no_mangle]
5875 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5876 /// but with all dynamically-allocated buffers duplicated in new buffers.
5877 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5878 #[repr(C)]
5879 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5880 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5881         /// A pointer to the contents in the success state.
5882         /// Reading from this pointer when `result_ok` is not set is undefined.
5883         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
5884         /// A pointer to the contents in the error state.
5885         /// Reading from this pointer when `result_ok` is set is undefined.
5886         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5887 }
5888 #[repr(C)]
5889 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5890 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5893         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5894         /// `err` or `result` depending on the state of `result_ok`.
5895         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
5896         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5897         pub result_ok: bool,
5898 }
5899 #[no_mangle]
5900 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
5901 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5902         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5903                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5904                         result: Box::into_raw(Box::new(o)),
5905                 },
5906                 result_ok: true,
5907         }
5908 }
5909 #[no_mangle]
5910 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
5911 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5912         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5913                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5914                         err: Box::into_raw(Box::new(e)),
5915                 },
5916                 result_ok: false,
5917         }
5918 }
5919 /// Checks if the given object is currently in the success state
5920 #[no_mangle]
5921 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
5922         o.result_ok
5923 }
5924 #[no_mangle]
5925 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
5926 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
5927 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5928         fn drop(&mut self) {
5929                 if self.result_ok {
5930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5932                         }
5933                 } else {
5934                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5935                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5936                         }
5937                 }
5938         }
5939 }
5940 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5941         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
5942                 let contents = if o.result_ok {
5943                         let result = unsafe { o.contents.result };
5944                         unsafe { o.contents.result = core::ptr::null_mut() };
5945                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
5946                 } else {
5947                         let err = unsafe { o.contents.err };
5948                         unsafe { o.contents.err = core::ptr::null_mut(); }
5949                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
5950                 };
5951                 Self {
5952                         contents,
5953                         result_ok: o.result_ok,
5954                 }
5955         }
5956 }
5957 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5958         fn clone(&self) -> Self {
5959                 if self.result_ok {
5960                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5961                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
5962                         } }
5963                 } else {
5964                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5965                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5966                         } }
5967                 }
5968         }
5969 }
5970 #[no_mangle]
5971 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
5972 /// but with all dynamically-allocated buffers duplicated in new buffers.
5973 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
5974 #[repr(C)]
5975 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5976 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
5977         /// A pointer to the contents in the success state.
5978         /// Reading from this pointer when `result_ok` is not set is undefined.
5979         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
5980         /// A pointer to the contents in the error state.
5981         /// Reading from this pointer when `result_ok` is set is undefined.
5982         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5983 }
5984 #[repr(C)]
5985 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5986 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5987 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5988 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
5989         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5990         /// `err` or `result` depending on the state of `result_ok`.
5991         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
5992         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5993         pub result_ok: bool,
5994 }
5995 #[no_mangle]
5996 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
5997 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
5998         CResult_SpendableOutputDescriptorDecodeErrorZ {
5999                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6000                         result: Box::into_raw(Box::new(o)),
6001                 },
6002                 result_ok: true,
6003         }
6004 }
6005 #[no_mangle]
6006 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6007 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6008         CResult_SpendableOutputDescriptorDecodeErrorZ {
6009                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6010                         err: Box::into_raw(Box::new(e)),
6011                 },
6012                 result_ok: false,
6013         }
6014 }
6015 /// Checks if the given object is currently in the success state
6016 #[no_mangle]
6017 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6018         o.result_ok
6019 }
6020 #[no_mangle]
6021 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6022 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6023 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6024         fn drop(&mut self) {
6025                 if self.result_ok {
6026                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6027                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6028                         }
6029                 } else {
6030                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6031                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6032                         }
6033                 }
6034         }
6035 }
6036 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6037         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6038                 let contents = if o.result_ok {
6039                         let result = unsafe { o.contents.result };
6040                         unsafe { o.contents.result = core::ptr::null_mut() };
6041                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6042                 } else {
6043                         let err = unsafe { o.contents.err };
6044                         unsafe { o.contents.err = core::ptr::null_mut(); }
6045                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6046                 };
6047                 Self {
6048                         contents,
6049                         result_ok: o.result_ok,
6050                 }
6051         }
6052 }
6053 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6054         fn clone(&self) -> Self {
6055                 if self.result_ok {
6056                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6057                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6058                         } }
6059                 } else {
6060                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6061                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6062                         } }
6063                 }
6064         }
6065 }
6066 #[no_mangle]
6067 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6068 /// but with all dynamically-allocated buffers duplicated in new buffers.
6069 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6070 #[repr(C)]
6071 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6072 /// This corresponds to std::vector in C++
6073 pub struct CVec_PaymentPreimageZ {
6074         /// The elements in the array.
6075         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6076         pub data: *mut crate::c_types::ThirtyTwoBytes,
6077         /// The number of elements pointed to by `data`.
6078         pub datalen: usize
6079 }
6080 impl CVec_PaymentPreimageZ {
6081         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6082                 if self.datalen == 0 { return Vec::new(); }
6083                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6084                 self.data = core::ptr::null_mut();
6085                 self.datalen = 0;
6086                 ret
6087         }
6088         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6089                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6090         }
6091 }
6092 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6093         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6094                 let datalen = v.len();
6095                 let data = Box::into_raw(v.into_boxed_slice());
6096                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6097         }
6098 }
6099 #[no_mangle]
6100 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6101 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6102 impl Drop for CVec_PaymentPreimageZ {
6103         fn drop(&mut self) {
6104                 if self.datalen == 0 { return; }
6105                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6106         }
6107 }
6108 impl Clone for CVec_PaymentPreimageZ {
6109         fn clone(&self) -> Self {
6110                 let mut res = Vec::new();
6111                 if self.datalen == 0 { return Self::from(res); }
6112                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6113                 Self::from(res)
6114         }
6115 }
6116 #[repr(C)]
6117 /// A tuple of 2 elements. See the individual fields for the types contained.
6118 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6119         /// The element at position 0
6120         pub a: crate::c_types::Signature,
6121         /// The element at position 1
6122         pub b: crate::c_types::derived::CVec_SignatureZ,
6123 }
6124 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6125         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6126                 Self {
6127                         a: tup.0,
6128                         b: tup.1,
6129                 }
6130         }
6131 }
6132 impl C2Tuple_SignatureCVec_SignatureZZ {
6133         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6134                 (self.a, self.b)
6135         }
6136 }
6137 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6138         fn clone(&self) -> Self {
6139                 Self {
6140                         a: Clone::clone(&self.a),
6141                         b: Clone::clone(&self.b),
6142                 }
6143         }
6144 }
6145 #[no_mangle]
6146 /// Creates a new tuple which has the same data as `orig`
6147 /// but with all dynamically-allocated buffers duplicated in new buffers.
6148 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6149 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6150 #[no_mangle]
6151 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6152         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6153 }
6154
6155 #[no_mangle]
6156 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6157 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6158 #[repr(C)]
6159 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6160 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6161         /// A pointer to the contents in the success state.
6162         /// Reading from this pointer when `result_ok` is not set is undefined.
6163         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6164         /// Note that this value is always NULL, as there are no contents in the Err variant
6165         pub err: *mut core::ffi::c_void,
6166 }
6167 #[repr(C)]
6168 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6169 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6171 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6172         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6173         /// `err` or `result` depending on the state of `result_ok`.
6174         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6175         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6176         pub result_ok: bool,
6177 }
6178 #[no_mangle]
6179 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6180 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6181         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6182                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6183                         result: Box::into_raw(Box::new(o)),
6184                 },
6185                 result_ok: true,
6186         }
6187 }
6188 #[no_mangle]
6189 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6190 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6191         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6192                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6193                         err: core::ptr::null_mut(),
6194                 },
6195                 result_ok: false,
6196         }
6197 }
6198 /// Checks if the given object is currently in the success state
6199 #[no_mangle]
6200 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6201         o.result_ok
6202 }
6203 #[no_mangle]
6204 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6205 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6206 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6207         fn drop(&mut self) {
6208                 if self.result_ok {
6209                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6210                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6211                         }
6212                 } else {
6213                 }
6214         }
6215 }
6216 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6217         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6218                 let contents = if o.result_ok {
6219                         let result = unsafe { o.contents.result };
6220                         unsafe { o.contents.result = core::ptr::null_mut() };
6221                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6222                 } else {
6223                         let _ = unsafe { Box::from_raw(o.contents.err) };
6224                         o.contents.err = core::ptr::null_mut();
6225                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6226                 };
6227                 Self {
6228                         contents,
6229                         result_ok: o.result_ok,
6230                 }
6231         }
6232 }
6233 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6234         fn clone(&self) -> Self {
6235                 if self.result_ok {
6236                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6237                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6238                         } }
6239                 } else {
6240                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6241                                 err: core::ptr::null_mut()
6242                         } }
6243                 }
6244         }
6245 }
6246 #[no_mangle]
6247 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6248 /// but with all dynamically-allocated buffers duplicated in new buffers.
6249 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6250 #[repr(C)]
6251 /// The contents of CResult_SignatureNoneZ
6252 pub union CResult_SignatureNoneZPtr {
6253         /// A pointer to the contents in the success state.
6254         /// Reading from this pointer when `result_ok` is not set is undefined.
6255         pub result: *mut crate::c_types::Signature,
6256         /// Note that this value is always NULL, as there are no contents in the Err variant
6257         pub err: *mut core::ffi::c_void,
6258 }
6259 #[repr(C)]
6260 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6261 /// containing a crate::c_types::Signature on success and a () on failure.
6262 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6263 pub struct CResult_SignatureNoneZ {
6264         /// The contents of this CResult_SignatureNoneZ, accessible via either
6265         /// `err` or `result` depending on the state of `result_ok`.
6266         pub contents: CResult_SignatureNoneZPtr,
6267         /// Whether this CResult_SignatureNoneZ represents a success state.
6268         pub result_ok: bool,
6269 }
6270 #[no_mangle]
6271 /// Creates a new CResult_SignatureNoneZ in the success state.
6272 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6273         CResult_SignatureNoneZ {
6274                 contents: CResult_SignatureNoneZPtr {
6275                         result: Box::into_raw(Box::new(o)),
6276                 },
6277                 result_ok: true,
6278         }
6279 }
6280 #[no_mangle]
6281 /// Creates a new CResult_SignatureNoneZ in the error state.
6282 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6283         CResult_SignatureNoneZ {
6284                 contents: CResult_SignatureNoneZPtr {
6285                         err: core::ptr::null_mut(),
6286                 },
6287                 result_ok: false,
6288         }
6289 }
6290 /// Checks if the given object is currently in the success state
6291 #[no_mangle]
6292 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6293         o.result_ok
6294 }
6295 #[no_mangle]
6296 /// Frees any resources used by the CResult_SignatureNoneZ.
6297 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6298 impl Drop for CResult_SignatureNoneZ {
6299         fn drop(&mut self) {
6300                 if self.result_ok {
6301                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6302                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6303                         }
6304                 } else {
6305                 }
6306         }
6307 }
6308 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6309         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6310                 let contents = if o.result_ok {
6311                         let result = unsafe { o.contents.result };
6312                         unsafe { o.contents.result = core::ptr::null_mut() };
6313                         CResult_SignatureNoneZPtr { result }
6314                 } else {
6315                         let _ = unsafe { Box::from_raw(o.contents.err) };
6316                         o.contents.err = core::ptr::null_mut();
6317                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6318                 };
6319                 Self {
6320                         contents,
6321                         result_ok: o.result_ok,
6322                 }
6323         }
6324 }
6325 impl Clone for CResult_SignatureNoneZ {
6326         fn clone(&self) -> Self {
6327                 if self.result_ok {
6328                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6329                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6330                         } }
6331                 } else {
6332                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6333                                 err: core::ptr::null_mut()
6334                         } }
6335                 }
6336         }
6337 }
6338 #[no_mangle]
6339 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6340 /// but with all dynamically-allocated buffers duplicated in new buffers.
6341 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6342 #[repr(C)]
6343 /// A tuple of 2 elements. See the individual fields for the types contained.
6344 pub struct C2Tuple_SignatureSignatureZ {
6345         /// The element at position 0
6346         pub a: crate::c_types::Signature,
6347         /// The element at position 1
6348         pub b: crate::c_types::Signature,
6349 }
6350 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6351         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6352                 Self {
6353                         a: tup.0,
6354                         b: tup.1,
6355                 }
6356         }
6357 }
6358 impl C2Tuple_SignatureSignatureZ {
6359         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6360                 (self.a, self.b)
6361         }
6362 }
6363 impl Clone for C2Tuple_SignatureSignatureZ {
6364         fn clone(&self) -> Self {
6365                 Self {
6366                         a: Clone::clone(&self.a),
6367                         b: Clone::clone(&self.b),
6368                 }
6369         }
6370 }
6371 #[no_mangle]
6372 /// Creates a new tuple which has the same data as `orig`
6373 /// but with all dynamically-allocated buffers duplicated in new buffers.
6374 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6375 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6376 #[no_mangle]
6377 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6378         C2Tuple_SignatureSignatureZ { a, b, }
6379 }
6380
6381 #[no_mangle]
6382 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6383 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6384 #[repr(C)]
6385 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6386 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6387         /// A pointer to the contents in the success state.
6388         /// Reading from this pointer when `result_ok` is not set is undefined.
6389         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6390         /// Note that this value is always NULL, as there are no contents in the Err variant
6391         pub err: *mut core::ffi::c_void,
6392 }
6393 #[repr(C)]
6394 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6395 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6397 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6398         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6399         /// `err` or `result` depending on the state of `result_ok`.
6400         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6401         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6402         pub result_ok: bool,
6403 }
6404 #[no_mangle]
6405 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6406 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6407         CResult_C2Tuple_SignatureSignatureZNoneZ {
6408                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6409                         result: Box::into_raw(Box::new(o)),
6410                 },
6411                 result_ok: true,
6412         }
6413 }
6414 #[no_mangle]
6415 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6416 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6417         CResult_C2Tuple_SignatureSignatureZNoneZ {
6418                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6419                         err: core::ptr::null_mut(),
6420                 },
6421                 result_ok: false,
6422         }
6423 }
6424 /// Checks if the given object is currently in the success state
6425 #[no_mangle]
6426 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6427         o.result_ok
6428 }
6429 #[no_mangle]
6430 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6431 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6432 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6433         fn drop(&mut self) {
6434                 if self.result_ok {
6435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6437                         }
6438                 } else {
6439                 }
6440         }
6441 }
6442 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6443         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6444                 let contents = if o.result_ok {
6445                         let result = unsafe { o.contents.result };
6446                         unsafe { o.contents.result = core::ptr::null_mut() };
6447                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6448                 } else {
6449                         let _ = unsafe { Box::from_raw(o.contents.err) };
6450                         o.contents.err = core::ptr::null_mut();
6451                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6452                 };
6453                 Self {
6454                         contents,
6455                         result_ok: o.result_ok,
6456                 }
6457         }
6458 }
6459 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6460         fn clone(&self) -> Self {
6461                 if self.result_ok {
6462                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6463                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6464                         } }
6465                 } else {
6466                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6467                                 err: core::ptr::null_mut()
6468                         } }
6469                 }
6470         }
6471 }
6472 #[no_mangle]
6473 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6474 /// but with all dynamically-allocated buffers duplicated in new buffers.
6475 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6476 #[repr(C)]
6477 /// The contents of CResult_SecretKeyNoneZ
6478 pub union CResult_SecretKeyNoneZPtr {
6479         /// A pointer to the contents in the success state.
6480         /// Reading from this pointer when `result_ok` is not set is undefined.
6481         pub result: *mut crate::c_types::SecretKey,
6482         /// Note that this value is always NULL, as there are no contents in the Err variant
6483         pub err: *mut core::ffi::c_void,
6484 }
6485 #[repr(C)]
6486 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6487 /// containing a crate::c_types::SecretKey on success and a () on failure.
6488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6489 pub struct CResult_SecretKeyNoneZ {
6490         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6491         /// `err` or `result` depending on the state of `result_ok`.
6492         pub contents: CResult_SecretKeyNoneZPtr,
6493         /// Whether this CResult_SecretKeyNoneZ represents a success state.
6494         pub result_ok: bool,
6495 }
6496 #[no_mangle]
6497 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6498 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6499         CResult_SecretKeyNoneZ {
6500                 contents: CResult_SecretKeyNoneZPtr {
6501                         result: Box::into_raw(Box::new(o)),
6502                 },
6503                 result_ok: true,
6504         }
6505 }
6506 #[no_mangle]
6507 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6508 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6509         CResult_SecretKeyNoneZ {
6510                 contents: CResult_SecretKeyNoneZPtr {
6511                         err: core::ptr::null_mut(),
6512                 },
6513                 result_ok: false,
6514         }
6515 }
6516 /// Checks if the given object is currently in the success state
6517 #[no_mangle]
6518 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6519         o.result_ok
6520 }
6521 #[no_mangle]
6522 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6523 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6524 impl Drop for CResult_SecretKeyNoneZ {
6525         fn drop(&mut self) {
6526                 if self.result_ok {
6527                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6528                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6529                         }
6530                 } else {
6531                 }
6532         }
6533 }
6534 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6535         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6536                 let contents = if o.result_ok {
6537                         let result = unsafe { o.contents.result };
6538                         unsafe { o.contents.result = core::ptr::null_mut() };
6539                         CResult_SecretKeyNoneZPtr { result }
6540                 } else {
6541                         let _ = unsafe { Box::from_raw(o.contents.err) };
6542                         o.contents.err = core::ptr::null_mut();
6543                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6544                 };
6545                 Self {
6546                         contents,
6547                         result_ok: o.result_ok,
6548                 }
6549         }
6550 }
6551 impl Clone for CResult_SecretKeyNoneZ {
6552         fn clone(&self) -> Self {
6553                 if self.result_ok {
6554                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6555                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6556                         } }
6557                 } else {
6558                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6559                                 err: core::ptr::null_mut()
6560                         } }
6561                 }
6562         }
6563 }
6564 #[no_mangle]
6565 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6566 /// but with all dynamically-allocated buffers duplicated in new buffers.
6567 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6568 #[repr(C)]
6569 /// The contents of CResult_SignDecodeErrorZ
6570 pub union CResult_SignDecodeErrorZPtr {
6571         /// A pointer to the contents in the success state.
6572         /// Reading from this pointer when `result_ok` is not set is undefined.
6573         pub result: *mut crate::lightning::chain::keysinterface::Sign,
6574         /// A pointer to the contents in the error state.
6575         /// Reading from this pointer when `result_ok` is set is undefined.
6576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6577 }
6578 #[repr(C)]
6579 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6580 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6582 pub struct CResult_SignDecodeErrorZ {
6583         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6584         /// `err` or `result` depending on the state of `result_ok`.
6585         pub contents: CResult_SignDecodeErrorZPtr,
6586         /// Whether this CResult_SignDecodeErrorZ represents a success state.
6587         pub result_ok: bool,
6588 }
6589 #[no_mangle]
6590 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6591 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6592         CResult_SignDecodeErrorZ {
6593                 contents: CResult_SignDecodeErrorZPtr {
6594                         result: Box::into_raw(Box::new(o)),
6595                 },
6596                 result_ok: true,
6597         }
6598 }
6599 #[no_mangle]
6600 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6601 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6602         CResult_SignDecodeErrorZ {
6603                 contents: CResult_SignDecodeErrorZPtr {
6604                         err: Box::into_raw(Box::new(e)),
6605                 },
6606                 result_ok: false,
6607         }
6608 }
6609 /// Checks if the given object is currently in the success state
6610 #[no_mangle]
6611 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6612         o.result_ok
6613 }
6614 #[no_mangle]
6615 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6616 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6617 impl Drop for CResult_SignDecodeErrorZ {
6618         fn drop(&mut self) {
6619                 if self.result_ok {
6620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6622                         }
6623                 } else {
6624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6626                         }
6627                 }
6628         }
6629 }
6630 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6632                 let contents = if o.result_ok {
6633                         let result = unsafe { o.contents.result };
6634                         unsafe { o.contents.result = core::ptr::null_mut() };
6635                         CResult_SignDecodeErrorZPtr { result }
6636                 } else {
6637                         let err = unsafe { o.contents.err };
6638                         unsafe { o.contents.err = core::ptr::null_mut(); }
6639                         CResult_SignDecodeErrorZPtr { err }
6640                 };
6641                 Self {
6642                         contents,
6643                         result_ok: o.result_ok,
6644                 }
6645         }
6646 }
6647 impl Clone for CResult_SignDecodeErrorZ {
6648         fn clone(&self) -> Self {
6649                 if self.result_ok {
6650                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6651                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6652                         } }
6653                 } else {
6654                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6656                         } }
6657                 }
6658         }
6659 }
6660 #[no_mangle]
6661 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6662 /// but with all dynamically-allocated buffers duplicated in new buffers.
6663 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6664 #[repr(C)]
6665 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6666 /// This corresponds to std::vector in C++
6667 pub struct CVec_u5Z {
6668         /// The elements in the array.
6669         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6670         pub data: *mut crate::c_types::u5,
6671         /// The number of elements pointed to by `data`.
6672         pub datalen: usize
6673 }
6674 impl CVec_u5Z {
6675         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
6676                 if self.datalen == 0 { return Vec::new(); }
6677                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6678                 self.data = core::ptr::null_mut();
6679                 self.datalen = 0;
6680                 ret
6681         }
6682         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
6683                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6684         }
6685 }
6686 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
6687         fn from(v: Vec<crate::c_types::u5>) -> Self {
6688                 let datalen = v.len();
6689                 let data = Box::into_raw(v.into_boxed_slice());
6690                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6691         }
6692 }
6693 #[no_mangle]
6694 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6695 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
6696 impl Drop for CVec_u5Z {
6697         fn drop(&mut self) {
6698                 if self.datalen == 0 { return; }
6699                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6700         }
6701 }
6702 impl Clone for CVec_u5Z {
6703         fn clone(&self) -> Self {
6704                 let mut res = Vec::new();
6705                 if self.datalen == 0 { return Self::from(res); }
6706                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6707                 Self::from(res)
6708         }
6709 }
6710 #[repr(C)]
6711 /// The contents of CResult_RecoverableSignatureNoneZ
6712 pub union CResult_RecoverableSignatureNoneZPtr {
6713         /// A pointer to the contents in the success state.
6714         /// Reading from this pointer when `result_ok` is not set is undefined.
6715         pub result: *mut crate::c_types::RecoverableSignature,
6716         /// Note that this value is always NULL, as there are no contents in the Err variant
6717         pub err: *mut core::ffi::c_void,
6718 }
6719 #[repr(C)]
6720 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6721 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
6722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6723 pub struct CResult_RecoverableSignatureNoneZ {
6724         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6725         /// `err` or `result` depending on the state of `result_ok`.
6726         pub contents: CResult_RecoverableSignatureNoneZPtr,
6727         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6728         pub result_ok: bool,
6729 }
6730 #[no_mangle]
6731 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
6732 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
6733         CResult_RecoverableSignatureNoneZ {
6734                 contents: CResult_RecoverableSignatureNoneZPtr {
6735                         result: Box::into_raw(Box::new(o)),
6736                 },
6737                 result_ok: true,
6738         }
6739 }
6740 #[no_mangle]
6741 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
6742 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
6743         CResult_RecoverableSignatureNoneZ {
6744                 contents: CResult_RecoverableSignatureNoneZPtr {
6745                         err: core::ptr::null_mut(),
6746                 },
6747                 result_ok: false,
6748         }
6749 }
6750 /// Checks if the given object is currently in the success state
6751 #[no_mangle]
6752 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
6753         o.result_ok
6754 }
6755 #[no_mangle]
6756 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
6757 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
6758 impl Drop for CResult_RecoverableSignatureNoneZ {
6759         fn drop(&mut self) {
6760                 if self.result_ok {
6761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6763                         }
6764                 } else {
6765                 }
6766         }
6767 }
6768 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
6769         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
6770                 let contents = if o.result_ok {
6771                         let result = unsafe { o.contents.result };
6772                         unsafe { o.contents.result = core::ptr::null_mut() };
6773                         CResult_RecoverableSignatureNoneZPtr { result }
6774                 } else {
6775                         let _ = unsafe { Box::from_raw(o.contents.err) };
6776                         o.contents.err = core::ptr::null_mut();
6777                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
6778                 };
6779                 Self {
6780                         contents,
6781                         result_ok: o.result_ok,
6782                 }
6783         }
6784 }
6785 impl Clone for CResult_RecoverableSignatureNoneZ {
6786         fn clone(&self) -> Self {
6787                 if self.result_ok {
6788                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
6789                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
6790                         } }
6791                 } else {
6792                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
6793                                 err: core::ptr::null_mut()
6794                         } }
6795                 }
6796         }
6797 }
6798 #[no_mangle]
6799 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
6800 /// but with all dynamically-allocated buffers duplicated in new buffers.
6801 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
6802 #[repr(C)]
6803 /// A dynamically-allocated array of u8s of arbitrary size.
6804 /// This corresponds to std::vector in C++
6805 pub struct CVec_u8Z {
6806         /// The elements in the array.
6807         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6808         pub data: *mut u8,
6809         /// The number of elements pointed to by `data`.
6810         pub datalen: usize
6811 }
6812 impl CVec_u8Z {
6813         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
6814                 if self.datalen == 0 { return Vec::new(); }
6815                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6816                 self.data = core::ptr::null_mut();
6817                 self.datalen = 0;
6818                 ret
6819         }
6820         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
6821                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6822         }
6823 }
6824 impl From<Vec<u8>> for CVec_u8Z {
6825         fn from(v: Vec<u8>) -> Self {
6826                 let datalen = v.len();
6827                 let data = Box::into_raw(v.into_boxed_slice());
6828                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6829         }
6830 }
6831 #[no_mangle]
6832 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6833 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
6834 impl Drop for CVec_u8Z {
6835         fn drop(&mut self) {
6836                 if self.datalen == 0 { return; }
6837                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6838         }
6839 }
6840 impl Clone for CVec_u8Z {
6841         fn clone(&self) -> Self {
6842                 let mut res = Vec::new();
6843                 if self.datalen == 0 { return Self::from(res); }
6844                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6845                 Self::from(res)
6846         }
6847 }
6848 #[repr(C)]
6849 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6850 /// This corresponds to std::vector in C++
6851 pub struct CVec_CVec_u8ZZ {
6852         /// The elements in the array.
6853         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6854         pub data: *mut crate::c_types::derived::CVec_u8Z,
6855         /// The number of elements pointed to by `data`.
6856         pub datalen: usize
6857 }
6858 impl CVec_CVec_u8ZZ {
6859         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
6860                 if self.datalen == 0 { return Vec::new(); }
6861                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6862                 self.data = core::ptr::null_mut();
6863                 self.datalen = 0;
6864                 ret
6865         }
6866         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
6867                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6868         }
6869 }
6870 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
6871         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
6872                 let datalen = v.len();
6873                 let data = Box::into_raw(v.into_boxed_slice());
6874                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6875         }
6876 }
6877 #[no_mangle]
6878 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6879 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
6880 impl Drop for CVec_CVec_u8ZZ {
6881         fn drop(&mut self) {
6882                 if self.datalen == 0 { return; }
6883                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6884         }
6885 }
6886 impl Clone for CVec_CVec_u8ZZ {
6887         fn clone(&self) -> Self {
6888                 let mut res = Vec::new();
6889                 if self.datalen == 0 { return Self::from(res); }
6890                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6891                 Self::from(res)
6892         }
6893 }
6894 #[repr(C)]
6895 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
6896 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
6897         /// A pointer to the contents in the success state.
6898         /// Reading from this pointer when `result_ok` is not set is undefined.
6899         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
6900         /// Note that this value is always NULL, as there are no contents in the Err variant
6901         pub err: *mut core::ffi::c_void,
6902 }
6903 #[repr(C)]
6904 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6905 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6906 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6907 pub struct CResult_CVec_CVec_u8ZZNoneZ {
6908         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6909         /// `err` or `result` depending on the state of `result_ok`.
6910         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
6911         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6912         pub result_ok: bool,
6913 }
6914 #[no_mangle]
6915 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
6916 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
6917         CResult_CVec_CVec_u8ZZNoneZ {
6918                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6919                         result: Box::into_raw(Box::new(o)),
6920                 },
6921                 result_ok: true,
6922         }
6923 }
6924 #[no_mangle]
6925 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
6926 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
6927         CResult_CVec_CVec_u8ZZNoneZ {
6928                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6929                         err: core::ptr::null_mut(),
6930                 },
6931                 result_ok: false,
6932         }
6933 }
6934 /// Checks if the given object is currently in the success state
6935 #[no_mangle]
6936 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
6937         o.result_ok
6938 }
6939 #[no_mangle]
6940 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
6941 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
6942 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
6943         fn drop(&mut self) {
6944                 if self.result_ok {
6945                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6946                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6947                         }
6948                 } else {
6949                 }
6950         }
6951 }
6952 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
6953         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
6954                 let contents = if o.result_ok {
6955                         let result = unsafe { o.contents.result };
6956                         unsafe { o.contents.result = core::ptr::null_mut() };
6957                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
6958                 } else {
6959                         let _ = unsafe { Box::from_raw(o.contents.err) };
6960                         o.contents.err = core::ptr::null_mut();
6961                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
6962                 };
6963                 Self {
6964                         contents,
6965                         result_ok: o.result_ok,
6966                 }
6967         }
6968 }
6969 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
6970         fn clone(&self) -> Self {
6971                 if self.result_ok {
6972                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6973                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
6974                         } }
6975                 } else {
6976                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
6977                                 err: core::ptr::null_mut()
6978                         } }
6979                 }
6980         }
6981 }
6982 #[no_mangle]
6983 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
6984 /// but with all dynamically-allocated buffers duplicated in new buffers.
6985 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
6986 #[repr(C)]
6987 /// The contents of CResult_InMemorySignerDecodeErrorZ
6988 pub union CResult_InMemorySignerDecodeErrorZPtr {
6989         /// A pointer to the contents in the success state.
6990         /// Reading from this pointer when `result_ok` is not set is undefined.
6991         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
6992         /// A pointer to the contents in the error state.
6993         /// Reading from this pointer when `result_ok` is set is undefined.
6994         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6995 }
6996 #[repr(C)]
6997 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6998 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6999 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7000 pub struct CResult_InMemorySignerDecodeErrorZ {
7001         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7002         /// `err` or `result` depending on the state of `result_ok`.
7003         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7004         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7005         pub result_ok: bool,
7006 }
7007 #[no_mangle]
7008 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7009 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7010         CResult_InMemorySignerDecodeErrorZ {
7011                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7012                         result: Box::into_raw(Box::new(o)),
7013                 },
7014                 result_ok: true,
7015         }
7016 }
7017 #[no_mangle]
7018 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7019 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7020         CResult_InMemorySignerDecodeErrorZ {
7021                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7022                         err: Box::into_raw(Box::new(e)),
7023                 },
7024                 result_ok: false,
7025         }
7026 }
7027 /// Checks if the given object is currently in the success state
7028 #[no_mangle]
7029 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7030         o.result_ok
7031 }
7032 #[no_mangle]
7033 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7034 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7035 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7036         fn drop(&mut self) {
7037                 if self.result_ok {
7038                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7039                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7040                         }
7041                 } else {
7042                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7043                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7044                         }
7045                 }
7046         }
7047 }
7048 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7049         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7050                 let contents = if o.result_ok {
7051                         let result = unsafe { o.contents.result };
7052                         unsafe { o.contents.result = core::ptr::null_mut() };
7053                         CResult_InMemorySignerDecodeErrorZPtr { result }
7054                 } else {
7055                         let err = unsafe { o.contents.err };
7056                         unsafe { o.contents.err = core::ptr::null_mut(); }
7057                         CResult_InMemorySignerDecodeErrorZPtr { err }
7058                 };
7059                 Self {
7060                         contents,
7061                         result_ok: o.result_ok,
7062                 }
7063         }
7064 }
7065 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7066         fn clone(&self) -> Self {
7067                 if self.result_ok {
7068                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7069                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7070                         } }
7071                 } else {
7072                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7073                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7074                         } }
7075                 }
7076         }
7077 }
7078 #[no_mangle]
7079 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7080 /// but with all dynamically-allocated buffers duplicated in new buffers.
7081 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7082 #[repr(C)]
7083 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7084 /// This corresponds to std::vector in C++
7085 pub struct CVec_TxOutZ {
7086         /// The elements in the array.
7087         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7088         pub data: *mut crate::c_types::TxOut,
7089         /// The number of elements pointed to by `data`.
7090         pub datalen: usize
7091 }
7092 impl CVec_TxOutZ {
7093         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7094                 if self.datalen == 0 { return Vec::new(); }
7095                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7096                 self.data = core::ptr::null_mut();
7097                 self.datalen = 0;
7098                 ret
7099         }
7100         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7101                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7102         }
7103 }
7104 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7105         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7106                 let datalen = v.len();
7107                 let data = Box::into_raw(v.into_boxed_slice());
7108                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7109         }
7110 }
7111 #[no_mangle]
7112 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7113 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7114 impl Drop for CVec_TxOutZ {
7115         fn drop(&mut self) {
7116                 if self.datalen == 0 { return; }
7117                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7118         }
7119 }
7120 impl Clone for CVec_TxOutZ {
7121         fn clone(&self) -> Self {
7122                 let mut res = Vec::new();
7123                 if self.datalen == 0 { return Self::from(res); }
7124                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7125                 Self::from(res)
7126         }
7127 }
7128 #[repr(C)]
7129 /// The contents of CResult_TransactionNoneZ
7130 pub union CResult_TransactionNoneZPtr {
7131         /// A pointer to the contents in the success state.
7132         /// Reading from this pointer when `result_ok` is not set is undefined.
7133         pub result: *mut crate::c_types::Transaction,
7134         /// Note that this value is always NULL, as there are no contents in the Err variant
7135         pub err: *mut core::ffi::c_void,
7136 }
7137 #[repr(C)]
7138 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7139 /// containing a crate::c_types::Transaction on success and a () on failure.
7140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7141 pub struct CResult_TransactionNoneZ {
7142         /// The contents of this CResult_TransactionNoneZ, accessible via either
7143         /// `err` or `result` depending on the state of `result_ok`.
7144         pub contents: CResult_TransactionNoneZPtr,
7145         /// Whether this CResult_TransactionNoneZ represents a success state.
7146         pub result_ok: bool,
7147 }
7148 #[no_mangle]
7149 /// Creates a new CResult_TransactionNoneZ in the success state.
7150 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7151         CResult_TransactionNoneZ {
7152                 contents: CResult_TransactionNoneZPtr {
7153                         result: Box::into_raw(Box::new(o)),
7154                 },
7155                 result_ok: true,
7156         }
7157 }
7158 #[no_mangle]
7159 /// Creates a new CResult_TransactionNoneZ in the error state.
7160 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7161         CResult_TransactionNoneZ {
7162                 contents: CResult_TransactionNoneZPtr {
7163                         err: core::ptr::null_mut(),
7164                 },
7165                 result_ok: false,
7166         }
7167 }
7168 /// Checks if the given object is currently in the success state
7169 #[no_mangle]
7170 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7171         o.result_ok
7172 }
7173 #[no_mangle]
7174 /// Frees any resources used by the CResult_TransactionNoneZ.
7175 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7176 impl Drop for CResult_TransactionNoneZ {
7177         fn drop(&mut self) {
7178                 if self.result_ok {
7179                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7180                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7181                         }
7182                 } else {
7183                 }
7184         }
7185 }
7186 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7187         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7188                 let contents = if o.result_ok {
7189                         let result = unsafe { o.contents.result };
7190                         unsafe { o.contents.result = core::ptr::null_mut() };
7191                         CResult_TransactionNoneZPtr { result }
7192                 } else {
7193                         let _ = unsafe { Box::from_raw(o.contents.err) };
7194                         o.contents.err = core::ptr::null_mut();
7195                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7196                 };
7197                 Self {
7198                         contents,
7199                         result_ok: o.result_ok,
7200                 }
7201         }
7202 }
7203 impl Clone for CResult_TransactionNoneZ {
7204         fn clone(&self) -> Self {
7205                 if self.result_ok {
7206                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7207                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7208                         } }
7209                 } else {
7210                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7211                                 err: core::ptr::null_mut()
7212                         } }
7213                 }
7214         }
7215 }
7216 #[no_mangle]
7217 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7218 /// but with all dynamically-allocated buffers duplicated in new buffers.
7219 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7220 #[repr(C)]
7221 /// A tuple of 2 elements. See the individual fields for the types contained.
7222 pub struct C2Tuple_BlockHashChannelMonitorZ {
7223         /// The element at position 0
7224         pub a: crate::c_types::ThirtyTwoBytes,
7225         /// The element at position 1
7226         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7227 }
7228 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7229         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7230                 Self {
7231                         a: tup.0,
7232                         b: tup.1,
7233                 }
7234         }
7235 }
7236 impl C2Tuple_BlockHashChannelMonitorZ {
7237         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7238                 (self.a, self.b)
7239         }
7240 }
7241 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7242 #[no_mangle]
7243 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7244         C2Tuple_BlockHashChannelMonitorZ { a, b, }
7245 }
7246
7247 #[no_mangle]
7248 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7249 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7250 #[repr(C)]
7251 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7252 /// This corresponds to std::vector in C++
7253 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7254         /// The elements in the array.
7255         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7256         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7257         /// The number of elements pointed to by `data`.
7258         pub datalen: usize
7259 }
7260 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7261         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7262                 if self.datalen == 0 { return Vec::new(); }
7263                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7264                 self.data = core::ptr::null_mut();
7265                 self.datalen = 0;
7266                 ret
7267         }
7268         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7269                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7270         }
7271 }
7272 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7273         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7274                 let datalen = v.len();
7275                 let data = Box::into_raw(v.into_boxed_slice());
7276                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7277         }
7278 }
7279 #[no_mangle]
7280 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7281 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7282 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7283         fn drop(&mut self) {
7284                 if self.datalen == 0 { return; }
7285                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7286         }
7287 }
7288 #[repr(C)]
7289 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7290 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7291         /// A pointer to the contents in the success state.
7292         /// Reading from this pointer when `result_ok` is not set is undefined.
7293         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7294         /// A pointer to the contents in the error state.
7295         /// Reading from this pointer when `result_ok` is set is undefined.
7296         pub err: *mut crate::c_types::IOError,
7297 }
7298 #[repr(C)]
7299 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7300 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7301 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7302 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7303         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7304         /// `err` or `result` depending on the state of `result_ok`.
7305         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7306         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7307         pub result_ok: bool,
7308 }
7309 #[no_mangle]
7310 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7311 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7312         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7313                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7314                         result: Box::into_raw(Box::new(o)),
7315                 },
7316                 result_ok: true,
7317         }
7318 }
7319 #[no_mangle]
7320 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7321 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7322         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7323                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7324                         err: Box::into_raw(Box::new(e)),
7325                 },
7326                 result_ok: false,
7327         }
7328 }
7329 /// Checks if the given object is currently in the success state
7330 #[no_mangle]
7331 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7332         o.result_ok
7333 }
7334 #[no_mangle]
7335 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7336 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7337 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7338         fn drop(&mut self) {
7339                 if self.result_ok {
7340                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7341                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7342                         }
7343                 } else {
7344                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7345                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7346                         }
7347                 }
7348         }
7349 }
7350 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7351         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7352                 let contents = if o.result_ok {
7353                         let result = unsafe { o.contents.result };
7354                         unsafe { o.contents.result = core::ptr::null_mut() };
7355                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7356                 } else {
7357                         let err = unsafe { o.contents.err };
7358                         unsafe { o.contents.err = core::ptr::null_mut(); }
7359                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7360                 };
7361                 Self {
7362                         contents,
7363                         result_ok: o.result_ok,
7364                 }
7365         }
7366 }
7367 #[repr(C)]
7368 #[derive(Clone)]
7369 /// An enum which can either contain a u16 or not
7370 pub enum COption_u16Z {
7371         /// When we're in this state, this COption_u16Z contains a u16
7372         Some(u16),
7373         /// When we're in this state, this COption_u16Z contains nothing
7374         None
7375 }
7376 impl COption_u16Z {
7377         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7378                 if let Self::None = self { false } else { true }
7379         }
7380         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7381                 !self.is_some()
7382         }
7383         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7384                 if let Self::Some(v) = self { v } else { unreachable!() }
7385         }
7386 }
7387 #[no_mangle]
7388 /// Constructs a new COption_u16Z containing a u16
7389 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7390         COption_u16Z::Some(o)
7391 }
7392 #[no_mangle]
7393 /// Constructs a new COption_u16Z containing nothing
7394 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7395         COption_u16Z::None
7396 }
7397 #[no_mangle]
7398 /// Frees any resources associated with the u16, if we are in the Some state
7399 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7400 #[no_mangle]
7401 /// Creates a new COption_u16Z which has the same data as `orig`
7402 /// but with all dynamically-allocated buffers duplicated in new buffers.
7403 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7404 #[repr(C)]
7405 /// The contents of CResult_NoneAPIErrorZ
7406 pub union CResult_NoneAPIErrorZPtr {
7407         /// Note that this value is always NULL, as there are no contents in the OK variant
7408         pub result: *mut core::ffi::c_void,
7409         /// A pointer to the contents in the error state.
7410         /// Reading from this pointer when `result_ok` is set is undefined.
7411         pub err: *mut crate::lightning::util::errors::APIError,
7412 }
7413 #[repr(C)]
7414 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7415 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7416 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7417 pub struct CResult_NoneAPIErrorZ {
7418         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7419         /// `err` or `result` depending on the state of `result_ok`.
7420         pub contents: CResult_NoneAPIErrorZPtr,
7421         /// Whether this CResult_NoneAPIErrorZ represents a success state.
7422         pub result_ok: bool,
7423 }
7424 #[no_mangle]
7425 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7426 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7427         CResult_NoneAPIErrorZ {
7428                 contents: CResult_NoneAPIErrorZPtr {
7429                         result: core::ptr::null_mut(),
7430                 },
7431                 result_ok: true,
7432         }
7433 }
7434 #[no_mangle]
7435 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7436 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7437         CResult_NoneAPIErrorZ {
7438                 contents: CResult_NoneAPIErrorZPtr {
7439                         err: Box::into_raw(Box::new(e)),
7440                 },
7441                 result_ok: false,
7442         }
7443 }
7444 /// Checks if the given object is currently in the success state
7445 #[no_mangle]
7446 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7447         o.result_ok
7448 }
7449 #[no_mangle]
7450 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7451 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7452 impl Drop for CResult_NoneAPIErrorZ {
7453         fn drop(&mut self) {
7454                 if self.result_ok {
7455                 } else {
7456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7458                         }
7459                 }
7460         }
7461 }
7462 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7463         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7464                 let contents = if o.result_ok {
7465                         let _ = unsafe { Box::from_raw(o.contents.result) };
7466                         o.contents.result = core::ptr::null_mut();
7467                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7468                 } else {
7469                         let err = unsafe { o.contents.err };
7470                         unsafe { o.contents.err = core::ptr::null_mut(); }
7471                         CResult_NoneAPIErrorZPtr { err }
7472                 };
7473                 Self {
7474                         contents,
7475                         result_ok: o.result_ok,
7476                 }
7477         }
7478 }
7479 impl Clone for CResult_NoneAPIErrorZ {
7480         fn clone(&self) -> Self {
7481                 if self.result_ok {
7482                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7483                                 result: core::ptr::null_mut()
7484                         } }
7485                 } else {
7486                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7487                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7488                         } }
7489                 }
7490         }
7491 }
7492 #[no_mangle]
7493 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7494 /// but with all dynamically-allocated buffers duplicated in new buffers.
7495 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7496 #[repr(C)]
7497 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7498 /// This corresponds to std::vector in C++
7499 pub struct CVec_CResult_NoneAPIErrorZZ {
7500         /// The elements in the array.
7501         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7502         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7503         /// The number of elements pointed to by `data`.
7504         pub datalen: usize
7505 }
7506 impl CVec_CResult_NoneAPIErrorZZ {
7507         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7508                 if self.datalen == 0 { return Vec::new(); }
7509                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7510                 self.data = core::ptr::null_mut();
7511                 self.datalen = 0;
7512                 ret
7513         }
7514         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7515                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7516         }
7517 }
7518 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7519         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7520                 let datalen = v.len();
7521                 let data = Box::into_raw(v.into_boxed_slice());
7522                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7523         }
7524 }
7525 #[no_mangle]
7526 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7527 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7528 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7529         fn drop(&mut self) {
7530                 if self.datalen == 0 { return; }
7531                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7532         }
7533 }
7534 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7535         fn clone(&self) -> Self {
7536                 let mut res = Vec::new();
7537                 if self.datalen == 0 { return Self::from(res); }
7538                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7539                 Self::from(res)
7540         }
7541 }
7542 #[repr(C)]
7543 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7544 /// This corresponds to std::vector in C++
7545 pub struct CVec_APIErrorZ {
7546         /// The elements in the array.
7547         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7548         pub data: *mut crate::lightning::util::errors::APIError,
7549         /// The number of elements pointed to by `data`.
7550         pub datalen: usize
7551 }
7552 impl CVec_APIErrorZ {
7553         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7554                 if self.datalen == 0 { return Vec::new(); }
7555                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7556                 self.data = core::ptr::null_mut();
7557                 self.datalen = 0;
7558                 ret
7559         }
7560         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7561                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7562         }
7563 }
7564 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7565         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7566                 let datalen = v.len();
7567                 let data = Box::into_raw(v.into_boxed_slice());
7568                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7569         }
7570 }
7571 #[no_mangle]
7572 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7573 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7574 impl Drop for CVec_APIErrorZ {
7575         fn drop(&mut self) {
7576                 if self.datalen == 0 { return; }
7577                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7578         }
7579 }
7580 impl Clone for CVec_APIErrorZ {
7581         fn clone(&self) -> Self {
7582                 let mut res = Vec::new();
7583                 if self.datalen == 0 { return Self::from(res); }
7584                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7585                 Self::from(res)
7586         }
7587 }
7588 #[repr(C)]
7589 /// The contents of CResult__u832APIErrorZ
7590 pub union CResult__u832APIErrorZPtr {
7591         /// A pointer to the contents in the success state.
7592         /// Reading from this pointer when `result_ok` is not set is undefined.
7593         pub result: *mut crate::c_types::ThirtyTwoBytes,
7594         /// A pointer to the contents in the error state.
7595         /// Reading from this pointer when `result_ok` is set is undefined.
7596         pub err: *mut crate::lightning::util::errors::APIError,
7597 }
7598 #[repr(C)]
7599 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7600 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7601 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7602 pub struct CResult__u832APIErrorZ {
7603         /// The contents of this CResult__u832APIErrorZ, accessible via either
7604         /// `err` or `result` depending on the state of `result_ok`.
7605         pub contents: CResult__u832APIErrorZPtr,
7606         /// Whether this CResult__u832APIErrorZ represents a success state.
7607         pub result_ok: bool,
7608 }
7609 #[no_mangle]
7610 /// Creates a new CResult__u832APIErrorZ in the success state.
7611 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7612         CResult__u832APIErrorZ {
7613                 contents: CResult__u832APIErrorZPtr {
7614                         result: Box::into_raw(Box::new(o)),
7615                 },
7616                 result_ok: true,
7617         }
7618 }
7619 #[no_mangle]
7620 /// Creates a new CResult__u832APIErrorZ in the error state.
7621 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7622         CResult__u832APIErrorZ {
7623                 contents: CResult__u832APIErrorZPtr {
7624                         err: Box::into_raw(Box::new(e)),
7625                 },
7626                 result_ok: false,
7627         }
7628 }
7629 /// Checks if the given object is currently in the success state
7630 #[no_mangle]
7631 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7632         o.result_ok
7633 }
7634 #[no_mangle]
7635 /// Frees any resources used by the CResult__u832APIErrorZ.
7636 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7637 impl Drop for CResult__u832APIErrorZ {
7638         fn drop(&mut self) {
7639                 if self.result_ok {
7640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7642                         }
7643                 } else {
7644                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7645                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7646                         }
7647                 }
7648         }
7649 }
7650 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7651         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7652                 let contents = if o.result_ok {
7653                         let result = unsafe { o.contents.result };
7654                         unsafe { o.contents.result = core::ptr::null_mut() };
7655                         CResult__u832APIErrorZPtr { result }
7656                 } else {
7657                         let err = unsafe { o.contents.err };
7658                         unsafe { o.contents.err = core::ptr::null_mut(); }
7659                         CResult__u832APIErrorZPtr { err }
7660                 };
7661                 Self {
7662                         contents,
7663                         result_ok: o.result_ok,
7664                 }
7665         }
7666 }
7667 impl Clone for CResult__u832APIErrorZ {
7668         fn clone(&self) -> Self {
7669                 if self.result_ok {
7670                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7671                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7672                         } }
7673                 } else {
7674                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7675                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7676                         } }
7677                 }
7678         }
7679 }
7680 #[no_mangle]
7681 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7682 /// but with all dynamically-allocated buffers duplicated in new buffers.
7683 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7684 #[repr(C)]
7685 /// The contents of CResult_PaymentIdPaymentSendFailureZ
7686 pub union CResult_PaymentIdPaymentSendFailureZPtr {
7687         /// A pointer to the contents in the success state.
7688         /// Reading from this pointer when `result_ok` is not set is undefined.
7689         pub result: *mut crate::c_types::ThirtyTwoBytes,
7690         /// A pointer to the contents in the error state.
7691         /// Reading from this pointer when `result_ok` is set is undefined.
7692         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7693 }
7694 #[repr(C)]
7695 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7696 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7697 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7698 pub struct CResult_PaymentIdPaymentSendFailureZ {
7699         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7700         /// `err` or `result` depending on the state of `result_ok`.
7701         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
7702         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7703         pub result_ok: bool,
7704 }
7705 #[no_mangle]
7706 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
7707 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
7708         CResult_PaymentIdPaymentSendFailureZ {
7709                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7710                         result: Box::into_raw(Box::new(o)),
7711                 },
7712                 result_ok: true,
7713         }
7714 }
7715 #[no_mangle]
7716 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
7717 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
7718         CResult_PaymentIdPaymentSendFailureZ {
7719                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7720                         err: Box::into_raw(Box::new(e)),
7721                 },
7722                 result_ok: false,
7723         }
7724 }
7725 /// Checks if the given object is currently in the success state
7726 #[no_mangle]
7727 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
7728         o.result_ok
7729 }
7730 #[no_mangle]
7731 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
7732 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
7733 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
7734         fn drop(&mut self) {
7735                 if self.result_ok {
7736                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7737                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7738                         }
7739                 } else {
7740                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7741                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7742                         }
7743                 }
7744         }
7745 }
7746 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
7747         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7748                 let contents = if o.result_ok {
7749                         let result = unsafe { o.contents.result };
7750                         unsafe { o.contents.result = core::ptr::null_mut() };
7751                         CResult_PaymentIdPaymentSendFailureZPtr { result }
7752                 } else {
7753                         let err = unsafe { o.contents.err };
7754                         unsafe { o.contents.err = core::ptr::null_mut(); }
7755                         CResult_PaymentIdPaymentSendFailureZPtr { err }
7756                 };
7757                 Self {
7758                         contents,
7759                         result_ok: o.result_ok,
7760                 }
7761         }
7762 }
7763 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
7764         fn clone(&self) -> Self {
7765                 if self.result_ok {
7766                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7767                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7768                         } }
7769                 } else {
7770                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7771                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7772                         } }
7773                 }
7774         }
7775 }
7776 #[no_mangle]
7777 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
7778 /// but with all dynamically-allocated buffers duplicated in new buffers.
7779 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
7780 #[repr(C)]
7781 /// The contents of CResult_NonePaymentSendFailureZ
7782 pub union CResult_NonePaymentSendFailureZPtr {
7783         /// Note that this value is always NULL, as there are no contents in the OK variant
7784         pub result: *mut core::ffi::c_void,
7785         /// A pointer to the contents in the error state.
7786         /// Reading from this pointer when `result_ok` is set is undefined.
7787         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7788 }
7789 #[repr(C)]
7790 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7791 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7793 pub struct CResult_NonePaymentSendFailureZ {
7794         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7795         /// `err` or `result` depending on the state of `result_ok`.
7796         pub contents: CResult_NonePaymentSendFailureZPtr,
7797         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7798         pub result_ok: bool,
7799 }
7800 #[no_mangle]
7801 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7802 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7803         CResult_NonePaymentSendFailureZ {
7804                 contents: CResult_NonePaymentSendFailureZPtr {
7805                         result: core::ptr::null_mut(),
7806                 },
7807                 result_ok: true,
7808         }
7809 }
7810 #[no_mangle]
7811 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
7812 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
7813         CResult_NonePaymentSendFailureZ {
7814                 contents: CResult_NonePaymentSendFailureZPtr {
7815                         err: Box::into_raw(Box::new(e)),
7816                 },
7817                 result_ok: false,
7818         }
7819 }
7820 /// Checks if the given object is currently in the success state
7821 #[no_mangle]
7822 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
7823         o.result_ok
7824 }
7825 #[no_mangle]
7826 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
7827 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
7828 impl Drop for CResult_NonePaymentSendFailureZ {
7829         fn drop(&mut self) {
7830                 if self.result_ok {
7831                 } else {
7832                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7833                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7834                         }
7835                 }
7836         }
7837 }
7838 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
7839         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7840                 let contents = if o.result_ok {
7841                         let _ = unsafe { Box::from_raw(o.contents.result) };
7842                         o.contents.result = core::ptr::null_mut();
7843                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
7844                 } else {
7845                         let err = unsafe { o.contents.err };
7846                         unsafe { o.contents.err = core::ptr::null_mut(); }
7847                         CResult_NonePaymentSendFailureZPtr { err }
7848                 };
7849                 Self {
7850                         contents,
7851                         result_ok: o.result_ok,
7852                 }
7853         }
7854 }
7855 impl Clone for CResult_NonePaymentSendFailureZ {
7856         fn clone(&self) -> Self {
7857                 if self.result_ok {
7858                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
7859                                 result: core::ptr::null_mut()
7860                         } }
7861                 } else {
7862                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
7863                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7864                         } }
7865                 }
7866         }
7867 }
7868 #[no_mangle]
7869 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
7870 /// but with all dynamically-allocated buffers duplicated in new buffers.
7871 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
7872 #[repr(C)]
7873 /// A tuple of 2 elements. See the individual fields for the types contained.
7874 pub struct C2Tuple_PaymentHashPaymentIdZ {
7875         /// The element at position 0
7876         pub a: crate::c_types::ThirtyTwoBytes,
7877         /// The element at position 1
7878         pub b: crate::c_types::ThirtyTwoBytes,
7879 }
7880 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
7881         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
7882                 Self {
7883                         a: tup.0,
7884                         b: tup.1,
7885                 }
7886         }
7887 }
7888 impl C2Tuple_PaymentHashPaymentIdZ {
7889         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
7890                 (self.a, self.b)
7891         }
7892 }
7893 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
7894         fn clone(&self) -> Self {
7895                 Self {
7896                         a: Clone::clone(&self.a),
7897                         b: Clone::clone(&self.b),
7898                 }
7899         }
7900 }
7901 #[no_mangle]
7902 /// Creates a new tuple which has the same data as `orig`
7903 /// but with all dynamically-allocated buffers duplicated in new buffers.
7904 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
7905 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
7906 #[no_mangle]
7907 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
7908         C2Tuple_PaymentHashPaymentIdZ { a, b, }
7909 }
7910
7911 #[no_mangle]
7912 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
7913 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
7914 #[repr(C)]
7915 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7916 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7917         /// A pointer to the contents in the success state.
7918         /// Reading from this pointer when `result_ok` is not set is undefined.
7919         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
7920         /// A pointer to the contents in the error state.
7921         /// Reading from this pointer when `result_ok` is set is undefined.
7922         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7923 }
7924 #[repr(C)]
7925 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7926 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7928 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7929         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7930         /// `err` or `result` depending on the state of `result_ok`.
7931         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
7932         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7933         pub result_ok: bool,
7934 }
7935 #[no_mangle]
7936 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
7937 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7938         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7939                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7940                         result: Box::into_raw(Box::new(o)),
7941                 },
7942                 result_ok: true,
7943         }
7944 }
7945 #[no_mangle]
7946 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
7947 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7948         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7949                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7950                         err: Box::into_raw(Box::new(e)),
7951                 },
7952                 result_ok: false,
7953         }
7954 }
7955 /// Checks if the given object is currently in the success state
7956 #[no_mangle]
7957 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
7958         o.result_ok
7959 }
7960 #[no_mangle]
7961 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
7962 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
7963 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7964         fn drop(&mut self) {
7965                 if self.result_ok {
7966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7968                         }
7969                 } else {
7970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7972                         }
7973                 }
7974         }
7975 }
7976 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7977         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7978                 let contents = if o.result_ok {
7979                         let result = unsafe { o.contents.result };
7980                         unsafe { o.contents.result = core::ptr::null_mut() };
7981                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
7982                 } else {
7983                         let err = unsafe { o.contents.err };
7984                         unsafe { o.contents.err = core::ptr::null_mut(); }
7985                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
7986                 };
7987                 Self {
7988                         contents,
7989                         result_ok: o.result_ok,
7990                 }
7991         }
7992 }
7993 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7994         fn clone(&self) -> Self {
7995                 if self.result_ok {
7996                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7997                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
7998                         } }
7999                 } else {
8000                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8001                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8002                         } }
8003                 }
8004         }
8005 }
8006 #[no_mangle]
8007 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8008 /// but with all dynamically-allocated buffers duplicated in new buffers.
8009 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8010 #[repr(C)]
8011 /// A tuple of 2 elements. See the individual fields for the types contained.
8012 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8013         /// The element at position 0
8014         pub a: crate::c_types::ThirtyTwoBytes,
8015         /// The element at position 1
8016         pub b: crate::c_types::ThirtyTwoBytes,
8017 }
8018 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8019         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8020                 Self {
8021                         a: tup.0,
8022                         b: tup.1,
8023                 }
8024         }
8025 }
8026 impl C2Tuple_PaymentHashPaymentSecretZ {
8027         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8028                 (self.a, self.b)
8029         }
8030 }
8031 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8032         fn clone(&self) -> Self {
8033                 Self {
8034                         a: Clone::clone(&self.a),
8035                         b: Clone::clone(&self.b),
8036                 }
8037         }
8038 }
8039 #[no_mangle]
8040 /// Creates a new tuple which has the same data as `orig`
8041 /// but with all dynamically-allocated buffers duplicated in new buffers.
8042 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8043 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8044 #[no_mangle]
8045 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8046         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8047 }
8048
8049 #[no_mangle]
8050 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8051 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8052 #[repr(C)]
8053 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8054 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8055         /// A pointer to the contents in the success state.
8056         /// Reading from this pointer when `result_ok` is not set is undefined.
8057         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8058         /// Note that this value is always NULL, as there are no contents in the Err variant
8059         pub err: *mut core::ffi::c_void,
8060 }
8061 #[repr(C)]
8062 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8063 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8065 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8066         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8067         /// `err` or `result` depending on the state of `result_ok`.
8068         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8069         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8070         pub result_ok: bool,
8071 }
8072 #[no_mangle]
8073 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8074 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8075         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8076                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8077                         result: Box::into_raw(Box::new(o)),
8078                 },
8079                 result_ok: true,
8080         }
8081 }
8082 #[no_mangle]
8083 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8084 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8085         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8086                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8087                         err: core::ptr::null_mut(),
8088                 },
8089                 result_ok: false,
8090         }
8091 }
8092 /// Checks if the given object is currently in the success state
8093 #[no_mangle]
8094 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8095         o.result_ok
8096 }
8097 #[no_mangle]
8098 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8099 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8100 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8101         fn drop(&mut self) {
8102                 if self.result_ok {
8103                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8104                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8105                         }
8106                 } else {
8107                 }
8108         }
8109 }
8110 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8111         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8112                 let contents = if o.result_ok {
8113                         let result = unsafe { o.contents.result };
8114                         unsafe { o.contents.result = core::ptr::null_mut() };
8115                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8116                 } else {
8117                         let _ = unsafe { Box::from_raw(o.contents.err) };
8118                         o.contents.err = core::ptr::null_mut();
8119                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8120                 };
8121                 Self {
8122                         contents,
8123                         result_ok: o.result_ok,
8124                 }
8125         }
8126 }
8127 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8128         fn clone(&self) -> Self {
8129                 if self.result_ok {
8130                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8131                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8132                         } }
8133                 } else {
8134                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8135                                 err: core::ptr::null_mut()
8136                         } }
8137                 }
8138         }
8139 }
8140 #[no_mangle]
8141 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8142 /// but with all dynamically-allocated buffers duplicated in new buffers.
8143 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8144 #[repr(C)]
8145 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8146 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8147         /// A pointer to the contents in the success state.
8148         /// Reading from this pointer when `result_ok` is not set is undefined.
8149         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8150         /// A pointer to the contents in the error state.
8151         /// Reading from this pointer when `result_ok` is set is undefined.
8152         pub err: *mut crate::lightning::util::errors::APIError,
8153 }
8154 #[repr(C)]
8155 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8156 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8157 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8158 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8159         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8160         /// `err` or `result` depending on the state of `result_ok`.
8161         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8162         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8163         pub result_ok: bool,
8164 }
8165 #[no_mangle]
8166 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8167 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8168         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8169                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8170                         result: Box::into_raw(Box::new(o)),
8171                 },
8172                 result_ok: true,
8173         }
8174 }
8175 #[no_mangle]
8176 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8177 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8178         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8179                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8180                         err: Box::into_raw(Box::new(e)),
8181                 },
8182                 result_ok: false,
8183         }
8184 }
8185 /// Checks if the given object is currently in the success state
8186 #[no_mangle]
8187 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8188         o.result_ok
8189 }
8190 #[no_mangle]
8191 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8192 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8193 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8194         fn drop(&mut self) {
8195                 if self.result_ok {
8196                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8197                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8198                         }
8199                 } else {
8200                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8201                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8202                         }
8203                 }
8204         }
8205 }
8206 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8207         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8208                 let contents = if o.result_ok {
8209                         let result = unsafe { o.contents.result };
8210                         unsafe { o.contents.result = core::ptr::null_mut() };
8211                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8212                 } else {
8213                         let err = unsafe { o.contents.err };
8214                         unsafe { o.contents.err = core::ptr::null_mut(); }
8215                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8216                 };
8217                 Self {
8218                         contents,
8219                         result_ok: o.result_ok,
8220                 }
8221         }
8222 }
8223 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8224         fn clone(&self) -> Self {
8225                 if self.result_ok {
8226                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8227                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8228                         } }
8229                 } else {
8230                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8231                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8232                         } }
8233                 }
8234         }
8235 }
8236 #[no_mangle]
8237 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8238 /// but with all dynamically-allocated buffers duplicated in new buffers.
8239 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8240 #[repr(C)]
8241 /// The contents of CResult_PaymentSecretNoneZ
8242 pub union CResult_PaymentSecretNoneZPtr {
8243         /// A pointer to the contents in the success state.
8244         /// Reading from this pointer when `result_ok` is not set is undefined.
8245         pub result: *mut crate::c_types::ThirtyTwoBytes,
8246         /// Note that this value is always NULL, as there are no contents in the Err variant
8247         pub err: *mut core::ffi::c_void,
8248 }
8249 #[repr(C)]
8250 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8251 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8253 pub struct CResult_PaymentSecretNoneZ {
8254         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8255         /// `err` or `result` depending on the state of `result_ok`.
8256         pub contents: CResult_PaymentSecretNoneZPtr,
8257         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8258         pub result_ok: bool,
8259 }
8260 #[no_mangle]
8261 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8262 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8263         CResult_PaymentSecretNoneZ {
8264                 contents: CResult_PaymentSecretNoneZPtr {
8265                         result: Box::into_raw(Box::new(o)),
8266                 },
8267                 result_ok: true,
8268         }
8269 }
8270 #[no_mangle]
8271 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8272 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8273         CResult_PaymentSecretNoneZ {
8274                 contents: CResult_PaymentSecretNoneZPtr {
8275                         err: core::ptr::null_mut(),
8276                 },
8277                 result_ok: false,
8278         }
8279 }
8280 /// Checks if the given object is currently in the success state
8281 #[no_mangle]
8282 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8283         o.result_ok
8284 }
8285 #[no_mangle]
8286 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8287 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8288 impl Drop for CResult_PaymentSecretNoneZ {
8289         fn drop(&mut self) {
8290                 if self.result_ok {
8291                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8292                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8293                         }
8294                 } else {
8295                 }
8296         }
8297 }
8298 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8299         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8300                 let contents = if o.result_ok {
8301                         let result = unsafe { o.contents.result };
8302                         unsafe { o.contents.result = core::ptr::null_mut() };
8303                         CResult_PaymentSecretNoneZPtr { result }
8304                 } else {
8305                         let _ = unsafe { Box::from_raw(o.contents.err) };
8306                         o.contents.err = core::ptr::null_mut();
8307                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8308                 };
8309                 Self {
8310                         contents,
8311                         result_ok: o.result_ok,
8312                 }
8313         }
8314 }
8315 impl Clone for CResult_PaymentSecretNoneZ {
8316         fn clone(&self) -> Self {
8317                 if self.result_ok {
8318                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8319                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8320                         } }
8321                 } else {
8322                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8323                                 err: core::ptr::null_mut()
8324                         } }
8325                 }
8326         }
8327 }
8328 #[no_mangle]
8329 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8330 /// but with all dynamically-allocated buffers duplicated in new buffers.
8331 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8332 #[repr(C)]
8333 /// The contents of CResult_PaymentSecretAPIErrorZ
8334 pub union CResult_PaymentSecretAPIErrorZPtr {
8335         /// A pointer to the contents in the success state.
8336         /// Reading from this pointer when `result_ok` is not set is undefined.
8337         pub result: *mut crate::c_types::ThirtyTwoBytes,
8338         /// A pointer to the contents in the error state.
8339         /// Reading from this pointer when `result_ok` is set is undefined.
8340         pub err: *mut crate::lightning::util::errors::APIError,
8341 }
8342 #[repr(C)]
8343 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8344 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8345 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8346 pub struct CResult_PaymentSecretAPIErrorZ {
8347         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8348         /// `err` or `result` depending on the state of `result_ok`.
8349         pub contents: CResult_PaymentSecretAPIErrorZPtr,
8350         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8351         pub result_ok: bool,
8352 }
8353 #[no_mangle]
8354 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8355 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8356         CResult_PaymentSecretAPIErrorZ {
8357                 contents: CResult_PaymentSecretAPIErrorZPtr {
8358                         result: Box::into_raw(Box::new(o)),
8359                 },
8360                 result_ok: true,
8361         }
8362 }
8363 #[no_mangle]
8364 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8365 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8366         CResult_PaymentSecretAPIErrorZ {
8367                 contents: CResult_PaymentSecretAPIErrorZPtr {
8368                         err: Box::into_raw(Box::new(e)),
8369                 },
8370                 result_ok: false,
8371         }
8372 }
8373 /// Checks if the given object is currently in the success state
8374 #[no_mangle]
8375 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8376         o.result_ok
8377 }
8378 #[no_mangle]
8379 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8380 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8381 impl Drop for CResult_PaymentSecretAPIErrorZ {
8382         fn drop(&mut self) {
8383                 if self.result_ok {
8384                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8385                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8386                         }
8387                 } else {
8388                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8389                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8390                         }
8391                 }
8392         }
8393 }
8394 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8395         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8396                 let contents = if o.result_ok {
8397                         let result = unsafe { o.contents.result };
8398                         unsafe { o.contents.result = core::ptr::null_mut() };
8399                         CResult_PaymentSecretAPIErrorZPtr { result }
8400                 } else {
8401                         let err = unsafe { o.contents.err };
8402                         unsafe { o.contents.err = core::ptr::null_mut(); }
8403                         CResult_PaymentSecretAPIErrorZPtr { err }
8404                 };
8405                 Self {
8406                         contents,
8407                         result_ok: o.result_ok,
8408                 }
8409         }
8410 }
8411 impl Clone for CResult_PaymentSecretAPIErrorZ {
8412         fn clone(&self) -> Self {
8413                 if self.result_ok {
8414                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8415                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8416                         } }
8417                 } else {
8418                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8419                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8420                         } }
8421                 }
8422         }
8423 }
8424 #[no_mangle]
8425 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8426 /// but with all dynamically-allocated buffers duplicated in new buffers.
8427 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8428 #[repr(C)]
8429 /// The contents of CResult_PaymentPreimageAPIErrorZ
8430 pub union CResult_PaymentPreimageAPIErrorZPtr {
8431         /// A pointer to the contents in the success state.
8432         /// Reading from this pointer when `result_ok` is not set is undefined.
8433         pub result: *mut crate::c_types::ThirtyTwoBytes,
8434         /// A pointer to the contents in the error state.
8435         /// Reading from this pointer when `result_ok` is set is undefined.
8436         pub err: *mut crate::lightning::util::errors::APIError,
8437 }
8438 #[repr(C)]
8439 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8440 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8441 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8442 pub struct CResult_PaymentPreimageAPIErrorZ {
8443         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8444         /// `err` or `result` depending on the state of `result_ok`.
8445         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8446         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8447         pub result_ok: bool,
8448 }
8449 #[no_mangle]
8450 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8451 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8452         CResult_PaymentPreimageAPIErrorZ {
8453                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8454                         result: Box::into_raw(Box::new(o)),
8455                 },
8456                 result_ok: true,
8457         }
8458 }
8459 #[no_mangle]
8460 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8461 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8462         CResult_PaymentPreimageAPIErrorZ {
8463                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8464                         err: Box::into_raw(Box::new(e)),
8465                 },
8466                 result_ok: false,
8467         }
8468 }
8469 /// Checks if the given object is currently in the success state
8470 #[no_mangle]
8471 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8472         o.result_ok
8473 }
8474 #[no_mangle]
8475 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8476 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8477 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8478         fn drop(&mut self) {
8479                 if self.result_ok {
8480                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8481                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8482                         }
8483                 } else {
8484                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8485                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8486                         }
8487                 }
8488         }
8489 }
8490 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8491         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8492                 let contents = if o.result_ok {
8493                         let result = unsafe { o.contents.result };
8494                         unsafe { o.contents.result = core::ptr::null_mut() };
8495                         CResult_PaymentPreimageAPIErrorZPtr { result }
8496                 } else {
8497                         let err = unsafe { o.contents.err };
8498                         unsafe { o.contents.err = core::ptr::null_mut(); }
8499                         CResult_PaymentPreimageAPIErrorZPtr { err }
8500                 };
8501                 Self {
8502                         contents,
8503                         result_ok: o.result_ok,
8504                 }
8505         }
8506 }
8507 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8508         fn clone(&self) -> Self {
8509                 if self.result_ok {
8510                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8511                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8512                         } }
8513                 } else {
8514                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8515                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8516                         } }
8517                 }
8518         }
8519 }
8520 #[no_mangle]
8521 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8522 /// but with all dynamically-allocated buffers duplicated in new buffers.
8523 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8524 #[repr(C)]
8525 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8526 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8527         /// A pointer to the contents in the success state.
8528         /// Reading from this pointer when `result_ok` is not set is undefined.
8529         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8530         /// A pointer to the contents in the error state.
8531         /// Reading from this pointer when `result_ok` is set is undefined.
8532         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8533 }
8534 #[repr(C)]
8535 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8536 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8537 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8538 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8539         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8540         /// `err` or `result` depending on the state of `result_ok`.
8541         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8542         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8543         pub result_ok: bool,
8544 }
8545 #[no_mangle]
8546 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8547 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8548         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8549                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8550                         result: Box::into_raw(Box::new(o)),
8551                 },
8552                 result_ok: true,
8553         }
8554 }
8555 #[no_mangle]
8556 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8557 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8558         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8559                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8560                         err: Box::into_raw(Box::new(e)),
8561                 },
8562                 result_ok: false,
8563         }
8564 }
8565 /// Checks if the given object is currently in the success state
8566 #[no_mangle]
8567 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8568         o.result_ok
8569 }
8570 #[no_mangle]
8571 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8572 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8573 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8574         fn drop(&mut self) {
8575                 if self.result_ok {
8576                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8577                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8578                         }
8579                 } else {
8580                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8581                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8582                         }
8583                 }
8584         }
8585 }
8586 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8587         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8588                 let contents = if o.result_ok {
8589                         let result = unsafe { o.contents.result };
8590                         unsafe { o.contents.result = core::ptr::null_mut() };
8591                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8592                 } else {
8593                         let err = unsafe { o.contents.err };
8594                         unsafe { o.contents.err = core::ptr::null_mut(); }
8595                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8596                 };
8597                 Self {
8598                         contents,
8599                         result_ok: o.result_ok,
8600                 }
8601         }
8602 }
8603 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8604         fn clone(&self) -> Self {
8605                 if self.result_ok {
8606                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8607                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8608                         } }
8609                 } else {
8610                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8611                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8612                         } }
8613                 }
8614         }
8615 }
8616 #[no_mangle]
8617 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8618 /// but with all dynamically-allocated buffers duplicated in new buffers.
8619 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8620 #[repr(C)]
8621 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8622 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8623         /// A pointer to the contents in the success state.
8624         /// Reading from this pointer when `result_ok` is not set is undefined.
8625         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8626         /// A pointer to the contents in the error state.
8627         /// Reading from this pointer when `result_ok` is set is undefined.
8628         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8629 }
8630 #[repr(C)]
8631 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8632 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8633 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8634 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8635         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8636         /// `err` or `result` depending on the state of `result_ok`.
8637         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8638         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8639         pub result_ok: bool,
8640 }
8641 #[no_mangle]
8642 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8643 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8644         CResult_ChannelCounterpartyDecodeErrorZ {
8645                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8646                         result: Box::into_raw(Box::new(o)),
8647                 },
8648                 result_ok: true,
8649         }
8650 }
8651 #[no_mangle]
8652 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8653 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8654         CResult_ChannelCounterpartyDecodeErrorZ {
8655                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8656                         err: Box::into_raw(Box::new(e)),
8657                 },
8658                 result_ok: false,
8659         }
8660 }
8661 /// Checks if the given object is currently in the success state
8662 #[no_mangle]
8663 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8664         o.result_ok
8665 }
8666 #[no_mangle]
8667 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8668 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8669 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8670         fn drop(&mut self) {
8671                 if self.result_ok {
8672                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8673                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8674                         }
8675                 } else {
8676                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8677                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8678                         }
8679                 }
8680         }
8681 }
8682 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8683         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8684                 let contents = if o.result_ok {
8685                         let result = unsafe { o.contents.result };
8686                         unsafe { o.contents.result = core::ptr::null_mut() };
8687                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8688                 } else {
8689                         let err = unsafe { o.contents.err };
8690                         unsafe { o.contents.err = core::ptr::null_mut(); }
8691                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8692                 };
8693                 Self {
8694                         contents,
8695                         result_ok: o.result_ok,
8696                 }
8697         }
8698 }
8699 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8700         fn clone(&self) -> Self {
8701                 if self.result_ok {
8702                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8703                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8704                         } }
8705                 } else {
8706                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8707                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8708                         } }
8709                 }
8710         }
8711 }
8712 #[no_mangle]
8713 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8714 /// but with all dynamically-allocated buffers duplicated in new buffers.
8715 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8716 #[repr(C)]
8717 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8718 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8719         /// A pointer to the contents in the success state.
8720         /// Reading from this pointer when `result_ok` is not set is undefined.
8721         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
8722         /// A pointer to the contents in the error state.
8723         /// Reading from this pointer when `result_ok` is set is undefined.
8724         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8725 }
8726 #[repr(C)]
8727 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8728 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8729 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8730 pub struct CResult_ChannelDetailsDecodeErrorZ {
8731         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8732         /// `err` or `result` depending on the state of `result_ok`.
8733         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
8734         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8735         pub result_ok: bool,
8736 }
8737 #[no_mangle]
8738 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
8739 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
8740         CResult_ChannelDetailsDecodeErrorZ {
8741                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8742                         result: Box::into_raw(Box::new(o)),
8743                 },
8744                 result_ok: true,
8745         }
8746 }
8747 #[no_mangle]
8748 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
8749 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
8750         CResult_ChannelDetailsDecodeErrorZ {
8751                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8752                         err: Box::into_raw(Box::new(e)),
8753                 },
8754                 result_ok: false,
8755         }
8756 }
8757 /// Checks if the given object is currently in the success state
8758 #[no_mangle]
8759 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
8760         o.result_ok
8761 }
8762 #[no_mangle]
8763 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
8764 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
8765 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
8766         fn drop(&mut self) {
8767                 if self.result_ok {
8768                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8769                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8770                         }
8771                 } else {
8772                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8773                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8774                         }
8775                 }
8776         }
8777 }
8778 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
8779         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
8780                 let contents = if o.result_ok {
8781                         let result = unsafe { o.contents.result };
8782                         unsafe { o.contents.result = core::ptr::null_mut() };
8783                         CResult_ChannelDetailsDecodeErrorZPtr { result }
8784                 } else {
8785                         let err = unsafe { o.contents.err };
8786                         unsafe { o.contents.err = core::ptr::null_mut(); }
8787                         CResult_ChannelDetailsDecodeErrorZPtr { err }
8788                 };
8789                 Self {
8790                         contents,
8791                         result_ok: o.result_ok,
8792                 }
8793         }
8794 }
8795 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
8796         fn clone(&self) -> Self {
8797                 if self.result_ok {
8798                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8799                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
8800                         } }
8801                 } else {
8802                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
8803                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8804                         } }
8805                 }
8806         }
8807 }
8808 #[no_mangle]
8809 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
8810 /// but with all dynamically-allocated buffers duplicated in new buffers.
8811 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
8812 #[repr(C)]
8813 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
8814 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
8815         /// A pointer to the contents in the success state.
8816         /// Reading from this pointer when `result_ok` is not set is undefined.
8817         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
8818         /// A pointer to the contents in the error state.
8819         /// Reading from this pointer when `result_ok` is set is undefined.
8820         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8821 }
8822 #[repr(C)]
8823 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
8824 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
8825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8826 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
8827         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
8828         /// `err` or `result` depending on the state of `result_ok`.
8829         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
8830         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
8831         pub result_ok: bool,
8832 }
8833 #[no_mangle]
8834 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
8835 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
8836         CResult_PhantomRouteHintsDecodeErrorZ {
8837                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8838                         result: Box::into_raw(Box::new(o)),
8839                 },
8840                 result_ok: true,
8841         }
8842 }
8843 #[no_mangle]
8844 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
8845 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
8846         CResult_PhantomRouteHintsDecodeErrorZ {
8847                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8848                         err: Box::into_raw(Box::new(e)),
8849                 },
8850                 result_ok: false,
8851         }
8852 }
8853 /// Checks if the given object is currently in the success state
8854 #[no_mangle]
8855 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
8856         o.result_ok
8857 }
8858 #[no_mangle]
8859 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
8860 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
8861 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
8862         fn drop(&mut self) {
8863                 if self.result_ok {
8864                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8865                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8866                         }
8867                 } else {
8868                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8869                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8870                         }
8871                 }
8872         }
8873 }
8874 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
8875         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
8876                 let contents = if o.result_ok {
8877                         let result = unsafe { o.contents.result };
8878                         unsafe { o.contents.result = core::ptr::null_mut() };
8879                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
8880                 } else {
8881                         let err = unsafe { o.contents.err };
8882                         unsafe { o.contents.err = core::ptr::null_mut(); }
8883                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
8884                 };
8885                 Self {
8886                         contents,
8887                         result_ok: o.result_ok,
8888                 }
8889         }
8890 }
8891 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
8892         fn clone(&self) -> Self {
8893                 if self.result_ok {
8894                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8895                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
8896                         } }
8897                 } else {
8898                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
8899                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8900                         } }
8901                 }
8902         }
8903 }
8904 #[no_mangle]
8905 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
8906 /// but with all dynamically-allocated buffers duplicated in new buffers.
8907 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
8908 #[repr(C)]
8909 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8910 /// This corresponds to std::vector in C++
8911 pub struct CVec_ChannelMonitorZ {
8912         /// The elements in the array.
8913         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8914         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
8915         /// The number of elements pointed to by `data`.
8916         pub datalen: usize
8917 }
8918 impl CVec_ChannelMonitorZ {
8919         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
8920                 if self.datalen == 0 { return Vec::new(); }
8921                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8922                 self.data = core::ptr::null_mut();
8923                 self.datalen = 0;
8924                 ret
8925         }
8926         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
8927                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8928         }
8929 }
8930 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
8931         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
8932                 let datalen = v.len();
8933                 let data = Box::into_raw(v.into_boxed_slice());
8934                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8935         }
8936 }
8937 #[no_mangle]
8938 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8939 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
8940 impl Drop for CVec_ChannelMonitorZ {
8941         fn drop(&mut self) {
8942                 if self.datalen == 0 { return; }
8943                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8944         }
8945 }
8946 #[repr(C)]
8947 /// A tuple of 2 elements. See the individual fields for the types contained.
8948 pub struct C2Tuple_BlockHashChannelManagerZ {
8949         /// The element at position 0
8950         pub a: crate::c_types::ThirtyTwoBytes,
8951         /// The element at position 1
8952         pub b: crate::lightning::ln::channelmanager::ChannelManager,
8953 }
8954 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
8955         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
8956                 Self {
8957                         a: tup.0,
8958                         b: tup.1,
8959                 }
8960         }
8961 }
8962 impl C2Tuple_BlockHashChannelManagerZ {
8963         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
8964                 (self.a, self.b)
8965         }
8966 }
8967 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
8968 #[no_mangle]
8969 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
8970         C2Tuple_BlockHashChannelManagerZ { a, b, }
8971 }
8972
8973 #[no_mangle]
8974 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
8975 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
8976 #[repr(C)]
8977 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8978 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8979         /// A pointer to the contents in the success state.
8980         /// Reading from this pointer when `result_ok` is not set is undefined.
8981         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
8982         /// A pointer to the contents in the error state.
8983         /// Reading from this pointer when `result_ok` is set is undefined.
8984         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8985 }
8986 #[repr(C)]
8987 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8988 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8990 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8991         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8992         /// `err` or `result` depending on the state of `result_ok`.
8993         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
8994         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8995         pub result_ok: bool,
8996 }
8997 #[no_mangle]
8998 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
8999 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9000         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9001                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9002                         result: Box::into_raw(Box::new(o)),
9003                 },
9004                 result_ok: true,
9005         }
9006 }
9007 #[no_mangle]
9008 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9009 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9010         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9011                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9012                         err: Box::into_raw(Box::new(e)),
9013                 },
9014                 result_ok: false,
9015         }
9016 }
9017 /// Checks if the given object is currently in the success state
9018 #[no_mangle]
9019 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9020         o.result_ok
9021 }
9022 #[no_mangle]
9023 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9024 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9025 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9026         fn drop(&mut self) {
9027                 if self.result_ok {
9028                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9029                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9030                         }
9031                 } else {
9032                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9033                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9034                         }
9035                 }
9036         }
9037 }
9038 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9039         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9040                 let contents = if o.result_ok {
9041                         let result = unsafe { o.contents.result };
9042                         unsafe { o.contents.result = core::ptr::null_mut() };
9043                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9044                 } else {
9045                         let err = unsafe { o.contents.err };
9046                         unsafe { o.contents.err = core::ptr::null_mut(); }
9047                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9048                 };
9049                 Self {
9050                         contents,
9051                         result_ok: o.result_ok,
9052                 }
9053         }
9054 }
9055 #[repr(C)]
9056 /// The contents of CResult_ChannelConfigDecodeErrorZ
9057 pub union CResult_ChannelConfigDecodeErrorZPtr {
9058         /// A pointer to the contents in the success state.
9059         /// Reading from this pointer when `result_ok` is not set is undefined.
9060         pub result: *mut crate::lightning::util::config::ChannelConfig,
9061         /// A pointer to the contents in the error state.
9062         /// Reading from this pointer when `result_ok` is set is undefined.
9063         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9064 }
9065 #[repr(C)]
9066 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9067 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9069 pub struct CResult_ChannelConfigDecodeErrorZ {
9070         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9071         /// `err` or `result` depending on the state of `result_ok`.
9072         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9073         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9074         pub result_ok: bool,
9075 }
9076 #[no_mangle]
9077 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9078 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9079         CResult_ChannelConfigDecodeErrorZ {
9080                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9081                         result: Box::into_raw(Box::new(o)),
9082                 },
9083                 result_ok: true,
9084         }
9085 }
9086 #[no_mangle]
9087 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9088 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9089         CResult_ChannelConfigDecodeErrorZ {
9090                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9091                         err: Box::into_raw(Box::new(e)),
9092                 },
9093                 result_ok: false,
9094         }
9095 }
9096 /// Checks if the given object is currently in the success state
9097 #[no_mangle]
9098 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9099         o.result_ok
9100 }
9101 #[no_mangle]
9102 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9103 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9104 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9105         fn drop(&mut self) {
9106                 if self.result_ok {
9107                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9108                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9109                         }
9110                 } else {
9111                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9112                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9113                         }
9114                 }
9115         }
9116 }
9117 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9118         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9119                 let contents = if o.result_ok {
9120                         let result = unsafe { o.contents.result };
9121                         unsafe { o.contents.result = core::ptr::null_mut() };
9122                         CResult_ChannelConfigDecodeErrorZPtr { result }
9123                 } else {
9124                         let err = unsafe { o.contents.err };
9125                         unsafe { o.contents.err = core::ptr::null_mut(); }
9126                         CResult_ChannelConfigDecodeErrorZPtr { err }
9127                 };
9128                 Self {
9129                         contents,
9130                         result_ok: o.result_ok,
9131                 }
9132         }
9133 }
9134 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9135         fn clone(&self) -> Self {
9136                 if self.result_ok {
9137                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9138                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9139                         } }
9140                 } else {
9141                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9142                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9143                         } }
9144                 }
9145         }
9146 }
9147 #[no_mangle]
9148 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9149 /// but with all dynamically-allocated buffers duplicated in new buffers.
9150 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9151 #[repr(C)]
9152 /// The contents of CResult_OutPointDecodeErrorZ
9153 pub union CResult_OutPointDecodeErrorZPtr {
9154         /// A pointer to the contents in the success state.
9155         /// Reading from this pointer when `result_ok` is not set is undefined.
9156         pub result: *mut crate::lightning::chain::transaction::OutPoint,
9157         /// A pointer to the contents in the error state.
9158         /// Reading from this pointer when `result_ok` is set is undefined.
9159         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9160 }
9161 #[repr(C)]
9162 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9163 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9164 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9165 pub struct CResult_OutPointDecodeErrorZ {
9166         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9167         /// `err` or `result` depending on the state of `result_ok`.
9168         pub contents: CResult_OutPointDecodeErrorZPtr,
9169         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9170         pub result_ok: bool,
9171 }
9172 #[no_mangle]
9173 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9174 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9175         CResult_OutPointDecodeErrorZ {
9176                 contents: CResult_OutPointDecodeErrorZPtr {
9177                         result: Box::into_raw(Box::new(o)),
9178                 },
9179                 result_ok: true,
9180         }
9181 }
9182 #[no_mangle]
9183 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9184 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9185         CResult_OutPointDecodeErrorZ {
9186                 contents: CResult_OutPointDecodeErrorZPtr {
9187                         err: Box::into_raw(Box::new(e)),
9188                 },
9189                 result_ok: false,
9190         }
9191 }
9192 /// Checks if the given object is currently in the success state
9193 #[no_mangle]
9194 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9195         o.result_ok
9196 }
9197 #[no_mangle]
9198 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9199 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9200 impl Drop for CResult_OutPointDecodeErrorZ {
9201         fn drop(&mut self) {
9202                 if self.result_ok {
9203                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9204                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9205                         }
9206                 } else {
9207                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9208                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9209                         }
9210                 }
9211         }
9212 }
9213 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9214         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9215                 let contents = if o.result_ok {
9216                         let result = unsafe { o.contents.result };
9217                         unsafe { o.contents.result = core::ptr::null_mut() };
9218                         CResult_OutPointDecodeErrorZPtr { result }
9219                 } else {
9220                         let err = unsafe { o.contents.err };
9221                         unsafe { o.contents.err = core::ptr::null_mut(); }
9222                         CResult_OutPointDecodeErrorZPtr { err }
9223                 };
9224                 Self {
9225                         contents,
9226                         result_ok: o.result_ok,
9227                 }
9228         }
9229 }
9230 impl Clone for CResult_OutPointDecodeErrorZ {
9231         fn clone(&self) -> Self {
9232                 if self.result_ok {
9233                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9234                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9235                         } }
9236                 } else {
9237                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9238                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9239                         } }
9240                 }
9241         }
9242 }
9243 #[no_mangle]
9244 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9245 /// but with all dynamically-allocated buffers duplicated in new buffers.
9246 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9247 #[repr(C)]
9248 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9249 pub enum COption_TypeZ {
9250         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9251         Some(crate::lightning::ln::wire::Type),
9252         /// When we're in this state, this COption_TypeZ contains nothing
9253         None
9254 }
9255 impl COption_TypeZ {
9256         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9257                 if let Self::None = self { false } else { true }
9258         }
9259         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9260                 !self.is_some()
9261         }
9262         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9263                 if let Self::Some(v) = self { v } else { unreachable!() }
9264         }
9265 }
9266 #[no_mangle]
9267 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9268 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9269         COption_TypeZ::Some(o)
9270 }
9271 #[no_mangle]
9272 /// Constructs a new COption_TypeZ containing nothing
9273 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9274         COption_TypeZ::None
9275 }
9276 #[no_mangle]
9277 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9278 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9279 #[repr(C)]
9280 /// The contents of CResult_COption_TypeZDecodeErrorZ
9281 pub union CResult_COption_TypeZDecodeErrorZPtr {
9282         /// A pointer to the contents in the success state.
9283         /// Reading from this pointer when `result_ok` is not set is undefined.
9284         pub result: *mut crate::c_types::derived::COption_TypeZ,
9285         /// A pointer to the contents in the error state.
9286         /// Reading from this pointer when `result_ok` is set is undefined.
9287         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9288 }
9289 #[repr(C)]
9290 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9291 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9292 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9293 pub struct CResult_COption_TypeZDecodeErrorZ {
9294         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9295         /// `err` or `result` depending on the state of `result_ok`.
9296         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9297         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9298         pub result_ok: bool,
9299 }
9300 #[no_mangle]
9301 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9302 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9303         CResult_COption_TypeZDecodeErrorZ {
9304                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9305                         result: Box::into_raw(Box::new(o)),
9306                 },
9307                 result_ok: true,
9308         }
9309 }
9310 #[no_mangle]
9311 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9312 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9313         CResult_COption_TypeZDecodeErrorZ {
9314                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9315                         err: Box::into_raw(Box::new(e)),
9316                 },
9317                 result_ok: false,
9318         }
9319 }
9320 /// Checks if the given object is currently in the success state
9321 #[no_mangle]
9322 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9323         o.result_ok
9324 }
9325 #[no_mangle]
9326 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9327 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9328 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9329         fn drop(&mut self) {
9330                 if self.result_ok {
9331                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9332                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9333                         }
9334                 } else {
9335                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9336                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9337                         }
9338                 }
9339         }
9340 }
9341 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9342         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9343                 let contents = if o.result_ok {
9344                         let result = unsafe { o.contents.result };
9345                         unsafe { o.contents.result = core::ptr::null_mut() };
9346                         CResult_COption_TypeZDecodeErrorZPtr { result }
9347                 } else {
9348                         let err = unsafe { o.contents.err };
9349                         unsafe { o.contents.err = core::ptr::null_mut(); }
9350                         CResult_COption_TypeZDecodeErrorZPtr { err }
9351                 };
9352                 Self {
9353                         contents,
9354                         result_ok: o.result_ok,
9355                 }
9356         }
9357 }
9358 #[repr(C)]
9359 /// The contents of CResult_PaymentIdPaymentErrorZ
9360 pub union CResult_PaymentIdPaymentErrorZPtr {
9361         /// A pointer to the contents in the success state.
9362         /// Reading from this pointer when `result_ok` is not set is undefined.
9363         pub result: *mut crate::c_types::ThirtyTwoBytes,
9364         /// A pointer to the contents in the error state.
9365         /// Reading from this pointer when `result_ok` is set is undefined.
9366         pub err: *mut crate::lightning_invoice::payment::PaymentError,
9367 }
9368 #[repr(C)]
9369 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9370 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9371 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9372 pub struct CResult_PaymentIdPaymentErrorZ {
9373         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9374         /// `err` or `result` depending on the state of `result_ok`.
9375         pub contents: CResult_PaymentIdPaymentErrorZPtr,
9376         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9377         pub result_ok: bool,
9378 }
9379 #[no_mangle]
9380 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9381 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9382         CResult_PaymentIdPaymentErrorZ {
9383                 contents: CResult_PaymentIdPaymentErrorZPtr {
9384                         result: Box::into_raw(Box::new(o)),
9385                 },
9386                 result_ok: true,
9387         }
9388 }
9389 #[no_mangle]
9390 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9391 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9392         CResult_PaymentIdPaymentErrorZ {
9393                 contents: CResult_PaymentIdPaymentErrorZPtr {
9394                         err: Box::into_raw(Box::new(e)),
9395                 },
9396                 result_ok: false,
9397         }
9398 }
9399 /// Checks if the given object is currently in the success state
9400 #[no_mangle]
9401 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9402         o.result_ok
9403 }
9404 #[no_mangle]
9405 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9406 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9407 impl Drop for CResult_PaymentIdPaymentErrorZ {
9408         fn drop(&mut self) {
9409                 if self.result_ok {
9410                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9411                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9412                         }
9413                 } else {
9414                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9415                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9416                         }
9417                 }
9418         }
9419 }
9420 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9421         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9422                 let contents = if o.result_ok {
9423                         let result = unsafe { o.contents.result };
9424                         unsafe { o.contents.result = core::ptr::null_mut() };
9425                         CResult_PaymentIdPaymentErrorZPtr { result }
9426                 } else {
9427                         let err = unsafe { o.contents.err };
9428                         unsafe { o.contents.err = core::ptr::null_mut(); }
9429                         CResult_PaymentIdPaymentErrorZPtr { err }
9430                 };
9431                 Self {
9432                         contents,
9433                         result_ok: o.result_ok,
9434                 }
9435         }
9436 }
9437 impl Clone for CResult_PaymentIdPaymentErrorZ {
9438         fn clone(&self) -> Self {
9439                 if self.result_ok {
9440                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9441                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9442                         } }
9443                 } else {
9444                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9445                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9446                         } }
9447                 }
9448         }
9449 }
9450 #[no_mangle]
9451 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9452 /// but with all dynamically-allocated buffers duplicated in new buffers.
9453 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9454 #[repr(C)]
9455 /// The contents of CResult_SiPrefixParseErrorZ
9456 pub union CResult_SiPrefixParseErrorZPtr {
9457         /// A pointer to the contents in the success state.
9458         /// Reading from this pointer when `result_ok` is not set is undefined.
9459         pub result: *mut crate::lightning_invoice::SiPrefix,
9460         /// A pointer to the contents in the error state.
9461         /// Reading from this pointer when `result_ok` is set is undefined.
9462         pub err: *mut crate::lightning_invoice::ParseError,
9463 }
9464 #[repr(C)]
9465 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9466 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9467 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9468 pub struct CResult_SiPrefixParseErrorZ {
9469         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9470         /// `err` or `result` depending on the state of `result_ok`.
9471         pub contents: CResult_SiPrefixParseErrorZPtr,
9472         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9473         pub result_ok: bool,
9474 }
9475 #[no_mangle]
9476 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9477 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9478         CResult_SiPrefixParseErrorZ {
9479                 contents: CResult_SiPrefixParseErrorZPtr {
9480                         result: Box::into_raw(Box::new(o)),
9481                 },
9482                 result_ok: true,
9483         }
9484 }
9485 #[no_mangle]
9486 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9487 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9488         CResult_SiPrefixParseErrorZ {
9489                 contents: CResult_SiPrefixParseErrorZPtr {
9490                         err: Box::into_raw(Box::new(e)),
9491                 },
9492                 result_ok: false,
9493         }
9494 }
9495 /// Checks if the given object is currently in the success state
9496 #[no_mangle]
9497 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9498         o.result_ok
9499 }
9500 #[no_mangle]
9501 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9502 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9503 impl Drop for CResult_SiPrefixParseErrorZ {
9504         fn drop(&mut self) {
9505                 if self.result_ok {
9506                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9507                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9508                         }
9509                 } else {
9510                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9511                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9512                         }
9513                 }
9514         }
9515 }
9516 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9517         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9518                 let contents = if o.result_ok {
9519                         let result = unsafe { o.contents.result };
9520                         unsafe { o.contents.result = core::ptr::null_mut() };
9521                         CResult_SiPrefixParseErrorZPtr { result }
9522                 } else {
9523                         let err = unsafe { o.contents.err };
9524                         unsafe { o.contents.err = core::ptr::null_mut(); }
9525                         CResult_SiPrefixParseErrorZPtr { err }
9526                 };
9527                 Self {
9528                         contents,
9529                         result_ok: o.result_ok,
9530                 }
9531         }
9532 }
9533 impl Clone for CResult_SiPrefixParseErrorZ {
9534         fn clone(&self) -> Self {
9535                 if self.result_ok {
9536                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9537                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9538                         } }
9539                 } else {
9540                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9541                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9542                         } }
9543                 }
9544         }
9545 }
9546 #[no_mangle]
9547 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9548 /// but with all dynamically-allocated buffers duplicated in new buffers.
9549 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9550 #[repr(C)]
9551 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9552 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9553         /// A pointer to the contents in the success state.
9554         /// Reading from this pointer when `result_ok` is not set is undefined.
9555         pub result: *mut crate::lightning_invoice::Invoice,
9556         /// A pointer to the contents in the error state.
9557         /// Reading from this pointer when `result_ok` is set is undefined.
9558         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9559 }
9560 #[repr(C)]
9561 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9562 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9563 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9564 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9565         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9566         /// `err` or `result` depending on the state of `result_ok`.
9567         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9568         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9569         pub result_ok: bool,
9570 }
9571 #[no_mangle]
9572 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9573 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9574         CResult_InvoiceParseOrSemanticErrorZ {
9575                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9576                         result: Box::into_raw(Box::new(o)),
9577                 },
9578                 result_ok: true,
9579         }
9580 }
9581 #[no_mangle]
9582 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9583 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9584         CResult_InvoiceParseOrSemanticErrorZ {
9585                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9586                         err: Box::into_raw(Box::new(e)),
9587                 },
9588                 result_ok: false,
9589         }
9590 }
9591 /// Checks if the given object is currently in the success state
9592 #[no_mangle]
9593 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9594         o.result_ok
9595 }
9596 #[no_mangle]
9597 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9598 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9599 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9600         fn drop(&mut self) {
9601                 if self.result_ok {
9602                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9603                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9604                         }
9605                 } else {
9606                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9607                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9608                         }
9609                 }
9610         }
9611 }
9612 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9613         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9614                 let contents = if o.result_ok {
9615                         let result = unsafe { o.contents.result };
9616                         unsafe { o.contents.result = core::ptr::null_mut() };
9617                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
9618                 } else {
9619                         let err = unsafe { o.contents.err };
9620                         unsafe { o.contents.err = core::ptr::null_mut(); }
9621                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
9622                 };
9623                 Self {
9624                         contents,
9625                         result_ok: o.result_ok,
9626                 }
9627         }
9628 }
9629 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
9630         fn clone(&self) -> Self {
9631                 if self.result_ok {
9632                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9633                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9634                         } }
9635                 } else {
9636                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9637                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
9638                         } }
9639                 }
9640         }
9641 }
9642 #[no_mangle]
9643 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
9644 /// but with all dynamically-allocated buffers duplicated in new buffers.
9645 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
9646 #[repr(C)]
9647 /// The contents of CResult_SignedRawInvoiceParseErrorZ
9648 pub union CResult_SignedRawInvoiceParseErrorZPtr {
9649         /// A pointer to the contents in the success state.
9650         /// Reading from this pointer when `result_ok` is not set is undefined.
9651         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
9652         /// A pointer to the contents in the error state.
9653         /// Reading from this pointer when `result_ok` is set is undefined.
9654         pub err: *mut crate::lightning_invoice::ParseError,
9655 }
9656 #[repr(C)]
9657 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
9658 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
9659 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9660 pub struct CResult_SignedRawInvoiceParseErrorZ {
9661         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
9662         /// `err` or `result` depending on the state of `result_ok`.
9663         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
9664         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
9665         pub result_ok: bool,
9666 }
9667 #[no_mangle]
9668 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
9669 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
9670         CResult_SignedRawInvoiceParseErrorZ {
9671                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9672                         result: Box::into_raw(Box::new(o)),
9673                 },
9674                 result_ok: true,
9675         }
9676 }
9677 #[no_mangle]
9678 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
9679 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
9680         CResult_SignedRawInvoiceParseErrorZ {
9681                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9682                         err: Box::into_raw(Box::new(e)),
9683                 },
9684                 result_ok: false,
9685         }
9686 }
9687 /// Checks if the given object is currently in the success state
9688 #[no_mangle]
9689 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
9690         o.result_ok
9691 }
9692 #[no_mangle]
9693 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
9694 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
9695 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
9696         fn drop(&mut self) {
9697                 if self.result_ok {
9698                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9699                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9700                         }
9701                 } else {
9702                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9703                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9704                         }
9705                 }
9706         }
9707 }
9708 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
9709         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
9710                 let contents = if o.result_ok {
9711                         let result = unsafe { o.contents.result };
9712                         unsafe { o.contents.result = core::ptr::null_mut() };
9713                         CResult_SignedRawInvoiceParseErrorZPtr { result }
9714                 } else {
9715                         let err = unsafe { o.contents.err };
9716                         unsafe { o.contents.err = core::ptr::null_mut(); }
9717                         CResult_SignedRawInvoiceParseErrorZPtr { err }
9718                 };
9719                 Self {
9720                         contents,
9721                         result_ok: o.result_ok,
9722                 }
9723         }
9724 }
9725 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
9726         fn clone(&self) -> Self {
9727                 if self.result_ok {
9728                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9729                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
9730                         } }
9731                 } else {
9732                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9733                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9734                         } }
9735                 }
9736         }
9737 }
9738 #[no_mangle]
9739 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
9740 /// but with all dynamically-allocated buffers duplicated in new buffers.
9741 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
9742 #[repr(C)]
9743 /// A tuple of 3 elements. See the individual fields for the types contained.
9744 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9745         /// The element at position 0
9746         pub a: crate::lightning_invoice::RawInvoice,
9747         /// The element at position 1
9748         pub b: crate::c_types::ThirtyTwoBytes,
9749         /// The element at position 2
9750         pub c: crate::lightning_invoice::InvoiceSignature,
9751 }
9752 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9753         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
9754                 Self {
9755                         a: tup.0,
9756                         b: tup.1,
9757                         c: tup.2,
9758                 }
9759         }
9760 }
9761 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9762         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
9763                 (self.a, self.b, self.c)
9764         }
9765 }
9766 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9767         fn clone(&self) -> Self {
9768                 Self {
9769                         a: Clone::clone(&self.a),
9770                         b: Clone::clone(&self.b),
9771                         c: Clone::clone(&self.c),
9772                 }
9773         }
9774 }
9775 #[no_mangle]
9776 /// Creates a new tuple which has the same data as `orig`
9777 /// but with all dynamically-allocated buffers duplicated in new buffers.
9778 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
9779 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
9780 #[no_mangle]
9781 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 {
9782         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
9783 }
9784
9785 #[no_mangle]
9786 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
9787 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
9788 #[repr(C)]
9789 /// The contents of CResult_PayeePubKeyErrorZ
9790 pub union CResult_PayeePubKeyErrorZPtr {
9791         /// A pointer to the contents in the success state.
9792         /// Reading from this pointer when `result_ok` is not set is undefined.
9793         pub result: *mut crate::lightning_invoice::PayeePubKey,
9794         /// A pointer to the contents in the error state.
9795         /// Reading from this pointer when `result_ok` is set is undefined.
9796         pub err: *mut crate::c_types::Secp256k1Error,
9797 }
9798 #[repr(C)]
9799 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
9800 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
9801 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9802 pub struct CResult_PayeePubKeyErrorZ {
9803         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
9804         /// `err` or `result` depending on the state of `result_ok`.
9805         pub contents: CResult_PayeePubKeyErrorZPtr,
9806         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
9807         pub result_ok: bool,
9808 }
9809 #[no_mangle]
9810 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
9811 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
9812         CResult_PayeePubKeyErrorZ {
9813                 contents: CResult_PayeePubKeyErrorZPtr {
9814                         result: Box::into_raw(Box::new(o)),
9815                 },
9816                 result_ok: true,
9817         }
9818 }
9819 #[no_mangle]
9820 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
9821 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
9822         CResult_PayeePubKeyErrorZ {
9823                 contents: CResult_PayeePubKeyErrorZPtr {
9824                         err: Box::into_raw(Box::new(e)),
9825                 },
9826                 result_ok: false,
9827         }
9828 }
9829 /// Checks if the given object is currently in the success state
9830 #[no_mangle]
9831 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
9832         o.result_ok
9833 }
9834 #[no_mangle]
9835 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
9836 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
9837 impl Drop for CResult_PayeePubKeyErrorZ {
9838         fn drop(&mut self) {
9839                 if self.result_ok {
9840                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9841                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9842                         }
9843                 } else {
9844                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9845                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9846                         }
9847                 }
9848         }
9849 }
9850 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
9851         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
9852                 let contents = if o.result_ok {
9853                         let result = unsafe { o.contents.result };
9854                         unsafe { o.contents.result = core::ptr::null_mut() };
9855                         CResult_PayeePubKeyErrorZPtr { result }
9856                 } else {
9857                         let err = unsafe { o.contents.err };
9858                         unsafe { o.contents.err = core::ptr::null_mut(); }
9859                         CResult_PayeePubKeyErrorZPtr { err }
9860                 };
9861                 Self {
9862                         contents,
9863                         result_ok: o.result_ok,
9864                 }
9865         }
9866 }
9867 impl Clone for CResult_PayeePubKeyErrorZ {
9868         fn clone(&self) -> Self {
9869                 if self.result_ok {
9870                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
9871                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
9872                         } }
9873                 } else {
9874                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
9875                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
9876                         } }
9877                 }
9878         }
9879 }
9880 #[no_mangle]
9881 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
9882 /// but with all dynamically-allocated buffers duplicated in new buffers.
9883 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
9884 #[repr(C)]
9885 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
9886 /// This corresponds to std::vector in C++
9887 pub struct CVec_PrivateRouteZ {
9888         /// The elements in the array.
9889         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9890         pub data: *mut crate::lightning_invoice::PrivateRoute,
9891         /// The number of elements pointed to by `data`.
9892         pub datalen: usize
9893 }
9894 impl CVec_PrivateRouteZ {
9895         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
9896                 if self.datalen == 0 { return Vec::new(); }
9897                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9898                 self.data = core::ptr::null_mut();
9899                 self.datalen = 0;
9900                 ret
9901         }
9902         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
9903                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9904         }
9905 }
9906 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
9907         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
9908                 let datalen = v.len();
9909                 let data = Box::into_raw(v.into_boxed_slice());
9910                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9911         }
9912 }
9913 #[no_mangle]
9914 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9915 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
9916 impl Drop for CVec_PrivateRouteZ {
9917         fn drop(&mut self) {
9918                 if self.datalen == 0 { return; }
9919                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9920         }
9921 }
9922 impl Clone for CVec_PrivateRouteZ {
9923         fn clone(&self) -> Self {
9924                 let mut res = Vec::new();
9925                 if self.datalen == 0 { return Self::from(res); }
9926                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9927                 Self::from(res)
9928         }
9929 }
9930 #[repr(C)]
9931 /// The contents of CResult_PositiveTimestampCreationErrorZ
9932 pub union CResult_PositiveTimestampCreationErrorZPtr {
9933         /// A pointer to the contents in the success state.
9934         /// Reading from this pointer when `result_ok` is not set is undefined.
9935         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
9936         /// A pointer to the contents in the error state.
9937         /// Reading from this pointer when `result_ok` is set is undefined.
9938         pub err: *mut crate::lightning_invoice::CreationError,
9939 }
9940 #[repr(C)]
9941 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
9942 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
9943 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9944 pub struct CResult_PositiveTimestampCreationErrorZ {
9945         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
9946         /// `err` or `result` depending on the state of `result_ok`.
9947         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
9948         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
9949         pub result_ok: bool,
9950 }
9951 #[no_mangle]
9952 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
9953 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
9954         CResult_PositiveTimestampCreationErrorZ {
9955                 contents: CResult_PositiveTimestampCreationErrorZPtr {
9956                         result: Box::into_raw(Box::new(o)),
9957                 },
9958                 result_ok: true,
9959         }
9960 }
9961 #[no_mangle]
9962 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
9963 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
9964         CResult_PositiveTimestampCreationErrorZ {
9965                 contents: CResult_PositiveTimestampCreationErrorZPtr {
9966                         err: Box::into_raw(Box::new(e)),
9967                 },
9968                 result_ok: false,
9969         }
9970 }
9971 /// Checks if the given object is currently in the success state
9972 #[no_mangle]
9973 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
9974         o.result_ok
9975 }
9976 #[no_mangle]
9977 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
9978 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
9979 impl Drop for CResult_PositiveTimestampCreationErrorZ {
9980         fn drop(&mut self) {
9981                 if self.result_ok {
9982                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9983                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9984                         }
9985                 } else {
9986                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9987                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9988                         }
9989                 }
9990         }
9991 }
9992 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
9993         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
9994                 let contents = if o.result_ok {
9995                         let result = unsafe { o.contents.result };
9996                         unsafe { o.contents.result = core::ptr::null_mut() };
9997                         CResult_PositiveTimestampCreationErrorZPtr { result }
9998                 } else {
9999                         let err = unsafe { o.contents.err };
10000                         unsafe { o.contents.err = core::ptr::null_mut(); }
10001                         CResult_PositiveTimestampCreationErrorZPtr { err }
10002                 };
10003                 Self {
10004                         contents,
10005                         result_ok: o.result_ok,
10006                 }
10007         }
10008 }
10009 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10010         fn clone(&self) -> Self {
10011                 if self.result_ok {
10012                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10013                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10014                         } }
10015                 } else {
10016                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10017                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10018                         } }
10019                 }
10020         }
10021 }
10022 #[no_mangle]
10023 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10024 /// but with all dynamically-allocated buffers duplicated in new buffers.
10025 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10026 #[repr(C)]
10027 /// The contents of CResult_NoneSemanticErrorZ
10028 pub union CResult_NoneSemanticErrorZPtr {
10029         /// Note that this value is always NULL, as there are no contents in the OK variant
10030         pub result: *mut core::ffi::c_void,
10031         /// A pointer to the contents in the error state.
10032         /// Reading from this pointer when `result_ok` is set is undefined.
10033         pub err: *mut crate::lightning_invoice::SemanticError,
10034 }
10035 #[repr(C)]
10036 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10037 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10039 pub struct CResult_NoneSemanticErrorZ {
10040         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10041         /// `err` or `result` depending on the state of `result_ok`.
10042         pub contents: CResult_NoneSemanticErrorZPtr,
10043         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10044         pub result_ok: bool,
10045 }
10046 #[no_mangle]
10047 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10048 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10049         CResult_NoneSemanticErrorZ {
10050                 contents: CResult_NoneSemanticErrorZPtr {
10051                         result: core::ptr::null_mut(),
10052                 },
10053                 result_ok: true,
10054         }
10055 }
10056 #[no_mangle]
10057 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10058 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10059         CResult_NoneSemanticErrorZ {
10060                 contents: CResult_NoneSemanticErrorZPtr {
10061                         err: Box::into_raw(Box::new(e)),
10062                 },
10063                 result_ok: false,
10064         }
10065 }
10066 /// Checks if the given object is currently in the success state
10067 #[no_mangle]
10068 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10069         o.result_ok
10070 }
10071 #[no_mangle]
10072 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10073 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10074 impl Drop for CResult_NoneSemanticErrorZ {
10075         fn drop(&mut self) {
10076                 if self.result_ok {
10077                 } else {
10078                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10079                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10080                         }
10081                 }
10082         }
10083 }
10084 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10085         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10086                 let contents = if o.result_ok {
10087                         let _ = unsafe { Box::from_raw(o.contents.result) };
10088                         o.contents.result = core::ptr::null_mut();
10089                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10090                 } else {
10091                         let err = unsafe { o.contents.err };
10092                         unsafe { o.contents.err = core::ptr::null_mut(); }
10093                         CResult_NoneSemanticErrorZPtr { err }
10094                 };
10095                 Self {
10096                         contents,
10097                         result_ok: o.result_ok,
10098                 }
10099         }
10100 }
10101 impl Clone for CResult_NoneSemanticErrorZ {
10102         fn clone(&self) -> Self {
10103                 if self.result_ok {
10104                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10105                                 result: core::ptr::null_mut()
10106                         } }
10107                 } else {
10108                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10109                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10110                         } }
10111                 }
10112         }
10113 }
10114 #[no_mangle]
10115 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10116 /// but with all dynamically-allocated buffers duplicated in new buffers.
10117 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10118 #[repr(C)]
10119 /// The contents of CResult_InvoiceSemanticErrorZ
10120 pub union CResult_InvoiceSemanticErrorZPtr {
10121         /// A pointer to the contents in the success state.
10122         /// Reading from this pointer when `result_ok` is not set is undefined.
10123         pub result: *mut crate::lightning_invoice::Invoice,
10124         /// A pointer to the contents in the error state.
10125         /// Reading from this pointer when `result_ok` is set is undefined.
10126         pub err: *mut crate::lightning_invoice::SemanticError,
10127 }
10128 #[repr(C)]
10129 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10130 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10132 pub struct CResult_InvoiceSemanticErrorZ {
10133         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10134         /// `err` or `result` depending on the state of `result_ok`.
10135         pub contents: CResult_InvoiceSemanticErrorZPtr,
10136         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10137         pub result_ok: bool,
10138 }
10139 #[no_mangle]
10140 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10141 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10142         CResult_InvoiceSemanticErrorZ {
10143                 contents: CResult_InvoiceSemanticErrorZPtr {
10144                         result: Box::into_raw(Box::new(o)),
10145                 },
10146                 result_ok: true,
10147         }
10148 }
10149 #[no_mangle]
10150 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10151 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10152         CResult_InvoiceSemanticErrorZ {
10153                 contents: CResult_InvoiceSemanticErrorZPtr {
10154                         err: Box::into_raw(Box::new(e)),
10155                 },
10156                 result_ok: false,
10157         }
10158 }
10159 /// Checks if the given object is currently in the success state
10160 #[no_mangle]
10161 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10162         o.result_ok
10163 }
10164 #[no_mangle]
10165 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10166 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10167 impl Drop for CResult_InvoiceSemanticErrorZ {
10168         fn drop(&mut self) {
10169                 if self.result_ok {
10170                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10171                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10172                         }
10173                 } else {
10174                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10175                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10176                         }
10177                 }
10178         }
10179 }
10180 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10182                 let contents = if o.result_ok {
10183                         let result = unsafe { o.contents.result };
10184                         unsafe { o.contents.result = core::ptr::null_mut() };
10185                         CResult_InvoiceSemanticErrorZPtr { result }
10186                 } else {
10187                         let err = unsafe { o.contents.err };
10188                         unsafe { o.contents.err = core::ptr::null_mut(); }
10189                         CResult_InvoiceSemanticErrorZPtr { err }
10190                 };
10191                 Self {
10192                         contents,
10193                         result_ok: o.result_ok,
10194                 }
10195         }
10196 }
10197 impl Clone for CResult_InvoiceSemanticErrorZ {
10198         fn clone(&self) -> Self {
10199                 if self.result_ok {
10200                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10201                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10202                         } }
10203                 } else {
10204                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10205                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10206                         } }
10207                 }
10208         }
10209 }
10210 #[no_mangle]
10211 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10212 /// but with all dynamically-allocated buffers duplicated in new buffers.
10213 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10214 #[repr(C)]
10215 /// The contents of CResult_DescriptionCreationErrorZ
10216 pub union CResult_DescriptionCreationErrorZPtr {
10217         /// A pointer to the contents in the success state.
10218         /// Reading from this pointer when `result_ok` is not set is undefined.
10219         pub result: *mut crate::lightning_invoice::Description,
10220         /// A pointer to the contents in the error state.
10221         /// Reading from this pointer when `result_ok` is set is undefined.
10222         pub err: *mut crate::lightning_invoice::CreationError,
10223 }
10224 #[repr(C)]
10225 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10226 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10228 pub struct CResult_DescriptionCreationErrorZ {
10229         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10230         /// `err` or `result` depending on the state of `result_ok`.
10231         pub contents: CResult_DescriptionCreationErrorZPtr,
10232         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10233         pub result_ok: bool,
10234 }
10235 #[no_mangle]
10236 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10237 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10238         CResult_DescriptionCreationErrorZ {
10239                 contents: CResult_DescriptionCreationErrorZPtr {
10240                         result: Box::into_raw(Box::new(o)),
10241                 },
10242                 result_ok: true,
10243         }
10244 }
10245 #[no_mangle]
10246 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10247 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10248         CResult_DescriptionCreationErrorZ {
10249                 contents: CResult_DescriptionCreationErrorZPtr {
10250                         err: Box::into_raw(Box::new(e)),
10251                 },
10252                 result_ok: false,
10253         }
10254 }
10255 /// Checks if the given object is currently in the success state
10256 #[no_mangle]
10257 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10258         o.result_ok
10259 }
10260 #[no_mangle]
10261 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10262 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10263 impl Drop for CResult_DescriptionCreationErrorZ {
10264         fn drop(&mut self) {
10265                 if self.result_ok {
10266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10268                         }
10269                 } else {
10270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10272                         }
10273                 }
10274         }
10275 }
10276 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10277         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10278                 let contents = if o.result_ok {
10279                         let result = unsafe { o.contents.result };
10280                         unsafe { o.contents.result = core::ptr::null_mut() };
10281                         CResult_DescriptionCreationErrorZPtr { result }
10282                 } else {
10283                         let err = unsafe { o.contents.err };
10284                         unsafe { o.contents.err = core::ptr::null_mut(); }
10285                         CResult_DescriptionCreationErrorZPtr { err }
10286                 };
10287                 Self {
10288                         contents,
10289                         result_ok: o.result_ok,
10290                 }
10291         }
10292 }
10293 impl Clone for CResult_DescriptionCreationErrorZ {
10294         fn clone(&self) -> Self {
10295                 if self.result_ok {
10296                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10297                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10298                         } }
10299                 } else {
10300                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10301                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10302                         } }
10303                 }
10304         }
10305 }
10306 #[no_mangle]
10307 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10308 /// but with all dynamically-allocated buffers duplicated in new buffers.
10309 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10310 #[repr(C)]
10311 /// The contents of CResult_PrivateRouteCreationErrorZ
10312 pub union CResult_PrivateRouteCreationErrorZPtr {
10313         /// A pointer to the contents in the success state.
10314         /// Reading from this pointer when `result_ok` is not set is undefined.
10315         pub result: *mut crate::lightning_invoice::PrivateRoute,
10316         /// A pointer to the contents in the error state.
10317         /// Reading from this pointer when `result_ok` is set is undefined.
10318         pub err: *mut crate::lightning_invoice::CreationError,
10319 }
10320 #[repr(C)]
10321 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10322 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10324 pub struct CResult_PrivateRouteCreationErrorZ {
10325         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10326         /// `err` or `result` depending on the state of `result_ok`.
10327         pub contents: CResult_PrivateRouteCreationErrorZPtr,
10328         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10329         pub result_ok: bool,
10330 }
10331 #[no_mangle]
10332 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10333 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10334         CResult_PrivateRouteCreationErrorZ {
10335                 contents: CResult_PrivateRouteCreationErrorZPtr {
10336                         result: Box::into_raw(Box::new(o)),
10337                 },
10338                 result_ok: true,
10339         }
10340 }
10341 #[no_mangle]
10342 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10343 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10344         CResult_PrivateRouteCreationErrorZ {
10345                 contents: CResult_PrivateRouteCreationErrorZPtr {
10346                         err: Box::into_raw(Box::new(e)),
10347                 },
10348                 result_ok: false,
10349         }
10350 }
10351 /// Checks if the given object is currently in the success state
10352 #[no_mangle]
10353 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10354         o.result_ok
10355 }
10356 #[no_mangle]
10357 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10358 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10359 impl Drop for CResult_PrivateRouteCreationErrorZ {
10360         fn drop(&mut self) {
10361                 if self.result_ok {
10362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10364                         }
10365                 } else {
10366                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10367                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10368                         }
10369                 }
10370         }
10371 }
10372 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10373         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10374                 let contents = if o.result_ok {
10375                         let result = unsafe { o.contents.result };
10376                         unsafe { o.contents.result = core::ptr::null_mut() };
10377                         CResult_PrivateRouteCreationErrorZPtr { result }
10378                 } else {
10379                         let err = unsafe { o.contents.err };
10380                         unsafe { o.contents.err = core::ptr::null_mut(); }
10381                         CResult_PrivateRouteCreationErrorZPtr { err }
10382                 };
10383                 Self {
10384                         contents,
10385                         result_ok: o.result_ok,
10386                 }
10387         }
10388 }
10389 impl Clone for CResult_PrivateRouteCreationErrorZ {
10390         fn clone(&self) -> Self {
10391                 if self.result_ok {
10392                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10393                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10394                         } }
10395                 } else {
10396                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10397                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10398                         } }
10399                 }
10400         }
10401 }
10402 #[no_mangle]
10403 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10404 /// but with all dynamically-allocated buffers duplicated in new buffers.
10405 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10406 #[repr(C)]
10407 /// The contents of CResult_StringErrorZ
10408 pub union CResult_StringErrorZPtr {
10409         /// A pointer to the contents in the success state.
10410         /// Reading from this pointer when `result_ok` is not set is undefined.
10411         pub result: *mut crate::c_types::Str,
10412         /// A pointer to the contents in the error state.
10413         /// Reading from this pointer when `result_ok` is set is undefined.
10414         pub err: *mut crate::c_types::Secp256k1Error,
10415 }
10416 #[repr(C)]
10417 /// A CResult_StringErrorZ represents the result of a fallible operation,
10418 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10419 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10420 pub struct CResult_StringErrorZ {
10421         /// The contents of this CResult_StringErrorZ, accessible via either
10422         /// `err` or `result` depending on the state of `result_ok`.
10423         pub contents: CResult_StringErrorZPtr,
10424         /// Whether this CResult_StringErrorZ represents a success state.
10425         pub result_ok: bool,
10426 }
10427 #[no_mangle]
10428 /// Creates a new CResult_StringErrorZ in the success state.
10429 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10430         CResult_StringErrorZ {
10431                 contents: CResult_StringErrorZPtr {
10432                         result: Box::into_raw(Box::new(o)),
10433                 },
10434                 result_ok: true,
10435         }
10436 }
10437 #[no_mangle]
10438 /// Creates a new CResult_StringErrorZ in the error state.
10439 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10440         CResult_StringErrorZ {
10441                 contents: CResult_StringErrorZPtr {
10442                         err: Box::into_raw(Box::new(e)),
10443                 },
10444                 result_ok: false,
10445         }
10446 }
10447 /// Checks if the given object is currently in the success state
10448 #[no_mangle]
10449 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10450         o.result_ok
10451 }
10452 #[no_mangle]
10453 /// Frees any resources used by the CResult_StringErrorZ.
10454 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10455 impl Drop for CResult_StringErrorZ {
10456         fn drop(&mut self) {
10457                 if self.result_ok {
10458                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10459                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10460                         }
10461                 } else {
10462                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10463                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10464                         }
10465                 }
10466         }
10467 }
10468 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10469         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10470                 let contents = if o.result_ok {
10471                         let result = unsafe { o.contents.result };
10472                         unsafe { o.contents.result = core::ptr::null_mut() };
10473                         CResult_StringErrorZPtr { result }
10474                 } else {
10475                         let err = unsafe { o.contents.err };
10476                         unsafe { o.contents.err = core::ptr::null_mut(); }
10477                         CResult_StringErrorZPtr { err }
10478                 };
10479                 Self {
10480                         contents,
10481                         result_ok: o.result_ok,
10482                 }
10483         }
10484 }
10485 impl Clone for CResult_StringErrorZ {
10486         fn clone(&self) -> Self {
10487                 if self.result_ok {
10488                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
10489                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10490                         } }
10491                 } else {
10492                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
10493                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10494                         } }
10495                 }
10496         }
10497 }
10498 #[no_mangle]
10499 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10500 /// but with all dynamically-allocated buffers duplicated in new buffers.
10501 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10502 #[repr(C)]
10503 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10504 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10505         /// A pointer to the contents in the success state.
10506         /// Reading from this pointer when `result_ok` is not set is undefined.
10507         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10508         /// A pointer to the contents in the error state.
10509         /// Reading from this pointer when `result_ok` is set is undefined.
10510         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10511 }
10512 #[repr(C)]
10513 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10514 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10515 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10516 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10517         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10518         /// `err` or `result` depending on the state of `result_ok`.
10519         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10520         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10521         pub result_ok: bool,
10522 }
10523 #[no_mangle]
10524 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10525 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10526         CResult_ChannelMonitorUpdateDecodeErrorZ {
10527                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10528                         result: Box::into_raw(Box::new(o)),
10529                 },
10530                 result_ok: true,
10531         }
10532 }
10533 #[no_mangle]
10534 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10535 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10536         CResult_ChannelMonitorUpdateDecodeErrorZ {
10537                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10538                         err: Box::into_raw(Box::new(e)),
10539                 },
10540                 result_ok: false,
10541         }
10542 }
10543 /// Checks if the given object is currently in the success state
10544 #[no_mangle]
10545 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10546         o.result_ok
10547 }
10548 #[no_mangle]
10549 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10550 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10551 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10552         fn drop(&mut self) {
10553                 if self.result_ok {
10554                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10555                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10556                         }
10557                 } else {
10558                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10559                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10560                         }
10561                 }
10562         }
10563 }
10564 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10565         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10566                 let contents = if o.result_ok {
10567                         let result = unsafe { o.contents.result };
10568                         unsafe { o.contents.result = core::ptr::null_mut() };
10569                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10570                 } else {
10571                         let err = unsafe { o.contents.err };
10572                         unsafe { o.contents.err = core::ptr::null_mut(); }
10573                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10574                 };
10575                 Self {
10576                         contents,
10577                         result_ok: o.result_ok,
10578                 }
10579         }
10580 }
10581 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10582         fn clone(&self) -> Self {
10583                 if self.result_ok {
10584                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10585                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10586                         } }
10587                 } else {
10588                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10589                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10590                         } }
10591                 }
10592         }
10593 }
10594 #[no_mangle]
10595 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10596 /// but with all dynamically-allocated buffers duplicated in new buffers.
10597 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10598 #[repr(C)]
10599 #[derive(Clone)]
10600 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10601 pub enum COption_MonitorEventZ {
10602         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10603         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10604         /// When we're in this state, this COption_MonitorEventZ contains nothing
10605         None
10606 }
10607 impl COption_MonitorEventZ {
10608         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10609                 if let Self::None = self { false } else { true }
10610         }
10611         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10612                 !self.is_some()
10613         }
10614         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10615                 if let Self::Some(v) = self { v } else { unreachable!() }
10616         }
10617 }
10618 #[no_mangle]
10619 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10620 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10621         COption_MonitorEventZ::Some(o)
10622 }
10623 #[no_mangle]
10624 /// Constructs a new COption_MonitorEventZ containing nothing
10625 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10626         COption_MonitorEventZ::None
10627 }
10628 #[no_mangle]
10629 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10630 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10631 #[no_mangle]
10632 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10633 /// but with all dynamically-allocated buffers duplicated in new buffers.
10634 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10635 #[repr(C)]
10636 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10637 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10638         /// A pointer to the contents in the success state.
10639         /// Reading from this pointer when `result_ok` is not set is undefined.
10640         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10641         /// A pointer to the contents in the error state.
10642         /// Reading from this pointer when `result_ok` is set is undefined.
10643         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10644 }
10645 #[repr(C)]
10646 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10647 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10649 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10650         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10651         /// `err` or `result` depending on the state of `result_ok`.
10652         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10653         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10654         pub result_ok: bool,
10655 }
10656 #[no_mangle]
10657 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10658 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10659         CResult_COption_MonitorEventZDecodeErrorZ {
10660                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10661                         result: Box::into_raw(Box::new(o)),
10662                 },
10663                 result_ok: true,
10664         }
10665 }
10666 #[no_mangle]
10667 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10668 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10669         CResult_COption_MonitorEventZDecodeErrorZ {
10670                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10671                         err: Box::into_raw(Box::new(e)),
10672                 },
10673                 result_ok: false,
10674         }
10675 }
10676 /// Checks if the given object is currently in the success state
10677 #[no_mangle]
10678 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10679         o.result_ok
10680 }
10681 #[no_mangle]
10682 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10683 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10684 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10685         fn drop(&mut self) {
10686                 if self.result_ok {
10687                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10688                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10689                         }
10690                 } else {
10691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10693                         }
10694                 }
10695         }
10696 }
10697 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10698         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10699                 let contents = if o.result_ok {
10700                         let result = unsafe { o.contents.result };
10701                         unsafe { o.contents.result = core::ptr::null_mut() };
10702                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10703                 } else {
10704                         let err = unsafe { o.contents.err };
10705                         unsafe { o.contents.err = core::ptr::null_mut(); }
10706                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10707                 };
10708                 Self {
10709                         contents,
10710                         result_ok: o.result_ok,
10711                 }
10712         }
10713 }
10714 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10715         fn clone(&self) -> Self {
10716                 if self.result_ok {
10717                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10718                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10719                         } }
10720                 } else {
10721                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10722                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10723                         } }
10724                 }
10725         }
10726 }
10727 #[no_mangle]
10728 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10729 /// but with all dynamically-allocated buffers duplicated in new buffers.
10730 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10731 #[repr(C)]
10732 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10733 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10734         /// A pointer to the contents in the success state.
10735         /// Reading from this pointer when `result_ok` is not set is undefined.
10736         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10737         /// A pointer to the contents in the error state.
10738         /// Reading from this pointer when `result_ok` is set is undefined.
10739         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10740 }
10741 #[repr(C)]
10742 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10743 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10745 pub struct CResult_HTLCUpdateDecodeErrorZ {
10746         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10747         /// `err` or `result` depending on the state of `result_ok`.
10748         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10749         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10750         pub result_ok: bool,
10751 }
10752 #[no_mangle]
10753 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10754 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10755         CResult_HTLCUpdateDecodeErrorZ {
10756                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10757                         result: Box::into_raw(Box::new(o)),
10758                 },
10759                 result_ok: true,
10760         }
10761 }
10762 #[no_mangle]
10763 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10764 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
10765         CResult_HTLCUpdateDecodeErrorZ {
10766                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10767                         err: Box::into_raw(Box::new(e)),
10768                 },
10769                 result_ok: false,
10770         }
10771 }
10772 /// Checks if the given object is currently in the success state
10773 #[no_mangle]
10774 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
10775         o.result_ok
10776 }
10777 #[no_mangle]
10778 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10779 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
10780 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
10781         fn drop(&mut self) {
10782                 if self.result_ok {
10783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10785                         }
10786                 } else {
10787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10789                         }
10790                 }
10791         }
10792 }
10793 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
10794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10795                 let contents = if o.result_ok {
10796                         let result = unsafe { o.contents.result };
10797                         unsafe { o.contents.result = core::ptr::null_mut() };
10798                         CResult_HTLCUpdateDecodeErrorZPtr { result }
10799                 } else {
10800                         let err = unsafe { o.contents.err };
10801                         unsafe { o.contents.err = core::ptr::null_mut(); }
10802                         CResult_HTLCUpdateDecodeErrorZPtr { err }
10803                 };
10804                 Self {
10805                         contents,
10806                         result_ok: o.result_ok,
10807                 }
10808         }
10809 }
10810 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
10811         fn clone(&self) -> Self {
10812                 if self.result_ok {
10813                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10814                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
10815                         } }
10816                 } else {
10817                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
10818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10819                         } }
10820                 }
10821         }
10822 }
10823 #[no_mangle]
10824 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10825 /// but with all dynamically-allocated buffers duplicated in new buffers.
10826 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
10827 #[repr(C)]
10828 /// A tuple of 2 elements. See the individual fields for the types contained.
10829 pub struct C2Tuple_OutPointScriptZ {
10830         /// The element at position 0
10831         pub a: crate::lightning::chain::transaction::OutPoint,
10832         /// The element at position 1
10833         pub b: crate::c_types::derived::CVec_u8Z,
10834 }
10835 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
10836         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
10837                 Self {
10838                         a: tup.0,
10839                         b: tup.1,
10840                 }
10841         }
10842 }
10843 impl C2Tuple_OutPointScriptZ {
10844         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
10845                 (self.a, self.b)
10846         }
10847 }
10848 impl Clone for C2Tuple_OutPointScriptZ {
10849         fn clone(&self) -> Self {
10850                 Self {
10851                         a: Clone::clone(&self.a),
10852                         b: Clone::clone(&self.b),
10853                 }
10854         }
10855 }
10856 #[no_mangle]
10857 /// Creates a new tuple which has the same data as `orig`
10858 /// but with all dynamically-allocated buffers duplicated in new buffers.
10859 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
10860 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10861 #[no_mangle]
10862 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
10863         C2Tuple_OutPointScriptZ { a, b, }
10864 }
10865
10866 #[no_mangle]
10867 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
10868 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
10869 #[repr(C)]
10870 /// A tuple of 2 elements. See the individual fields for the types contained.
10871 pub struct C2Tuple_u32ScriptZ {
10872         /// The element at position 0
10873         pub a: u32,
10874         /// The element at position 1
10875         pub b: crate::c_types::derived::CVec_u8Z,
10876 }
10877 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
10878         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
10879                 Self {
10880                         a: tup.0,
10881                         b: tup.1,
10882                 }
10883         }
10884 }
10885 impl C2Tuple_u32ScriptZ {
10886         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
10887                 (self.a, self.b)
10888         }
10889 }
10890 impl Clone for C2Tuple_u32ScriptZ {
10891         fn clone(&self) -> Self {
10892                 Self {
10893                         a: Clone::clone(&self.a),
10894                         b: Clone::clone(&self.b),
10895                 }
10896         }
10897 }
10898 #[no_mangle]
10899 /// Creates a new tuple which has the same data as `orig`
10900 /// but with all dynamically-allocated buffers duplicated in new buffers.
10901 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
10902 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
10903 #[no_mangle]
10904 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
10905         C2Tuple_u32ScriptZ { a, b, }
10906 }
10907
10908 #[no_mangle]
10909 /// Frees any resources used by the C2Tuple_u32ScriptZ.
10910 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
10911 #[repr(C)]
10912 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
10913 /// This corresponds to std::vector in C++
10914 pub struct CVec_C2Tuple_u32ScriptZZ {
10915         /// The elements in the array.
10916         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10917         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
10918         /// The number of elements pointed to by `data`.
10919         pub datalen: usize
10920 }
10921 impl CVec_C2Tuple_u32ScriptZZ {
10922         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
10923                 if self.datalen == 0 { return Vec::new(); }
10924                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10925                 self.data = core::ptr::null_mut();
10926                 self.datalen = 0;
10927                 ret
10928         }
10929         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
10930                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10931         }
10932 }
10933 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
10934         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
10935                 let datalen = v.len();
10936                 let data = Box::into_raw(v.into_boxed_slice());
10937                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10938         }
10939 }
10940 #[no_mangle]
10941 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10942 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
10943 impl Drop for CVec_C2Tuple_u32ScriptZZ {
10944         fn drop(&mut self) {
10945                 if self.datalen == 0 { return; }
10946                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10947         }
10948 }
10949 impl Clone for CVec_C2Tuple_u32ScriptZZ {
10950         fn clone(&self) -> Self {
10951                 let mut res = Vec::new();
10952                 if self.datalen == 0 { return Self::from(res); }
10953                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10954                 Self::from(res)
10955         }
10956 }
10957 #[repr(C)]
10958 /// A tuple of 2 elements. See the individual fields for the types contained.
10959 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10960         /// The element at position 0
10961         pub a: crate::c_types::ThirtyTwoBytes,
10962         /// The element at position 1
10963         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
10964 }
10965 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10966         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
10967                 Self {
10968                         a: tup.0,
10969                         b: tup.1,
10970                 }
10971         }
10972 }
10973 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10974         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
10975                 (self.a, self.b)
10976         }
10977 }
10978 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
10979         fn clone(&self) -> Self {
10980                 Self {
10981                         a: Clone::clone(&self.a),
10982                         b: Clone::clone(&self.b),
10983                 }
10984         }
10985 }
10986 #[no_mangle]
10987 /// Creates a new tuple which has the same data as `orig`
10988 /// but with all dynamically-allocated buffers duplicated in new buffers.
10989 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
10990 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10991 #[no_mangle]
10992 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 {
10993         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
10994 }
10995
10996 #[no_mangle]
10997 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10998 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
10999 #[repr(C)]
11000 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11001 /// This corresponds to std::vector in C++
11002 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11003         /// The elements in the array.
11004         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11005         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11006         /// The number of elements pointed to by `data`.
11007         pub datalen: usize
11008 }
11009 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11010         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11011                 if self.datalen == 0 { return Vec::new(); }
11012                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11013                 self.data = core::ptr::null_mut();
11014                 self.datalen = 0;
11015                 ret
11016         }
11017         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11018                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11019         }
11020 }
11021 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11022         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11023                 let datalen = v.len();
11024                 let data = Box::into_raw(v.into_boxed_slice());
11025                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11026         }
11027 }
11028 #[no_mangle]
11029 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11030 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11031 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11032         fn drop(&mut self) {
11033                 if self.datalen == 0 { return; }
11034                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11035         }
11036 }
11037 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11038         fn clone(&self) -> Self {
11039                 let mut res = Vec::new();
11040                 if self.datalen == 0 { return Self::from(res); }
11041                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11042                 Self::from(res)
11043         }
11044 }
11045 #[repr(C)]
11046 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11047 /// This corresponds to std::vector in C++
11048 pub struct CVec_EventZ {
11049         /// The elements in the array.
11050         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11051         pub data: *mut crate::lightning::util::events::Event,
11052         /// The number of elements pointed to by `data`.
11053         pub datalen: usize
11054 }
11055 impl CVec_EventZ {
11056         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11057                 if self.datalen == 0 { return Vec::new(); }
11058                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11059                 self.data = core::ptr::null_mut();
11060                 self.datalen = 0;
11061                 ret
11062         }
11063         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11064                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11065         }
11066 }
11067 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11068         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11069                 let datalen = v.len();
11070                 let data = Box::into_raw(v.into_boxed_slice());
11071                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11072         }
11073 }
11074 #[no_mangle]
11075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11076 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11077 impl Drop for CVec_EventZ {
11078         fn drop(&mut self) {
11079                 if self.datalen == 0 { return; }
11080                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11081         }
11082 }
11083 impl Clone for CVec_EventZ {
11084         fn clone(&self) -> Self {
11085                 let mut res = Vec::new();
11086                 if self.datalen == 0 { return Self::from(res); }
11087                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11088                 Self::from(res)
11089         }
11090 }
11091 #[repr(C)]
11092 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11093 /// This corresponds to std::vector in C++
11094 pub struct CVec_TransactionZ {
11095         /// The elements in the array.
11096         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11097         pub data: *mut crate::c_types::Transaction,
11098         /// The number of elements pointed to by `data`.
11099         pub datalen: usize
11100 }
11101 impl CVec_TransactionZ {
11102         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11103                 if self.datalen == 0 { return Vec::new(); }
11104                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11105                 self.data = core::ptr::null_mut();
11106                 self.datalen = 0;
11107                 ret
11108         }
11109         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11110                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11111         }
11112 }
11113 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11114         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11115                 let datalen = v.len();
11116                 let data = Box::into_raw(v.into_boxed_slice());
11117                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11118         }
11119 }
11120 #[no_mangle]
11121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11122 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11123 impl Drop for CVec_TransactionZ {
11124         fn drop(&mut self) {
11125                 if self.datalen == 0 { return; }
11126                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11127         }
11128 }
11129 impl Clone for CVec_TransactionZ {
11130         fn clone(&self) -> Self {
11131                 let mut res = Vec::new();
11132                 if self.datalen == 0 { return Self::from(res); }
11133                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11134                 Self::from(res)
11135         }
11136 }
11137 #[repr(C)]
11138 /// A tuple of 2 elements. See the individual fields for the types contained.
11139 pub struct C2Tuple_u32TxOutZ {
11140         /// The element at position 0
11141         pub a: u32,
11142         /// The element at position 1
11143         pub b: crate::c_types::TxOut,
11144 }
11145 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11146         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11147                 Self {
11148                         a: tup.0,
11149                         b: tup.1,
11150                 }
11151         }
11152 }
11153 impl C2Tuple_u32TxOutZ {
11154         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11155                 (self.a, self.b)
11156         }
11157 }
11158 impl Clone for C2Tuple_u32TxOutZ {
11159         fn clone(&self) -> Self {
11160                 Self {
11161                         a: Clone::clone(&self.a),
11162                         b: Clone::clone(&self.b),
11163                 }
11164         }
11165 }
11166 #[no_mangle]
11167 /// Creates a new tuple which has the same data as `orig`
11168 /// but with all dynamically-allocated buffers duplicated in new buffers.
11169 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11170 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11171 #[no_mangle]
11172 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11173         C2Tuple_u32TxOutZ { a, b, }
11174 }
11175
11176 #[no_mangle]
11177 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11178 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11179 #[repr(C)]
11180 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11181 /// This corresponds to std::vector in C++
11182 pub struct CVec_C2Tuple_u32TxOutZZ {
11183         /// The elements in the array.
11184         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11185         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11186         /// The number of elements pointed to by `data`.
11187         pub datalen: usize
11188 }
11189 impl CVec_C2Tuple_u32TxOutZZ {
11190         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11191                 if self.datalen == 0 { return Vec::new(); }
11192                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11193                 self.data = core::ptr::null_mut();
11194                 self.datalen = 0;
11195                 ret
11196         }
11197         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11198                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11199         }
11200 }
11201 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11202         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11203                 let datalen = v.len();
11204                 let data = Box::into_raw(v.into_boxed_slice());
11205                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11206         }
11207 }
11208 #[no_mangle]
11209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11210 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11211 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11212         fn drop(&mut self) {
11213                 if self.datalen == 0 { return; }
11214                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11215         }
11216 }
11217 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11218         fn clone(&self) -> Self {
11219                 let mut res = Vec::new();
11220                 if self.datalen == 0 { return Self::from(res); }
11221                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11222                 Self::from(res)
11223         }
11224 }
11225 #[repr(C)]
11226 /// A tuple of 2 elements. See the individual fields for the types contained.
11227 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11228         /// The element at position 0
11229         pub a: crate::c_types::ThirtyTwoBytes,
11230         /// The element at position 1
11231         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11232 }
11233 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11234         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11235                 Self {
11236                         a: tup.0,
11237                         b: tup.1,
11238                 }
11239         }
11240 }
11241 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11242         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11243                 (self.a, self.b)
11244         }
11245 }
11246 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11247         fn clone(&self) -> Self {
11248                 Self {
11249                         a: Clone::clone(&self.a),
11250                         b: Clone::clone(&self.b),
11251                 }
11252         }
11253 }
11254 #[no_mangle]
11255 /// Creates a new tuple which has the same data as `orig`
11256 /// but with all dynamically-allocated buffers duplicated in new buffers.
11257 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11258 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11259 #[no_mangle]
11260 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 {
11261         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11262 }
11263
11264 #[no_mangle]
11265 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11266 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11267 #[repr(C)]
11268 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11269 /// This corresponds to std::vector in C++
11270 pub struct CVec_TransactionOutputsZ {
11271         /// The elements in the array.
11272         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11273         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11274         /// The number of elements pointed to by `data`.
11275         pub datalen: usize
11276 }
11277 impl CVec_TransactionOutputsZ {
11278         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11279                 if self.datalen == 0 { return Vec::new(); }
11280                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11281                 self.data = core::ptr::null_mut();
11282                 self.datalen = 0;
11283                 ret
11284         }
11285         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11286                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11287         }
11288 }
11289 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11290         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11291                 let datalen = v.len();
11292                 let data = Box::into_raw(v.into_boxed_slice());
11293                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11294         }
11295 }
11296 #[no_mangle]
11297 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11298 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11299 impl Drop for CVec_TransactionOutputsZ {
11300         fn drop(&mut self) {
11301                 if self.datalen == 0 { return; }
11302                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11303         }
11304 }
11305 impl Clone for CVec_TransactionOutputsZ {
11306         fn clone(&self) -> Self {
11307                 let mut res = Vec::new();
11308                 if self.datalen == 0 { return Self::from(res); }
11309                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11310                 Self::from(res)
11311         }
11312 }
11313 #[repr(C)]
11314 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11315 /// This corresponds to std::vector in C++
11316 pub struct CVec_BalanceZ {
11317         /// The elements in the array.
11318         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11319         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11320         /// The number of elements pointed to by `data`.
11321         pub datalen: usize
11322 }
11323 impl CVec_BalanceZ {
11324         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11325                 if self.datalen == 0 { return Vec::new(); }
11326                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11327                 self.data = core::ptr::null_mut();
11328                 self.datalen = 0;
11329                 ret
11330         }
11331         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11332                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11333         }
11334 }
11335 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11336         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11337                 let datalen = v.len();
11338                 let data = Box::into_raw(v.into_boxed_slice());
11339                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11340         }
11341 }
11342 #[no_mangle]
11343 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11344 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11345 impl Drop for CVec_BalanceZ {
11346         fn drop(&mut self) {
11347                 if self.datalen == 0 { return; }
11348                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11349         }
11350 }
11351 impl Clone for CVec_BalanceZ {
11352         fn clone(&self) -> Self {
11353                 let mut res = Vec::new();
11354                 if self.datalen == 0 { return Self::from(res); }
11355                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11356                 Self::from(res)
11357         }
11358 }
11359 #[repr(C)]
11360 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11361 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11362         /// A pointer to the contents in the success state.
11363         /// Reading from this pointer when `result_ok` is not set is undefined.
11364         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11365         /// A pointer to the contents in the error state.
11366         /// Reading from this pointer when `result_ok` is set is undefined.
11367         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11368 }
11369 #[repr(C)]
11370 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11371 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11373 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11374         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11375         /// `err` or `result` depending on the state of `result_ok`.
11376         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11377         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11378         pub result_ok: bool,
11379 }
11380 #[no_mangle]
11381 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11382 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11383         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11384                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11385                         result: Box::into_raw(Box::new(o)),
11386                 },
11387                 result_ok: true,
11388         }
11389 }
11390 #[no_mangle]
11391 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11392 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11393         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11394                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11395                         err: Box::into_raw(Box::new(e)),
11396                 },
11397                 result_ok: false,
11398         }
11399 }
11400 /// Checks if the given object is currently in the success state
11401 #[no_mangle]
11402 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11403         o.result_ok
11404 }
11405 #[no_mangle]
11406 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11407 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11408 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11409         fn drop(&mut self) {
11410                 if self.result_ok {
11411                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11412                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11413                         }
11414                 } else {
11415                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11416                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11417                         }
11418                 }
11419         }
11420 }
11421 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11422         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11423                 let contents = if o.result_ok {
11424                         let result = unsafe { o.contents.result };
11425                         unsafe { o.contents.result = core::ptr::null_mut() };
11426                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11427                 } else {
11428                         let err = unsafe { o.contents.err };
11429                         unsafe { o.contents.err = core::ptr::null_mut(); }
11430                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11431                 };
11432                 Self {
11433                         contents,
11434                         result_ok: o.result_ok,
11435                 }
11436         }
11437 }
11438 #[repr(C)]
11439 /// A tuple of 2 elements. See the individual fields for the types contained.
11440 pub struct C2Tuple_PublicKeyTypeZ {
11441         /// The element at position 0
11442         pub a: crate::c_types::PublicKey,
11443         /// The element at position 1
11444         pub b: crate::lightning::ln::wire::Type,
11445 }
11446 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11447         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11448                 Self {
11449                         a: tup.0,
11450                         b: tup.1,
11451                 }
11452         }
11453 }
11454 impl C2Tuple_PublicKeyTypeZ {
11455         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11456                 (self.a, self.b)
11457         }
11458 }
11459 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11460 #[no_mangle]
11461 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11462         C2Tuple_PublicKeyTypeZ { a, b, }
11463 }
11464
11465 #[no_mangle]
11466 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11467 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11468 #[repr(C)]
11469 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11470 /// This corresponds to std::vector in C++
11471 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11472         /// The elements in the array.
11473         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11474         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11475         /// The number of elements pointed to by `data`.
11476         pub datalen: usize
11477 }
11478 impl CVec_C2Tuple_PublicKeyTypeZZ {
11479         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11480                 if self.datalen == 0 { return Vec::new(); }
11481                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11482                 self.data = core::ptr::null_mut();
11483                 self.datalen = 0;
11484                 ret
11485         }
11486         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11487                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11488         }
11489 }
11490 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11491         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11492                 let datalen = v.len();
11493                 let data = Box::into_raw(v.into_boxed_slice());
11494                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11495         }
11496 }
11497 #[no_mangle]
11498 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11499 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11500 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11501         fn drop(&mut self) {
11502                 if self.datalen == 0 { return; }
11503                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11504         }
11505 }
11506 #[repr(C)]
11507 #[derive(Clone)]
11508 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11509 pub enum COption_NetAddressZ {
11510         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11511         Some(crate::lightning::ln::msgs::NetAddress),
11512         /// When we're in this state, this COption_NetAddressZ contains nothing
11513         None
11514 }
11515 impl COption_NetAddressZ {
11516         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11517                 if let Self::None = self { false } else { true }
11518         }
11519         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11520                 !self.is_some()
11521         }
11522         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11523                 if let Self::Some(v) = self { v } else { unreachable!() }
11524         }
11525 }
11526 #[no_mangle]
11527 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11528 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11529         COption_NetAddressZ::Some(o)
11530 }
11531 #[no_mangle]
11532 /// Constructs a new COption_NetAddressZ containing nothing
11533 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11534         COption_NetAddressZ::None
11535 }
11536 #[no_mangle]
11537 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11538 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11539 #[no_mangle]
11540 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11541 /// but with all dynamically-allocated buffers duplicated in new buffers.
11542 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11543 #[repr(C)]
11544 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11545 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11546         /// A pointer to the contents in the success state.
11547         /// Reading from this pointer when `result_ok` is not set is undefined.
11548         pub result: *mut crate::c_types::derived::CVec_u8Z,
11549         /// A pointer to the contents in the error state.
11550         /// Reading from this pointer when `result_ok` is set is undefined.
11551         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11552 }
11553 #[repr(C)]
11554 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11555 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11557 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11558         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11559         /// `err` or `result` depending on the state of `result_ok`.
11560         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11561         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11562         pub result_ok: bool,
11563 }
11564 #[no_mangle]
11565 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11566 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11567         CResult_CVec_u8ZPeerHandleErrorZ {
11568                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11569                         result: Box::into_raw(Box::new(o)),
11570                 },
11571                 result_ok: true,
11572         }
11573 }
11574 #[no_mangle]
11575 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11576 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11577         CResult_CVec_u8ZPeerHandleErrorZ {
11578                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11579                         err: Box::into_raw(Box::new(e)),
11580                 },
11581                 result_ok: false,
11582         }
11583 }
11584 /// Checks if the given object is currently in the success state
11585 #[no_mangle]
11586 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11587         o.result_ok
11588 }
11589 #[no_mangle]
11590 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11591 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11592 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11593         fn drop(&mut self) {
11594                 if self.result_ok {
11595                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11596                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11597                         }
11598                 } else {
11599                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11600                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11601                         }
11602                 }
11603         }
11604 }
11605 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11606         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11607                 let contents = if o.result_ok {
11608                         let result = unsafe { o.contents.result };
11609                         unsafe { o.contents.result = core::ptr::null_mut() };
11610                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11611                 } else {
11612                         let err = unsafe { o.contents.err };
11613                         unsafe { o.contents.err = core::ptr::null_mut(); }
11614                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11615                 };
11616                 Self {
11617                         contents,
11618                         result_ok: o.result_ok,
11619                 }
11620         }
11621 }
11622 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11623         fn clone(&self) -> Self {
11624                 if self.result_ok {
11625                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11626                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11627                         } }
11628                 } else {
11629                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11630                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11631                         } }
11632                 }
11633         }
11634 }
11635 #[no_mangle]
11636 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11637 /// but with all dynamically-allocated buffers duplicated in new buffers.
11638 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11639 #[repr(C)]
11640 /// The contents of CResult_NonePeerHandleErrorZ
11641 pub union CResult_NonePeerHandleErrorZPtr {
11642         /// Note that this value is always NULL, as there are no contents in the OK variant
11643         pub result: *mut core::ffi::c_void,
11644         /// A pointer to the contents in the error state.
11645         /// Reading from this pointer when `result_ok` is set is undefined.
11646         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11647 }
11648 #[repr(C)]
11649 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11650 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11652 pub struct CResult_NonePeerHandleErrorZ {
11653         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11654         /// `err` or `result` depending on the state of `result_ok`.
11655         pub contents: CResult_NonePeerHandleErrorZPtr,
11656         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11657         pub result_ok: bool,
11658 }
11659 #[no_mangle]
11660 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11661 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11662         CResult_NonePeerHandleErrorZ {
11663                 contents: CResult_NonePeerHandleErrorZPtr {
11664                         result: core::ptr::null_mut(),
11665                 },
11666                 result_ok: true,
11667         }
11668 }
11669 #[no_mangle]
11670 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11671 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11672         CResult_NonePeerHandleErrorZ {
11673                 contents: CResult_NonePeerHandleErrorZPtr {
11674                         err: Box::into_raw(Box::new(e)),
11675                 },
11676                 result_ok: false,
11677         }
11678 }
11679 /// Checks if the given object is currently in the success state
11680 #[no_mangle]
11681 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11682         o.result_ok
11683 }
11684 #[no_mangle]
11685 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11686 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11687 impl Drop for CResult_NonePeerHandleErrorZ {
11688         fn drop(&mut self) {
11689                 if self.result_ok {
11690                 } else {
11691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11693                         }
11694                 }
11695         }
11696 }
11697 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11698         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11699                 let contents = if o.result_ok {
11700                         let _ = unsafe { Box::from_raw(o.contents.result) };
11701                         o.contents.result = core::ptr::null_mut();
11702                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11703                 } else {
11704                         let err = unsafe { o.contents.err };
11705                         unsafe { o.contents.err = core::ptr::null_mut(); }
11706                         CResult_NonePeerHandleErrorZPtr { err }
11707                 };
11708                 Self {
11709                         contents,
11710                         result_ok: o.result_ok,
11711                 }
11712         }
11713 }
11714 impl Clone for CResult_NonePeerHandleErrorZ {
11715         fn clone(&self) -> Self {
11716                 if self.result_ok {
11717                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11718                                 result: core::ptr::null_mut()
11719                         } }
11720                 } else {
11721                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11722                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11723                         } }
11724                 }
11725         }
11726 }
11727 #[no_mangle]
11728 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11729 /// but with all dynamically-allocated buffers duplicated in new buffers.
11730 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11731 #[repr(C)]
11732 /// The contents of CResult_boolPeerHandleErrorZ
11733 pub union CResult_boolPeerHandleErrorZPtr {
11734         /// A pointer to the contents in the success state.
11735         /// Reading from this pointer when `result_ok` is not set is undefined.
11736         pub result: *mut bool,
11737         /// A pointer to the contents in the error state.
11738         /// Reading from this pointer when `result_ok` is set is undefined.
11739         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11740 }
11741 #[repr(C)]
11742 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11743 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11745 pub struct CResult_boolPeerHandleErrorZ {
11746         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11747         /// `err` or `result` depending on the state of `result_ok`.
11748         pub contents: CResult_boolPeerHandleErrorZPtr,
11749         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11750         pub result_ok: bool,
11751 }
11752 #[no_mangle]
11753 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11754 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11755         CResult_boolPeerHandleErrorZ {
11756                 contents: CResult_boolPeerHandleErrorZPtr {
11757                         result: Box::into_raw(Box::new(o)),
11758                 },
11759                 result_ok: true,
11760         }
11761 }
11762 #[no_mangle]
11763 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11764 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
11765         CResult_boolPeerHandleErrorZ {
11766                 contents: CResult_boolPeerHandleErrorZPtr {
11767                         err: Box::into_raw(Box::new(e)),
11768                 },
11769                 result_ok: false,
11770         }
11771 }
11772 /// Checks if the given object is currently in the success state
11773 #[no_mangle]
11774 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
11775         o.result_ok
11776 }
11777 #[no_mangle]
11778 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
11779 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
11780 impl Drop for CResult_boolPeerHandleErrorZ {
11781         fn drop(&mut self) {
11782                 if self.result_ok {
11783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11785                         }
11786                 } else {
11787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11789                         }
11790                 }
11791         }
11792 }
11793 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
11794         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11795                 let contents = if o.result_ok {
11796                         let result = unsafe { o.contents.result };
11797                         unsafe { o.contents.result = core::ptr::null_mut() };
11798                         CResult_boolPeerHandleErrorZPtr { result }
11799                 } else {
11800                         let err = unsafe { o.contents.err };
11801                         unsafe { o.contents.err = core::ptr::null_mut(); }
11802                         CResult_boolPeerHandleErrorZPtr { err }
11803                 };
11804                 Self {
11805                         contents,
11806                         result_ok: o.result_ok,
11807                 }
11808         }
11809 }
11810 impl Clone for CResult_boolPeerHandleErrorZ {
11811         fn clone(&self) -> Self {
11812                 if self.result_ok {
11813                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
11814                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
11815                         } }
11816                 } else {
11817                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
11818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11819                         } }
11820                 }
11821         }
11822 }
11823 #[no_mangle]
11824 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11825 /// but with all dynamically-allocated buffers duplicated in new buffers.
11826 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
11827 #[repr(C)]
11828 /// The contents of CResult_u32GraphSyncErrorZ
11829 pub union CResult_u32GraphSyncErrorZPtr {
11830         /// A pointer to the contents in the success state.
11831         /// Reading from this pointer when `result_ok` is not set is undefined.
11832         pub result: *mut u32,
11833         /// A pointer to the contents in the error state.
11834         /// Reading from this pointer when `result_ok` is set is undefined.
11835         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
11836 }
11837 #[repr(C)]
11838 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
11839 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
11840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11841 pub struct CResult_u32GraphSyncErrorZ {
11842         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
11843         /// `err` or `result` depending on the state of `result_ok`.
11844         pub contents: CResult_u32GraphSyncErrorZPtr,
11845         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
11846         pub result_ok: bool,
11847 }
11848 #[no_mangle]
11849 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
11850 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
11851         CResult_u32GraphSyncErrorZ {
11852                 contents: CResult_u32GraphSyncErrorZPtr {
11853                         result: Box::into_raw(Box::new(o)),
11854                 },
11855                 result_ok: true,
11856         }
11857 }
11858 #[no_mangle]
11859 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
11860 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
11861         CResult_u32GraphSyncErrorZ {
11862                 contents: CResult_u32GraphSyncErrorZPtr {
11863                         err: Box::into_raw(Box::new(e)),
11864                 },
11865                 result_ok: false,
11866         }
11867 }
11868 /// Checks if the given object is currently in the success state
11869 #[no_mangle]
11870 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
11871         o.result_ok
11872 }
11873 #[no_mangle]
11874 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
11875 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
11876 impl Drop for CResult_u32GraphSyncErrorZ {
11877         fn drop(&mut self) {
11878                 if self.result_ok {
11879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11881                         }
11882                 } else {
11883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11885                         }
11886                 }
11887         }
11888 }
11889 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
11890         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
11891                 let contents = if o.result_ok {
11892                         let result = unsafe { o.contents.result };
11893                         unsafe { o.contents.result = core::ptr::null_mut() };
11894                         CResult_u32GraphSyncErrorZPtr { result }
11895                 } else {
11896                         let err = unsafe { o.contents.err };
11897                         unsafe { o.contents.err = core::ptr::null_mut(); }
11898                         CResult_u32GraphSyncErrorZPtr { err }
11899                 };
11900                 Self {
11901                         contents,
11902                         result_ok: o.result_ok,
11903                 }
11904         }
11905 }
11906 #[repr(C)]
11907 /// The contents of CResult_NetAddressDecodeErrorZ
11908 pub union CResult_NetAddressDecodeErrorZPtr {
11909         /// A pointer to the contents in the success state.
11910         /// Reading from this pointer when `result_ok` is not set is undefined.
11911         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11912         /// A pointer to the contents in the error state.
11913         /// Reading from this pointer when `result_ok` is set is undefined.
11914         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11915 }
11916 #[repr(C)]
11917 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11918 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11919 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11920 pub struct CResult_NetAddressDecodeErrorZ {
11921         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11922         /// `err` or `result` depending on the state of `result_ok`.
11923         pub contents: CResult_NetAddressDecodeErrorZPtr,
11924         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11925         pub result_ok: bool,
11926 }
11927 #[no_mangle]
11928 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11929 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11930         CResult_NetAddressDecodeErrorZ {
11931                 contents: CResult_NetAddressDecodeErrorZPtr {
11932                         result: Box::into_raw(Box::new(o)),
11933                 },
11934                 result_ok: true,
11935         }
11936 }
11937 #[no_mangle]
11938 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11939 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11940         CResult_NetAddressDecodeErrorZ {
11941                 contents: CResult_NetAddressDecodeErrorZPtr {
11942                         err: Box::into_raw(Box::new(e)),
11943                 },
11944                 result_ok: false,
11945         }
11946 }
11947 /// Checks if the given object is currently in the success state
11948 #[no_mangle]
11949 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11950         o.result_ok
11951 }
11952 #[no_mangle]
11953 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11954 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11955 impl Drop for CResult_NetAddressDecodeErrorZ {
11956         fn drop(&mut self) {
11957                 if self.result_ok {
11958                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11959                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11960                         }
11961                 } else {
11962                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11963                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11964                         }
11965                 }
11966         }
11967 }
11968 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11969         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11970                 let contents = if o.result_ok {
11971                         let result = unsafe { o.contents.result };
11972                         unsafe { o.contents.result = core::ptr::null_mut() };
11973                         CResult_NetAddressDecodeErrorZPtr { result }
11974                 } else {
11975                         let err = unsafe { o.contents.err };
11976                         unsafe { o.contents.err = core::ptr::null_mut(); }
11977                         CResult_NetAddressDecodeErrorZPtr { err }
11978                 };
11979                 Self {
11980                         contents,
11981                         result_ok: o.result_ok,
11982                 }
11983         }
11984 }
11985 impl Clone for CResult_NetAddressDecodeErrorZ {
11986         fn clone(&self) -> Self {
11987                 if self.result_ok {
11988                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11989                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11990                         } }
11991                 } else {
11992                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11993                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11994                         } }
11995                 }
11996         }
11997 }
11998 #[no_mangle]
11999 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12000 /// but with all dynamically-allocated buffers duplicated in new buffers.
12001 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12002 #[repr(C)]
12003 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12004 /// This corresponds to std::vector in C++
12005 pub struct CVec_UpdateAddHTLCZ {
12006         /// The elements in the array.
12007         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12008         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12009         /// The number of elements pointed to by `data`.
12010         pub datalen: usize
12011 }
12012 impl CVec_UpdateAddHTLCZ {
12013         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12014                 if self.datalen == 0 { return Vec::new(); }
12015                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12016                 self.data = core::ptr::null_mut();
12017                 self.datalen = 0;
12018                 ret
12019         }
12020         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12021                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12022         }
12023 }
12024 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12025         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12026                 let datalen = v.len();
12027                 let data = Box::into_raw(v.into_boxed_slice());
12028                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12029         }
12030 }
12031 #[no_mangle]
12032 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12033 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12034 impl Drop for CVec_UpdateAddHTLCZ {
12035         fn drop(&mut self) {
12036                 if self.datalen == 0 { return; }
12037                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12038         }
12039 }
12040 impl Clone for CVec_UpdateAddHTLCZ {
12041         fn clone(&self) -> Self {
12042                 let mut res = Vec::new();
12043                 if self.datalen == 0 { return Self::from(res); }
12044                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12045                 Self::from(res)
12046         }
12047 }
12048 #[repr(C)]
12049 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12050 /// This corresponds to std::vector in C++
12051 pub struct CVec_UpdateFulfillHTLCZ {
12052         /// The elements in the array.
12053         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12054         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12055         /// The number of elements pointed to by `data`.
12056         pub datalen: usize
12057 }
12058 impl CVec_UpdateFulfillHTLCZ {
12059         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12060                 if self.datalen == 0 { return Vec::new(); }
12061                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12062                 self.data = core::ptr::null_mut();
12063                 self.datalen = 0;
12064                 ret
12065         }
12066         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12067                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12068         }
12069 }
12070 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12071         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12072                 let datalen = v.len();
12073                 let data = Box::into_raw(v.into_boxed_slice());
12074                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12075         }
12076 }
12077 #[no_mangle]
12078 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12079 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12080 impl Drop for CVec_UpdateFulfillHTLCZ {
12081         fn drop(&mut self) {
12082                 if self.datalen == 0 { return; }
12083                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12084         }
12085 }
12086 impl Clone for CVec_UpdateFulfillHTLCZ {
12087         fn clone(&self) -> Self {
12088                 let mut res = Vec::new();
12089                 if self.datalen == 0 { return Self::from(res); }
12090                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12091                 Self::from(res)
12092         }
12093 }
12094 #[repr(C)]
12095 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12096 /// This corresponds to std::vector in C++
12097 pub struct CVec_UpdateFailHTLCZ {
12098         /// The elements in the array.
12099         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12100         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12101         /// The number of elements pointed to by `data`.
12102         pub datalen: usize
12103 }
12104 impl CVec_UpdateFailHTLCZ {
12105         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12106                 if self.datalen == 0 { return Vec::new(); }
12107                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12108                 self.data = core::ptr::null_mut();
12109                 self.datalen = 0;
12110                 ret
12111         }
12112         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12113                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12114         }
12115 }
12116 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12117         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12118                 let datalen = v.len();
12119                 let data = Box::into_raw(v.into_boxed_slice());
12120                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12121         }
12122 }
12123 #[no_mangle]
12124 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12125 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12126 impl Drop for CVec_UpdateFailHTLCZ {
12127         fn drop(&mut self) {
12128                 if self.datalen == 0 { return; }
12129                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12130         }
12131 }
12132 impl Clone for CVec_UpdateFailHTLCZ {
12133         fn clone(&self) -> Self {
12134                 let mut res = Vec::new();
12135                 if self.datalen == 0 { return Self::from(res); }
12136                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12137                 Self::from(res)
12138         }
12139 }
12140 #[repr(C)]
12141 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12142 /// This corresponds to std::vector in C++
12143 pub struct CVec_UpdateFailMalformedHTLCZ {
12144         /// The elements in the array.
12145         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12146         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12147         /// The number of elements pointed to by `data`.
12148         pub datalen: usize
12149 }
12150 impl CVec_UpdateFailMalformedHTLCZ {
12151         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12152                 if self.datalen == 0 { return Vec::new(); }
12153                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12154                 self.data = core::ptr::null_mut();
12155                 self.datalen = 0;
12156                 ret
12157         }
12158         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12159                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12160         }
12161 }
12162 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12163         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12164                 let datalen = v.len();
12165                 let data = Box::into_raw(v.into_boxed_slice());
12166                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12167         }
12168 }
12169 #[no_mangle]
12170 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12171 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12172 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12173         fn drop(&mut self) {
12174                 if self.datalen == 0 { return; }
12175                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12176         }
12177 }
12178 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12179         fn clone(&self) -> Self {
12180                 let mut res = Vec::new();
12181                 if self.datalen == 0 { return Self::from(res); }
12182                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12183                 Self::from(res)
12184         }
12185 }
12186 #[repr(C)]
12187 /// The contents of CResult_AcceptChannelDecodeErrorZ
12188 pub union CResult_AcceptChannelDecodeErrorZPtr {
12189         /// A pointer to the contents in the success state.
12190         /// Reading from this pointer when `result_ok` is not set is undefined.
12191         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12192         /// A pointer to the contents in the error state.
12193         /// Reading from this pointer when `result_ok` is set is undefined.
12194         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12195 }
12196 #[repr(C)]
12197 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12198 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12200 pub struct CResult_AcceptChannelDecodeErrorZ {
12201         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12202         /// `err` or `result` depending on the state of `result_ok`.
12203         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12204         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12205         pub result_ok: bool,
12206 }
12207 #[no_mangle]
12208 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12209 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12210         CResult_AcceptChannelDecodeErrorZ {
12211                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12212                         result: Box::into_raw(Box::new(o)),
12213                 },
12214                 result_ok: true,
12215         }
12216 }
12217 #[no_mangle]
12218 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12219 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12220         CResult_AcceptChannelDecodeErrorZ {
12221                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12222                         err: Box::into_raw(Box::new(e)),
12223                 },
12224                 result_ok: false,
12225         }
12226 }
12227 /// Checks if the given object is currently in the success state
12228 #[no_mangle]
12229 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12230         o.result_ok
12231 }
12232 #[no_mangle]
12233 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12234 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12235 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12236         fn drop(&mut self) {
12237                 if self.result_ok {
12238                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12239                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12240                         }
12241                 } else {
12242                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12243                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12244                         }
12245                 }
12246         }
12247 }
12248 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12249         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12250                 let contents = if o.result_ok {
12251                         let result = unsafe { o.contents.result };
12252                         unsafe { o.contents.result = core::ptr::null_mut() };
12253                         CResult_AcceptChannelDecodeErrorZPtr { result }
12254                 } else {
12255                         let err = unsafe { o.contents.err };
12256                         unsafe { o.contents.err = core::ptr::null_mut(); }
12257                         CResult_AcceptChannelDecodeErrorZPtr { err }
12258                 };
12259                 Self {
12260                         contents,
12261                         result_ok: o.result_ok,
12262                 }
12263         }
12264 }
12265 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12266         fn clone(&self) -> Self {
12267                 if self.result_ok {
12268                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12269                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12270                         } }
12271                 } else {
12272                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12273                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12274                         } }
12275                 }
12276         }
12277 }
12278 #[no_mangle]
12279 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12280 /// but with all dynamically-allocated buffers duplicated in new buffers.
12281 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12282 #[repr(C)]
12283 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12284 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12285         /// A pointer to the contents in the success state.
12286         /// Reading from this pointer when `result_ok` is not set is undefined.
12287         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12288         /// A pointer to the contents in the error state.
12289         /// Reading from this pointer when `result_ok` is set is undefined.
12290         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12291 }
12292 #[repr(C)]
12293 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12294 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12296 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12297         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12298         /// `err` or `result` depending on the state of `result_ok`.
12299         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12300         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12301         pub result_ok: bool,
12302 }
12303 #[no_mangle]
12304 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12305 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12306         CResult_AnnouncementSignaturesDecodeErrorZ {
12307                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12308                         result: Box::into_raw(Box::new(o)),
12309                 },
12310                 result_ok: true,
12311         }
12312 }
12313 #[no_mangle]
12314 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12315 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12316         CResult_AnnouncementSignaturesDecodeErrorZ {
12317                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12318                         err: Box::into_raw(Box::new(e)),
12319                 },
12320                 result_ok: false,
12321         }
12322 }
12323 /// Checks if the given object is currently in the success state
12324 #[no_mangle]
12325 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12326         o.result_ok
12327 }
12328 #[no_mangle]
12329 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12330 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12331 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12332         fn drop(&mut self) {
12333                 if self.result_ok {
12334                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12335                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12336                         }
12337                 } else {
12338                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12339                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12340                         }
12341                 }
12342         }
12343 }
12344 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12345         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12346                 let contents = if o.result_ok {
12347                         let result = unsafe { o.contents.result };
12348                         unsafe { o.contents.result = core::ptr::null_mut() };
12349                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12350                 } else {
12351                         let err = unsafe { o.contents.err };
12352                         unsafe { o.contents.err = core::ptr::null_mut(); }
12353                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12354                 };
12355                 Self {
12356                         contents,
12357                         result_ok: o.result_ok,
12358                 }
12359         }
12360 }
12361 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12362         fn clone(&self) -> Self {
12363                 if self.result_ok {
12364                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12365                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12366                         } }
12367                 } else {
12368                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12369                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12370                         } }
12371                 }
12372         }
12373 }
12374 #[no_mangle]
12375 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12376 /// but with all dynamically-allocated buffers duplicated in new buffers.
12377 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12378 #[repr(C)]
12379 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12380 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12381         /// A pointer to the contents in the success state.
12382         /// Reading from this pointer when `result_ok` is not set is undefined.
12383         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12384         /// A pointer to the contents in the error state.
12385         /// Reading from this pointer when `result_ok` is set is undefined.
12386         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12387 }
12388 #[repr(C)]
12389 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12390 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12391 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12392 pub struct CResult_ChannelReestablishDecodeErrorZ {
12393         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12394         /// `err` or `result` depending on the state of `result_ok`.
12395         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12396         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12397         pub result_ok: bool,
12398 }
12399 #[no_mangle]
12400 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12401 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12402         CResult_ChannelReestablishDecodeErrorZ {
12403                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12404                         result: Box::into_raw(Box::new(o)),
12405                 },
12406                 result_ok: true,
12407         }
12408 }
12409 #[no_mangle]
12410 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12411 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12412         CResult_ChannelReestablishDecodeErrorZ {
12413                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12414                         err: Box::into_raw(Box::new(e)),
12415                 },
12416                 result_ok: false,
12417         }
12418 }
12419 /// Checks if the given object is currently in the success state
12420 #[no_mangle]
12421 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12422         o.result_ok
12423 }
12424 #[no_mangle]
12425 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12426 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12427 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12428         fn drop(&mut self) {
12429                 if self.result_ok {
12430                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12431                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12432                         }
12433                 } else {
12434                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12435                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12436                         }
12437                 }
12438         }
12439 }
12440 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12441         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12442                 let contents = if o.result_ok {
12443                         let result = unsafe { o.contents.result };
12444                         unsafe { o.contents.result = core::ptr::null_mut() };
12445                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12446                 } else {
12447                         let err = unsafe { o.contents.err };
12448                         unsafe { o.contents.err = core::ptr::null_mut(); }
12449                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12450                 };
12451                 Self {
12452                         contents,
12453                         result_ok: o.result_ok,
12454                 }
12455         }
12456 }
12457 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12458         fn clone(&self) -> Self {
12459                 if self.result_ok {
12460                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12461                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12462                         } }
12463                 } else {
12464                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12465                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12466                         } }
12467                 }
12468         }
12469 }
12470 #[no_mangle]
12471 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12472 /// but with all dynamically-allocated buffers duplicated in new buffers.
12473 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12474 #[repr(C)]
12475 /// The contents of CResult_ClosingSignedDecodeErrorZ
12476 pub union CResult_ClosingSignedDecodeErrorZPtr {
12477         /// A pointer to the contents in the success state.
12478         /// Reading from this pointer when `result_ok` is not set is undefined.
12479         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12480         /// A pointer to the contents in the error state.
12481         /// Reading from this pointer when `result_ok` is set is undefined.
12482         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12483 }
12484 #[repr(C)]
12485 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12486 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12488 pub struct CResult_ClosingSignedDecodeErrorZ {
12489         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12490         /// `err` or `result` depending on the state of `result_ok`.
12491         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12492         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12493         pub result_ok: bool,
12494 }
12495 #[no_mangle]
12496 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12497 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12498         CResult_ClosingSignedDecodeErrorZ {
12499                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12500                         result: Box::into_raw(Box::new(o)),
12501                 },
12502                 result_ok: true,
12503         }
12504 }
12505 #[no_mangle]
12506 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12507 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12508         CResult_ClosingSignedDecodeErrorZ {
12509                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12510                         err: Box::into_raw(Box::new(e)),
12511                 },
12512                 result_ok: false,
12513         }
12514 }
12515 /// Checks if the given object is currently in the success state
12516 #[no_mangle]
12517 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12518         o.result_ok
12519 }
12520 #[no_mangle]
12521 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12522 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12523 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12524         fn drop(&mut self) {
12525                 if self.result_ok {
12526                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12527                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12528                         }
12529                 } else {
12530                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12531                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12532                         }
12533                 }
12534         }
12535 }
12536 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12537         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12538                 let contents = if o.result_ok {
12539                         let result = unsafe { o.contents.result };
12540                         unsafe { o.contents.result = core::ptr::null_mut() };
12541                         CResult_ClosingSignedDecodeErrorZPtr { result }
12542                 } else {
12543                         let err = unsafe { o.contents.err };
12544                         unsafe { o.contents.err = core::ptr::null_mut(); }
12545                         CResult_ClosingSignedDecodeErrorZPtr { err }
12546                 };
12547                 Self {
12548                         contents,
12549                         result_ok: o.result_ok,
12550                 }
12551         }
12552 }
12553 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12554         fn clone(&self) -> Self {
12555                 if self.result_ok {
12556                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12557                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12558                         } }
12559                 } else {
12560                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12561                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12562                         } }
12563                 }
12564         }
12565 }
12566 #[no_mangle]
12567 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12568 /// but with all dynamically-allocated buffers duplicated in new buffers.
12569 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12570 #[repr(C)]
12571 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12572 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12573         /// A pointer to the contents in the success state.
12574         /// Reading from this pointer when `result_ok` is not set is undefined.
12575         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12576         /// A pointer to the contents in the error state.
12577         /// Reading from this pointer when `result_ok` is set is undefined.
12578         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12579 }
12580 #[repr(C)]
12581 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12582 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12583 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12584 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12585         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12586         /// `err` or `result` depending on the state of `result_ok`.
12587         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12588         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12589         pub result_ok: bool,
12590 }
12591 #[no_mangle]
12592 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12593 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12594         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12595                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12596                         result: Box::into_raw(Box::new(o)),
12597                 },
12598                 result_ok: true,
12599         }
12600 }
12601 #[no_mangle]
12602 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12603 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12604         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12605                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12606                         err: Box::into_raw(Box::new(e)),
12607                 },
12608                 result_ok: false,
12609         }
12610 }
12611 /// Checks if the given object is currently in the success state
12612 #[no_mangle]
12613 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12614         o.result_ok
12615 }
12616 #[no_mangle]
12617 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12618 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12619 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12620         fn drop(&mut self) {
12621                 if self.result_ok {
12622                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12623                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12624                         }
12625                 } else {
12626                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12627                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12628                         }
12629                 }
12630         }
12631 }
12632 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12633         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12634                 let contents = if o.result_ok {
12635                         let result = unsafe { o.contents.result };
12636                         unsafe { o.contents.result = core::ptr::null_mut() };
12637                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12638                 } else {
12639                         let err = unsafe { o.contents.err };
12640                         unsafe { o.contents.err = core::ptr::null_mut(); }
12641                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12642                 };
12643                 Self {
12644                         contents,
12645                         result_ok: o.result_ok,
12646                 }
12647         }
12648 }
12649 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12650         fn clone(&self) -> Self {
12651                 if self.result_ok {
12652                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12653                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12654                         } }
12655                 } else {
12656                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12657                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12658                         } }
12659                 }
12660         }
12661 }
12662 #[no_mangle]
12663 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12664 /// but with all dynamically-allocated buffers duplicated in new buffers.
12665 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12666 #[repr(C)]
12667 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12668 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12669         /// A pointer to the contents in the success state.
12670         /// Reading from this pointer when `result_ok` is not set is undefined.
12671         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12672         /// A pointer to the contents in the error state.
12673         /// Reading from this pointer when `result_ok` is set is undefined.
12674         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12675 }
12676 #[repr(C)]
12677 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12678 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12680 pub struct CResult_CommitmentSignedDecodeErrorZ {
12681         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12682         /// `err` or `result` depending on the state of `result_ok`.
12683         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12684         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12685         pub result_ok: bool,
12686 }
12687 #[no_mangle]
12688 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12689 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12690         CResult_CommitmentSignedDecodeErrorZ {
12691                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12692                         result: Box::into_raw(Box::new(o)),
12693                 },
12694                 result_ok: true,
12695         }
12696 }
12697 #[no_mangle]
12698 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12699 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12700         CResult_CommitmentSignedDecodeErrorZ {
12701                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12702                         err: Box::into_raw(Box::new(e)),
12703                 },
12704                 result_ok: false,
12705         }
12706 }
12707 /// Checks if the given object is currently in the success state
12708 #[no_mangle]
12709 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12710         o.result_ok
12711 }
12712 #[no_mangle]
12713 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12714 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12715 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12716         fn drop(&mut self) {
12717                 if self.result_ok {
12718                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12719                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12720                         }
12721                 } else {
12722                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12723                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12724                         }
12725                 }
12726         }
12727 }
12728 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12729         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12730                 let contents = if o.result_ok {
12731                         let result = unsafe { o.contents.result };
12732                         unsafe { o.contents.result = core::ptr::null_mut() };
12733                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12734                 } else {
12735                         let err = unsafe { o.contents.err };
12736                         unsafe { o.contents.err = core::ptr::null_mut(); }
12737                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12738                 };
12739                 Self {
12740                         contents,
12741                         result_ok: o.result_ok,
12742                 }
12743         }
12744 }
12745 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12746         fn clone(&self) -> Self {
12747                 if self.result_ok {
12748                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12749                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12750                         } }
12751                 } else {
12752                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12753                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12754                         } }
12755                 }
12756         }
12757 }
12758 #[no_mangle]
12759 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12760 /// but with all dynamically-allocated buffers duplicated in new buffers.
12761 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12762 #[repr(C)]
12763 /// The contents of CResult_FundingCreatedDecodeErrorZ
12764 pub union CResult_FundingCreatedDecodeErrorZPtr {
12765         /// A pointer to the contents in the success state.
12766         /// Reading from this pointer when `result_ok` is not set is undefined.
12767         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12768         /// A pointer to the contents in the error state.
12769         /// Reading from this pointer when `result_ok` is set is undefined.
12770         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12771 }
12772 #[repr(C)]
12773 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12774 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12776 pub struct CResult_FundingCreatedDecodeErrorZ {
12777         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12778         /// `err` or `result` depending on the state of `result_ok`.
12779         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12780         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12781         pub result_ok: bool,
12782 }
12783 #[no_mangle]
12784 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12785 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12786         CResult_FundingCreatedDecodeErrorZ {
12787                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12788                         result: Box::into_raw(Box::new(o)),
12789                 },
12790                 result_ok: true,
12791         }
12792 }
12793 #[no_mangle]
12794 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12795 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12796         CResult_FundingCreatedDecodeErrorZ {
12797                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12798                         err: Box::into_raw(Box::new(e)),
12799                 },
12800                 result_ok: false,
12801         }
12802 }
12803 /// Checks if the given object is currently in the success state
12804 #[no_mangle]
12805 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12806         o.result_ok
12807 }
12808 #[no_mangle]
12809 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12810 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12811 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12812         fn drop(&mut self) {
12813                 if self.result_ok {
12814                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12815                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12816                         }
12817                 } else {
12818                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12819                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12820                         }
12821                 }
12822         }
12823 }
12824 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12825         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12826                 let contents = if o.result_ok {
12827                         let result = unsafe { o.contents.result };
12828                         unsafe { o.contents.result = core::ptr::null_mut() };
12829                         CResult_FundingCreatedDecodeErrorZPtr { result }
12830                 } else {
12831                         let err = unsafe { o.contents.err };
12832                         unsafe { o.contents.err = core::ptr::null_mut(); }
12833                         CResult_FundingCreatedDecodeErrorZPtr { err }
12834                 };
12835                 Self {
12836                         contents,
12837                         result_ok: o.result_ok,
12838                 }
12839         }
12840 }
12841 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12842         fn clone(&self) -> Self {
12843                 if self.result_ok {
12844                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12845                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12846                         } }
12847                 } else {
12848                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12849                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12850                         } }
12851                 }
12852         }
12853 }
12854 #[no_mangle]
12855 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12856 /// but with all dynamically-allocated buffers duplicated in new buffers.
12857 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12858 #[repr(C)]
12859 /// The contents of CResult_FundingSignedDecodeErrorZ
12860 pub union CResult_FundingSignedDecodeErrorZPtr {
12861         /// A pointer to the contents in the success state.
12862         /// Reading from this pointer when `result_ok` is not set is undefined.
12863         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12864         /// A pointer to the contents in the error state.
12865         /// Reading from this pointer when `result_ok` is set is undefined.
12866         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12867 }
12868 #[repr(C)]
12869 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12870 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12871 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12872 pub struct CResult_FundingSignedDecodeErrorZ {
12873         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12874         /// `err` or `result` depending on the state of `result_ok`.
12875         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12876         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12877         pub result_ok: bool,
12878 }
12879 #[no_mangle]
12880 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12881 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12882         CResult_FundingSignedDecodeErrorZ {
12883                 contents: CResult_FundingSignedDecodeErrorZPtr {
12884                         result: Box::into_raw(Box::new(o)),
12885                 },
12886                 result_ok: true,
12887         }
12888 }
12889 #[no_mangle]
12890 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12891 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12892         CResult_FundingSignedDecodeErrorZ {
12893                 contents: CResult_FundingSignedDecodeErrorZPtr {
12894                         err: Box::into_raw(Box::new(e)),
12895                 },
12896                 result_ok: false,
12897         }
12898 }
12899 /// Checks if the given object is currently in the success state
12900 #[no_mangle]
12901 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12902         o.result_ok
12903 }
12904 #[no_mangle]
12905 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12906 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12907 impl Drop for CResult_FundingSignedDecodeErrorZ {
12908         fn drop(&mut self) {
12909                 if self.result_ok {
12910                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12911                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12912                         }
12913                 } else {
12914                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12915                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12916                         }
12917                 }
12918         }
12919 }
12920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12921         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12922                 let contents = if o.result_ok {
12923                         let result = unsafe { o.contents.result };
12924                         unsafe { o.contents.result = core::ptr::null_mut() };
12925                         CResult_FundingSignedDecodeErrorZPtr { result }
12926                 } else {
12927                         let err = unsafe { o.contents.err };
12928                         unsafe { o.contents.err = core::ptr::null_mut(); }
12929                         CResult_FundingSignedDecodeErrorZPtr { err }
12930                 };
12931                 Self {
12932                         contents,
12933                         result_ok: o.result_ok,
12934                 }
12935         }
12936 }
12937 impl Clone for CResult_FundingSignedDecodeErrorZ {
12938         fn clone(&self) -> Self {
12939                 if self.result_ok {
12940                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12941                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12942                         } }
12943                 } else {
12944                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12945                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12946                         } }
12947                 }
12948         }
12949 }
12950 #[no_mangle]
12951 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12952 /// but with all dynamically-allocated buffers duplicated in new buffers.
12953 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12954 #[repr(C)]
12955 /// The contents of CResult_ChannelReadyDecodeErrorZ
12956 pub union CResult_ChannelReadyDecodeErrorZPtr {
12957         /// A pointer to the contents in the success state.
12958         /// Reading from this pointer when `result_ok` is not set is undefined.
12959         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
12960         /// A pointer to the contents in the error state.
12961         /// Reading from this pointer when `result_ok` is set is undefined.
12962         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12963 }
12964 #[repr(C)]
12965 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
12966 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
12967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12968 pub struct CResult_ChannelReadyDecodeErrorZ {
12969         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
12970         /// `err` or `result` depending on the state of `result_ok`.
12971         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
12972         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
12973         pub result_ok: bool,
12974 }
12975 #[no_mangle]
12976 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
12977 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
12978         CResult_ChannelReadyDecodeErrorZ {
12979                 contents: CResult_ChannelReadyDecodeErrorZPtr {
12980                         result: Box::into_raw(Box::new(o)),
12981                 },
12982                 result_ok: true,
12983         }
12984 }
12985 #[no_mangle]
12986 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
12987 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
12988         CResult_ChannelReadyDecodeErrorZ {
12989                 contents: CResult_ChannelReadyDecodeErrorZPtr {
12990                         err: Box::into_raw(Box::new(e)),
12991                 },
12992                 result_ok: false,
12993         }
12994 }
12995 /// Checks if the given object is currently in the success state
12996 #[no_mangle]
12997 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
12998         o.result_ok
12999 }
13000 #[no_mangle]
13001 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13002 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13003 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13004         fn drop(&mut self) {
13005                 if self.result_ok {
13006                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13007                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13008                         }
13009                 } else {
13010                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13011                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13012                         }
13013                 }
13014         }
13015 }
13016 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13017         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13018                 let contents = if o.result_ok {
13019                         let result = unsafe { o.contents.result };
13020                         unsafe { o.contents.result = core::ptr::null_mut() };
13021                         CResult_ChannelReadyDecodeErrorZPtr { result }
13022                 } else {
13023                         let err = unsafe { o.contents.err };
13024                         unsafe { o.contents.err = core::ptr::null_mut(); }
13025                         CResult_ChannelReadyDecodeErrorZPtr { err }
13026                 };
13027                 Self {
13028                         contents,
13029                         result_ok: o.result_ok,
13030                 }
13031         }
13032 }
13033 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13034         fn clone(&self) -> Self {
13035                 if self.result_ok {
13036                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13037                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13038                         } }
13039                 } else {
13040                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13041                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13042                         } }
13043                 }
13044         }
13045 }
13046 #[no_mangle]
13047 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13048 /// but with all dynamically-allocated buffers duplicated in new buffers.
13049 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13050 #[repr(C)]
13051 /// The contents of CResult_InitDecodeErrorZ
13052 pub union CResult_InitDecodeErrorZPtr {
13053         /// A pointer to the contents in the success state.
13054         /// Reading from this pointer when `result_ok` is not set is undefined.
13055         pub result: *mut crate::lightning::ln::msgs::Init,
13056         /// A pointer to the contents in the error state.
13057         /// Reading from this pointer when `result_ok` is set is undefined.
13058         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13059 }
13060 #[repr(C)]
13061 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13062 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13063 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13064 pub struct CResult_InitDecodeErrorZ {
13065         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13066         /// `err` or `result` depending on the state of `result_ok`.
13067         pub contents: CResult_InitDecodeErrorZPtr,
13068         /// Whether this CResult_InitDecodeErrorZ represents a success state.
13069         pub result_ok: bool,
13070 }
13071 #[no_mangle]
13072 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13073 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13074         CResult_InitDecodeErrorZ {
13075                 contents: CResult_InitDecodeErrorZPtr {
13076                         result: Box::into_raw(Box::new(o)),
13077                 },
13078                 result_ok: true,
13079         }
13080 }
13081 #[no_mangle]
13082 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13083 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13084         CResult_InitDecodeErrorZ {
13085                 contents: CResult_InitDecodeErrorZPtr {
13086                         err: Box::into_raw(Box::new(e)),
13087                 },
13088                 result_ok: false,
13089         }
13090 }
13091 /// Checks if the given object is currently in the success state
13092 #[no_mangle]
13093 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13094         o.result_ok
13095 }
13096 #[no_mangle]
13097 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13098 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13099 impl Drop for CResult_InitDecodeErrorZ {
13100         fn drop(&mut self) {
13101                 if self.result_ok {
13102                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13103                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13104                         }
13105                 } else {
13106                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13107                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13108                         }
13109                 }
13110         }
13111 }
13112 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13113         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13114                 let contents = if o.result_ok {
13115                         let result = unsafe { o.contents.result };
13116                         unsafe { o.contents.result = core::ptr::null_mut() };
13117                         CResult_InitDecodeErrorZPtr { result }
13118                 } else {
13119                         let err = unsafe { o.contents.err };
13120                         unsafe { o.contents.err = core::ptr::null_mut(); }
13121                         CResult_InitDecodeErrorZPtr { err }
13122                 };
13123                 Self {
13124                         contents,
13125                         result_ok: o.result_ok,
13126                 }
13127         }
13128 }
13129 impl Clone for CResult_InitDecodeErrorZ {
13130         fn clone(&self) -> Self {
13131                 if self.result_ok {
13132                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13133                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13134                         } }
13135                 } else {
13136                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13137                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13138                         } }
13139                 }
13140         }
13141 }
13142 #[no_mangle]
13143 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13144 /// but with all dynamically-allocated buffers duplicated in new buffers.
13145 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13146 #[repr(C)]
13147 /// The contents of CResult_OpenChannelDecodeErrorZ
13148 pub union CResult_OpenChannelDecodeErrorZPtr {
13149         /// A pointer to the contents in the success state.
13150         /// Reading from this pointer when `result_ok` is not set is undefined.
13151         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13152         /// A pointer to the contents in the error state.
13153         /// Reading from this pointer when `result_ok` is set is undefined.
13154         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13155 }
13156 #[repr(C)]
13157 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13158 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13159 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13160 pub struct CResult_OpenChannelDecodeErrorZ {
13161         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13162         /// `err` or `result` depending on the state of `result_ok`.
13163         pub contents: CResult_OpenChannelDecodeErrorZPtr,
13164         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13165         pub result_ok: bool,
13166 }
13167 #[no_mangle]
13168 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13169 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13170         CResult_OpenChannelDecodeErrorZ {
13171                 contents: CResult_OpenChannelDecodeErrorZPtr {
13172                         result: Box::into_raw(Box::new(o)),
13173                 },
13174                 result_ok: true,
13175         }
13176 }
13177 #[no_mangle]
13178 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13179 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13180         CResult_OpenChannelDecodeErrorZ {
13181                 contents: CResult_OpenChannelDecodeErrorZPtr {
13182                         err: Box::into_raw(Box::new(e)),
13183                 },
13184                 result_ok: false,
13185         }
13186 }
13187 /// Checks if the given object is currently in the success state
13188 #[no_mangle]
13189 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13190         o.result_ok
13191 }
13192 #[no_mangle]
13193 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13194 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13195 impl Drop for CResult_OpenChannelDecodeErrorZ {
13196         fn drop(&mut self) {
13197                 if self.result_ok {
13198                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13199                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13200                         }
13201                 } else {
13202                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13203                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13204                         }
13205                 }
13206         }
13207 }
13208 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13209         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13210                 let contents = if o.result_ok {
13211                         let result = unsafe { o.contents.result };
13212                         unsafe { o.contents.result = core::ptr::null_mut() };
13213                         CResult_OpenChannelDecodeErrorZPtr { result }
13214                 } else {
13215                         let err = unsafe { o.contents.err };
13216                         unsafe { o.contents.err = core::ptr::null_mut(); }
13217                         CResult_OpenChannelDecodeErrorZPtr { err }
13218                 };
13219                 Self {
13220                         contents,
13221                         result_ok: o.result_ok,
13222                 }
13223         }
13224 }
13225 impl Clone for CResult_OpenChannelDecodeErrorZ {
13226         fn clone(&self) -> Self {
13227                 if self.result_ok {
13228                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13229                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13230                         } }
13231                 } else {
13232                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13233                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13234                         } }
13235                 }
13236         }
13237 }
13238 #[no_mangle]
13239 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13240 /// but with all dynamically-allocated buffers duplicated in new buffers.
13241 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13242 #[repr(C)]
13243 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13244 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13245         /// A pointer to the contents in the success state.
13246         /// Reading from this pointer when `result_ok` is not set is undefined.
13247         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13248         /// A pointer to the contents in the error state.
13249         /// Reading from this pointer when `result_ok` is set is undefined.
13250         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13251 }
13252 #[repr(C)]
13253 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13254 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13256 pub struct CResult_RevokeAndACKDecodeErrorZ {
13257         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13258         /// `err` or `result` depending on the state of `result_ok`.
13259         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13260         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13261         pub result_ok: bool,
13262 }
13263 #[no_mangle]
13264 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13265 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13266         CResult_RevokeAndACKDecodeErrorZ {
13267                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13268                         result: Box::into_raw(Box::new(o)),
13269                 },
13270                 result_ok: true,
13271         }
13272 }
13273 #[no_mangle]
13274 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13275 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13276         CResult_RevokeAndACKDecodeErrorZ {
13277                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13278                         err: Box::into_raw(Box::new(e)),
13279                 },
13280                 result_ok: false,
13281         }
13282 }
13283 /// Checks if the given object is currently in the success state
13284 #[no_mangle]
13285 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13286         o.result_ok
13287 }
13288 #[no_mangle]
13289 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13290 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13291 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13292         fn drop(&mut self) {
13293                 if self.result_ok {
13294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13296                         }
13297                 } else {
13298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13300                         }
13301                 }
13302         }
13303 }
13304 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13305         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13306                 let contents = if o.result_ok {
13307                         let result = unsafe { o.contents.result };
13308                         unsafe { o.contents.result = core::ptr::null_mut() };
13309                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13310                 } else {
13311                         let err = unsafe { o.contents.err };
13312                         unsafe { o.contents.err = core::ptr::null_mut(); }
13313                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13314                 };
13315                 Self {
13316                         contents,
13317                         result_ok: o.result_ok,
13318                 }
13319         }
13320 }
13321 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13322         fn clone(&self) -> Self {
13323                 if self.result_ok {
13324                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13325                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13326                         } }
13327                 } else {
13328                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13329                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13330                         } }
13331                 }
13332         }
13333 }
13334 #[no_mangle]
13335 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13336 /// but with all dynamically-allocated buffers duplicated in new buffers.
13337 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13338 #[repr(C)]
13339 /// The contents of CResult_ShutdownDecodeErrorZ
13340 pub union CResult_ShutdownDecodeErrorZPtr {
13341         /// A pointer to the contents in the success state.
13342         /// Reading from this pointer when `result_ok` is not set is undefined.
13343         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13344         /// A pointer to the contents in the error state.
13345         /// Reading from this pointer when `result_ok` is set is undefined.
13346         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13347 }
13348 #[repr(C)]
13349 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13350 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13352 pub struct CResult_ShutdownDecodeErrorZ {
13353         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13354         /// `err` or `result` depending on the state of `result_ok`.
13355         pub contents: CResult_ShutdownDecodeErrorZPtr,
13356         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13357         pub result_ok: bool,
13358 }
13359 #[no_mangle]
13360 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13361 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13362         CResult_ShutdownDecodeErrorZ {
13363                 contents: CResult_ShutdownDecodeErrorZPtr {
13364                         result: Box::into_raw(Box::new(o)),
13365                 },
13366                 result_ok: true,
13367         }
13368 }
13369 #[no_mangle]
13370 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13371 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13372         CResult_ShutdownDecodeErrorZ {
13373                 contents: CResult_ShutdownDecodeErrorZPtr {
13374                         err: Box::into_raw(Box::new(e)),
13375                 },
13376                 result_ok: false,
13377         }
13378 }
13379 /// Checks if the given object is currently in the success state
13380 #[no_mangle]
13381 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13382         o.result_ok
13383 }
13384 #[no_mangle]
13385 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13386 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13387 impl Drop for CResult_ShutdownDecodeErrorZ {
13388         fn drop(&mut self) {
13389                 if self.result_ok {
13390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13392                         }
13393                 } else {
13394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13396                         }
13397                 }
13398         }
13399 }
13400 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13401         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13402                 let contents = if o.result_ok {
13403                         let result = unsafe { o.contents.result };
13404                         unsafe { o.contents.result = core::ptr::null_mut() };
13405                         CResult_ShutdownDecodeErrorZPtr { result }
13406                 } else {
13407                         let err = unsafe { o.contents.err };
13408                         unsafe { o.contents.err = core::ptr::null_mut(); }
13409                         CResult_ShutdownDecodeErrorZPtr { err }
13410                 };
13411                 Self {
13412                         contents,
13413                         result_ok: o.result_ok,
13414                 }
13415         }
13416 }
13417 impl Clone for CResult_ShutdownDecodeErrorZ {
13418         fn clone(&self) -> Self {
13419                 if self.result_ok {
13420                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13421                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13422                         } }
13423                 } else {
13424                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13425                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13426                         } }
13427                 }
13428         }
13429 }
13430 #[no_mangle]
13431 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13432 /// but with all dynamically-allocated buffers duplicated in new buffers.
13433 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13434 #[repr(C)]
13435 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13436 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13437         /// A pointer to the contents in the success state.
13438         /// Reading from this pointer when `result_ok` is not set is undefined.
13439         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13440         /// A pointer to the contents in the error state.
13441         /// Reading from this pointer when `result_ok` is set is undefined.
13442         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13443 }
13444 #[repr(C)]
13445 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13446 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13448 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13449         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13450         /// `err` or `result` depending on the state of `result_ok`.
13451         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13452         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13453         pub result_ok: bool,
13454 }
13455 #[no_mangle]
13456 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13457 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13458         CResult_UpdateFailHTLCDecodeErrorZ {
13459                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13460                         result: Box::into_raw(Box::new(o)),
13461                 },
13462                 result_ok: true,
13463         }
13464 }
13465 #[no_mangle]
13466 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13467 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13468         CResult_UpdateFailHTLCDecodeErrorZ {
13469                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13470                         err: Box::into_raw(Box::new(e)),
13471                 },
13472                 result_ok: false,
13473         }
13474 }
13475 /// Checks if the given object is currently in the success state
13476 #[no_mangle]
13477 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13478         o.result_ok
13479 }
13480 #[no_mangle]
13481 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13482 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13483 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13484         fn drop(&mut self) {
13485                 if self.result_ok {
13486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13488                         }
13489                 } else {
13490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13492                         }
13493                 }
13494         }
13495 }
13496 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13497         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13498                 let contents = if o.result_ok {
13499                         let result = unsafe { o.contents.result };
13500                         unsafe { o.contents.result = core::ptr::null_mut() };
13501                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13502                 } else {
13503                         let err = unsafe { o.contents.err };
13504                         unsafe { o.contents.err = core::ptr::null_mut(); }
13505                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13506                 };
13507                 Self {
13508                         contents,
13509                         result_ok: o.result_ok,
13510                 }
13511         }
13512 }
13513 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13514         fn clone(&self) -> Self {
13515                 if self.result_ok {
13516                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13517                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13518                         } }
13519                 } else {
13520                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13521                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13522                         } }
13523                 }
13524         }
13525 }
13526 #[no_mangle]
13527 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13528 /// but with all dynamically-allocated buffers duplicated in new buffers.
13529 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13530 #[repr(C)]
13531 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13532 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13533         /// A pointer to the contents in the success state.
13534         /// Reading from this pointer when `result_ok` is not set is undefined.
13535         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13536         /// A pointer to the contents in the error state.
13537         /// Reading from this pointer when `result_ok` is set is undefined.
13538         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13539 }
13540 #[repr(C)]
13541 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13542 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13544 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13545         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13546         /// `err` or `result` depending on the state of `result_ok`.
13547         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13548         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13549         pub result_ok: bool,
13550 }
13551 #[no_mangle]
13552 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13553 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13554         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13555                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13556                         result: Box::into_raw(Box::new(o)),
13557                 },
13558                 result_ok: true,
13559         }
13560 }
13561 #[no_mangle]
13562 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13563 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13564         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13565                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13566                         err: Box::into_raw(Box::new(e)),
13567                 },
13568                 result_ok: false,
13569         }
13570 }
13571 /// Checks if the given object is currently in the success state
13572 #[no_mangle]
13573 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13574         o.result_ok
13575 }
13576 #[no_mangle]
13577 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13578 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13579 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13580         fn drop(&mut self) {
13581                 if self.result_ok {
13582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13584                         }
13585                 } else {
13586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13588                         }
13589                 }
13590         }
13591 }
13592 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13594                 let contents = if o.result_ok {
13595                         let result = unsafe { o.contents.result };
13596                         unsafe { o.contents.result = core::ptr::null_mut() };
13597                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13598                 } else {
13599                         let err = unsafe { o.contents.err };
13600                         unsafe { o.contents.err = core::ptr::null_mut(); }
13601                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13602                 };
13603                 Self {
13604                         contents,
13605                         result_ok: o.result_ok,
13606                 }
13607         }
13608 }
13609 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13610         fn clone(&self) -> Self {
13611                 if self.result_ok {
13612                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13613                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13614                         } }
13615                 } else {
13616                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13618                         } }
13619                 }
13620         }
13621 }
13622 #[no_mangle]
13623 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13624 /// but with all dynamically-allocated buffers duplicated in new buffers.
13625 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13626 #[repr(C)]
13627 /// The contents of CResult_UpdateFeeDecodeErrorZ
13628 pub union CResult_UpdateFeeDecodeErrorZPtr {
13629         /// A pointer to the contents in the success state.
13630         /// Reading from this pointer when `result_ok` is not set is undefined.
13631         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13632         /// A pointer to the contents in the error state.
13633         /// Reading from this pointer when `result_ok` is set is undefined.
13634         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13635 }
13636 #[repr(C)]
13637 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13638 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13640 pub struct CResult_UpdateFeeDecodeErrorZ {
13641         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13642         /// `err` or `result` depending on the state of `result_ok`.
13643         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13644         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13645         pub result_ok: bool,
13646 }
13647 #[no_mangle]
13648 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13649 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13650         CResult_UpdateFeeDecodeErrorZ {
13651                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13652                         result: Box::into_raw(Box::new(o)),
13653                 },
13654                 result_ok: true,
13655         }
13656 }
13657 #[no_mangle]
13658 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13659 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13660         CResult_UpdateFeeDecodeErrorZ {
13661                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13662                         err: Box::into_raw(Box::new(e)),
13663                 },
13664                 result_ok: false,
13665         }
13666 }
13667 /// Checks if the given object is currently in the success state
13668 #[no_mangle]
13669 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13670         o.result_ok
13671 }
13672 #[no_mangle]
13673 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13674 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13675 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13676         fn drop(&mut self) {
13677                 if self.result_ok {
13678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13680                         }
13681                 } else {
13682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13684                         }
13685                 }
13686         }
13687 }
13688 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13689         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13690                 let contents = if o.result_ok {
13691                         let result = unsafe { o.contents.result };
13692                         unsafe { o.contents.result = core::ptr::null_mut() };
13693                         CResult_UpdateFeeDecodeErrorZPtr { result }
13694                 } else {
13695                         let err = unsafe { o.contents.err };
13696                         unsafe { o.contents.err = core::ptr::null_mut(); }
13697                         CResult_UpdateFeeDecodeErrorZPtr { err }
13698                 };
13699                 Self {
13700                         contents,
13701                         result_ok: o.result_ok,
13702                 }
13703         }
13704 }
13705 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13706         fn clone(&self) -> Self {
13707                 if self.result_ok {
13708                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13709                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13710                         } }
13711                 } else {
13712                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13714                         } }
13715                 }
13716         }
13717 }
13718 #[no_mangle]
13719 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13720 /// but with all dynamically-allocated buffers duplicated in new buffers.
13721 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13722 #[repr(C)]
13723 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13724 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13725         /// A pointer to the contents in the success state.
13726         /// Reading from this pointer when `result_ok` is not set is undefined.
13727         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13728         /// A pointer to the contents in the error state.
13729         /// Reading from this pointer when `result_ok` is set is undefined.
13730         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13731 }
13732 #[repr(C)]
13733 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13734 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13736 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13737         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13738         /// `err` or `result` depending on the state of `result_ok`.
13739         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13740         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13741         pub result_ok: bool,
13742 }
13743 #[no_mangle]
13744 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13745 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13746         CResult_UpdateFulfillHTLCDecodeErrorZ {
13747                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13748                         result: Box::into_raw(Box::new(o)),
13749                 },
13750                 result_ok: true,
13751         }
13752 }
13753 #[no_mangle]
13754 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13755 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13756         CResult_UpdateFulfillHTLCDecodeErrorZ {
13757                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13758                         err: Box::into_raw(Box::new(e)),
13759                 },
13760                 result_ok: false,
13761         }
13762 }
13763 /// Checks if the given object is currently in the success state
13764 #[no_mangle]
13765 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13766         o.result_ok
13767 }
13768 #[no_mangle]
13769 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13770 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13771 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13772         fn drop(&mut self) {
13773                 if self.result_ok {
13774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13776                         }
13777                 } else {
13778                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13779                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13780                         }
13781                 }
13782         }
13783 }
13784 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13785         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13786                 let contents = if o.result_ok {
13787                         let result = unsafe { o.contents.result };
13788                         unsafe { o.contents.result = core::ptr::null_mut() };
13789                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13790                 } else {
13791                         let err = unsafe { o.contents.err };
13792                         unsafe { o.contents.err = core::ptr::null_mut(); }
13793                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13794                 };
13795                 Self {
13796                         contents,
13797                         result_ok: o.result_ok,
13798                 }
13799         }
13800 }
13801 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13802         fn clone(&self) -> Self {
13803                 if self.result_ok {
13804                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13805                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13806                         } }
13807                 } else {
13808                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13809                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13810                         } }
13811                 }
13812         }
13813 }
13814 #[no_mangle]
13815 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13816 /// but with all dynamically-allocated buffers duplicated in new buffers.
13817 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13818 #[repr(C)]
13819 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13820 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13821         /// A pointer to the contents in the success state.
13822         /// Reading from this pointer when `result_ok` is not set is undefined.
13823         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13824         /// A pointer to the contents in the error state.
13825         /// Reading from this pointer when `result_ok` is set is undefined.
13826         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13827 }
13828 #[repr(C)]
13829 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13830 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13832 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13833         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13834         /// `err` or `result` depending on the state of `result_ok`.
13835         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13836         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13837         pub result_ok: bool,
13838 }
13839 #[no_mangle]
13840 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13841 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13842         CResult_UpdateAddHTLCDecodeErrorZ {
13843                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13844                         result: Box::into_raw(Box::new(o)),
13845                 },
13846                 result_ok: true,
13847         }
13848 }
13849 #[no_mangle]
13850 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13851 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13852         CResult_UpdateAddHTLCDecodeErrorZ {
13853                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13854                         err: Box::into_raw(Box::new(e)),
13855                 },
13856                 result_ok: false,
13857         }
13858 }
13859 /// Checks if the given object is currently in the success state
13860 #[no_mangle]
13861 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13862         o.result_ok
13863 }
13864 #[no_mangle]
13865 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13866 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13867 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13868         fn drop(&mut self) {
13869                 if self.result_ok {
13870                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13871                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13872                         }
13873                 } else {
13874                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13875                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13876                         }
13877                 }
13878         }
13879 }
13880 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13881         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13882                 let contents = if o.result_ok {
13883                         let result = unsafe { o.contents.result };
13884                         unsafe { o.contents.result = core::ptr::null_mut() };
13885                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13886                 } else {
13887                         let err = unsafe { o.contents.err };
13888                         unsafe { o.contents.err = core::ptr::null_mut(); }
13889                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13890                 };
13891                 Self {
13892                         contents,
13893                         result_ok: o.result_ok,
13894                 }
13895         }
13896 }
13897 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13898         fn clone(&self) -> Self {
13899                 if self.result_ok {
13900                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13901                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13902                         } }
13903                 } else {
13904                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13905                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13906                         } }
13907                 }
13908         }
13909 }
13910 #[no_mangle]
13911 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13912 /// but with all dynamically-allocated buffers duplicated in new buffers.
13913 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13914 #[repr(C)]
13915 /// The contents of CResult_PingDecodeErrorZ
13916 pub union CResult_PingDecodeErrorZPtr {
13917         /// A pointer to the contents in the success state.
13918         /// Reading from this pointer when `result_ok` is not set is undefined.
13919         pub result: *mut crate::lightning::ln::msgs::Ping,
13920         /// A pointer to the contents in the error state.
13921         /// Reading from this pointer when `result_ok` is set is undefined.
13922         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13923 }
13924 #[repr(C)]
13925 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13926 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13928 pub struct CResult_PingDecodeErrorZ {
13929         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13930         /// `err` or `result` depending on the state of `result_ok`.
13931         pub contents: CResult_PingDecodeErrorZPtr,
13932         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13933         pub result_ok: bool,
13934 }
13935 #[no_mangle]
13936 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13937 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13938         CResult_PingDecodeErrorZ {
13939                 contents: CResult_PingDecodeErrorZPtr {
13940                         result: Box::into_raw(Box::new(o)),
13941                 },
13942                 result_ok: true,
13943         }
13944 }
13945 #[no_mangle]
13946 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13947 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13948         CResult_PingDecodeErrorZ {
13949                 contents: CResult_PingDecodeErrorZPtr {
13950                         err: Box::into_raw(Box::new(e)),
13951                 },
13952                 result_ok: false,
13953         }
13954 }
13955 /// Checks if the given object is currently in the success state
13956 #[no_mangle]
13957 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13958         o.result_ok
13959 }
13960 #[no_mangle]
13961 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13962 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13963 impl Drop for CResult_PingDecodeErrorZ {
13964         fn drop(&mut self) {
13965                 if self.result_ok {
13966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13968                         }
13969                 } else {
13970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13972                         }
13973                 }
13974         }
13975 }
13976 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13977         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13978                 let contents = if o.result_ok {
13979                         let result = unsafe { o.contents.result };
13980                         unsafe { o.contents.result = core::ptr::null_mut() };
13981                         CResult_PingDecodeErrorZPtr { result }
13982                 } else {
13983                         let err = unsafe { o.contents.err };
13984                         unsafe { o.contents.err = core::ptr::null_mut(); }
13985                         CResult_PingDecodeErrorZPtr { err }
13986                 };
13987                 Self {
13988                         contents,
13989                         result_ok: o.result_ok,
13990                 }
13991         }
13992 }
13993 impl Clone for CResult_PingDecodeErrorZ {
13994         fn clone(&self) -> Self {
13995                 if self.result_ok {
13996                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13997                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13998                         } }
13999                 } else {
14000                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14001                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14002                         } }
14003                 }
14004         }
14005 }
14006 #[no_mangle]
14007 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14008 /// but with all dynamically-allocated buffers duplicated in new buffers.
14009 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14010 #[repr(C)]
14011 /// The contents of CResult_PongDecodeErrorZ
14012 pub union CResult_PongDecodeErrorZPtr {
14013         /// A pointer to the contents in the success state.
14014         /// Reading from this pointer when `result_ok` is not set is undefined.
14015         pub result: *mut crate::lightning::ln::msgs::Pong,
14016         /// A pointer to the contents in the error state.
14017         /// Reading from this pointer when `result_ok` is set is undefined.
14018         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14019 }
14020 #[repr(C)]
14021 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14022 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14024 pub struct CResult_PongDecodeErrorZ {
14025         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14026         /// `err` or `result` depending on the state of `result_ok`.
14027         pub contents: CResult_PongDecodeErrorZPtr,
14028         /// Whether this CResult_PongDecodeErrorZ represents a success state.
14029         pub result_ok: bool,
14030 }
14031 #[no_mangle]
14032 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14033 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14034         CResult_PongDecodeErrorZ {
14035                 contents: CResult_PongDecodeErrorZPtr {
14036                         result: Box::into_raw(Box::new(o)),
14037                 },
14038                 result_ok: true,
14039         }
14040 }
14041 #[no_mangle]
14042 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14043 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14044         CResult_PongDecodeErrorZ {
14045                 contents: CResult_PongDecodeErrorZPtr {
14046                         err: Box::into_raw(Box::new(e)),
14047                 },
14048                 result_ok: false,
14049         }
14050 }
14051 /// Checks if the given object is currently in the success state
14052 #[no_mangle]
14053 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14054         o.result_ok
14055 }
14056 #[no_mangle]
14057 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14058 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14059 impl Drop for CResult_PongDecodeErrorZ {
14060         fn drop(&mut self) {
14061                 if self.result_ok {
14062                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14063                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14064                         }
14065                 } else {
14066                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14067                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14068                         }
14069                 }
14070         }
14071 }
14072 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14073         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14074                 let contents = if o.result_ok {
14075                         let result = unsafe { o.contents.result };
14076                         unsafe { o.contents.result = core::ptr::null_mut() };
14077                         CResult_PongDecodeErrorZPtr { result }
14078                 } else {
14079                         let err = unsafe { o.contents.err };
14080                         unsafe { o.contents.err = core::ptr::null_mut(); }
14081                         CResult_PongDecodeErrorZPtr { err }
14082                 };
14083                 Self {
14084                         contents,
14085                         result_ok: o.result_ok,
14086                 }
14087         }
14088 }
14089 impl Clone for CResult_PongDecodeErrorZ {
14090         fn clone(&self) -> Self {
14091                 if self.result_ok {
14092                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14093                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14094                         } }
14095                 } else {
14096                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14097                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14098                         } }
14099                 }
14100         }
14101 }
14102 #[no_mangle]
14103 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14104 /// but with all dynamically-allocated buffers duplicated in new buffers.
14105 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14106 #[repr(C)]
14107 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14108 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14109         /// A pointer to the contents in the success state.
14110         /// Reading from this pointer when `result_ok` is not set is undefined.
14111         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14112         /// A pointer to the contents in the error state.
14113         /// Reading from this pointer when `result_ok` is set is undefined.
14114         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14115 }
14116 #[repr(C)]
14117 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14118 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14119 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14120 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14121         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14122         /// `err` or `result` depending on the state of `result_ok`.
14123         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14124         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14125         pub result_ok: bool,
14126 }
14127 #[no_mangle]
14128 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14129 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14130         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14131                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14132                         result: Box::into_raw(Box::new(o)),
14133                 },
14134                 result_ok: true,
14135         }
14136 }
14137 #[no_mangle]
14138 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14139 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14140         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14141                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14142                         err: Box::into_raw(Box::new(e)),
14143                 },
14144                 result_ok: false,
14145         }
14146 }
14147 /// Checks if the given object is currently in the success state
14148 #[no_mangle]
14149 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14150         o.result_ok
14151 }
14152 #[no_mangle]
14153 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14154 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14155 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14156         fn drop(&mut self) {
14157                 if self.result_ok {
14158                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14159                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14160                         }
14161                 } else {
14162                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14163                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14164                         }
14165                 }
14166         }
14167 }
14168 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14169         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14170                 let contents = if o.result_ok {
14171                         let result = unsafe { o.contents.result };
14172                         unsafe { o.contents.result = core::ptr::null_mut() };
14173                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14174                 } else {
14175                         let err = unsafe { o.contents.err };
14176                         unsafe { o.contents.err = core::ptr::null_mut(); }
14177                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14178                 };
14179                 Self {
14180                         contents,
14181                         result_ok: o.result_ok,
14182                 }
14183         }
14184 }
14185 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14186         fn clone(&self) -> Self {
14187                 if self.result_ok {
14188                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14189                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14190                         } }
14191                 } else {
14192                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14193                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14194                         } }
14195                 }
14196         }
14197 }
14198 #[no_mangle]
14199 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14200 /// but with all dynamically-allocated buffers duplicated in new buffers.
14201 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14202 #[repr(C)]
14203 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14204 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14205         /// A pointer to the contents in the success state.
14206         /// Reading from this pointer when `result_ok` is not set is undefined.
14207         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14208         /// A pointer to the contents in the error state.
14209         /// Reading from this pointer when `result_ok` is set is undefined.
14210         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14211 }
14212 #[repr(C)]
14213 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14214 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14216 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14217         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14218         /// `err` or `result` depending on the state of `result_ok`.
14219         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14220         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14221         pub result_ok: bool,
14222 }
14223 #[no_mangle]
14224 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14225 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14226         CResult_ChannelAnnouncementDecodeErrorZ {
14227                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14228                         result: Box::into_raw(Box::new(o)),
14229                 },
14230                 result_ok: true,
14231         }
14232 }
14233 #[no_mangle]
14234 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14235 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14236         CResult_ChannelAnnouncementDecodeErrorZ {
14237                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14238                         err: Box::into_raw(Box::new(e)),
14239                 },
14240                 result_ok: false,
14241         }
14242 }
14243 /// Checks if the given object is currently in the success state
14244 #[no_mangle]
14245 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14246         o.result_ok
14247 }
14248 #[no_mangle]
14249 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14250 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14251 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14252         fn drop(&mut self) {
14253                 if self.result_ok {
14254                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14255                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14256                         }
14257                 } else {
14258                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14259                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14260                         }
14261                 }
14262         }
14263 }
14264 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14265         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14266                 let contents = if o.result_ok {
14267                         let result = unsafe { o.contents.result };
14268                         unsafe { o.contents.result = core::ptr::null_mut() };
14269                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14270                 } else {
14271                         let err = unsafe { o.contents.err };
14272                         unsafe { o.contents.err = core::ptr::null_mut(); }
14273                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14274                 };
14275                 Self {
14276                         contents,
14277                         result_ok: o.result_ok,
14278                 }
14279         }
14280 }
14281 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14282         fn clone(&self) -> Self {
14283                 if self.result_ok {
14284                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14285                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14286                         } }
14287                 } else {
14288                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14289                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14290                         } }
14291                 }
14292         }
14293 }
14294 #[no_mangle]
14295 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14296 /// but with all dynamically-allocated buffers duplicated in new buffers.
14297 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14298 #[repr(C)]
14299 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14300 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14301         /// A pointer to the contents in the success state.
14302         /// Reading from this pointer when `result_ok` is not set is undefined.
14303         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14304         /// A pointer to the contents in the error state.
14305         /// Reading from this pointer when `result_ok` is set is undefined.
14306         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14307 }
14308 #[repr(C)]
14309 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14310 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14311 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14312 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14313         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14314         /// `err` or `result` depending on the state of `result_ok`.
14315         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14316         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14317         pub result_ok: bool,
14318 }
14319 #[no_mangle]
14320 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14321 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14322         CResult_UnsignedChannelUpdateDecodeErrorZ {
14323                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14324                         result: Box::into_raw(Box::new(o)),
14325                 },
14326                 result_ok: true,
14327         }
14328 }
14329 #[no_mangle]
14330 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14331 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14332         CResult_UnsignedChannelUpdateDecodeErrorZ {
14333                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14334                         err: Box::into_raw(Box::new(e)),
14335                 },
14336                 result_ok: false,
14337         }
14338 }
14339 /// Checks if the given object is currently in the success state
14340 #[no_mangle]
14341 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14342         o.result_ok
14343 }
14344 #[no_mangle]
14345 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14346 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14347 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14348         fn drop(&mut self) {
14349                 if self.result_ok {
14350                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14351                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14352                         }
14353                 } else {
14354                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14355                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14356                         }
14357                 }
14358         }
14359 }
14360 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14361         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14362                 let contents = if o.result_ok {
14363                         let result = unsafe { o.contents.result };
14364                         unsafe { o.contents.result = core::ptr::null_mut() };
14365                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14366                 } else {
14367                         let err = unsafe { o.contents.err };
14368                         unsafe { o.contents.err = core::ptr::null_mut(); }
14369                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14370                 };
14371                 Self {
14372                         contents,
14373                         result_ok: o.result_ok,
14374                 }
14375         }
14376 }
14377 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14378         fn clone(&self) -> Self {
14379                 if self.result_ok {
14380                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14381                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14382                         } }
14383                 } else {
14384                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14385                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14386                         } }
14387                 }
14388         }
14389 }
14390 #[no_mangle]
14391 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14392 /// but with all dynamically-allocated buffers duplicated in new buffers.
14393 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14394 #[repr(C)]
14395 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14396 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14397         /// A pointer to the contents in the success state.
14398         /// Reading from this pointer when `result_ok` is not set is undefined.
14399         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14400         /// A pointer to the contents in the error state.
14401         /// Reading from this pointer when `result_ok` is set is undefined.
14402         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14403 }
14404 #[repr(C)]
14405 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14406 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14407 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14408 pub struct CResult_ChannelUpdateDecodeErrorZ {
14409         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14410         /// `err` or `result` depending on the state of `result_ok`.
14411         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14412         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14413         pub result_ok: bool,
14414 }
14415 #[no_mangle]
14416 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14417 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14418         CResult_ChannelUpdateDecodeErrorZ {
14419                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14420                         result: Box::into_raw(Box::new(o)),
14421                 },
14422                 result_ok: true,
14423         }
14424 }
14425 #[no_mangle]
14426 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14427 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14428         CResult_ChannelUpdateDecodeErrorZ {
14429                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14430                         err: Box::into_raw(Box::new(e)),
14431                 },
14432                 result_ok: false,
14433         }
14434 }
14435 /// Checks if the given object is currently in the success state
14436 #[no_mangle]
14437 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14438         o.result_ok
14439 }
14440 #[no_mangle]
14441 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14442 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14443 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14444         fn drop(&mut self) {
14445                 if self.result_ok {
14446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14448                         }
14449                 } else {
14450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14452                         }
14453                 }
14454         }
14455 }
14456 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14457         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14458                 let contents = if o.result_ok {
14459                         let result = unsafe { o.contents.result };
14460                         unsafe { o.contents.result = core::ptr::null_mut() };
14461                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14462                 } else {
14463                         let err = unsafe { o.contents.err };
14464                         unsafe { o.contents.err = core::ptr::null_mut(); }
14465                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14466                 };
14467                 Self {
14468                         contents,
14469                         result_ok: o.result_ok,
14470                 }
14471         }
14472 }
14473 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14474         fn clone(&self) -> Self {
14475                 if self.result_ok {
14476                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14477                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14478                         } }
14479                 } else {
14480                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14481                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14482                         } }
14483                 }
14484         }
14485 }
14486 #[no_mangle]
14487 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14488 /// but with all dynamically-allocated buffers duplicated in new buffers.
14489 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14490 #[repr(C)]
14491 /// The contents of CResult_ErrorMessageDecodeErrorZ
14492 pub union CResult_ErrorMessageDecodeErrorZPtr {
14493         /// A pointer to the contents in the success state.
14494         /// Reading from this pointer when `result_ok` is not set is undefined.
14495         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14496         /// A pointer to the contents in the error state.
14497         /// Reading from this pointer when `result_ok` is set is undefined.
14498         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14499 }
14500 #[repr(C)]
14501 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14502 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14504 pub struct CResult_ErrorMessageDecodeErrorZ {
14505         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14506         /// `err` or `result` depending on the state of `result_ok`.
14507         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14508         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14509         pub result_ok: bool,
14510 }
14511 #[no_mangle]
14512 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14513 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14514         CResult_ErrorMessageDecodeErrorZ {
14515                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14516                         result: Box::into_raw(Box::new(o)),
14517                 },
14518                 result_ok: true,
14519         }
14520 }
14521 #[no_mangle]
14522 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14523 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14524         CResult_ErrorMessageDecodeErrorZ {
14525                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14526                         err: Box::into_raw(Box::new(e)),
14527                 },
14528                 result_ok: false,
14529         }
14530 }
14531 /// Checks if the given object is currently in the success state
14532 #[no_mangle]
14533 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14534         o.result_ok
14535 }
14536 #[no_mangle]
14537 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14538 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14539 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14540         fn drop(&mut self) {
14541                 if self.result_ok {
14542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14544                         }
14545                 } else {
14546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14548                         }
14549                 }
14550         }
14551 }
14552 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14553         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14554                 let contents = if o.result_ok {
14555                         let result = unsafe { o.contents.result };
14556                         unsafe { o.contents.result = core::ptr::null_mut() };
14557                         CResult_ErrorMessageDecodeErrorZPtr { result }
14558                 } else {
14559                         let err = unsafe { o.contents.err };
14560                         unsafe { o.contents.err = core::ptr::null_mut(); }
14561                         CResult_ErrorMessageDecodeErrorZPtr { err }
14562                 };
14563                 Self {
14564                         contents,
14565                         result_ok: o.result_ok,
14566                 }
14567         }
14568 }
14569 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14570         fn clone(&self) -> Self {
14571                 if self.result_ok {
14572                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14573                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14574                         } }
14575                 } else {
14576                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14577                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14578                         } }
14579                 }
14580         }
14581 }
14582 #[no_mangle]
14583 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14584 /// but with all dynamically-allocated buffers duplicated in new buffers.
14585 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14586 #[repr(C)]
14587 /// The contents of CResult_WarningMessageDecodeErrorZ
14588 pub union CResult_WarningMessageDecodeErrorZPtr {
14589         /// A pointer to the contents in the success state.
14590         /// Reading from this pointer when `result_ok` is not set is undefined.
14591         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14592         /// A pointer to the contents in the error state.
14593         /// Reading from this pointer when `result_ok` is set is undefined.
14594         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14595 }
14596 #[repr(C)]
14597 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14598 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14600 pub struct CResult_WarningMessageDecodeErrorZ {
14601         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14602         /// `err` or `result` depending on the state of `result_ok`.
14603         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14604         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14605         pub result_ok: bool,
14606 }
14607 #[no_mangle]
14608 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14609 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14610         CResult_WarningMessageDecodeErrorZ {
14611                 contents: CResult_WarningMessageDecodeErrorZPtr {
14612                         result: Box::into_raw(Box::new(o)),
14613                 },
14614                 result_ok: true,
14615         }
14616 }
14617 #[no_mangle]
14618 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14619 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14620         CResult_WarningMessageDecodeErrorZ {
14621                 contents: CResult_WarningMessageDecodeErrorZPtr {
14622                         err: Box::into_raw(Box::new(e)),
14623                 },
14624                 result_ok: false,
14625         }
14626 }
14627 /// Checks if the given object is currently in the success state
14628 #[no_mangle]
14629 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14630         o.result_ok
14631 }
14632 #[no_mangle]
14633 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14634 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14635 impl Drop for CResult_WarningMessageDecodeErrorZ {
14636         fn drop(&mut self) {
14637                 if self.result_ok {
14638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14640                         }
14641                 } else {
14642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14644                         }
14645                 }
14646         }
14647 }
14648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14650                 let contents = if o.result_ok {
14651                         let result = unsafe { o.contents.result };
14652                         unsafe { o.contents.result = core::ptr::null_mut() };
14653                         CResult_WarningMessageDecodeErrorZPtr { result }
14654                 } else {
14655                         let err = unsafe { o.contents.err };
14656                         unsafe { o.contents.err = core::ptr::null_mut(); }
14657                         CResult_WarningMessageDecodeErrorZPtr { err }
14658                 };
14659                 Self {
14660                         contents,
14661                         result_ok: o.result_ok,
14662                 }
14663         }
14664 }
14665 impl Clone for CResult_WarningMessageDecodeErrorZ {
14666         fn clone(&self) -> Self {
14667                 if self.result_ok {
14668                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14669                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14670                         } }
14671                 } else {
14672                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14673                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14674                         } }
14675                 }
14676         }
14677 }
14678 #[no_mangle]
14679 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14680 /// but with all dynamically-allocated buffers duplicated in new buffers.
14681 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14682 #[repr(C)]
14683 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14684 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14685         /// A pointer to the contents in the success state.
14686         /// Reading from this pointer when `result_ok` is not set is undefined.
14687         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14688         /// A pointer to the contents in the error state.
14689         /// Reading from this pointer when `result_ok` is set is undefined.
14690         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14691 }
14692 #[repr(C)]
14693 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14694 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14696 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14697         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14698         /// `err` or `result` depending on the state of `result_ok`.
14699         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14700         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14701         pub result_ok: bool,
14702 }
14703 #[no_mangle]
14704 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14705 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14706         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14707                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14708                         result: Box::into_raw(Box::new(o)),
14709                 },
14710                 result_ok: true,
14711         }
14712 }
14713 #[no_mangle]
14714 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14715 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14716         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14717                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14718                         err: Box::into_raw(Box::new(e)),
14719                 },
14720                 result_ok: false,
14721         }
14722 }
14723 /// Checks if the given object is currently in the success state
14724 #[no_mangle]
14725 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14726         o.result_ok
14727 }
14728 #[no_mangle]
14729 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14730 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14731 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14732         fn drop(&mut self) {
14733                 if self.result_ok {
14734                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14735                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14736                         }
14737                 } else {
14738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14740                         }
14741                 }
14742         }
14743 }
14744 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14745         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14746                 let contents = if o.result_ok {
14747                         let result = unsafe { o.contents.result };
14748                         unsafe { o.contents.result = core::ptr::null_mut() };
14749                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14750                 } else {
14751                         let err = unsafe { o.contents.err };
14752                         unsafe { o.contents.err = core::ptr::null_mut(); }
14753                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14754                 };
14755                 Self {
14756                         contents,
14757                         result_ok: o.result_ok,
14758                 }
14759         }
14760 }
14761 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14762         fn clone(&self) -> Self {
14763                 if self.result_ok {
14764                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14765                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14766                         } }
14767                 } else {
14768                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14769                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14770                         } }
14771                 }
14772         }
14773 }
14774 #[no_mangle]
14775 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14776 /// but with all dynamically-allocated buffers duplicated in new buffers.
14777 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14778 #[repr(C)]
14779 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14780 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14781         /// A pointer to the contents in the success state.
14782         /// Reading from this pointer when `result_ok` is not set is undefined.
14783         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14784         /// A pointer to the contents in the error state.
14785         /// Reading from this pointer when `result_ok` is set is undefined.
14786         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14787 }
14788 #[repr(C)]
14789 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14790 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14792 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14793         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14794         /// `err` or `result` depending on the state of `result_ok`.
14795         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14796         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14797         pub result_ok: bool,
14798 }
14799 #[no_mangle]
14800 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14801 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14802         CResult_NodeAnnouncementDecodeErrorZ {
14803                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14804                         result: Box::into_raw(Box::new(o)),
14805                 },
14806                 result_ok: true,
14807         }
14808 }
14809 #[no_mangle]
14810 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14811 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14812         CResult_NodeAnnouncementDecodeErrorZ {
14813                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14814                         err: Box::into_raw(Box::new(e)),
14815                 },
14816                 result_ok: false,
14817         }
14818 }
14819 /// Checks if the given object is currently in the success state
14820 #[no_mangle]
14821 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14822         o.result_ok
14823 }
14824 #[no_mangle]
14825 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14826 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14827 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14828         fn drop(&mut self) {
14829                 if self.result_ok {
14830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14832                         }
14833                 } else {
14834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14836                         }
14837                 }
14838         }
14839 }
14840 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14841         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14842                 let contents = if o.result_ok {
14843                         let result = unsafe { o.contents.result };
14844                         unsafe { o.contents.result = core::ptr::null_mut() };
14845                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14846                 } else {
14847                         let err = unsafe { o.contents.err };
14848                         unsafe { o.contents.err = core::ptr::null_mut(); }
14849                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14850                 };
14851                 Self {
14852                         contents,
14853                         result_ok: o.result_ok,
14854                 }
14855         }
14856 }
14857 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14858         fn clone(&self) -> Self {
14859                 if self.result_ok {
14860                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14861                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14862                         } }
14863                 } else {
14864                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14865                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14866                         } }
14867                 }
14868         }
14869 }
14870 #[no_mangle]
14871 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14872 /// but with all dynamically-allocated buffers duplicated in new buffers.
14873 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14874 #[repr(C)]
14875 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14876 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14877         /// A pointer to the contents in the success state.
14878         /// Reading from this pointer when `result_ok` is not set is undefined.
14879         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14880         /// A pointer to the contents in the error state.
14881         /// Reading from this pointer when `result_ok` is set is undefined.
14882         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14883 }
14884 #[repr(C)]
14885 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14886 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14888 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14889         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14890         /// `err` or `result` depending on the state of `result_ok`.
14891         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14892         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14893         pub result_ok: bool,
14894 }
14895 #[no_mangle]
14896 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14897 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14898         CResult_QueryShortChannelIdsDecodeErrorZ {
14899                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14900                         result: Box::into_raw(Box::new(o)),
14901                 },
14902                 result_ok: true,
14903         }
14904 }
14905 #[no_mangle]
14906 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14907 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14908         CResult_QueryShortChannelIdsDecodeErrorZ {
14909                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14910                         err: Box::into_raw(Box::new(e)),
14911                 },
14912                 result_ok: false,
14913         }
14914 }
14915 /// Checks if the given object is currently in the success state
14916 #[no_mangle]
14917 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14918         o.result_ok
14919 }
14920 #[no_mangle]
14921 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14922 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14923 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14924         fn drop(&mut self) {
14925                 if self.result_ok {
14926                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14927                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14928                         }
14929                 } else {
14930                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14931                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14932                         }
14933                 }
14934         }
14935 }
14936 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14937         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14938                 let contents = if o.result_ok {
14939                         let result = unsafe { o.contents.result };
14940                         unsafe { o.contents.result = core::ptr::null_mut() };
14941                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14942                 } else {
14943                         let err = unsafe { o.contents.err };
14944                         unsafe { o.contents.err = core::ptr::null_mut(); }
14945                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14946                 };
14947                 Self {
14948                         contents,
14949                         result_ok: o.result_ok,
14950                 }
14951         }
14952 }
14953 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14954         fn clone(&self) -> Self {
14955                 if self.result_ok {
14956                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14957                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14958                         } }
14959                 } else {
14960                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14961                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14962                         } }
14963                 }
14964         }
14965 }
14966 #[no_mangle]
14967 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14968 /// but with all dynamically-allocated buffers duplicated in new buffers.
14969 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14970 #[repr(C)]
14971 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14972 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14973         /// A pointer to the contents in the success state.
14974         /// Reading from this pointer when `result_ok` is not set is undefined.
14975         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14976         /// A pointer to the contents in the error state.
14977         /// Reading from this pointer when `result_ok` is set is undefined.
14978         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14979 }
14980 #[repr(C)]
14981 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14982 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14984 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14985         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14986         /// `err` or `result` depending on the state of `result_ok`.
14987         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14988         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14989         pub result_ok: bool,
14990 }
14991 #[no_mangle]
14992 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14993 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14994         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14995                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14996                         result: Box::into_raw(Box::new(o)),
14997                 },
14998                 result_ok: true,
14999         }
15000 }
15001 #[no_mangle]
15002 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15003 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15004         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15005                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15006                         err: Box::into_raw(Box::new(e)),
15007                 },
15008                 result_ok: false,
15009         }
15010 }
15011 /// Checks if the given object is currently in the success state
15012 #[no_mangle]
15013 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15014         o.result_ok
15015 }
15016 #[no_mangle]
15017 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15018 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15019 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15020         fn drop(&mut self) {
15021                 if self.result_ok {
15022                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15023                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15024                         }
15025                 } else {
15026                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15027                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15028                         }
15029                 }
15030         }
15031 }
15032 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15033         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15034                 let contents = if o.result_ok {
15035                         let result = unsafe { o.contents.result };
15036                         unsafe { o.contents.result = core::ptr::null_mut() };
15037                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15038                 } else {
15039                         let err = unsafe { o.contents.err };
15040                         unsafe { o.contents.err = core::ptr::null_mut(); }
15041                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15042                 };
15043                 Self {
15044                         contents,
15045                         result_ok: o.result_ok,
15046                 }
15047         }
15048 }
15049 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15050         fn clone(&self) -> Self {
15051                 if self.result_ok {
15052                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15053                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15054                         } }
15055                 } else {
15056                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15057                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15058                         } }
15059                 }
15060         }
15061 }
15062 #[no_mangle]
15063 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15064 /// but with all dynamically-allocated buffers duplicated in new buffers.
15065 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15066 #[repr(C)]
15067 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15068 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15069         /// A pointer to the contents in the success state.
15070         /// Reading from this pointer when `result_ok` is not set is undefined.
15071         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15072         /// A pointer to the contents in the error state.
15073         /// Reading from this pointer when `result_ok` is set is undefined.
15074         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15075 }
15076 #[repr(C)]
15077 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15078 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15079 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15080 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15081         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15082         /// `err` or `result` depending on the state of `result_ok`.
15083         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15084         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15085         pub result_ok: bool,
15086 }
15087 #[no_mangle]
15088 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15089 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15090         CResult_QueryChannelRangeDecodeErrorZ {
15091                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15092                         result: Box::into_raw(Box::new(o)),
15093                 },
15094                 result_ok: true,
15095         }
15096 }
15097 #[no_mangle]
15098 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15099 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15100         CResult_QueryChannelRangeDecodeErrorZ {
15101                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15102                         err: Box::into_raw(Box::new(e)),
15103                 },
15104                 result_ok: false,
15105         }
15106 }
15107 /// Checks if the given object is currently in the success state
15108 #[no_mangle]
15109 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15110         o.result_ok
15111 }
15112 #[no_mangle]
15113 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15114 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15115 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15116         fn drop(&mut self) {
15117                 if self.result_ok {
15118                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15119                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15120                         }
15121                 } else {
15122                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15123                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15124                         }
15125                 }
15126         }
15127 }
15128 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15129         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15130                 let contents = if o.result_ok {
15131                         let result = unsafe { o.contents.result };
15132                         unsafe { o.contents.result = core::ptr::null_mut() };
15133                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
15134                 } else {
15135                         let err = unsafe { o.contents.err };
15136                         unsafe { o.contents.err = core::ptr::null_mut(); }
15137                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
15138                 };
15139                 Self {
15140                         contents,
15141                         result_ok: o.result_ok,
15142                 }
15143         }
15144 }
15145 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15146         fn clone(&self) -> Self {
15147                 if self.result_ok {
15148                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15149                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15150                         } }
15151                 } else {
15152                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15153                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15154                         } }
15155                 }
15156         }
15157 }
15158 #[no_mangle]
15159 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15160 /// but with all dynamically-allocated buffers duplicated in new buffers.
15161 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15162 #[repr(C)]
15163 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15164 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15165         /// A pointer to the contents in the success state.
15166         /// Reading from this pointer when `result_ok` is not set is undefined.
15167         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15168         /// A pointer to the contents in the error state.
15169         /// Reading from this pointer when `result_ok` is set is undefined.
15170         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15171 }
15172 #[repr(C)]
15173 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15174 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15175 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15176 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15177         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15178         /// `err` or `result` depending on the state of `result_ok`.
15179         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15180         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15181         pub result_ok: bool,
15182 }
15183 #[no_mangle]
15184 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15185 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15186         CResult_ReplyChannelRangeDecodeErrorZ {
15187                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15188                         result: Box::into_raw(Box::new(o)),
15189                 },
15190                 result_ok: true,
15191         }
15192 }
15193 #[no_mangle]
15194 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15195 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15196         CResult_ReplyChannelRangeDecodeErrorZ {
15197                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15198                         err: Box::into_raw(Box::new(e)),
15199                 },
15200                 result_ok: false,
15201         }
15202 }
15203 /// Checks if the given object is currently in the success state
15204 #[no_mangle]
15205 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15206         o.result_ok
15207 }
15208 #[no_mangle]
15209 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15210 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15211 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15212         fn drop(&mut self) {
15213                 if self.result_ok {
15214                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15215                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15216                         }
15217                 } else {
15218                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15219                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15220                         }
15221                 }
15222         }
15223 }
15224 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15225         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15226                 let contents = if o.result_ok {
15227                         let result = unsafe { o.contents.result };
15228                         unsafe { o.contents.result = core::ptr::null_mut() };
15229                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15230                 } else {
15231                         let err = unsafe { o.contents.err };
15232                         unsafe { o.contents.err = core::ptr::null_mut(); }
15233                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15234                 };
15235                 Self {
15236                         contents,
15237                         result_ok: o.result_ok,
15238                 }
15239         }
15240 }
15241 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15242         fn clone(&self) -> Self {
15243                 if self.result_ok {
15244                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15245                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15246                         } }
15247                 } else {
15248                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15249                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15250                         } }
15251                 }
15252         }
15253 }
15254 #[no_mangle]
15255 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15256 /// but with all dynamically-allocated buffers duplicated in new buffers.
15257 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15258 #[repr(C)]
15259 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15260 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15261         /// A pointer to the contents in the success state.
15262         /// Reading from this pointer when `result_ok` is not set is undefined.
15263         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15264         /// A pointer to the contents in the error state.
15265         /// Reading from this pointer when `result_ok` is set is undefined.
15266         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15267 }
15268 #[repr(C)]
15269 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15270 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15271 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15272 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15273         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15274         /// `err` or `result` depending on the state of `result_ok`.
15275         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15276         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15277         pub result_ok: bool,
15278 }
15279 #[no_mangle]
15280 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15281 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15282         CResult_GossipTimestampFilterDecodeErrorZ {
15283                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15284                         result: Box::into_raw(Box::new(o)),
15285                 },
15286                 result_ok: true,
15287         }
15288 }
15289 #[no_mangle]
15290 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15291 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15292         CResult_GossipTimestampFilterDecodeErrorZ {
15293                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15294                         err: Box::into_raw(Box::new(e)),
15295                 },
15296                 result_ok: false,
15297         }
15298 }
15299 /// Checks if the given object is currently in the success state
15300 #[no_mangle]
15301 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15302         o.result_ok
15303 }
15304 #[no_mangle]
15305 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15306 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15307 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15308         fn drop(&mut self) {
15309                 if self.result_ok {
15310                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15311                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15312                         }
15313                 } else {
15314                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15315                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15316                         }
15317                 }
15318         }
15319 }
15320 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15321         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15322                 let contents = if o.result_ok {
15323                         let result = unsafe { o.contents.result };
15324                         unsafe { o.contents.result = core::ptr::null_mut() };
15325                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15326                 } else {
15327                         let err = unsafe { o.contents.err };
15328                         unsafe { o.contents.err = core::ptr::null_mut(); }
15329                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15330                 };
15331                 Self {
15332                         contents,
15333                         result_ok: o.result_ok,
15334                 }
15335         }
15336 }
15337 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15338         fn clone(&self) -> Self {
15339                 if self.result_ok {
15340                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15341                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15342                         } }
15343                 } else {
15344                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15345                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15346                         } }
15347                 }
15348         }
15349 }
15350 #[no_mangle]
15351 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15352 /// but with all dynamically-allocated buffers duplicated in new buffers.
15353 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15354 #[repr(C)]
15355 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15356 /// This corresponds to std::vector in C++
15357 pub struct CVec_PhantomRouteHintsZ {
15358         /// The elements in the array.
15359         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15360         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15361         /// The number of elements pointed to by `data`.
15362         pub datalen: usize
15363 }
15364 impl CVec_PhantomRouteHintsZ {
15365         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15366                 if self.datalen == 0 { return Vec::new(); }
15367                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15368                 self.data = core::ptr::null_mut();
15369                 self.datalen = 0;
15370                 ret
15371         }
15372         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15373                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15374         }
15375 }
15376 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15377         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15378                 let datalen = v.len();
15379                 let data = Box::into_raw(v.into_boxed_slice());
15380                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15381         }
15382 }
15383 #[no_mangle]
15384 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15385 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15386 impl Drop for CVec_PhantomRouteHintsZ {
15387         fn drop(&mut self) {
15388                 if self.datalen == 0 { return; }
15389                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15390         }
15391 }
15392 impl Clone for CVec_PhantomRouteHintsZ {
15393         fn clone(&self) -> Self {
15394                 let mut res = Vec::new();
15395                 if self.datalen == 0 { return Self::from(res); }
15396                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15397                 Self::from(res)
15398         }
15399 }
15400 #[repr(C)]
15401 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15402 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15403         /// A pointer to the contents in the success state.
15404         /// Reading from this pointer when `result_ok` is not set is undefined.
15405         pub result: *mut crate::lightning_invoice::Invoice,
15406         /// A pointer to the contents in the error state.
15407         /// Reading from this pointer when `result_ok` is set is undefined.
15408         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15409 }
15410 #[repr(C)]
15411 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15412 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15414 pub struct CResult_InvoiceSignOrCreationErrorZ {
15415         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15416         /// `err` or `result` depending on the state of `result_ok`.
15417         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15418         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15419         pub result_ok: bool,
15420 }
15421 #[no_mangle]
15422 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15423 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15424         CResult_InvoiceSignOrCreationErrorZ {
15425                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15426                         result: Box::into_raw(Box::new(o)),
15427                 },
15428                 result_ok: true,
15429         }
15430 }
15431 #[no_mangle]
15432 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15433 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15434         CResult_InvoiceSignOrCreationErrorZ {
15435                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15436                         err: Box::into_raw(Box::new(e)),
15437                 },
15438                 result_ok: false,
15439         }
15440 }
15441 /// Checks if the given object is currently in the success state
15442 #[no_mangle]
15443 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15444         o.result_ok
15445 }
15446 #[no_mangle]
15447 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15448 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15449 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15450         fn drop(&mut self) {
15451                 if self.result_ok {
15452                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15453                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15454                         }
15455                 } else {
15456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15458                         }
15459                 }
15460         }
15461 }
15462 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15463         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15464                 let contents = if o.result_ok {
15465                         let result = unsafe { o.contents.result };
15466                         unsafe { o.contents.result = core::ptr::null_mut() };
15467                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15468                 } else {
15469                         let err = unsafe { o.contents.err };
15470                         unsafe { o.contents.err = core::ptr::null_mut(); }
15471                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15472                 };
15473                 Self {
15474                         contents,
15475                         result_ok: o.result_ok,
15476                 }
15477         }
15478 }
15479 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15480         fn clone(&self) -> Self {
15481                 if self.result_ok {
15482                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15483                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15484                         } }
15485                 } else {
15486                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15487                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15488                         } }
15489                 }
15490         }
15491 }
15492 #[no_mangle]
15493 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15494 /// but with all dynamically-allocated buffers duplicated in new buffers.
15495 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15496 #[repr(C)]
15497 /// An enum which can either contain a crate::lightning::chain::Filter or not
15498 pub enum COption_FilterZ {
15499         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15500         Some(crate::lightning::chain::Filter),
15501         /// When we're in this state, this COption_FilterZ contains nothing
15502         None
15503 }
15504 impl COption_FilterZ {
15505         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15506                 if let Self::None = self { false } else { true }
15507         }
15508         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15509                 !self.is_some()
15510         }
15511         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15512                 if let Self::Some(v) = self { v } else { unreachable!() }
15513         }
15514 }
15515 #[no_mangle]
15516 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15517 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15518         COption_FilterZ::Some(o)
15519 }
15520 #[no_mangle]
15521 /// Constructs a new COption_FilterZ containing nothing
15522 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15523         COption_FilterZ::None
15524 }
15525 #[no_mangle]
15526 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15527 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15528 #[repr(C)]
15529 /// The contents of CResult_LockedChannelMonitorNoneZ
15530 pub union CResult_LockedChannelMonitorNoneZPtr {
15531         /// A pointer to the contents in the success state.
15532         /// Reading from this pointer when `result_ok` is not set is undefined.
15533         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15534         /// Note that this value is always NULL, as there are no contents in the Err variant
15535         pub err: *mut core::ffi::c_void,
15536 }
15537 #[repr(C)]
15538 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15539 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15540 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15541 pub struct CResult_LockedChannelMonitorNoneZ {
15542         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15543         /// `err` or `result` depending on the state of `result_ok`.
15544         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15545         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15546         pub result_ok: bool,
15547 }
15548 #[no_mangle]
15549 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15550 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15551         CResult_LockedChannelMonitorNoneZ {
15552                 contents: CResult_LockedChannelMonitorNoneZPtr {
15553                         result: Box::into_raw(Box::new(o)),
15554                 },
15555                 result_ok: true,
15556         }
15557 }
15558 #[no_mangle]
15559 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15560 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15561         CResult_LockedChannelMonitorNoneZ {
15562                 contents: CResult_LockedChannelMonitorNoneZPtr {
15563                         err: core::ptr::null_mut(),
15564                 },
15565                 result_ok: false,
15566         }
15567 }
15568 /// Checks if the given object is currently in the success state
15569 #[no_mangle]
15570 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15571         o.result_ok
15572 }
15573 #[no_mangle]
15574 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15575 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15576 impl Drop for CResult_LockedChannelMonitorNoneZ {
15577         fn drop(&mut self) {
15578                 if self.result_ok {
15579                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15580                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15581                         }
15582                 } else {
15583                 }
15584         }
15585 }
15586 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15587         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15588                 let contents = if o.result_ok {
15589                         let result = unsafe { o.contents.result };
15590                         unsafe { o.contents.result = core::ptr::null_mut() };
15591                         CResult_LockedChannelMonitorNoneZPtr { result }
15592                 } else {
15593                         let _ = unsafe { Box::from_raw(o.contents.err) };
15594                         o.contents.err = core::ptr::null_mut();
15595                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15596                 };
15597                 Self {
15598                         contents,
15599                         result_ok: o.result_ok,
15600                 }
15601         }
15602 }
15603 #[repr(C)]
15604 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15605 /// This corresponds to std::vector in C++
15606 pub struct CVec_OutPointZ {
15607         /// The elements in the array.
15608         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15609         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15610         /// The number of elements pointed to by `data`.
15611         pub datalen: usize
15612 }
15613 impl CVec_OutPointZ {
15614         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15615                 if self.datalen == 0 { return Vec::new(); }
15616                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15617                 self.data = core::ptr::null_mut();
15618                 self.datalen = 0;
15619                 ret
15620         }
15621         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15622                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15623         }
15624 }
15625 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15626         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15627                 let datalen = v.len();
15628                 let data = Box::into_raw(v.into_boxed_slice());
15629                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15630         }
15631 }
15632 #[no_mangle]
15633 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15634 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15635 impl Drop for CVec_OutPointZ {
15636         fn drop(&mut self) {
15637                 if self.datalen == 0 { return; }
15638                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15639         }
15640 }
15641 impl Clone for CVec_OutPointZ {
15642         fn clone(&self) -> Self {
15643                 let mut res = Vec::new();
15644                 if self.datalen == 0 { return Self::from(res); }
15645                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15646                 Self::from(res)
15647         }
15648 }